:root {
  /* Light. "ours" is the paper's blue. */
  --bg: #ffffff;
  --band: #f5fafb;
  --surface: #ffffff;
  --ink: #1d1c1a;
  --muted: #555d62;
  --line: #d8e5e9;
  --accent: #b11928;
  --accent-ink: #ffffff;
  --accent-soft: #fff5f3;
  --on-strong: #ffffff;
  --ours: #3a84cb;
  --paper-live: #7d9362;
  --paper-banana: #f7c242;
  --paper-auto: #af2930;
  --paper-ours: #3a84cb;
  --math: #d9534a;
  --physics: #9a7a14;
  --chemistry: #2f8a2a;
  --cs: #a8468a;
  --c-engine: #b11928;
  --c-agent: #5d4c76;
  --c-bench: #35a1c8;
  --shadow: 0 1px 2px rgba(23, 55, 66, .06), 0 4px 16px rgba(23, 55, 66, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
/* Dark: the lesson player's navy, so a lesson framed in the page sits on the same ground; the accent
   stays the light theme's red, lifted to read on it. */
:root[data-theme="dark"] {
  --bg: #0d1120; --band: #121729; --surface: #171d31; --ink: #e7e9f3; --muted: #a2a9c0;
  --line: #283049; --accent: #f0727a; --accent-ink: #1a0b0e; --accent-soft: #2d1f2d; --on-strong: #0d1120; --ours: #6fa8ea;
  --math: #f08a82; --physics: #d8b64a; --chemistry: #6fce68; --cs: #e083c3; --c-engine: #f0857a; --c-agent: #b19cf0; --c-bench: #5cc0f2;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.25rem; margin-top: 1.8em; }
p { margin: 0 0 1em; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.measure, .sectionlede { max-width: none; }
.sectionlede { color: var(--muted); font-size: 1.05rem; }
.sc { font-variant: small-caps; letter-spacing: .02em; }
section { padding: 64px 0; }
.band { background: var(--band); border-block: 1px solid var(--line); }
#overview { background: var(--bg); }

/* nav: stays with the reader, frosted over whatever scrolls under it */
.topnav { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, calc((100% - 1200px) / 2 + 16px)); background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.brand { display: flex; align-items: center; gap: 8px; font-family: Georgia, "Times New Roman", serif; font-weight: 600; color: var(--ink); text-decoration: none;
  font-size: 1.05rem; letter-spacing: 0; }
.brand img { width: 22px; height: auto; }
.navlinks { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.navlinks a { color: var(--muted); text-decoration: none; padding: 6px 8px; font-size: .9rem; white-space: nowrap; transition: color .15s, box-shadow .15s; }
.navlinks a:hover { color: var(--ink); }
@media (min-width: 720px) { .topnav { padding-inline: max(28px, calc((100% - 1200px) / 2 + 28px)); } }
@media (max-width: 560px) { .brand span, .navlinks a:nth-child(n+4) { display: none; } }

/* hero */
.hero { position: relative; overflow: hidden; isolation: isolate; padding: 108px 0 56px; text-align: left; background: var(--bg); }
.hero > .wrap { position: relative; z-index: 2; }
.venue { display: inline-block; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 12px; }
.hero h1 { display: flex; align-items: center; justify-content: flex-start; gap: .2em; font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 6vw, 4rem); margin-bottom: .55em; }
.hero h1 img { width: auto; height: .8em; flex: 0 0 auto; }
.hero h1 .sc { font-variant: normal; letter-spacing: 0; }
.tagline { font-family: var(--serif); font-size: clamp(1.2rem, 2.4vw, 1.5rem); max-width: 30ch; line-height: 1.35; margin: 0 0 1.4em; }
.lede { max-width: min(56ch, 54%); color: var(--muted); font-size: 1rem; }
.cta { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 8px 24px; margin: 24px 0 40px; font-size: .95rem; }
.cta a { color: var(--ink); font-weight: 700; text-decoration-thickness: 1.5px; text-underline-offset: 4px; transition: color .15s; }
.cta a:hover { color: var(--accent); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none; font: 600 .95rem var(--sans); cursor: pointer; transition: border-color .15s; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn:focus-visible, .tabs button:focus-visible, .filters button:focus-visible, .card button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the wall of figure loops behind it (hero.js), fading out under the text */
.hero-bg { position: absolute; inset: 0 0 0 32%; z-index: 0; overflow: hidden; opacity: .96; }
.hero-bg::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 76%, transparent) 12%, color-mix(in srgb, var(--bg) 10%, transparent) 38%, transparent 56%),
              linear-gradient(0deg, var(--bg) 0%, transparent 12%), linear-gradient(180deg, var(--bg) 0%, transparent 8%); }
.wall { position: absolute; top: -10%; left: 0; width: 150%; height: 120%; display: flex; gap: 14px; }
.wall-col { flex: 0 0 280px; overflow: hidden; }
.wall-run { display: flex; flex-direction: column; gap: 14px; animation: wall-down var(--dur, 80s) linear infinite; }
.wall-col.up .wall-run { animation-name: wall-up; }
@keyframes wall-down { from { transform: translateY(-50%); } to { transform: translateY(0); } }
@keyframes wall-up { from { transform: translateY(0); } to { transform: translateY(-50%); } }
.wall-card { overflow: hidden; background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.wall-card video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface); }
.hero-pause { position: absolute; right: 16px; bottom: 12px; z-index: 3; padding: 3px 7px; border: 0; background: color-mix(in srgb, var(--bg) 82%, transparent);
  color: var(--muted); font: 500 .72rem var(--sans); text-decoration: underline; cursor: pointer; transition: color .15s; }
.hero-pause:hover { color: var(--ink); }
.hero-pause:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hero.paused * { animation-play-state: paused !important; }
@media (max-width: 900px) {
  .hero-bg { left: 28%; opacity: .2; }
  .lede { max-width: 72ch; }
}

/* figures from the paper */
.paperfig { margin: 24px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.paperfig figcaption { color: var(--muted); font-size: .9rem; margin-top: 12px; line-height: 1.5; }
.paperfig img { margin: 0 auto; background: #fff; border-radius: 6px; }
.abstract { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; max-width: 80ch; }
.abstract summary { cursor: pointer; font-weight: 600; }
.abstract p { margin-top: .8em; color: var(--muted); }
.twocol { display: grid; gap: 28px; align-items: start; }
@media (min-width: 960px) { .twocol { grid-template-columns: 1fr 1.35fr; } .twocol h3 { margin-top: 0; } }

.note { background: var(--accent-soft); border-radius: 8px; padding: 12px 16px; font-size: .92rem; margin: 16px 0 24px; }

/* player */
.player { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.player-head h3 { margin: 4px 0 0; font-size: 1.2rem; }
.head-actions { display: flex; gap: 8px; }
.player-body { display: grid; }
@media (min-width: 960px) { .player-body { grid-template-columns: 1fr 260px; } }
.player-side { padding: 16px 18px; border-top: 1px solid var(--line); }
@media (min-width: 960px) { .player-side { border-top: 0; border-left: 1px solid var(--line); } }
.player-side img { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px; max-height: 220px; object-fit: contain; width: 100%; }
.label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin: 0 0 6px; }
.player-side .label + p, .player-side img { margin-bottom: 16px; }
.side-actions a { font-weight: 600; font-size: .92rem; }

.frame { position: relative; width: 100%; background: #0a0d18; }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.lesson-frame iframe { background: var(--bg); }
.lesson-frame { aspect-ratio: 16 / 10; min-height: 420px; }
@media (max-width: 720px) { .lesson-frame { aspect-ratio: auto; height: 78vh; min-height: 480px; } }
.fig-frame { aspect-ratio: 16 / 10; min-height: 380px; background: var(--surface); }
.fig-frame iframe { background: transparent; }
.frame-start { position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content; padding: 14px 24px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-ink); font: 600 1rem var(--sans); cursor: pointer; box-shadow: 0 6px 24px rgba(0,0,0,.35); z-index: 2; }
.frame-poster { position: absolute; inset: 0; background-size: cover; background-position: top center; opacity: .45; }
.frame video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }

/* chips, filters, cards */
.chip { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--dom, var(--muted)); }
.chip::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dom, var(--muted)); margin-right: 6px; vertical-align: 1px; }
[data-domain="Math"] { --dom: var(--math); }
[data-domain="Physics"] { --dom: var(--physics); }
[data-domain="Chemistry"] { --dom: var(--chemistry); }
[data-domain="CS"] { --dom: var(--cs); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 32px 0 16px; }
.filters button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 14px; font: 500 .9rem var(--sans); cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card button { all: unset; box-sizing: border-box; display: flex; flex-direction: column; width: 100%; height: 100%; cursor: pointer; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.card button:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--muted); }
.card[aria-current="true"] button { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.card .thumb { aspect-ratio: 16 / 10; background: #0a0d18 center top / cover no-repeat; border-bottom: 1px solid var(--line); }
.figcards .card .thumb { background-color: var(--surface); background-size: cover; background-position: center; }
.card .meta { padding: 12px 14px 14px; }
.card .title { font-weight: 600; line-height: 1.35; margin-top: 4px; font-size: .96rem; }
.card[hidden] { display: none; }
.figplayer { margin-bottom: 24px; }

/* compare */
.compare-controls { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-end; margin: 24px 0 16px; }
.compare-controls .ctl { display: grid; gap: 6px; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; min-width: 0; }
.compare-controls label.ctl { flex: 1 1 360px; max-width: 520px; }
.compare-controls select { width: 100%; font: 500 .95rem var(--sans); padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-transform: none; letter-spacing: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 8px 12px; font: 500 .9rem var(--sans); cursor: pointer; text-transform: none; letter-spacing: 0; }
.tabs button:hover { border-color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tabs button[hidden] { display: none; }
.compare-grid { display: grid; gap: 16px; align-items: stretch; }
@media (min-width: 1100px) {
  .compare-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
  .compare-controls label.ctl { max-width: none; }
  .compare-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .compare-grid .lesson-frame { min-height: 380px; }
  .compare-grid .pane-head { min-height: 48px; align-items: center; flex-wrap: nowrap; }
}
.pane { min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pane > .frame { flex: 1; }
.pane-head { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pane-head a { margin-left: auto; }
.pane > p { padding: 0 14px; margin: 10px 0; }
.sys { font-weight: 700; }
.sys.ours { color: var(--ours); }
.slides { position: absolute; inset: 0; display: flex; flex-direction: column; background: #2a2a2a; }
.slides img { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #fff; }
.slides .slidebar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px; color: #eee; font-size: .9rem; }
.slides .slidebar button { background: #444; color: #fff; border: 0; border-radius: 6px; padding: 6px 12px; cursor: pointer; font: inherit; }
.transcript { margin: 10px 14px 14px; font-size: .88rem; }
.transcript summary { cursor: pointer; font-weight: 600; }
.transcript pre { white-space: pre-wrap; font: .85rem/1.5 var(--sans); color: var(--muted); max-height: 260px; overflow: auto; background: var(--band); padding: 10px 12px; border-radius: 6px; }

/* results */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); margin-bottom: 8px; }
table.results { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .92rem; }
.results th, .results td { padding: 9px 14px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.results th:first-child, .results td:first-child { text-align: left; }
.results thead th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; background: var(--band); }
.results tr:last-child td { border-bottom: 0; }
.results tr.ours td { background: color-mix(in srgb, var(--ours) 9%, transparent); font-weight: 600; }
.results tr.sys-livefigure > * { background: color-mix(in srgb, var(--paper-live) 12%, transparent); }
.results tr.sys-paperbanana > * { background: color-mix(in srgb, var(--paper-banana) 12%, transparent); }
.results tr.sys-autofigure > * { background: color-mix(in srgb, var(--paper-auto) 10%, transparent); }
.results tr.group td { border-top: 2px solid var(--line); }
.results .se { color: var(--muted); font-size: .78rem; margin-left: 3px; font-weight: 400; }
.results .best { font-weight: 700; color: var(--ink); text-decoration: underline; text-decoration-color: var(--ours); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.results td.avg { font-weight: 600; }
.bar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.bar i { display: block; height: 8px; border-radius: 4px; background: var(--muted); opacity: .45; }
tr.ours .bar i { background: var(--ours); opacity: 1; }

footer { padding: 40px 0 56px; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.stage-ph { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 16px; text-align: center; color: var(--muted); }
.frame iframe:not([src]) { visibility: hidden; }
.compare-controls label { flex: 1 1 320px; min-width: 0; }
.compare-controls select { width: 100%; max-width: 620px; }
.results tr.ours th { background: color-mix(in srgb, var(--ours) 9%, transparent); }
.results tr.group th { border-top: 2px solid var(--line); }
/* In the side-by-side view, render pages at desktop width and scale them into the half-width pane */
@media (min-width: 1100px) {
  .compare-grid .frame iframe { width: 160%; height: 160%; transform: scale(.625); transform-origin: 0 0; }
}


/* ===== Overview: DSL -> lesson, then fixed video vs. adaptive lesson ===== */
.ov-layout { display: grid; gap: 32px; margin: 28px 0 36px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "code" "right"; }
.ov-layout > * { min-width: 0; margin: 0; }
.ov-layout .code-card { grid-area: code; display: flex; flex-direction: column; }
.ov-layout .ov-arrow { grid-area: arrow; }
.ov-layout .ov-right { grid-area: right; display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.ov-layout .ov-video, .ov-layout .paths { margin: 0; min-width: 0; }
.ov-label { display: flex; align-items: center; gap: 10px; font: 600 1.08rem/1.3 var(--serif); margin: 0 0 12px; }
.ov-step { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font: 700 .8rem var(--sans); }
.code-frame { flex: 1; display: flex; flex-direction: column; background: #fbfbfd; border: 1px solid #d9dbe8; border-radius: 12px; overflow: hidden; box-shadow: 0 18px 40px -26px rgba(30,30,80,.45); color: #1d2033; }
.code-bar { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; background: #eceef6; border-bottom: 1px solid #d9dbe8; }
.code-bar > i { width: 11px; height: 11px; border-radius: 50%; }
.code-bar > i:nth-child(1) { background: #ec6a5e; } .code-bar > i:nth-child(2) { background: #f4bf4f; } .code-bar > i:nth-child(3) { background: #61c554; }
.code-bar span { margin-left: 8px; font: 600 .8rem var(--sans); color: #44475a; }
.code-bar .ts { margin-left: auto; font: 800 .78rem var(--sans); color: #fff; background: #3178c6; border-radius: 6px; padding: 2px 7px; letter-spacing: .02em; }
.code-card pre { flex: 1; margin: 0; padding: 14px 16px; overflow-x: auto; font: 12.5px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; display: flex; align-items: center; }
.code-card code { display: block; width: 100%; }
.code-card .k { color: #2f5fd0; font-weight: 600; } .code-card .s { color: #1f8a5b; } .code-card .n { color: #b3541e; }
.code-card .hl { display: inline-block; width: 100%; background: #e8efff; margin: 0 -16px; padding: 0 16px; }
.code-card i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #2f6fe0; color: #fff;
  font: 700 .7rem var(--sans); font-style: normal; vertical-align: 1px; }
.code-card figcaption { margin-top: 10px; font-size: .85rem; color: var(--muted); line-height: 1.9; }
.ov-video figcaption { color: var(--muted); font-size: .88rem; margin-top: 10px; }
.ov-arrow { display: grid; place-items: center; color: var(--accent); }
.ov-arrow span { display: none; }
.ov-arrow svg { width: 64px; height: 24px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ov-arrow span { font: 600 .8rem/1.3 var(--sans); color: var(--muted); }
@media (max-width: 999px) { .ov-arrow { display: none; } }
.browser-flat { border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: 0 0 0 1px var(--line), 0 24px 60px -28px rgba(20,24,60,.45); }
.browser-flat video { display: block; width: 100%; aspect-ratio: 16 / 10; background: #f5f6fa; }
.browser-bar { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px; background: #f1efe9; border-bottom: 1px solid #e2ded3; }
.browser-bar i { width: 11px; height: 11px; border-radius: 50%; }
.browser-bar i:nth-child(1) { background: #ec6a5e; } .browser-bar i:nth-child(2) { background: #f4bf4f; } .browser-bar i:nth-child(3) { background: #61c554; }
.browser-bar span { margin-left: 12px; font: .74rem var(--sans); color: #6b675f; background: #fff; border: 1px solid #e2ded3; border-radius: 6px; padding: 2px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.paths { padding: 18px 22px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.paths svg { display: block; width: 100%; height: auto; }
.paths figcaption { text-align: center; color: var(--muted); margin-top: 6px; font-size: .95rem; min-height: 1.6em; }
.paths figcaption b { color: var(--ink); font-weight: 600; }
.p-label { font: 600 30px var(--serif); fill: var(--ink); }
.p-muted { fill: var(--muted); font-weight: 400; }
.p-note { font: 20px var(--sans); fill: var(--muted); text-anchor: middle; }
.p-line { stroke: var(--muted); stroke-width: 4; opacity: .7; }
.p-grey circle { fill: #9b9a96; stroke: var(--surface); stroke-width: 3; }
.p-edge path { fill: none; stroke: var(--ink); stroke-width: 3.5; opacity: .75; }
.p-head { fill: var(--ink); opacity: .75; }
.p-trail { fill: none; stroke: #f2c94c; stroke-width: 26; stroke-linecap: round; stroke-linejoin: round; opacity: .6; }
.p-node circle { fill: #c9362b; stroke: #f0a35e; stroke-width: 5; transition: fill .4s; }
.p-node circle.lit { fill: #ffd84d; }
.p-learner circle, .p-learner path { fill: var(--ink); }
.p-q { font: 700 24px var(--sans); fill: var(--accent); opacity: 0; transition: opacity .2s; }
.p-q.on { opacity: 1; }
.p-pad path:first-child { fill: var(--ink); }
.p-pad-x { fill: none; stroke: var(--surface); stroke-width: 4; stroke-linecap: round; }
.p-pad-b { fill: var(--surface); }
@media (max-width: 700px) { .paths { padding: 14px 10px 12px; } .paths-scroll { overflow-x: auto; } .paths-scroll svg { min-width: 620px; } }

.components { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 24px; }
.comp { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--c);
  border-radius: 10px; color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.comp:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.comp:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.comp-name { font: 600 1.3rem var(--serif); font-variant: small-caps; color: var(--c); letter-spacing: .02em; }
.comp p { margin: 0; color: var(--muted); font-size: .95rem; }
.comp-fact { font-size: .88rem; padding: 8px 10px; background: color-mix(in srgb, var(--c) 8%, transparent); border-radius: 6px; }
.comp-fact b { font-family: var(--serif); font-size: 1.05rem; color: var(--c); }
.comp-go { margin-top: auto; font-weight: 600; font-size: .9rem; color: var(--c); }

/* ===== Lesson and figure cards ===== */
#lesson-cards .card .thumb { aspect-ratio: 16 / 10; background-color: var(--band); background-size: cover; background-position: top center; }
.figcards .card .thumb { position: relative; aspect-ratio: 4 / 3; }
.figcards .card .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.figcards .card .thumb.playing video { opacity: 1; }
.figcards .card .thumb::after { content: "▶ live"; position: absolute; right: 8px; top: 8px; font: 600 .68rem var(--sans); letter-spacing: .04em; color: #fff;
  background: rgba(20,18,12,.55); border-radius: 999px; padding: 2px 8px; opacity: .85; transition: opacity .2s; }
.figcards .card .thumb.playing::after { opacity: 0; }

/* ===== Nav: current section ===== */
.navlinks a[aria-current="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

/* ===== Results takeaways ===== */
.takeaways { list-style: none; padding: 0; margin: 20px 0 8px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.takeaways li { display: grid; gap: 4px; padding: 14px 16px; border-left: 3px solid var(--ours); background: color-mix(in srgb, var(--ours) 6%, var(--surface)); border-radius: 0 8px 8px 0; }
.takeaways b { font: 600 1.7rem/1.1 var(--serif); color: var(--ours); font-variant-numeric: tabular-nums; }
.takeaways span { font-size: .9rem; color: var(--muted); line-height: 1.4; }

/* Overview layout: the code runs the full height on the left; the lesson and the adaptive paths stack on the right */
@media (min-width: 1000px) {
  .ov-layout { grid-template-columns: minmax(0, 1.12fr) 72px minmax(0, 1.25fr); grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: none; column-gap: 0; row-gap: 0; align-items: stretch; }
  .ov-layout .code-card { display: contents; }
  .ov-layout .code-card > .ov-label { grid-column: 1; grid-row: 1; }
  .ov-layout .code-frame { grid-column: 1; grid-row: 2; }
  .ov-layout .code-card > figcaption { grid-column: 1; grid-row: 3; }
  .ov-layout .ov-arrow { grid-column: 2; grid-row: 2; align-self: start; margin-top: clamp(95px, 10vw, 135px); }
  .ov-layout > .ov-right { grid-column: 3; grid-row: 1 / 3; align-self: stretch; }
  .ov-layout .code-card > .ov-label, .ov-layout .ov-video > .ov-label { min-height: 2.6em; align-items: flex-start; }
  .ov-layout .paths { flex: 1 1 0; display: flex; flex-direction: column; min-height: 280px; }
  .ov-layout .paths-scroll { flex: 1; display: flex; align-items: center; }
  .ov-layout .paths figcaption { flex: none; }
  .ov-layout .code-card pre { font-size: 13px; line-height: 1.62; padding: 16px 18px; }
  .ov-layout .code-card figcaption { font-size: .9rem; }
  .ov-layout .paths { padding: 14px 16px 10px; }
}
.code-card .c { color: #8a8ea3; font-style: italic; }
.code-card figcaption { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.code-card figcaption span { white-space: nowrap; }

/* ===== Compare: tidy pane heads and notes ===== */
.pane-head { align-items: center; gap: 10px; padding: 10px 14px; }
.pane-head .kind { font-size: .8rem; color: var(--muted); }
.pane-head .open { margin-left: auto; font-size: .82rem; font-weight: 600; text-decoration: none; }
.pane-head .open:hover { text-decoration: underline; }
.ours-tag { font: 700 .66rem var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--on-strong); background: var(--ours); border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: 2px; }
.cmp-note { color: var(--muted); font-size: .9rem; margin: 14px 0 0; }
.cmp-note b { color: var(--ink); font-weight: 600; }
#cmp-extra .transcript { margin: 10px 0 0; }
@media (min-width: 1100px) {
  .cmp-note { width: calc(50% - 8px); margin-left: calc(50% + 8px); }
}

/* ===== How LessonAgent writes a lesson ===== */
.steps { list-style: none; counter-reset: st; padding: 0; margin: 24px 0 8px; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.steps li { counter-increment: st; position: relative; padding: 16px 16px 16px 54px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: .92rem; color: var(--muted); line-height: 1.5; }
.steps li::before { content: counter(st); position: absolute; left: 16px; top: 15px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--c-agent); color: var(--on-strong); font: 700 .8rem var(--sans); }
.steps b { color: var(--ink); display: block; margin-bottom: 2px; }

/* ===== Results charts (charts.js) ===== */
:root { --s1: var(--paper-ours); --s2: var(--paper-live); --s3: var(--paper-banana); --s4: var(--paper-auto); --neutral: #c8cbd6; }
/* Dark keeps each series on the paper's hue, lifted so it reads on navy. */
:root[data-theme="dark"] { --s1: #6fa8ea; --s2: #9db27f; --s3: #e3c25c; --s4: #d9625f; --neutral: #4a5170; }
.res-h { margin-top: 44px; font-size: 1.45rem; }
.viz-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px 14px; margin: 16px 0; min-width: 0; }
.viz-pair { display: grid; gap: 16px; }
.viz-pair .viz-card { margin: 0; }
@media (min-width: 1000px) { .viz-pair { grid-template-columns: 1fr 1fr; } }
.viz-pair + .viz-card { margin-top: 16px; }
.viz-title { font: 600 1.02rem var(--serif); margin: 0 0 8px; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 6px; font-size: .84rem; color: var(--muted); }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-sw { display: inline-block; width: 10px; height: 10px; border-radius: 0; vertical-align: -1px; margin-right: 5px; }
.viz-legend .viz-sw { margin-right: 0; }
.viz-box { overflow-x: auto; }
.viz-box svg { display: block; }
.viz-note { margin: 6px 0 0; font-size: .8rem; color: var(--muted); line-height: 1.5; }
.viz-grid { stroke: var(--line); stroke-width: 1; }
.viz-base { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.viz-ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: .8; }
.viz-sep { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.viz-tick { font: 11px var(--sans); fill: var(--muted); font-variant-numeric: tabular-nums; }
.viz-cat { font: 500 12px var(--sans); fill: var(--ink); }
.viz-row { font: 500 12.5px var(--sans); fill: var(--ink); }
.viz-row.ours { font-weight: 700; }
.viz-val { font: 600 11.5px var(--sans); fill: var(--ink); font-variant-numeric: tabular-nums; }
.viz-val.ours { font-weight: 700; }
.viz-in { font: 700 11px var(--sans); fill: var(--on-strong); }
.viz-err { stroke: var(--ink); stroke-width: 1.2; opacity: .55; fill: none; }
.viz-hit { fill: transparent; }
.viz-mark:hover path, .viz-mark:hover rect:not(.viz-hit) { filter: brightness(1.12); }
.viz-tip { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: 8px; padding: 8px 10px;
  font: 12.5px/1.5 var(--sans); box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 260px; }
.viz-tip span { opacity: .75; }
.viz-tip .viz-sw { outline: 1px solid rgba(255,255,255,.5); }
.viz-table { margin-top: 10px; font-size: .88rem; }
.viz-table summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.viz-table .tablewrap { margin-top: 8px; }
#results .tablewrap { margin-bottom: 8px; }
.viz-bar { stroke: #000; stroke-width: 1; shape-rendering: crispEdges; }

/* ===== Theme toggle ===== */
.navlinks { margin-left: auto; }
.theme-toggle { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); cursor: pointer; }
.theme-toggle:hover { border-color: var(--muted); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .moon, :root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

/* ===== Dark mode: the overview's editor and browser chrome ===== */
:root[data-theme="dark"] .code-frame { background: #11162a; border-color: #2a3150; color: #dfe3f5; }
:root[data-theme="dark"] .code-bar { background: #1a2038; border-bottom-color: #2a3150; }
:root[data-theme="dark"] .code-bar span { color: #b6bcd6; }
:root[data-theme="dark"] .code-card .k { color: #9db7ff; }
:root[data-theme="dark"] .code-card .s { color: #6fd3a0; }
:root[data-theme="dark"] .code-card .n { color: #f0a070; }
:root[data-theme="dark"] .code-card .c { color: #7d84a3; }
:root[data-theme="dark"] .code-card .hl { background: #1f2a4d; }
:root[data-theme="dark"] .browser-bar { background: #1a2038; border-bottom-color: #2a3150; }
:root[data-theme="dark"] .browser-bar span { color: var(--muted); background: var(--bg); border-color: #2a3150; }

