/* LoopDrive look v3 (11-24): "the page is a circuit".
   One blue family, harmonised on a single hue (~222deg): night navy for hero/footer/figures, mist for the page,
   cobalt for LoopDrive in data, blue-greys for DrivoR and the rest. The logo red appears only in the logo,
   the car and the finish line.
   Type (11-24, user's pick): Archivo, slightly extended, for headings and numbers (speed, livery and timing-screen
   feel, close to the italic heavy wordmark); IBM Plex Sans for text; IBM Plex Mono for labels. All SIL OFL 1.1,
   bundled locally as latin-subset woff2 (assets/fonts, licences alongside), so the offline copy renders the same. */
@font-face { font-family: "Archivo"; src: url("fonts/archivo-var-latin.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibmplexsans-var-latin.woff2") format("woff2");
  font-weight: 100 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibmplexmono-500-latin.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/ibmplexmono-600-latin.woff2") format("woff2");
  font-weight: 600 700; font-style: normal; font-display: swap; }
:root {
  --night-0: #060f24;     /* deepest: hero base */
  --night-1: #0a1733;
  --night-2: #11244b;
  --night-3: #1c3566;     /* lines on night */
  --night-ink: #e9effa;
  --night-ink-2: #a9b9d6;
  --night-ink-3: #7184a8;
  --bg: #f3f6fb;          /* mist */
  --bg-2: #e9eff8;
  --surface: #ffffff;
  --surface-2: #eef3fa;
  --ink: #0d1a35;
  --ink-2: #3c4a66;
  --ink-3: #6b7893;
  --line: #d8e1ee;
  --loop: #2f62f0;        /* LoopDrive (cobalt) */
  --loop-2: #79a0ff;      /* cobalt on night */
  --loop-soft: #e3ebff;
  --drivor: #7d8aa3;      /* DrivoR (blue-grey) */
  --drivor-soft: #e8edf5;
  --signal: #e0352b;      /* logo red: logo, car, finish only */
  --warn: #c2412d;        /* collision events in the examples */
  --warn-soft: #fbe9e5;
  --ok: #17936b;
  --focus: #ffb020;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(13, 26, 53, .06), 0 8px 26px rgba(13, 26, 53, .07);
  --shadow-lg: 0 2px 6px rgba(13, 26, 53, .06), 0 22px 56px rgba(13, 26, 53, .14);
  --max: 1160px;
  --display: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --display-stretch: 112%;                /* Archivo, slightly extended */
  --wordmark-light: block;
  --wordmark-dark: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #081329; --bg-2: #0b1833; --surface: #0f1e3d; --surface-2: #132548; --ink: #e9effa; --ink-2: #a9b9d6;
    --ink-3: #7c8db0; --line: #1f3561; --loop: #79a0ff; --loop-soft: #172a55; --drivor: #93a0b8; --drivor-soft: #18284a;
    --warn: #f0957f; --warn-soft: #3a1f22; --ok: #5fd2a6; color-scheme: dark;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 26px rgba(0,0,0,.3); --shadow-lg: 0 22px 56px rgba(0,0,0,.45);
    --wordmark-light: none; --wordmark-dark: block;
  }
}
:root[data-theme="dark"] {
  --bg: #081329; --bg-2: #0b1833; --surface: #0f1e3d; --surface-2: #132548; --ink: #e9effa; --ink-2: #a9b9d6;
  --ink-3: #7c8db0; --line: #1f3561; --loop: #79a0ff; --loop-soft: #172a55; --drivor: #93a0b8; --drivor-soft: #18284a;
  --warn: #f0957f; --warn-soft: #3a1f22; --ok: #5fd2a6; color-scheme: dark;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 26px rgba(0,0,0,.3); --shadow-lg: 0 22px 56px rgba(0,0,0,.45);
  --wordmark-light: none; --wordmark-dark: block;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
}
img, video, canvas { max-width: 100%; display: block; }
a { color: var(--loop); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
section { padding: 56px 0; }
section + section { border-top: 1px solid var(--line); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.lead { font-size: 1.1rem; color: var(--ink-2); max-width: 760px; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--loop); margin-bottom: .5rem; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.loop { background: var(--loop-soft); color: var(--loop); border-color: transparent; }

/* nav */
.topnav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topnav .wrap { display: flex; align-items: center; gap: 16px; height: 52px; }
.brand { font-weight: 800; color: var(--ink); text-decoration: none; }
.topnav ul { display: flex; gap: 4px; list-style: none; margin: 0 0 0 auto; padding: 0; overflow-x: auto; }
.topnav a.navlink { display: block; padding: 6px 10px; color: var(--ink-2); text-decoration: none; border-radius: 8px; font-size: .9rem; white-space: nowrap; }
.topnav a.navlink:hover { background: var(--surface-2); color: var(--ink); }
.theme-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 8px; padding: 4px 8px; cursor: pointer; font: inherit; font-size: .85rem; }
@media (max-width: 720px) { .topnav ul .hide-sm { display: none; } }
@media (max-width: 480px) {
  .topnav .wrap { gap: 8px; }
  .topnav ul { gap: 0; overflow: visible; }
  .topnav a.navlink { padding-inline: 6px; }
}
@media (max-width: 370px) {
  .topnav .wrap { display: grid; grid-template-columns: 1fr auto; grid-template-rows: 44px 36px; height: auto; row-gap: 0; }
  .topnav ul { grid-area: 2 / 1 / 3 / -1; margin: 0; }
  .theme-btn { grid-area: 1 / 2; }
}

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--loop); border-color: var(--loop); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #0f1520; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0f1520; } }
.btn.sm { padding: 6px 10px; font-size: .875rem; border-radius: 8px; }
.btn[aria-pressed="true"] { background: var(--loop-soft); border-color: var(--loop); color: var(--loop); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* hero */
.hero { padding: clamp(22px, 3vw, 38px) 0 8px; }
.hero h1 { font-size: clamp(1.35rem, 3vw, 2.2rem); max-width: 830px; }
.hero-title { display: block; text-wrap: balance; }
.wordmark-label { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.wordmark { width: min(405px, 84%); height: auto; margin-bottom: 14px; }
.wordmark-light { display: var(--wordmark-light); }
.wordmark-dark { display: var(--wordmark-dark); }
.supp-edition .hero h1 { font-size: clamp(1.35rem, 3vw, 1.9rem); }
.supp-edition .wordmark { width: min(320px, 67%); }
.hero .lead { margin: 14px 0 22px; }
.authors { color: var(--ink-3); margin: 0 0 18px; font-size: .95rem; }
.links { margin-top: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 1.45rem; color: var(--loop); }
.stat span { font-size: .85rem; color: var(--ink-2); }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* demo player */
.demo { margin-top: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.demo-stage { position: relative; aspect-ratio: 16 / 9; background: #0b1220; }
.demo-stage video, .demo-stage img { width: 100%; height: 100%; object-fit: cover; }
.demo-stage .play-cover { position: absolute; inset: 0; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer; padding: 0; }
.play-cover .disc { width: 84px; height: 84px; border-radius: 50%; background: rgba(15, 25, 45, .72); display: grid; place-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.play-cover .disc svg { width: 34px; height: 34px; fill: #fff; margin-left: 5px; }
.play-cover .cover-label { position: absolute; left: 16px; bottom: 14px; color: #fff; background: rgba(15,25,45,.7); padding: 4px 10px; border-radius: 8px; font-size: .85rem; }
.demo-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); }
.demo-bar .label { font-size: .85rem; color: var(--ink-3); margin-right: 4px; }
.demo-bar .spacer { flex: 1; }
details.transcript { padding: 0 14px 14px; }
details.transcript summary { cursor: pointer; color: var(--ink-2); font-size: .9rem; padding: 6px 0; }
details.transcript ol { margin: 6px 0 0; padding-left: 0; list-style: none; font-size: .92rem; }
details.transcript li { display: grid; grid-template-columns: 56px 1fr; gap: 8px; padding: 3px 0; }
details.transcript li button { border: 0; background: none; color: var(--loop); font: inherit; cursor: pointer; text-align: left; padding: 0; font-variant-numeric: tabular-nums; }

/* method */
.figure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 22px 0; }
.figure img { width: 100%; height: auto; background: #fff; border-radius: 8px; }
.figure figcaption { font-size: .9rem; color: var(--ink-2); margin-top: 10px; }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }

.loopviz { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 22px; }
.loopviz-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.lv-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: start; padding: 12px 0; border-top: 1px dashed var(--line); }
.lv-row:first-of-type { border-top: 0; }
.lv-name b { display: block; }
.lv-name span { font-size: .8rem; color: var(--ink-3); }
.lv-blocks { display: flex; flex-wrap: wrap; gap: 8px; }
.lv-block { position: relative; min-width: 64px; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface-2); text-align: center; font-weight: 700; font-size: .9rem; transition: background .25s, border-color .25s, transform .25s; }
.lv-block small { display: block; font-weight: 500; font-size: .72rem; color: var(--ink-3); }
.lv-block.looped { border-style: solid; border-color: color-mix(in srgb, var(--loop) 45%, var(--line)); }
.lv-block.active { background: var(--loop); border-color: var(--loop); color: #fff; transform: translateY(-2px); }
.lv-block.active small { color: rgba(255,255,255,.85); }
.lv-block.untied.active { background: var(--drivor); border-color: var(--drivor); }
:root[data-theme="dark"] .lv-block.active { color: #0f1520; }
.lv-ticks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.lv-tick { width: 22px; height: 8px; border-radius: 3px; background: var(--line); transition: background .2s; }
.lv-tick.done { background: color-mix(in srgb, var(--loop) 55%, var(--line)); }
.lv-tick.now { background: var(--loop); }
.lv-tick.untied.done { background: color-mix(in srgb, var(--drivor) 55%, var(--line)); }
.lv-tick.untied.now { background: var(--drivor); }
.lv-traj { display: grid; grid-template-columns: 1fr 180px; gap: 14px; align-items: center; }
.lv-traj svg { width: 180px; height: 120px; background: var(--surface-2); border-radius: 10px; }
@media (max-width: 640px) { .lv-row { grid-template-columns: 1fr; } .lv-traj { grid-template-columns: 1fr; } }
.lv-status { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: .92rem; min-height: 2.6em; }
.lv-counters { display: flex; flex-wrap: wrap; gap: 18px; font-size: .9rem; color: var(--ink-2); margin-top: 10px; }
.lv-counters b { color: var(--ink); font-variant-numeric: tabular-nums; }

.knob { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.knob-out { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.knob-out div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.knob-out b { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.knob-out span { font-size: .8rem; color: var(--ink-3); }

/* results */
.bench { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
@media (max-width: 900px) { .bench { grid-template-columns: 1fr; } }
.bench .card header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.bench .card h3 { margin: 0; }
.bench .setting { font-size: .82rem; color: var(--ink-3); margin-bottom: 12px; }
.metric { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 14px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.metric .m { font-size: .85rem; color: var(--ink-2); }
.metric .v-d { color: var(--drivor); font-variant-numeric: tabular-nums; }
.metric .v-l { color: var(--loop); font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.legend-inline { display: flex; gap: 14px; font-size: .82rem; color: var(--ink-3); margin-top: 6px; }
.legend-inline i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.eff { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 720px) { .eff { grid-template-columns: 1fr; } }
.bar-row { display: grid; grid-template-columns: 82px 1fr 56px; gap: 10px; align-items: center; margin: 8px 0; font-size: .9rem; }
.bar { height: 14px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; }
.bar-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.delta { font-weight: 800; color: var(--loop); }
details.more { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.more > summary { cursor: pointer; padding: 14px 18px; font-weight: 600; }
details.more > div { padding: 0 18px 18px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 600; padding: 12px 0 6px; caption-side: top; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--ink-3); font-weight: 600; font-size: .8rem; }
tr.ours td { color: var(--loop); font-weight: 700; }
tr.group td { background: var(--surface-2); color: var(--ink-2); font-weight: 600; text-align: left; }

/* examples */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-top: 18px; }
.tab { border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink-3); padding: 10px 14px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--loop); }
.tab .count { font-weight: 500; font-size: .8rem; color: var(--ink-3); margin-left: 4px; }
.tabpanel { padding-top: 18px; }
.tabpanel .blurb { color: var(--ink-2); margin-bottom: 14px; }
.note-box { border: 1px dashed var(--line); background: var(--surface); border-radius: var(--radius); padding: 14px 16px; color: var(--ink-2); font-size: .95rem; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.case-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0; overflow: hidden; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; transition: border-color .2s, transform .2s; }
.case-card:hover { border-color: var(--loop); transform: translateY(-2px); }
.case-card[aria-current="true"] { border-color: var(--loop); box-shadow: 0 0 0 2px var(--loop) inset; }
.case-card img { aspect-ratio: 16 / 9; width: 100%; height: auto; object-fit: cover; background: var(--surface-2); }
.case-card .body { padding: 12px 14px 14px; }
.case-card h4 { margin: 0 0 4px; font-size: 1rem; }
.case-card .meta { font-size: .8rem; color: var(--ink-3); margin-bottom: 6px; }
.case-card p { font-size: .88rem; color: var(--ink-2); margin: 0; }
.group-title { margin: 26px 0 10px; font-size: 1rem; display: flex; align-items: center; gap: 8px; }

.player { margin-top: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; scroll-margin-top: 64px; }
.player[hidden] { display: none; }
.player-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.player-head h3 { margin: 0 0 2px; font-size: 1.25rem; }
.player-look { margin: 6px 0 0; padding-left: 10px; border-left: 3px solid var(--warn); color: var(--ink); font-weight: 600; }
.player-look:empty { display: none; }
/* playlist beside the player; the player widens past the text column so the two videos keep their size */
.player-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.player-main { min-width: 0; }
@media (min-width: 1100px) {
  .player { width: min(1480px, calc(100vw - 32px)); margin-left: calc(50% - min(740px, 50vw - 16px)); }
  .player-body { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .player-body .playlist { order: 2; position: sticky; top: 72px; }
  .pl-list { max-height: calc(100vh - 200px); }
}
.playlist { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 10px; min-width: 0; }
.pl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pl-title { font-weight: 700; color: var(--ink); }
.pl-nav { display: flex; gap: 6px; }
.pl-nav .btn:disabled { opacity: .35; cursor: default; }
.pl-bench { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 8px; }
.pl-tab { min-width: 0; font: inherit; font-size: .78rem; font-weight: 600; line-height: 1.2; padding: 5px 2px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.pl-tab .count { display: block; color: var(--ink-3); font-weight: 500; font-size: .7rem; }
.pl-tab .count::after { content: " clips"; }
.pl-tab[aria-pressed="true"] { background: var(--loop); border-color: var(--loop); color: #fff; }
.pl-tab[aria-pressed="true"] .count { color: rgba(255, 255, 255, .8); }
.pl-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-left: 5px; vertical-align: middle; }
.pl-list { list-style: none; margin: 0; padding: 0 2px 0 0; max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.pl-group { font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-3); margin: 6px 2px 0; }
.pl-item { width: 100%; display: grid; grid-template-columns: 18px 88px minmax(0, 1fr); gap: 8px; align-items: center; text-align: left;
  font: inherit; color: var(--ink-2); background: var(--surface); border: 2px solid transparent; border-radius: 9px; padding: 5px; cursor: pointer; }
.pl-item:hover { border-color: var(--line); }
.pl-item[aria-current="true"] { border-color: var(--loop); background: var(--loop-soft); color: var(--ink); }
.pl-item:focus-visible, .pl-tab:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.pl-num { font-size: .75rem; font-weight: 700; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.pl-item img { width: 88px; aspect-ratio: 1920 / 582; object-fit: cover; border-radius: 5px; display: block; background: var(--surface-2); }
.pl-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pl-name { font-size: .84rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-short { font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-state { font-size: .7rem; font-weight: 700; }
.pl-state.now { color: var(--loop); }
.pl-state.seen { color: var(--ok); font-weight: 600; }
/* the cards below show the same state */
.case-card { position: relative; }
.case-card.is-playing { border-color: var(--loop); box-shadow: 0 0 0 3px var(--loop) inset; }
.case-card.is-playing::after, .case-card.is-watched::after { position: absolute; top: 8px; left: 8px; font-size: .75rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; pointer-events: none; }
.case-card.is-playing::after { content: "▶ Now playing"; background: var(--loop); color: #fff; }
.case-card.is-watched::after { content: "✓ Watched"; background: rgba(15, 25, 45, .72); color: #fff; }
.screens { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.screens.single { grid-template-columns: 1fr; }
@media (max-width: 760px) { .screens { grid-template-columns: 1fr; } }
.screen { position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.screen canvas { width: 100%; height: auto; }
.screen .who { position: absolute; top: 8px; right: 8px; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: rgba(15,25,45,.75); color: #fff; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: .9rem; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.controls .time { font-variant-numeric: tabular-nums; font-size: .88rem; color: var(--ink-2); min-width: 116px; }
.controls select { font: inherit; font-size: .875rem; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.scrub { position: relative; flex: 1 1 100%; padding-top: 16px; }
.scrub input[type=range] { width: 100%; accent-color: var(--loop); }
.scrub .marks { position: absolute; left: 8px; right: 8px; top: 0; height: 14px; }
.scrub .mark { position: absolute; transform: translateX(-50%); width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); background: var(--warn); padding: 0; cursor: pointer; }
.scrub .mark.loopdrive { background: var(--loop); }
.events { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.events button { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: .9rem; cursor: pointer; display: grid; grid-template-columns: 54px 1fr; gap: 8px; }
.events button .t { font-variant-numeric: tabular-nums; color: var(--ink-3); }
.events button.drivor { border-left: 4px solid var(--warn); }
.events button.loopdrive { border-left: 4px solid var(--loop); }
.events button.hit { background: var(--loop-soft); }
.outcome { margin-top: 14px; }
.outcome th, .outcome td { font-size: .88rem; }
.caveat { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--ink); font-size: .92rem; }
.player .fine { font-size: .8rem; color: var(--ink-3); margin-top: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: .78rem ui-monospace, SFMono-Regular, Consolas, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface); }

/* footer */
footer { padding: 40px 0 60px; border-top: 1px solid var(--line); font-size: .9rem; color: var(--ink-2); }
footer h3 { font-size: 1rem; margin-top: 18px; }
footer ul { padding-left: 18px; }
pre.bib { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; font-size: .8rem; }
.soundtrack { position: fixed; right: 16px; bottom: 16px; z-index: 30; box-shadow: var(--shadow); }
@media (max-width: 480px) { .topnav ul .hide-xs { display: none; } }
.player:focus:not(:focus-visible) { outline: none; }
.player:focus-visible { outline: 2px solid var(--focus); }
#pOutcome { overflow-x: auto; }
.outcome th, .outcome td { white-space: normal; padding: 6px 8px; }
@media (max-width: 480px) { .outcome th, .outcome td { font-size: .8rem; padding: 5px 4px; } }
.bench.five { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
@media (max-width: 900px) { .bench.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bench.five .card { padding: 12px 14px; }
.bench.five .metric { grid-template-columns: auto auto; justify-content: start; gap: 12px; border-top: 0; padding: 2px 0 0; }
.bench.five .setting { margin-bottom: 4px; }
section { padding: 36px 0; }
section + section { border-top: 0; }
#demo { padding-top: 8px; }
.demo { margin-top: 0; }
.tabpanel .blurb { margin-bottom: 10px; }

.grid-cards.wide { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
@media (max-width: 480px) { .grid-cards.wide { grid-template-columns: 1fr; } }
.case-card.wide img { aspect-ratio: 1920 / 582; }

.vcrop { position: relative; width: 100%; overflow: hidden; background: #0b1220; }
.vcrop video { position: absolute; max-width: none; height: auto; display: block; }

/* ---------- supplementary edition: animated results (assets/results_supp.js) ---------- */
:root { --c-drivor: #7d8aa3; --c-loop: #2f62f0; --c-other: #c6d0de; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c-drivor: #93a0b8; --c-loop: #79a0ff; --c-other: #3a4d74; } }
:root[data-theme="dark"] { --c-drivor: #93a0b8; --c-loop: #79a0ff; --c-other: #3a4d74; }
.sr-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; margin-top: 14px; box-shadow: var(--shadow); }
.sr-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.sr-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.sr-tab { font: inherit; font-size: .85rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.sr-tab[aria-pressed="true"] { background: var(--c-loop); border-color: var(--c-loop); color: #fff; }
.sr-tab:focus-visible, .sr-play:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-progress { height: 3px; background: var(--line); border-radius: 3px; margin: 10px 0 12px; overflow: hidden; }
.sr-progress span { display: block; height: 100%; width: 0; background: var(--c-loop); }
.sr-head { min-height: 74px; }
.sr-head.in > * { animation: sr-rise .55s cubic-bezier(.2, .7, .2, 1) both; }
.sr-head.in > :nth-child(2) { animation-delay: .06s; }
.sr-head.in > :nth-child(3) { animation-delay: .12s; }
@keyframes sr-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sr-kicker { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--c-loop); }
.sr-h { margin: 2px 0 2px; font-size: 1.3rem; line-height: 1.25; }
.sr-sub { margin: 0; font-size: .82rem; color: var(--ink-3); }
.sr-stage { position: relative; margin-top: 6px; }
.sr-chart { display: block; width: 100%; height: auto; overflow: visible; transition: opacity .45s; }
.sr-stage.is-cost .sr-chart { opacity: 0; pointer-events: none; }
.sr-axis { transition: opacity .6s; }
.sr-axis.out { opacity: 0; }
.sr-grid { stroke: var(--line); stroke-width: 1; }
.sr-tick { fill: var(--ink-3); font-size: 12px; }
.sr-axis-t { fill: var(--ink-2); font-size: 13px; font-weight: 600; }
.sr-band { fill: var(--loop-soft); opacity: .55; }
.sr-band-t { fill: var(--ink-3); font-size: 11.5px; }
.sr-ref { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 4; }
.sr-ref-t { fill: var(--ink-3); font-size: 11.5px; }
.sr-pt { opacity: 0; transition: transform 1s cubic-bezier(.22, .9, .25, 1), opacity .5s; pointer-events: none; }
.sr-pt.on { opacity: 1; pointer-events: auto; }
.sr-hit { fill: transparent; }
.sr-dot { stroke: var(--surface); stroke-width: 2; transition: r .9s cubic-bezier(.22, .9, .25, 1); }
.sr-pt.other .sr-dot { fill: var(--c-other); fill-opacity: .8; }
.sr-pt.drivor .sr-dot { fill: var(--c-drivor); }
.sr-pt.loop .sr-dot { fill: var(--c-loop); }
.sr-pt.hollow .sr-dot { fill-opacity: 0; stroke-width: 2.2; }
.sr-pt.hollow.other .sr-dot { stroke: var(--c-other); }
.sr-pt.hollow.drivor .sr-dot { stroke: var(--c-drivor); }
.sr-pt.hollow.loop .sr-dot { stroke: var(--c-loop); }
.sr-pt.pulse .sr-dot { animation: sr-pulse 1.5s ease-out 2; }
.sr-pt.loop.hollow.pulse .sr-dot { animation: none; }
@keyframes sr-pulse { 0% { stroke: var(--c-loop); stroke-width: 2; stroke-opacity: 1; } 50% { stroke: var(--c-loop); stroke-width: 12; stroke-opacity: .25; } 100% { stroke: var(--surface); stroke-width: 2; stroke-opacity: 1; } }
.sr-lab { fill: var(--ink-3); font-size: 12px; transition: opacity .4s; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.sr-lab.strong { fill: var(--ink); font-size: 13.5px; font-weight: 700; }
.sr-pt.on:hover .sr-dot { stroke: var(--ink); }
.sr-call { opacity: 0; transition: opacity .5s; }
.sr-call.on { opacity: 1; }
.sr-call-line { stroke: var(--c-loop); stroke-width: 1.5; }
.sr-call-box { fill: var(--surface); stroke: var(--c-loop); stroke-width: 1.5; filter: drop-shadow(0 2px 6px rgba(20, 32, 51, .15)); }
.sr-call-t1 { fill: var(--ink); font-size: 14px; font-weight: 800; }
.sr-call-t2 { fill: var(--ink-2); font-size: 12px; }
.sr-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .78rem; color: var(--ink-3); margin-top: 6px; transition: opacity .4s; }
.sr-legend.muted { opacity: 0; }
.sr-legend .k::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.sr-legend .loop::before { background: var(--c-loop); }
.sr-legend .drivor::before { background: var(--c-drivor); }
.sr-legend .other::before { background: var(--c-other); }
.sr-legend .hollow::before { border: 2px solid var(--ink-3); width: 7px; height: 7px; }
.sr-legend .size::before { width: 6px; height: 6px; box-shadow: 9px -2px 0 3px var(--c-other); margin-right: 18px; background: var(--c-other); }
/* last scene */
.sr-costpane { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 26px; align-content: center; padding: 6px 8px; }
.sr-costpane[hidden] { display: none; }
.sr-costpane > * { opacity: 0; transform: translateY(10px); transition: opacity .5s, transform .5s; }
.sr-costpane.on > * { opacity: 1; transform: none; }
.sr-costpane.on > :nth-child(2) { transition-delay: .5s; }
.sr-unit { display: block; font-size: .72rem; color: var(--ink-3); font-weight: 500; }
.sr-cost { display: flex; flex-direction: column; gap: 22px; }
.sr-costtop { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 6px; }
.sr-cost-k { font-size: 1rem; font-weight: 700; color: var(--ink); }
.sr-delta { font-size: 1.7rem; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ok); }
/* DrivoR = full track; LoopDrive grows inside it; the remainder (what LoopDrive saves) is hatched */
.sr-track { position: relative; height: 34px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.sr-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; transition: width .9s cubic-bezier(.2, .7, .2, 1); }
.sr-bar.drivor { background: var(--c-drivor); opacity: .35; }
.sr-bar.loop { background: var(--c-loop); border-radius: 0 4px 4px 0; }
.sr-saved { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transform: scaleX(.2); transform-origin: left;
  transition: opacity .45s, transform .6s cubic-bezier(.2, .7, .2, 1); border-left: 2px solid var(--surface);
  background: repeating-linear-gradient(135deg, var(--ok) 0 6px, transparent 6px 11px); }
.sr-saved.on { opacity: 1; transform: none; }
.sr-saved span { background: var(--surface); color: var(--ok); font-weight: 800; font-size: .82rem; padding: 2px 7px; border-radius: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sr-cost-vals { display: flex; justify-content: space-between; margin-top: 5px; font-size: .8rem; font-variant-numeric: tabular-nums; }
.sr-cost-vals .v::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.sr-cost-vals .loop { color: var(--ink); font-weight: 700; }
.sr-cost-vals .loop::before { background: var(--c-loop); }
.sr-cost-vals .drivor { color: var(--ink-3); }
.sr-cost-vals .drivor::before { background: var(--c-drivor); opacity: .5; }
.sr-sets { display: flex; flex-direction: column; gap: 6px; }
.sr-sets-h { font-size: .8rem; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.sr-set { display: grid; grid-template-columns: 116px minmax(0, 1fr) 46px; gap: 10px; align-items: center; font-size: .84rem; }
.sr-set-k { font-weight: 600; color: var(--ink); }
.sr-diff-axis { position: relative; height: 14px; background: linear-gradient(var(--line), var(--line)) center / 100% 1px no-repeat; }
.sr-zero { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-3); }
.sr-diff-bar { position: absolute; top: 2px; height: 10px; width: 0; transition: width .7s ease-out; }
.sr-diff-bar.pos { left: 50%; background: var(--c-loop); border-radius: 0 4px 4px 0; }
.sr-diff-bar.neg { right: 50%; background: var(--c-drivor); border-radius: 4px 0 0 4px; }
.sr-diff-v { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.sr-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--surface); font-size: .78rem; line-height: 1.35; padding: 6px 9px; border-radius: 7px; box-shadow: var(--shadow); max-width: 260px; }
.sr-tip[hidden] { display: none; }
@media (max-width: 760px) {
  .sr-costpane { position: static; grid-template-columns: minmax(0, 1fr); }
  .sr-stage.is-cost .sr-chart { display: none; }
  .sr-lab:not(.strong) { opacity: 0; }
  .sr-h { font-size: 1.1rem; }
}

/* =====================================================================================
   LOOK v3 (11-24): night circuit. Overrides the base rules above.
   ===================================================================================== */
html.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1); }
html.js .reveal.in { opacity: 1; transform: none; }
body { font-family: var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); }
h2 { font-weight: 600; font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.1; letter-spacing: -.012em; margin-bottom: .4em; text-wrap: balance; }
.nb { white-space: nowrap; }
main { counter-reset: sec; }
section .kicker { counter-increment: sec; display: flex; align-items: center; gap: 12px; margin: 0 0 14px;
  font: 600 .74rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--loop); }
section .kicker::before { content: counter(sec, decimal-leading-zero); color: var(--ink-3); }
section .kicker::after { content: ""; width: 54px; height: 2px; background: repeating-linear-gradient(90deg, var(--loop) 0 10px, transparent 10px 16px); opacity: .6; }

/* ---------- nav: transparent over the night hero, mist below it ---------- */
.topnav { background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent); transition: background .35s, border-color .35s; }
.topnav .wrap { height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font: 600 1.15rem var(--display); letter-spacing: .005em; }
/* brand mark: a small circuit with the car on its grid slot; the car laps it on load and on hover */
.brand { --bm-rim: var(--ink); --bm-road: #26406f; --bm-lane: rgba(255, 255, 255, .7); }
.topnav.on-dark .brand, footer .brand { --bm-rim: #7f97c8; --bm-road: #1b2f5c; --bm-lane: rgba(233, 239, 250, .55); }
/* brand mark: the wordmark's infinity as a red track with a white rim, and a redrawn race car on it */
.bm { flex: none; width: 52px; height: 22px; overflow: visible; }
.bm-rim, .bm-band { fill: none; stroke-linejoin: round; stroke-linecap: butt; }
.bm-rim { stroke: #fff; stroke-width: 4.8; }
.bm-band { stroke: #d61a15; stroke-width: 3.3; }
.bm-car { transform-box: fill-box; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); }
.brand:hover .bm-car { transform: translateX(2.5px); }
.foot-brand .bm { width: 64px; height: 27px; }
.topnav a.navlink { border-radius: 999px; padding: 6px 13px; transition: background .2s, color .2s; }
.topnav a.navlink[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.theme-btn { border-radius: 999px; padding: 5px 12px; }
.topnav.on-dark { background: rgba(6, 15, 36, .35); border-bottom-color: rgba(28, 53, 102, .6); }
.topnav.on-dark .brand { color: var(--night-ink); }
.topnav.on-dark a.navlink { color: var(--night-ink-2); }
.topnav.on-dark a.navlink:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.topnav.on-dark .theme-btn { background: transparent; color: var(--night-ink-2); border-color: var(--night-3); }

/* ---------- buttons ---------- */
.btn { border-radius: 999px; padding: 10px 20px; font-size: .95rem; transition: background .2s, border-color .2s, transform .2s, box-shadow .2s; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--loop); border-color: var(--loop); color: #fff; box-shadow: 0 8px 22px rgba(47, 98, 240, .28); }
.btn.sm { border-radius: 999px; padding: 6px 12px; }

/* ---------- hero: night circuit ---------- */
.hero { position: relative; overflow: hidden; margin-top: -59px; padding: calc(59px + clamp(36px, 6vw, 76px)) 0 0; text-align: center; color: var(--night-ink);
  background: radial-gradient(70% 60% at 50% 0%, #1b3c80 0%, rgba(27, 60, 128, 0) 70%),
              radial-gradient(40% 50% at 100% 100%, rgba(47, 98, 240, .18), transparent 70%),
              linear-gradient(180deg, var(--night-1) 0%, var(--night-0) 100%); }
.hero-sky { position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(169, 195, 255, .16) 1px, transparent 1.3px); background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(60% 55% at 50% 35%, #000 10%, transparent 75%); mask-image: radial-gradient(60% 55% at 50% 35%, #000 10%, transparent 75%); }
.hero-inner { position: relative; display: flex; flex-direction: column; align-items: center; }
.badge { display: inline-flex; flex-wrap: wrap; justify-content: center; margin: 0; border: 1px solid var(--night-3); border-radius: 999px; overflow: hidden;
  font: 600 .7rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--night-ink-2); background: rgba(255, 255, 255, .03); }
.badge { padding: 7px 0 7px 14px; }
.badge span { padding: 0 14px; margin-left: 14px; border-left: 1px solid var(--night-3); color: var(--night-ink-3); }
.badge span:last-child { padding-right: 14px; }
.hero h1 { margin: 0; max-width: none; font-size: inherit; }
.ident { position: relative; display: block; width: min(780px, 94vw); aspect-ratio: 2020 / 360; margin: clamp(22px, 3vw, 34px) auto 0; }
.ident-still { position: absolute; inset: 0; width: 100%; height: 100%; }   /* same crop as the canvas: no jump at hand-over */
.ident-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
html.ident-ready .ident-still { visibility: hidden; }
.wordmark-label { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.hero-title { display: block; margin-top: clamp(14px, 2vw, 22px); font: 600 clamp(1.55rem, 3.2vw, 2.65rem)/1.14 var(--display); letter-spacing: -.008em; color: var(--night-ink); text-wrap: balance; }
.hero-title em { font-style: normal; color: var(--loop-2); padding-bottom: .06em;
  background: repeating-linear-gradient(90deg, var(--loop-2) 0 .5em, transparent .5em .8em) 0 100% / 100% .07em no-repeat; }
@media (max-width: 860px) { .br-lg { display: none; } }
/* start-lights game: five red lights, lights out, launch */
.lapboard { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 18px; padding: 5px 6px 5px 10px;
  border: 1px solid var(--night-3); border-radius: 10px; background: rgba(255, 255, 255, .03);
  font: 600 .66rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--night-ink-3); transition: border-color .3s, box-shadow .3s; }
.lights { display: inline-flex; gap: 5px; padding: 4px 8px; margin-right: 2px; border-radius: 6px; background: #050b1a; box-shadow: inset 0 0 0 1px #16264a; }
.lights i { width: 10px; height: 10px; border-radius: 50%; background: #2a1215; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .5); transition: background .08s, box-shadow .08s; }
.lights i.on { background: #ff3b2f; box-shadow: 0 0 8px 1px rgba(255, 59, 47, .75), inset 0 0 0 1px rgba(255, 255, 255, .25); }
.lapboard b { min-width: 5ch; text-align: left; font: 600 .95rem/1 var(--display); letter-spacing: .03em; color: var(--night-ink); font-variant-numeric: tabular-nums; }
.lapboard b + .lb-k { padding-left: 10px; border-left: 1px solid var(--night-3); }
.lb-go { font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--night-0); background: var(--night-ink); border: 0; border-radius: 6px;
  padding: 6px 12px; margin-left: 4px; min-width: 9ch; cursor: pointer; transition: background .15s, color .15s, transform .1s; }
.lb-go:hover { background: #fff; }
.lb-go:active { transform: scale(.96); }
.lapboard[data-state="lights"] .lb-go { background: #2a1215; color: #ff8a80; }
.lapboard[data-state="armed"] { border-color: #2ecc71; box-shadow: 0 0 0 3px rgba(46, 204, 113, .18); }
.lapboard[data-state="armed"] .lb-go { background: #2ecc71; color: #04210f; }
.lapboard[data-state="racing"] .lb-go { background: transparent; color: var(--night-ink-3); box-shadow: inset 0 0 0 1px var(--night-3); }
.lapboard[data-state="jump"] { border-color: #ff3b2f; }
.lapboard[data-state="jump"] #lbReact { color: #ff6b5e; }
.lapboard.pb #lbBest { color: #b48cff; }   /* purple: personal best, as on a timing screen */
.authors { margin: 20px 0 0; font-size: .95rem; color: var(--night-ink-3); }
.authors:has(.author) { max-width: 900px; margin-top: 22px; font: 500 clamp(.98rem, 1.5vw, 1.1rem)/1.6 var(--sans); color: var(--night-ink); text-wrap: balance; }
.authors .author { white-space: nowrap; }
.authors a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(169, 185, 214, .35); }
.authors a:hover { border-bottom-color: var(--night-ink); }
.authors sup, .affils sup { font: 500 .68em var(--mono); color: var(--loop-2); margin-left: 1px; vertical-align: .55em; line-height: 0; }
.affils { max-width: 880px; margin: 8px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 18px; font-size: .86rem; line-height: 1.5; color: var(--night-ink-2); }
.affils .affil { white-space: nowrap; }
.affils sup { margin: 0 3px 0 0; }
.author-notes { max-width: 880px; margin: 6px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 18px; font-size: .8rem; line-height: 1.5; color: var(--night-ink-3); }
.authors sup .mark { font-family: var(--sans); font-size: 1.15em; }
.author-notes .note { white-space: nowrap; }
.author-notes .contact { white-space: normal; }
.author-notes sup { font: 500 .95em var(--sans); color: var(--loop-2); margin-right: 3px; vertical-align: .4em; line-height: 0; }
.author-notes a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(169, 185, 214, .35); }
.author-notes a:hover { border-bottom-color: var(--night-ink); }
/* Institution logos: a light strip under the hero; each logo sits on a white tile so colour marks read in both themes. */
.affil-strip { background: var(--bg-2, var(--bg)); border-bottom: 1px solid var(--line); padding: 18px 0; }
/* One row on desktop (the strip may run a little wider than the text column); below that a balanced grid:
   4 + 3 on tablets, 2 + 3 + 2 on phones. --s is a per-logo optical scale from authors.js. */
.affil-logos { list-style: none; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: 12px; }
.affil-logos.wrap { max-width: 1260px; }
.affil-logos li { display: flex; align-items: center; justify-content: center; min-width: 0; height: 62px; padding: 0 18px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.affil-logos img { display: block; height: calc(34px * var(--s, 1)); width: auto; max-width: 100%; object-fit: contain; }
.affil-logos img.emblem { height: calc(48px * var(--s, 1)); }   /* round seals with no wordmark read small at wordmark height */
@media (max-width: 1219px) {
  .affil-logos { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .affil-logos.wrap { max-width: 820px; }
  .affil-logos li { grid-column: span 2; padding: 0 14px; }
  .affil-logos li:nth-child(5) { grid-column: 2 / span 2; }
}
@media (max-width: 720px) {
  .affils { gap: 2px 12px; font-size: .8rem; }
  .affils .affil { white-space: normal; }
  .affil-logos { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .affil-logos li, .affil-logos li:nth-child(5) { grid-column: span 3; height: 52px; padding: 0 10px; }
  .affil-logos li:nth-child(3), .affil-logos li:nth-child(4), .affil-logos li:nth-child(5) { grid-column: span 2; padding: 0 8px; }
  .affil-logos img { height: calc(28px * var(--s, 1)); }
  .affil-logos img.emblem { height: calc(40px * var(--s, 1)); }
}
.hero .lead { max-width: 620px; margin: 8px auto 28px; font-size: 1.08rem; color: var(--night-ink-2); }
.hero .btn-row { justify-content: center; }
.hero .btn.primary { background: #fff; border-color: #fff; color: var(--night-0); box-shadow: 0 10px 28px rgba(0, 0, 0, .35); }
.hero .btn.ghost { background: transparent; color: var(--night-ink); border-color: rgba(169, 185, 214, .35); }
.hero .btn.ghost:hover { border-color: var(--night-ink-2); }
/* timing strip */
.hero .stats { list-style: none; padding: 0; margin: clamp(40px, 6vw, 70px) 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
  text-align: left; border-top: 1px solid var(--night-3); }
.hero .stats li { padding: 18px 22px 24px; border-left: 1px solid var(--night-3); background: none; border-radius: 0; box-shadow: none; }
.hero .stats li:first-child { border-left: 0; padding-left: 4px; }
.st-k { display: block; font: 600 .68rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--night-ink-3); }
.hero .stats b { display: block; margin-top: 10px; font: 600 clamp(2rem, 3.6vw, 2.9rem)/1 var(--display); color: var(--night-ink); font-variant-numeric: tabular-nums; }
.hero .stats b small { font-size: .5em; margin: 0 2px; color: var(--night-ink-3); }
.hero .stats em { display: block; margin-top: 10px; font: 500 .76rem var(--mono); font-style: normal; color: var(--night-ink-3); }
.hero .stats em i { font-style: normal; color: var(--loop-2); font-weight: 700; }
@media (max-width: 760px) {
  .hero .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero .stats li:nth-child(3) { border-left: 0; padding-left: 4px; }
  .hero .stats li:nth-child(n+3) { border-top: 1px solid var(--night-3); }
}
/* the road edge under the hero: a moving lane line */
.hero-lane { position: relative; height: 34px; border-top: 1px solid var(--night-3); background:
  repeating-linear-gradient(90deg, rgba(233, 239, 250, .5) 0 38px, transparent 38px 70px) 0 50% / 100% 3px repeat-x, var(--night-0);
  animation: lane 2.4s linear infinite; }
@keyframes lane { to { background-position: -70px 50%, 0 0; } }

/* ---------- sections ---------- */
section { padding: clamp(56px, 8vw, 100px) 0; }
#demo { padding: clamp(36px, 5vw, 56px) 0 0; }
.demo, .player, .sr-panel { border-radius: 18px; box-shadow: var(--shadow-lg); }
#results { background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.legend-inline { margin-top: 0; }

/* ---------- method: the circuit ---------- */
.method-grid { display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.62fr); gap: clamp(24px, 4vw, 52px); align-items: start; margin-top: 28px; }
@media (max-width: 980px) { .method-grid { grid-template-columns: minmax(0, 1fr); } }
.method-notes { list-style: none; counter-reset: mn; padding: 0; margin: 0; display: grid; gap: 20px; }
.method-notes li { counter-increment: mn; position: relative; padding-left: 42px; color: var(--ink-2); font-size: .97rem; }
.method-notes li::before { content: counter(mn); position: absolute; left: 0; top: -1px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--loop); color: var(--loop); font: 600 .82rem var(--display); }
.method-notes b { display: block; margin-bottom: 3px; font: 600 1.06rem var(--display); color: var(--ink); }
.method-notes li.mn-small { counter-increment: none; padding-top: 16px; border-top: 1px dashed var(--line); font-size: .87rem; color: var(--ink-3); }
.method-notes li.mn-small::before { content: none; }
.circuit { position: relative; margin: 0; padding: 16px 20px 14px; border-radius: 20px; overflow: hidden; color: var(--night-ink); box-shadow: var(--shadow-lg);
  background: radial-gradient(80% 60% at 100% 0%, rgba(47, 98, 240, .16), transparent 70%), linear-gradient(180deg, var(--night-1), var(--night-0)); }
.cc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.cc-title { font: 600 .7rem var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--night-ink-3); }
.cc-board { display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 196px; padding: 5px 10px; border: 1px solid var(--night-3); border-radius: 8px;
  font: 600 .68rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--night-ink-2); background: rgba(255, 255, 255, .03); }
.cc-board b { font: 600 .95rem var(--display); letter-spacing: .04em; color: #fff; font-variant-numeric: tabular-nums; }
.lane { padding: 10px 0 14px; border-top: 1px solid rgba(28, 53, 102, .7); }
.lane:first-of-type { border-top: 0; }
.lane-name { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.lane-name b { font: 600 .9rem var(--display); color: var(--night-ink); }
.lane-name span { font-size: .74rem; color: var(--night-ink-3); }
.road { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 76px; padding: 0 4px; }
.road::before { content: ""; position: absolute; left: -20px; right: -20px; top: 50%; height: 30px; transform: translateY(-50%);
  background: rgba(255, 255, 255, .035); border-top: 1px solid rgba(169, 185, 214, .16); border-bottom: 1px solid rgba(169, 185, 214, .16); }
.road::after { content: ""; position: absolute; left: -20px; right: -20px; top: 50%; height: 2px; transform: translateY(-50%);
  background: repeating-linear-gradient(90deg, rgba(233, 239, 250, .28) 0 12px, transparent 12px 24px); }
.node { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; height: 34px; min-width: 40px; padding: 0 10px; border-radius: 8px;
  background: var(--night-2); border: 1.5px solid #2b4680; color: var(--night-ink); font: 600 .98rem var(--display); white-space: nowrap;
  transition: background .2s, border-color .2s, color .2s, box-shadow .25s; }
.node sub { font-size: .62em; }
.node.rb { width: 54px; height: 54px; min-width: 0; padding: 0; border-radius: 50%; border: 2px dashed var(--loop-2);
  box-shadow: 0 0 0 9px rgba(121, 160, 255, .07); }
.node.rb.big { width: 62px; height: 62px; font-size: .78rem; }
.node.rb em { position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%); font: 600 .66rem var(--mono); font-style: normal; letter-spacing: .08em; color: var(--loop-2); }
.node.in, .node.out { height: 28px; border-radius: 999px; border: 1px solid var(--night-3); background: var(--night-1); color: var(--night-ink-2); font: 500 .76rem var(--sans); }
.node.finish { padding-left: 28px; }
.node.finish::before { content: ""; position: absolute; left: 9px; top: 50%; width: 12px; height: 12px; transform: translateY(-50%); border-radius: 2px;
  background: conic-gradient(#fff 25%, #0b1226 0 50%, #fff 0 75%, #0b1226 0) 0 0 / 6px 6px; }
.node.on { background: var(--loop); border-color: var(--loop); color: #fff; box-shadow: 0 0 0 4px rgba(47, 98, 240, .22), 0 0 26px rgba(47, 98, 240, .5); }
.node.rb.on { border-style: solid; border-color: var(--loop-2); box-shadow: 0 0 0 9px rgba(121, 160, 255, .16), 0 0 30px rgba(47, 98, 240, .55); }
.node.out.on, .node.in.on { background: var(--night-2); border-color: var(--loop-2); color: #fff; }
.node.finish.on { border-color: var(--signal); }
.cc-car { position: absolute; left: 0; top: 0; z-index: 3; width: 30px; height: 16px; pointer-events: none; opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .55)); transition: opacity .25s; will-change: transform; }
.cc-car.on { opacity: 1; }
.cc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 2px; padding-top: 12px; border-top: 1px solid rgba(28, 53, 102, .7);
  font-size: .74rem; color: var(--night-ink-3); }
.cc-foot .key { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px; border-radius: 3px; border: 1.5px solid #2b4680; background: var(--night-2); }
.cc-foot .key.rb { border-radius: 50%; border: 1.5px dashed var(--loop-2); background: none; }
.cc-note { margin-left: auto; }
@media (max-width: 600px) {
  .circuit { padding: 14px 12px 12px; }
  .road { gap: 4px; height: 70px; }
  .node { height: 30px; min-width: 32px; padding: 0 6px; font-size: .86rem; }
  .node.rb { width: 42px; height: 42px; }
  .node.rb.big { width: 50px; height: 50px; }
  .node.in, .node.out { font-size: .68rem; padding: 0 7px; }
  .node.finish { padding-left: 22px; } .node.finish::before { left: 6px; }
  .cc-board { min-width: 0; }
  .cc-note { margin-left: 0; flex-basis: 100%; }
}

/* ---------- results ---------- */
.sr-panel { padding: 22px 26px 20px; margin-top: 18px; }
.sr-tab { border-radius: 999px; padding: 6px 14px; transition: background .2s, color .2s, border-color .2s; }
.sr-tab[aria-pressed="true"] { background: var(--night-1); border-color: var(--night-1); color: #fff; }
:root[data-theme="dark"] .sr-tab[aria-pressed="true"] { background: var(--loop); border-color: var(--loop); color: var(--night-0); }
.sr-progress span { background: var(--loop); }
.sr-kicker { font: 600 .7rem var(--mono); letter-spacing: .14em; color: var(--ink-3); }
.sr-h { font-family: var(--display); font-weight: 600; font-size: 1.55rem; letter-spacing: -.005em; }

/* ---------- examples ---------- */
.tabs { margin-top: 24px; }
.tab { font: 600 1rem var(--display); padding: 10px 16px; transition: color .2s; }
.tab[aria-selected="true"] { border-bottom-color: var(--loop); }
.group-title { margin: 34px 0 12px; font: 600 .72rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.grid-cards { gap: 18px; }
.case-card { transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s, border-color .3s; }
.case-card img { transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.case-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--loop) 40%, var(--line)); box-shadow: var(--shadow-lg); }
.case-card:hover img { transform: scale(1.025); }
.case-card .body { padding: 14px 16px 16px; }
.case-card h4 { font: 600 1.06rem/1.25 var(--display); }
.player { padding: 20px; }
.player-head h3 { font: 600 1.45rem var(--display); }

/* ---------- footer: back on the night road ---------- */
footer { position: relative; margin-top: 0; padding: 52px 0 64px; border-top: 0; color: var(--night-ink-2); background: var(--night-0); }
footer::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: repeating-linear-gradient(90deg, rgba(233, 239, 250, .4) 0 38px, transparent 38px 70px); }
footer .muted { color: var(--night-ink-3); }
footer h3 { color: var(--night-ink); }
footer pre.bib { background: var(--night-1); border-color: var(--night-3); color: var(--night-ink); }

/* ---------- refine pass ---------- */
#demo { padding: clamp(56px, 7vw, 88px) 0 0; }
#demo h2 { margin-bottom: 22px; }
/* example tabs: same segmented pills as the results panel */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.tab { border: 0; margin: 0; border-radius: 999px; padding: 7px 16px; font-size: .95rem; color: var(--ink-2); }
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab[aria-selected="true"] { background: var(--night-1); color: #fff; }
.tab[aria-selected="true"] .count { color: rgba(233, 239, 250, .7); }
:root[data-theme="dark"] .tab[aria-selected="true"] { background: var(--loop); color: var(--night-0); }
:root[data-theme="dark"] .tab[aria-selected="true"] .count { color: rgba(6, 15, 36, .7); }
.tabpanel { padding-top: 22px; }
/* timing strip: a faint lane highlight follows the pointer */
.hero .stats li { position: relative; transition: background .3s; }
.hero .stats li:hover { background: linear-gradient(180deg, rgba(121, 160, 255, .08), transparent); }
.hero .stats li::after { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--loop-2); transform: scaleX(0); transform-origin: left; transition: transform .45s cubic-bezier(.2, .7, .2, 1); }
.hero .stats li:hover::after { transform: scaleX(1); }
/* footer */
.foot-grid { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 24px 48px; padding-bottom: 28px; border-bottom: 1px solid var(--night-3); }
.foot-brand .brand { color: var(--night-ink); text-decoration: none; font-size: 1.3rem; }
.foot-brand p { margin: 8px 0 0; max-width: 360px; font-size: .9rem; color: var(--night-ink-3); }
.foot-nav { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.foot-nav a { padding: 6px 12px; border-radius: 999px; color: var(--night-ink-2); text-decoration: none; font-size: .9rem; transition: background .2s, color .2s; }
.foot-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.foot-nav .foot-top { border: 1px solid var(--night-3); }
.foot-fine { padding-top: 22px; }

@media (prefers-reduced-motion: reduce) { .hero-lane { animation: none; } }
@media (max-width: 600px) {
  .topnav ul { display: none; }
  .theme-btn { margin-left: auto; }
  .badge span { display: none; }
  .badge { padding-right: 14px; }
}

/* Archivo, slightly extended, wherever the display face is used (the `font` shorthand resets stretch) */
h1, h2, h3, h4, .brand, .hero-title, .lapboard b, .hero .stats b, .method-notes b, .method-notes li::before,
.cc-board b, .lane-name b, .node, .sr-h, .tab, .case-card h4, .player-head h3 { font-stretch: var(--display-stretch); }

/* ---------- v3.1 breathing room (method notes no longer carry the interval note) ---------- */
.method-grid { gap: clamp(28px, 5vw, 72px); align-items: stretch; margin-top: clamp(36px, 4vw, 52px); }
@media (min-width: 981px) { .method-grid { grid-template-columns: minmax(0, .92fr) minmax(0, 1.55fr); } }
.method-notes { align-content: center; gap: clamp(26px, 3vw, 38px); padding: 8px 0; }
.method-notes li { font-size: 1rem; line-height: 1.68; padding-left: 50px; max-width: 40ch; }
.method-notes li::before { width: 32px; height: 32px; top: -2px; font-size: .86rem; }
.method-notes b { font-size: 1.14rem; margin-bottom: 6px; }
.circuit { padding: 20px 26px 16px; }
.lane { padding: 14px 0 18px; }
.cc-head { margin-bottom: 10px; }
.cc-foot { padding-top: 14px; }
@media (max-width: 980px) { .method-notes { padding: 0; } .method-notes li { max-width: 62ch; } }
@media (max-width: 600px) { .circuit { padding: 14px 12px 12px; } .lane { padding: 10px 0 14px; } .method-notes li { padding-left: 44px; } }
section h2 { margin-bottom: .55em; }
#results .legend-inline { margin: 4px 0 6px; }
#results .sr-panel { margin-top: 22px; }
#examples h2 + .muted { font-size: .98rem; line-height: 1.6; max-width: 62ch; margin: 0; }
#examples .tabs { margin-top: 30px; }
.cc-board b { white-space: nowrap; }
