/* Eight by Eight - race-bib paper, cobalt runs, signal-orange stations. */
:root {
  --bg: #f3f0e8; --card: #fffdf8; --ink: #16181d; --muted: #686c75; --line: #ddd6c8; --soft: #ece7dc;
  --run: #2443a6; --run-ink: #ffffff; --st: #f0561d; --st-ink: #1a0d06; --act: #2f7d5b;
  --faster: #23774f; --slower: #c0392b; --warn: #a65b00; --info: #4a5a7a;
  --hold: #55678f; --steady: #2f7d5b; --push: #e0441b; --recover: #8a74c4;
  --shadow: 0 1px 0 rgba(22, 24, 29, .06), 0 8px 24px -16px rgba(22, 24, 29, .25);
  --num: "DIN Condensed", "Bahnschrift", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111317; --card: #1a1d23; --ink: #ecebe6; --muted: #9ba1ab; --line: #2d3139; --soft: #23272e;
  --run: #6f8dff; --run-ink: #0b1030; --st: #ff7b45; --st-ink: #1f0c03; --act: #4fbf8a;
  --faster: #4fbf8a; --slower: #ff7a6b; --warn: #f0a640; --info: #9fb2d8;
  --hold: #8fa3cf; --steady: #4fbf8a; --push: #ff6a3d; --recover: #b4a3ea;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 30px -18px rgba(0, 0, 0, .8);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--run); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
h1, h2, h3 { line-height: 1.15; margin: 0; }

/* header */
.bar { display: flex; align-items: center; gap: 14px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 5; }
.back { color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand strong { font-family: var(--num); font-size: 21px; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.mark { position: relative; display: inline-grid; place-items: center; min-width: 46px; height: 30px; padding: 0 6px; border: 2px solid var(--ink); border-radius: 4px; background: var(--card); font-family: var(--num); font-weight: 700; font-size: 17px; }
.mark::before, .mark::after { content: ""; position: absolute; top: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); }
.mark::before { left: 3px; } .mark::after { right: 3px; }
.session { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.credits { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 13px; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.pill:hover { border-color: var(--ink); }
.pill.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pill:disabled { opacity: .45; cursor: not-allowed; }
.pill.file { position: relative; overflow: hidden; }
.pill.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 14px; }

/* hero */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center; max-width: 1280px; margin: 0 auto; padding: 34px 20px 22px; }
.kicker { margin: 0 0 8px; font-family: var(--num); text-transform: uppercase; letter-spacing: .08em; color: var(--st); font-size: 15px; }
.hero h1 { font-family: var(--num); font-size: clamp(38px, 6vw, 64px); text-transform: uppercase; letter-spacing: .01em; }
.sub { color: var(--muted); max-width: 56ch; margin: 12px 0 16px; font-size: 16px; }
.examples { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ex-label { color: var(--muted); font-size: 14px; }
.chip { border: 1px dashed var(--muted); background: transparent; border-radius: 6px; padding: 5px 11px; cursor: pointer; font-size: 14px; }
.chip.on, .chip:hover { border-style: solid; border-color: var(--st); color: var(--st); }
.clocks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.clock { position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: 8px; padding: 14px 16px 10px; box-shadow: var(--shadow); }
.clock::before, .clock::after { content: ""; position: absolute; top: 8px; width: 7px; height: 7px; border-radius: 50%; border: 2px solid var(--ink); background: var(--bg); }
.clock::before { left: 8px; } .clock::after { right: 8px; }
.clock .tag { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 12px; }
.clock b { display: block; text-align: center; font-family: var(--num); font-size: clamp(34px, 5vw, 54px); font-variant-numeric: tabular-nums; line-height: 1.05; }
.clock.a { border-top: 8px solid var(--run); } .clock.b { border-top: 8px solid var(--st); }
.delta { grid-column: 1 / -1; margin: 0; text-align: center; color: var(--muted); font-size: 14px; }

/* layout */
.grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; max-width: 1280px; margin: 0 auto; padding: 0 20px 30px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; box-shadow: var(--shadow); }
.board { display: grid; gap: 18px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { font-family: var(--num); text-transform: uppercase; font-size: 22px; letter-spacing: .02em; }
.meta { color: var(--muted); font-size: 13px; margin: 0; }
.note { color: var(--muted); font-size: 13px; margin: 6px 0; }
.mini { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }

/* setup form */
.setup { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
.ptabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.ptab { border: 2px solid var(--line); background: var(--soft); border-radius: 6px; padding: 7px; cursor: pointer; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tabA.on { border-color: var(--run); background: var(--card); box-shadow: inset 0 -4px 0 var(--run); }
#tabB.on { border-color: var(--st); background: var(--card); box-shadow: inset 0 -4px 0 var(--st); }
.fld { display: grid; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.fld input, .fld select, .fld textarea, textarea, .stations input, .stations select, .nudge input { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 6px; padding: 7px 9px; color: var(--ink); font-size: 15px; }
.fld input:focus, select:focus, textarea:focus, .stations input:focus, .nudge input:focus { outline: 2px solid var(--run); outline-offset: 0; border-color: transparent; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-toggle { border: 0; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; font-size: 14px; }
.seg-toggle legend { font-size: 13px; color: var(--muted); margin-bottom: 4px; padding: 0; }
.stations { width: 100%; border-collapse: collapse; font-size: 13px; }
.stations th, .stations td { padding: 4px 3px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.stations thead th { color: var(--muted); font-weight: 500; }
.stations .tcol { width: 74px; }
.stations input { padding: 5px 6px; font-variant-numeric: tabular-nums; font-size: 14px; }
.stations select { padding: 5px 4px; font-size: 13px; }
.stations input:disabled { opacity: .75; background: transparent; border-style: dashed; }
.sname { display: block; font-weight: 600; } .sspec { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.nudges { margin: 12px 0 4px; } .nudges summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.nudge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.nudge { display: grid; gap: 2px; font-size: 11.5px; color: var(--muted); }
.nudge.run { color: var(--run); } .nudge.station { color: var(--st); }
.nudge input { padding: 4px 5px; font-size: 13px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }

/* ribbon */
.ribbon { width: 100%; overflow-x: auto; }
.rib { width: 100%; min-width: 640px; height: auto; display: block; }
.rib .tick { stroke: var(--line); stroke-width: 1; }
.rib .ticklbl { fill: var(--muted); font-size: 11px; font-family: var(--num); }
.rib .rowlbl { fill: var(--ink); font-size: 13px; font-weight: 600; }
.rib .seg.run { fill: var(--run); } .rib .seg.st { fill: var(--st); }
.rib .row.act .seg.run { fill: var(--act); } .rib .row.act .seg.st { fill: var(--act); opacity: .7; }
.rib .row.act .seg.missing { fill: var(--soft); stroke: var(--muted); stroke-dasharray: 3 3; }
.rib .row.b .seg { opacity: .92; }
.rib .seglbl { font-size: 11px; font-family: var(--num); pointer-events: none; }
.rib .seglbl.run { fill: var(--run-ink); } .rib .seglbl.st { fill: var(--st-ink); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.lg::before { content: ""; display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.lg.run::before { background: var(--run); } .lg.st::before { background: var(--st); } .lg.act::before { background: var(--act); }

/* delta chart */
.delta-chart { width: 100%; overflow-x: auto; }
.dch { width: 100%; min-width: 520px; height: auto; display: block; }
.dch .axis { stroke: var(--muted); stroke-width: 1; }
.dch .dlbl { fill: var(--ink); font-size: 12.5px; }
.dch .dval { fill: var(--muted); font-size: 12.5px; font-family: var(--num); }
.dch .bar.faster, .dch .dval.faster { fill: var(--faster); } .dch .bar.slower, .dch .dval.slower { fill: var(--slower); }
.flags { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.flags li, .plainlist li.warn, .plainlist li.info, .plainlist li.ok { padding: 7px 10px; border-radius: 6px; font-size: 13.5px; border-left: 4px solid var(--line); background: var(--soft); }
.flags li.warn, .plainlist li.warn { border-left-color: var(--warn); }
.flags li.info, .plainlist li.info { border-left-color: var(--info); }
.flags li.ok, .plainlist li.ok { border-left-color: var(--faster); }

/* tables */
.table-wrap { width: 100%; overflow-x: auto; }
.splits, .calls { width: 100%; border-collapse: collapse; font-size: 14px; }
.splits th, .splits td, .calls th, .calls td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.splits thead th, .calls thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.splits tbody th, .calls tbody th { font-weight: 600; white-space: nowrap; }
.splits tr.run th { border-left: 4px solid var(--run); } .splits tr.station th { border-left: 4px solid var(--st); } .splits tr.rox th { border-left: 4px solid var(--muted); }
.calls tr.run th { border-left: 4px solid var(--run); } .calls tr.station th { border-left: 4px solid var(--st); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.faster { color: var(--faster); } .slower { color: var(--slower); } .muted { color: var(--muted); }
.splits tr.total th, .splits tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
.exports { display: flex; gap: 6px; flex-wrap: wrap; }
.calls .cue { font-weight: 600; } .calls .why { color: var(--muted); font-size: 13px; }

/* result paste */
textarea { resize: vertical; min-height: 90px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.leaks { margin: 0; padding-left: 20px; } .leaks li { margin: 3px 0; }

/* strategy */
.strategy { border-top: 6px solid var(--ink); }
.meter { font-size: 13px; color: var(--muted); margin: 8px 0; }
.gate { font-size: 13px; padding: 8px 10px; background: var(--soft); border-radius: 6px; margin: 6px 0; }
.gate .pill { margin-left: 4px; }
.cta { display: block; width: 100%; margin-top: 8px; padding: 13px 16px; border: 0; border-radius: 8px; background: var(--st); color: var(--st-ink); font-family: var(--num); font-size: 21px; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; }
.cta:hover:not(:disabled) { filter: brightness(1.05); }
.cta:disabled { opacity: .5; cursor: not-allowed; }
.progress { margin-top: 14px; padding: 12px; border: 1px dashed var(--line); border-radius: 8px; }
.progress h3 { font-size: 15px; margin-bottom: 6px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 3px; font-size: 14px; }
.step { color: var(--muted); } .step.active { color: var(--ink); font-weight: 600; } .step.done { color: var(--faster); }
.step-ic { display: inline-block; width: 14px; font-family: ui-monospace, monospace; }
#rawOutput { white-space: pre-wrap; font-size: 12px; background: var(--soft); padding: 10px; border-radius: 6px; max-height: 300px; overflow: auto; }
.result { margin-top: 16px; }
.partial { padding: 8px 10px; border-radius: 6px; background: var(--soft); border-left: 4px solid var(--warn); font-size: 13.5px; }
.verdict { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: start; }
.pickbox { border: 2px solid var(--ink); border-radius: 8px; text-align: center; padding: 8px 4px; }
.pickbox .tag { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pickbox b { font-family: var(--num); font-size: 26px; text-transform: uppercase; }
.vbody h3 { font-size: 18px; } .vmeta { color: var(--muted); margin: 4px 0; font-size: 14px; } .vmeta b { color: var(--ink); font-variant-numeric: tabular-nums; }
.callstrip { display: flex; gap: 2px; width: 100%; margin: 4px 0 10px; }
.cs { min-width: 0; flex-basis: 0; border-radius: 3px; padding: 5px 2px; text-align: center; color: #fff; overflow: hidden; }
.cs.c-hold { background: var(--hold); } .cs.c-steady { background: var(--steady); } .cs.c-push { background: var(--push); } .cs.c-recover { background: var(--recover); } .cs.c-none { background: var(--soft); color: var(--muted); }
:root[data-theme="dark"] .cs { color: #0e1014; }
.cs-id, .cs-call { display: block; font-size: 10.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.cs-id { font-family: var(--num); font-size: 12px; }
.callpill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #fff; }
:root[data-theme="dark"] .callpill { color: #0e1014; }
.callpill.c-hold { background: var(--hold); } .callpill.c-steady { background: var(--steady); } .callpill.c-push { background: var(--push); } .callpill.c-recover { background: var(--recover); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
.plainlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 14px; }
.plainlist li span { display: block; color: var(--muted); font-size: 13px; }
.plainlist li .blow { color: var(--warn); }
.plainlist li.yes b::before { content: "+ "; color: var(--faster); } .plainlist li.no b::before { content: "x "; color: var(--slower); }
.plainlist li.none, .history li.none { color: var(--muted); }

/* history */
.history { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.history li { display: grid; gap: 2px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }
.history li.cur { border-color: var(--st); }
.ht { font-weight: 600; } .hm { color: var(--muted); font-size: 13px; } .hrow { display: flex; gap: 6px; margin-top: 4px; }

/* footer, toasts */
.foot { max-width: 1280px; margin: 0 auto; padding: 18px 20px 40px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; font-size: 14px; box-shadow: var(--shadow); transition: opacity .5s; }
.toast.err { background: var(--slower); color: #fff; } .toast a { color: inherit; font-weight: 700; }
.toast.gone { opacity: 0; }

/* pace band - printed only */
.band { display: none; }
@media print {
  body > *:not(.band) { display: none !important; }
  body { background: #fff; color: #000; }
  .band { display: block; width: 7.5cm; font: 9pt/1.25 Arial, sans-serif; border: 1px solid #000; padding: 6px; }
  .band h2 { font-size: 10pt; margin: 0 0 4px; }
  .band ol { list-style: none; margin: 0; padding: 0; }
  .band li { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; border-bottom: 1px dotted #999; padding: 1px 0; }
  .band li.run .bn { font-weight: 700; }
  .band .bc { font-weight: 700; min-width: 4.2em; text-align: right; }
  .band .bq { grid-column: 1 / -1; font-size: 7.5pt; font-style: italic; }
  .band p { margin: 4px 0 0; font-size: 8pt; }
}

/* narrow */
@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 22px; }
  .grid { grid-template-columns: minmax(0, 1fr); padding: 0 16px 24px; }
  .setup { position: static; max-height: none; }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .bar { padding: 8px 16px; gap: 8px; flex-wrap: wrap; }
  .back { display: none; }
  .hero { padding: 18px 16px; }
  .clock b { font-size: 32px; }
  .verdict { grid-template-columns: 1fr; }
  .cs-call { display: none; }
  .foot { padding: 16px; }
}

/* docs pages: api.html and tokens.html */
.doc { max-width: 880px; margin: 0 auto; padding: 20px 16px 40px; }
.doc h1 { font-family: var(--num); text-transform: uppercase; font-size: 34px; margin: 10px 0 12px; }
.doc h2 { font-family: var(--num); text-transform: uppercase; font-size: 24px; margin: 32px 0 8px; }
.doc h3 { font-size: 16px; margin: 20px 0 6px; }
.doc pre { background: #16181d; color: #ecebe6; padding: 12px; border-radius: 8px; overflow-x: auto; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.doc code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.codegroup { margin: 10px 0 18px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.tab { border: 1px solid var(--line); background: var(--card); padding: 3px 10px; font: 600 12px ui-monospace, Menlo, monospace; border-radius: 999px; cursor: pointer; }
.tab.active { background: var(--run); color: var(--run-ink); border-color: var(--run); }
.statebox { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--card); }
.tokenrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.tokenbox { font: 13px ui-monospace, Menlo, monospace; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; overflow-wrap: anywhere; flex: 1; }
.mono { font-family: ui-monospace, Menlo, monospace; } .small { font-size: 12px; }
