/* ============================================================================
   Differential Tree — one committed LIGHT palette, no theme toggle.
   No external fonts, no external anything: the page works offline.

   Background is four moving layers, in z-order:
     .bg      base wash + three drifting colour blobs (multiply, not screen —
              on a light base screen-blended colour is invisible)
     .twigs   a tiled branching texture that drifts very slowly (parallax)
     .sheen   a wide soft light band sweeping across, so the twigs brighten
              as it passes — the "travelling pulse" idea that survives any
              viewport, unlike absolutely-positioned pulse paths
     .motes   slow rising particles
   ========================================================================== */

:root {
  --paper:   #eef1f4;
  --panel:   #ffffff;
  --panel2:  #f4f7f9;
  --sunk:    #f7f9fa;
  --line:    #dde5ea;
  --line2:   #c2d0d9;
  --ink:     #15242c;
  --ink2:    #3d545f;
  --dim:     #6d848f;
  --cool:    #1a7594;
  --cool2:   #d9edf4;
  --gold:    #9a6b12;
  --gold2:   #fbf0d5;
  --amber:   #a06a2c;
  --clay:    #a8433a;
  --clay2:   #fbe9e6;
  --moss:    #3d7a4c;
  --serif:   "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans:    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:    ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --shadow:  0 1px 2px rgba(21,36,44,.05), 0 8px 24px rgba(21,36,44,.06);
}

* { box-sizing: border-box; }
/* The fixed .bg layer IS the background, so body must not paint over it. */
html { background: var(--paper); }
body {
  margin: 0; background: transparent; color: var(--ink);
  font: 16px/1.62 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ------------------------------------------------------- living background */
.bg {
  position: fixed; inset: 0; z-index: -4; overflow: hidden;
  background:
    radial-gradient(1200px 720px at 78% -12%, #dcebf2 0%, transparent 62%),
    radial-gradient(980px 620px at 4% 104%, #f0e7dc 0%, transparent 60%),
    linear-gradient(180deg, #f4f7f9 0%, #eaeff3 52%, #e4ebf0 100%);
}
/* Sized in vmax and pulled inside the viewport: edge-anchored vw blobs sit
   almost entirely offscreen on a tall phone and the effect disappears. */
.blob {
  position: absolute; border-radius: 50%; filter: blur(78px);
  opacity: .55; mix-blend-mode: multiply; will-change: transform;
}
.b1 { width: 92vmax; height: 92vmax; left: -36vmax; top: -32vmax;
      background: radial-gradient(circle, #a9d8e8 0%, rgba(169,216,232,.42) 38%, rgba(169,216,232,0) 68%);
      animation: drift1 38s ease-in-out infinite; }
.b2 { width: 80vmax; height: 80vmax; right: -33vmax; top: 8vh;
      background: radial-gradient(circle, #e9d3ae 0%, rgba(233,211,174,.40) 38%, rgba(233,211,174,0) 68%);
      animation: drift2 50s ease-in-out infinite; }
.b3 { width: 76vmax; height: 76vmax; left: -14vmax; bottom: -38vmax;
      background: radial-gradient(circle, #cfd9c2 0%, rgba(207,217,194,.38) 38%, rgba(207,217,194,0) 68%);
      animation: drift3 44s ease-in-out infinite; }
@keyframes drift1 { 0%,100% { transform: translate(0,0) scale(1); }    50% { transform: translate(13vw,9vh) scale(1.15); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0) scale(1.07); } 50% { transform: translate(-12vw,13vh) scale(.93); } }
@keyframes drift3 { 0%,100% { transform: translate(0,0) scale(.95); }  50% { transform: translate(11vw,-11vh) scale(1.11); } }

/* No viewBox on purpose: one user unit stays one CSS pixel, so the twig
   pattern tiles at a constant size on a phone and a desktop alike instead of
   being scaled up into four enormous shapes. */
.twigs {
  position: fixed; inset: -60px; width: calc(100% + 120px); height: calc(100% + 120px);
  z-index: -3; pointer-events: none; opacity: .5;
  animation: sway 70s ease-in-out infinite; will-change: transform;
}
@keyframes sway { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-26px,16px); } }
.node { animation: breathe 6.5s ease-in-out infinite; }
.node.n2 { animation-duration: 8.5s; animation-delay: -3s; }
@keyframes breathe { 0%,100% { opacity: .30; } 50% { opacity: .62; } }
.sap { stroke-dasharray: 26 300; animation: flow 9s linear infinite; will-change: stroke-dashoffset; }
.sap.s2 { animation-duration: 12s; animation-delay: -4.5s; }
@keyframes flow { to { stroke-dashoffset: -326; } }

/* A wide diagonal light band crossing the page. It brightens the twigs as it
   passes, which reads as movement through the canopy and works at any width. */
.sheen {
  position: fixed; inset: -30vh -60vw; z-index: -2; pointer-events: none;
  background: linear-gradient(104deg,
    transparent 38%, rgba(255,255,255,.62) 47%, rgba(255,255,255,.80) 50%,
    rgba(255,255,255,.62) 53%, transparent 62%);
  animation: sweep 19s linear infinite; will-change: transform;
}
@keyframes sweep { 0% { transform: translateX(-34%); } 100% { transform: translateX(34%); } }

.motes { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.mote {
  position: absolute; bottom: -14px; border-radius: 50%;
  background: rgba(26,117,148,.30); will-change: transform, opacity;
  animation: rise linear infinite;
}
@keyframes rise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  14%  { opacity: .5; }
  86%  { opacity: .28; }
  100% { transform: translateY(-110vh) translateX(var(--sway, 16px)); opacity: 0; }
}

/* ------------------------------------------------------------------ shell */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px 80px; }

header.top {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  padding: 26px 0 18px; border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
header.top h1 { font: 600 25px/1.2 var(--serif); margin: 0; letter-spacing: .2px; }
header.top h1 span { color: var(--cool); }
header.top .sub { color: var(--dim); font-size: 13.5px; }
header.top .spacer { flex: 1 1 auto; }

.btn {
  font: 500 14px/1 var(--sans); color: var(--ink2);
  background: var(--panel); border: 1px solid var(--line2);
  padding: 9px 15px; border-radius: 7px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--cool2); color: var(--ink); border-color: var(--cool); }
.btn.ghost { background: rgba(255,255,255,.6); }
.btn.primary { background: var(--cool); border-color: var(--cool); color: #fff; font-weight: 650; box-shadow: 0 2px 8px rgba(26,117,148,.24); }
.btn.primary:hover { background: #146480; border-color: #146480; color: #fff; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }

/* --------------------------------------------------------------- landing */
.landing { max-width: 760px; margin: 4vh auto 0; }
.landing h2 { font: 600 32px/1.22 var(--serif); margin: 0 0 6px; }
.landing .lede { color: var(--ink2); font-size: 17px; margin: 0 0 26px; }
.landing p { color: var(--ink2); }
.landing ol { color: var(--ink2); padding-left: 20px; }
.landing ol li { margin-bottom: 9px; }
.landing ol b { color: var(--ink); font-weight: 650; }

.warn {
  border: 1px solid #e5bdb6; background: var(--clay2);
  border-left: 3px solid var(--clay);
  padding: 15px 18px; border-radius: 8px; margin: 24px 0;
}
.warn h4 { margin: 0 0 6px; font: 700 12px/1.3 var(--sans); color: var(--clay); letter-spacing: .7px; text-transform: uppercase; }
.warn p { margin: 0; font-size: 14.5px; color: #6d3931; }

.landing .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }

/* -------------------------------------------------------------- question */
.qlayout { display: grid; grid-template-columns: 232px 1fr; gap: 40px; align-items: start; }
@media (max-width: 880px) { .qlayout { grid-template-columns: 1fr; gap: 22px; } .spine { display: none; } }

.spine { position: sticky; top: 24px; }
.spine .lab { font: 700 11px/1 var(--sans); letter-spacing: 1.4px; text-transform: uppercase; color: var(--dim); margin-bottom: 14px; }
.spine ul { list-style: none; margin: 0; padding: 0; position: relative; }
.spine ul::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line2); }
.spine li { position: relative; padding: 5px 0 5px 20px; font-size: 13.5px; color: var(--dim); }
.spine li::before {
  content: ""; position: absolute; left: 2px; top: 12px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--paper); border: 1px solid var(--line2);
}
.spine li.done { color: var(--ink2); }
.spine li.done::before { background: var(--line2); border-color: var(--line2); }
.spine li.now { color: var(--cool); font-weight: 650; }
.spine li.now::before { background: var(--cool); border-color: var(--cool); box-shadow: 0 0 0 3px rgba(26,117,148,.15); }

.qcard {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 30px 32px 26px; max-width: 720px;
  box-shadow: var(--shadow);
}

/* Chapter banner, full-bleed to the card edges. Negative margins rather than
   restructuring the card, so the padding below it stays one rule. */
.artband {
  margin: -30px -32px 22px; border-radius: 11px 11px 0 0; overflow: hidden;
  border-bottom: 1px solid var(--line); line-height: 0;
  animation: bandin .4s ease both;
}
@keyframes bandin { from { opacity: 0; } }
/* Height follows the 720:140 aspect so the drawing is never cropped. */
.artband .artsvg { display: block; width: 100%; height: auto; aspect-ratio: 720 / 140; }

/* Motion inside the artwork. Every rule is opacity or transform only.
   transform-box: fill-box is required — without it an SVG shape's
   transform-origin resolves against the whole viewBox, so "center" scales the
   shape from the corner of the banner instead of from itself. */
.art-pulse, .art-ring, .art-jitter, .art-ghost, .art-drop, .art-flick { transform-box: fill-box; transform-origin: center; }
.art-pulse  { animation: aPulse 5s ease-in-out infinite; }
@keyframes aPulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
.art-ring   { animation: aRing 6.5s ease-out infinite; }
@keyframes aRing { 0% { transform: scale(.72); opacity: 0; } 22% { opacity: .5; } 100% { transform: scale(1.14); opacity: 0; } }
.art-flow   { animation: aFlow 11s linear infinite; }
@keyframes aFlow { to { stroke-dashoffset: -930; } }
.art-orbit  { animation: aOrbit 7s linear infinite; }
@keyframes aOrbit { to { stroke-dashoffset: -540; } }
.art-jitter { animation: aJitter 3.2s ease-in-out infinite; }
@keyframes aJitter { 0%,100% { transform: translateX(-2px); } 50% { transform: translateX(2px); } }
.art-fall   { animation: aFall 9s ease-in infinite; }
@keyframes aFall { 0% { transform: translate(0,0) rotate(0); opacity: 0; } 12% { opacity: .45; } 100% { transform: translate(18px,86px) rotate(120deg); opacity: 0; } }
.art-knit   { animation: aKnit 5s linear infinite; }
@keyframes aKnit { to { stroke-dashoffset: -34; } }
.art-ghost  { animation: aGhost 7s ease-in-out infinite; }
@keyframes aGhost { 0%,100% { transform: translate(9px,-5px); } 50% { transform: translate(-7px,4px); } }
.art-drop   { animation: aDrop 6.5s ease-in infinite; }
@keyframes aDrop { 0% { transform: translateY(-14px); opacity: 0; } 25% { opacity: .55; } 70%,100% { transform: translateY(44px); opacity: 0; } }
.art-flick  { animation: aFlick 4.4s ease-in-out infinite; }
@keyframes aFlick { 0%,100% { opacity: .16; } 45% { opacity: .55; } }
.qmeta { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.chip {
  font: 700 11px/1 var(--sans); letter-spacing: 1.1px; text-transform: uppercase;
  color: var(--cool); background: var(--cool2);
  border: 1px solid #b3dbe8; padding: 5px 9px; border-radius: 5px;
}
.qmeta .count { color: var(--dim); font-size: 12.5px; margin-left: auto; font-family: var(--mono); }

.qtext { font: 500 21px/1.42 var(--serif); margin: 0 0 8px; color: var(--ink); }
.qhelp { font-size: 14px; color: var(--dim); margin: 0 0 22px; border-left: 2px solid var(--line2); padding-left: 12px; }
.qhint { font-size: 13px; color: var(--dim); margin: -8px 0 18px; }

.opts { display: flex; flex-direction: column; gap: 9px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  background: var(--sunk); border: 1px solid var(--line);
  color: var(--ink2); padding: 13px 16px; border-radius: 9px; cursor: pointer;
  font: 15px/1.45 var(--sans); transition: all .13s;
}
.opt:hover { border-color: var(--line2); background: var(--panel2); color: var(--ink); }
.opt .box {
  flex: 0 0 auto; width: 18px; height: 18px; border-radius: 4px; margin-top: 2px;
  border: 1.5px solid var(--line2); display: grid; place-items: center;
  font-size: 12px; color: #fff; background: var(--panel);
}
.opt.radio .box { border-radius: 50%; }
.opt.on { border-color: var(--cool); background: var(--cool2); color: var(--ink); }
.opt.on .box { background: var(--cool); border-color: var(--cool); }
.opt.on .box::after { content: "\2713"; font-weight: 700; }

.qnav { display: flex; gap: 10px; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.qnav .spacer { flex: 1 1 auto; }
.bar { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 18px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cool), var(--gold)); transition: width .3s; }

/* --------------------------------------------------------------- results */
.res h2 { font: 600 27px/1.25 var(--serif); margin: 0 0 4px; }
.res .resub { color: var(--dim); font-size: 14px; margin: 0 0 26px; }

.panelbox {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 22px 24px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.panelbox > h3 { font: 700 12px/1 var(--sans); letter-spacing: 1.5px; text-transform: uppercase; color: var(--dim); margin: 0 0 4px; }
.panelbox > .note { color: var(--dim); font-size: 13.5px; margin: 0 0 18px; }

.dx { border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 11px; background: var(--sunk); }
.dx.met  { border-color: #e0c179; background: var(--gold2); }
.dx.near { border-color: #ddc6a8; background: #fbf6ef; }
.dx.out  { background: rgba(255,255,255,.5); }
.dx .hd { display: flex; align-items: baseline; gap: 11px; flex-wrap: wrap; }
.dx .nm { font: 600 17px/1.3 var(--serif); color: var(--ink); }
.dx.out .nm { color: var(--ink2); font-weight: 500; }
.dx .tag { font: 700 10.5px/1 var(--sans); letter-spacing: 1.1px; text-transform: uppercase; padding: 4px 8px; border-radius: 4px; }
.dx.met .tag  { background: var(--gold); color: #fff; }
.dx.near .tag { background: #f2e3cd; color: var(--amber); border: 1px solid #ddc6a8; }
.dx.out .tag  { background: transparent; color: var(--dim); border: 1px solid var(--line2); }
.dx .chapname { color: var(--dim); font-size: 12.5px; margin-left: auto; }
.dx .blurb { color: var(--ink2); font-size: 14px; margin: 9px 0 0; }
.dx .why { color: var(--ink2); font-size: 14.2px; margin: 10px 0 0; line-height: 1.58; border-left: 2px solid var(--line2); padding-left: 13px; }
.dx.out .why { border-left-color: #d9a79f; }
.dx .taint {
  margin-top: 10px; font-size: 13.4px; color: #7d332b;
  background: var(--clay2); border: 1px solid #e5bdb6; border-radius: 6px; padding: 8px 11px;
}
.dx .sev { font-size: 13px; color: var(--gold); margin-top: 7px; text-transform: capitalize; font-weight: 600; }
.dx .crit { margin-top: 13px; display: none; }
.dx.open .crit { display: block; }
.dx .crit .row { display: flex; gap: 10px; align-items: flex-start; font-size: 13.6px; padding: 7px 0; border-top: 1px solid var(--line); }
.dx .crit .row .mk { flex: 0 0 auto; width: 16px; text-align: center; font-weight: 700; }
.dx .crit .row.ok .mk { color: var(--moss); }
.dx .crit .row.no .mk { color: var(--clay); }
.dx .crit .row .lb { color: var(--ink2); }
.dx .crit .row .lb b { color: var(--ink); font-weight: 650; display: block; }
.dx .crit .row .lb i { color: var(--dim); font-style: normal; }
.dx .toggle { margin-top: 11px; }

.ledger .item { padding: 15px 0; border-top: 1px solid var(--line); }
.ledger .item:first-of-type { border-top: none; padding-top: 0; }
.ledger .item h4 { margin: 0 0 6px; font: 600 15px/1.35 var(--serif); color: var(--gold); display: flex; gap: 9px; align-items: baseline; }
.ledger .item h4 code { font: 600 10.5px/1 var(--mono); color: var(--dim); border: 1px solid var(--line2); padding: 4px 6px; border-radius: 4px; }
.ledger .item p { margin: 0; color: var(--ink2); font-size: 14.3px; line-height: 1.6; }

/* ------------------------------------------------------------ path replay */
.path .row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 46%); gap: 18px;
  align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.path .row:first-of-type { border-top: none; }
.path .row .q { color: var(--ink2); min-width: 0; }
.path .row .q em { color: var(--dim); font-style: normal; font-size: 12.5px; display: block; }
.path .row .a { color: var(--cool); font-weight: 650; text-align: right; min-width: 0; }
.path .row .a button {
  background: none; border: none; color: var(--cool); font: inherit; cursor: pointer;
  border-bottom: 1px dashed rgba(26,117,148,.55); padding: 0; text-align: right; line-height: 1.45;
}
.path .row .a button:hover { color: var(--gold); border-bottom-color: var(--gold); }
/* Stacked on a phone: the answer sits under its question, so it reads left. */
@media (max-width: 700px) {
  .path .row { grid-template-columns: 1fr; gap: 4px; }
  .path .row .a, .path .row .a button { text-align: left; }
}
.path .editor { grid-column: 1 / -1; padding: 14px 0 6px; }

/* The queue shrinking is the feature made visible, so it gets announced. */
.pruneNote {
  border: 1px solid #a9cbb4; background: #eef6f0; border-left: 3px solid var(--moss);
  border-radius: 9px; padding: 14px 17px; margin: 0 0 22px; max-width: 720px;
  animation: notein .35s ease both;
}
@keyframes notein { from { opacity: 0; transform: translateY(-6px); } }
.pruneNote b { display: block; font: 700 12px/1 var(--sans); letter-spacing: .9px; text-transform: uppercase; color: var(--moss); margin-bottom: 6px; }
.pruneNote p { margin: 0; font-size: 14.2px; color: #2f5b3d; }
.pruneNote p.sub { margin-top: 8px; font-size: 13.4px; color: #4a6b55; border-left: 2px solid #a9cbb4; padding-left: 11px; }

.panelbox.needs { border-color: var(--cool); box-shadow: 0 0 0 3px rgba(26,117,148,.09), var(--shadow); }
.dx.unresolved { border-color: #b3dbe8; background: var(--cool2); }
.dx.unresolved .tag { background: var(--cool); color: #fff; }

.diff { border: 1px solid #e0c179; background: var(--gold2); border-radius: 10px; padding: 16px 18px; margin-bottom: 20px; }
.diff h4 { margin: 0 0 9px; font: 700 12px/1 var(--sans); letter-spacing: 1.3px; text-transform: uppercase; color: var(--gold); }
.diff ul { margin: 0; padding-left: 18px; color: #5b451c; font-size: 14.2px; }
.diff li { margin-bottom: 6px; }
.diff b { color: var(--ink); }
.diff .none { color: var(--ink2); font-size: 14px; margin: 0; }

.resactions { display: flex; gap: 10px; flex-wrap: wrap; margin: 26px 0 0; }
.foot { color: var(--dim); font-size: 12.5px; margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); }
