/* Beat Offset - stage-dark. A near-black stage, one electric-cyan accent for the beat and the hits, magenta for
 * early, amber for late. Light is kept as an option (the header toggle). */
:root, :root[data-theme="dark"] {
  --bg: #06080b; --bg2: #0b0f14; --panel: #10151c; --panel2: #151b24; --line: #212a36; --line2: #2c3846;
  --ink: #e9eef4; --ink2: #b4c0cd; --muted: #7d8a99;
  --accent: #29f0ff; --accent-dim: rgba(41, 240, 255, 0.14); --accent-ink: #04161a;
  --early: #ff3fa4; --early-dim: rgba(255, 63, 164, 0.16); --late: #ffb21f; --late-dim: rgba(255, 178, 31, 0.16);
  --pocket-band: rgba(41, 240, 255, 0.07); --miss: #6d7987; --extra: #c79bff; --bad: #ff5a5a; --ok: #39e58c;
  --hatch-bg: rgba(255, 255, 255, 0.015); --hatch-line: rgba(255, 255, 255, 0.07);
  --glow: 0 0 22px rgba(41, 240, 255, 0.45);
  --font: "Avenir Next", "Avenir", "Futura", "Century Gothic", "Montserrat", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef2f5; --bg2: #e3e8ee; --panel: #ffffff; --panel2: #f4f7fa; --line: #d3dbe4; --line2: #bcc7d3;
  --ink: #0a1017; --ink2: #33404e; --muted: #5e6b7a;
  --accent: #0089a3; --accent-dim: rgba(0, 137, 163, 0.12); --accent-ink: #ffffff;
  --early: #c4157a; --early-dim: rgba(196, 21, 122, 0.12); --late: #b06a00; --late-dim: rgba(176, 106, 0, 0.13);
  --pocket-band: rgba(0, 137, 163, 0.08); --miss: #8794a2; --extra: #7a45c7; --bad: #c62828; --ok: #138a4f;
  --hatch-bg: rgba(0, 0, 0, 0.01); --hatch-line: rgba(0, 0, 0, 0.08);
  --glow: 0 0 14px rgba(0, 137, 163, 0.35);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; min-height: 100vh;
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, var(--accent-dim), transparent 70%); background-repeat: no-repeat; }
a { color: var(--accent); }
.hidden { display: none !important; }
kbd { font-family: var(--mono); font-size: 0.78em; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--ink2); background: var(--panel2); }
.small { font-size: 0.85rem; color: var(--muted); }
.kicker { font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin: 0; font-weight: 600; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.backlink { color: var(--muted); text-decoration: none; font-size: 0.85rem; white-space: nowrap; }
.backlink:hover { color: var(--ink); }
.logo svg { display: block; }
.lg-ring { fill: none; stroke: var(--line2); stroke-width: 2; } .lg-ring2 { fill: none; stroke: var(--accent); stroke-width: 2; } .lg-dot { fill: var(--accent); } .lg-tick { stroke: var(--accent); stroke-width: 2; stroke-linecap: round; }
.wordmark { font-size: 1.05rem; letter-spacing: 0.02em; white-space: nowrap; }
.topactions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.credits { font-family: var(--mono); font-size: 0.82rem; color: var(--ink2); }
.topup { font-size: 0.85rem; }
.ghost { background: transparent; border: 1px solid var(--line2); border-radius: 999px; padding: 6px 14px; font-size: 0.88rem; color: var(--ink); }
.ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ghost.icon { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; font-size: 1.05rem; }
.small-btn { padding: 4px 12px; font-size: 0.8rem; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 10px 22px; font-weight: 700; }
.primary:hover:not(:disabled) { box-shadow: var(--glow); }
.go { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 14px; padding: 14px 30px; font-size: 1.15rem; font-weight: 800; letter-spacing: 0.02em; box-shadow: var(--glow); }
.go kbd { background: rgba(0, 0, 0, 0.15); color: inherit; border-color: rgba(0, 0, 0, 0.25); }
.small-go { padding: 7px 16px; font-size: 0.92rem; border-radius: 999px; box-shadow: none; }

/* stage */
.stage { max-width: 1180px; margin: 0 auto; padding: 22px 20px 120px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.console { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 22px; }
.deck-left, .deck-right { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 20px; min-width: 0; }
.tempo { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bpm { display: flex; align-items: baseline; gap: 8px; justify-content: center; flex: 1; }
.bpm output { font-size: clamp(4rem, 11vw, 6.4rem); font-weight: 800; line-height: 0.95; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; color: var(--ink); text-shadow: 0 0 30px var(--accent-dim); }
.bpm .unit { font-size: 0.9rem; letter-spacing: 0.2em; color: var(--accent); font-weight: 700; }
.nudge { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line2); background: var(--panel2); font-size: 1.6rem; line-height: 1; color: var(--ink); }
.nudge:hover { border-color: var(--accent); color: var(--accent); }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 14px 0 6px; height: 28px; }
.ctl { margin-top: 14px; display: grid; gap: 6px; }
.ctl.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.lbl { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.segbtn { flex: 1 1 auto; border: 0; background: transparent; color: var(--ink2); border-radius: 9px; padding: 7px 10px; font-size: 0.88rem; font-weight: 600; white-space: nowrap; }
.segbtn[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }
.segbtn:hover:not([aria-checked="true"]) { color: var(--ink); background: var(--panel2); }
.field { display: inline-flex; align-items: center; gap: 8px; }
.field.grow { display: grid; gap: 6px; width: 100%; }
select, input[type="number"], textarea { background: var(--bg2); color: var(--ink); border: 1px solid var(--line2); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 0.92rem; }
input[type="number"] { width: 84px; font-family: var(--mono); }
textarea { width: 100%; resize: vertical; min-height: 54px; }
.unit-s { color: var(--muted); font-size: 0.85rem; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--ink2); cursor: pointer; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--line2); position: relative; cursor: pointer; transition: background 0.15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: transform 0.15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); background: var(--accent-ink); }
.lat { padding-top: 12px; border-top: 1px dashed var(--line); }

.pathead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pathead h1 { font-size: 1.6rem; }
.cue { margin: 4px 0 0; color: var(--ink2); font-size: 0.95rem; }
.levelpill { border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.staff { margin: 12px 0 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 6px 10px; }
.staff svg { display: block; width: 100%; height: auto; }
.nota .staffline { stroke: var(--line2); stroke-width: 1.5; }
.nota .barline { stroke: var(--ink2); stroke-width: 2; }
.nota .beattick { stroke: var(--line2); stroke-width: 1; }
.nota .head { fill: var(--ink); }
.nota .head.now { fill: var(--accent); }
.nota .stem { stroke: var(--ink); stroke-width: 1.6; }
.nota .beam, .nota .ink { fill: var(--ink); }
.nota .flag, .nota .rest { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nota .tsig { font-size: 26px; font-weight: 800; fill: var(--ink); font-family: var(--font); }
.nota .tuplet { font-size: 13px; font-style: italic; fill: var(--accent); font-family: var(--font); font-weight: 700; }
.nota.mini .stem { stroke-width: 1.2; } .nota.mini .flag, .nota.mini .rest { stroke-width: 1.4; }
.libhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 330px; overflow-y: auto; padding: 2px; }
.patcard { position: relative; display: grid; gap: 2px; text-align: left; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px 8px; }
.patcard svg { width: 100%; height: 40px; display: block; }
.patcard .pname { font-size: 0.82rem; font-weight: 600; color: var(--ink2); line-height: 1.25; }
.patcard .plevel { position: absolute; top: 6px; right: 8px; font-size: 0.68rem; color: var(--muted); font-weight: 700; }
.patcard:hover { border-color: var(--line2); }
.patcard[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-dim); }
.patcard[aria-checked="true"] .pname { color: var(--ink); }

/* the pit: LEDs, readouts, start, the pad */
.pit { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px 26px; background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: 22px; padding: 22px 24px; overflow: hidden; }
.pit.live { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dim), 0 20px 60px -30px var(--accent); }
.pit.dark-bar { border-color: var(--line2); box-shadow: none; }
.pit-top { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.leds { display: flex; gap: 12px; }
.led { width: 26px; height: 26px; border-radius: 50%; background: var(--panel2); border: 2px solid var(--line2); transition: transform 0.08s ease-out, background 0.08s; }
.led.down { width: 34px; height: 34px; }
.led.on { background: var(--accent); border-color: var(--accent); box-shadow: var(--glow); transform: scale(1.18); }
.led.ghost { border-color: var(--accent); border-style: dashed; }
.readouts { display: grid; gap: 2px; }
.barout { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.liveoff { font-family: var(--mono); font-size: 1.05rem; min-height: 1.4em; color: var(--muted); }
.liveoff.pocket { color: var(--accent); } .liveoff.early { color: var(--early); } .liveoff.late { color: var(--late); }
.pit-mid { grid-column: 1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hint { margin: 0; flex: 1 1 260px; }
.pad { grid-column: 2; grid-row: 1 / span 2; width: 150px; height: 150px; border-radius: 50%; border: 0; padding: 0; position: relative; background: radial-gradient(circle at 50% 40%, var(--panel2), var(--bg)); box-shadow: inset 0 0 0 2px var(--line2), 0 10px 30px -12px rgba(0, 0, 0, 0.7); touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.pad-ring { position: absolute; inset: 14px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0.55; }
.pad-label { position: relative; font-weight: 800; letter-spacing: 0.3em; color: var(--accent); font-size: 1rem; }
.pit.live .pad-ring { opacity: 1; }
.pad.hit { animation: padhit 0.16s ease-out; }
@keyframes padhit { 0% { box-shadow: inset 0 0 0 2px var(--accent), 0 0 40px var(--accent); transform: scale(0.97); } 100% { box-shadow: inset 0 0 0 2px var(--line2), 0 10px 30px -12px rgba(0, 0, 0, 0.7); transform: scale(1); } }

/* results */
.results { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 22px; display: grid; gap: 20px; min-width: 0; }
.reshead { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.reshead h2 { font-size: 1.35rem; }
.exports { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.numbers { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; }
.big { display: grid; justify-items: start; }
.bignum { font-size: clamp(3.6rem, 9vw, 5.6rem); font-weight: 800; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.bignum.pocket { color: var(--accent); text-shadow: 0 0 30px var(--accent-dim); } .bignum.mid { color: var(--late); } .bignum.low { color: var(--early); }
.cap { color: var(--muted); font-size: 0.85rem; }
.statgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.statgrid div { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-width: 0; }
.statgrid dt { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.statgrid dd { margin: 2px 0 0; font-family: var(--mono); font-size: 1rem; font-weight: 600; overflow-wrap: anywhere; }
dd.early { color: var(--early); } dd.late { color: var(--late); } dd.pocket { color: var(--accent); }
.progressbox { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-left: 3px solid var(--accent); background: var(--accent-dim); border-radius: 10px; padding: 10px 14px; }
.progressbox p { margin: 0; }
.progressbox.down { border-color: var(--late); background: var(--late-dim); }
.tlhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.legend { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8rem; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.lg.early::before { background: var(--early); } .lg.late::before { background: var(--late); } .lg.pocket::before { background: var(--accent); }
.lg.miss::before { border: 2px solid var(--miss); background: transparent; width: 7px; height: 7px; } .lg.extra::before { background: var(--extra); border-radius: 2px; transform: rotate(45deg); }
.lg.drift::before { height: 3px; border-radius: 2px; background: var(--ink2); } .lg.silent::before { border-radius: 2px; background: repeating-linear-gradient(45deg, var(--line2) 0 2px, transparent 2px 5px); }
.tlframe { overflow-x: auto; overflow-y: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); scrollbar-color: var(--line2) transparent; }
.tlframe svg { display: block; }
.tl-bg .pocketband, .pocketband { fill: var(--pocket-band); }
.silentbar { stroke: none; }
.hatch-bg { fill: var(--hatch-bg); } .hatch-line { stroke: var(--hatch-line); stroke-width: 3; }
.barline-tl { stroke: var(--line2); stroke-width: 1.5; } .beatline { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; } .beattick-tl { stroke: var(--accent); stroke-width: 2; opacity: 0.7; }
.barnum { fill: var(--accent); font: 700 13px var(--font); }
.gridzero { stroke: var(--accent); stroke-width: 1.2; opacity: 0.6; } .gridms { stroke: var(--line); stroke-width: 1; }
.msaxis { fill: var(--muted); font: 11px var(--mono); } .axisword { fill: var(--muted); font: 600 10px var(--font); letter-spacing: 0.1em; text-transform: uppercase; }
.barmean { font: 600 11px var(--mono); } .barmean.early, .posval.early { fill: var(--early); } .barmean.late, .posval.late { fill: var(--late); } .barmean.pocket, .posval.pocket { fill: var(--accent); }
.onset { stroke: var(--line2); stroke-width: 2; }
.stemline { stroke-width: 1.4; opacity: 0.55; } .stemline.early { stroke: var(--early); } .stemline.late { stroke: var(--late); } .stemline.pocket { stroke: var(--accent); }
.mark.pocket { fill: var(--accent); } .mark.early { fill: var(--early); } .mark.late { fill: var(--late); }
.mark.miss { fill: none; stroke: var(--miss); stroke-width: 2; } .mark.extra { fill: var(--extra); }
.clipmark.early { fill: var(--early); } .clipmark.late { fill: var(--late); }
.driftline { fill: none; stroke: var(--ink2); stroke-width: 2.2; stroke-linejoin: round; opacity: 0.85; }
.fitline { stroke: var(--ink2); stroke-width: 1.4; stroke-dasharray: 6 5; opacity: 0.6; }
.callout-bg { fill: var(--panel2); stroke: var(--accent); stroke-width: 1; } .callout-text { fill: var(--ink); font: 600 11.5px var(--font); } .callout-dot { fill: var(--accent); }

.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; min-width: 0; }
.panel h3 { font-size: 0.95rem; margin-bottom: 6px; }
.panel svg { width: 100%; height: auto; display: block; }
.poslabel { fill: var(--ink2); font: 600 12px var(--font); } .posval { font: 600 12px var(--mono); } .small-svg { fill: var(--muted); font: 11px var(--font); }
.posbar.pocket { fill: var(--accent); } .posbar.early { fill: var(--early); } .posbar.late { fill: var(--late); }
.whisker { stroke: var(--ink2); stroke-width: 1.4; opacity: 0.7; }
.barnum-s { fill: var(--muted); font: 600 10px var(--mono); }

/* coach */
.coach { border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 12px; }
.coachhead { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: baseline; }
.coachhead h3 { font-size: 1.2rem; }
.coachhead p { margin: 0; max-width: 640px; }
.runrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.meter { font-size: 0.85rem; color: var(--muted); }
.gate { margin: 0; font-size: 0.88rem; color: var(--ink2); background: var(--late-dim); border-radius: 10px; padding: 8px 12px; }
.gateact { font-weight: 700; }
.notice { margin: 0; font-size: 0.86rem; color: var(--ink2); border-left: 3px solid var(--line2); padding: 4px 10px; }
.progress { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.progress h4 { font-size: 1rem; }
.status { margin: 4px 0 8px; font-family: var(--mono); font-size: 0.85rem; color: var(--accent); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 3px; font-size: 0.9rem; color: var(--muted); }
.steps li.done { color: var(--ink2); } .steps li.done::marker { color: var(--ok); } .steps li.now { color: var(--ink); font-weight: 700; } .steps li.now::marker { color: var(--accent); }
.coachresult { display: grid; gap: 14px; }
.headline { font-size: 1.2rem; font-weight: 700; margin: 0; line-height: 1.35; }
.recon { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 0.86rem; }
.rc { padding-left: 22px; position: relative; color: var(--ink2); }
.rc::before { position: absolute; left: 0; font-weight: 800; }
.rc.ok::before { content: "\2713"; color: var(--ok); } .rc.warn::before { content: "!"; color: var(--late); left: 5px; } .rc.bad::before { content: "\2715"; color: var(--bad); }
.findings { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.finding { background: var(--bg2); border: 1px solid var(--line); border-left: 4px solid var(--line2); border-radius: 12px; padding: 10px 14px; display: grid; gap: 4px; }
.finding.high { border-left-color: var(--early); } .finding.medium { border-left-color: var(--late); } .finding.low { border-left-color: var(--accent); }
.finding .sev { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.ftext { margin: 0; }
.check { font-family: var(--mono); font-size: 0.76rem; justify-self: start; border-radius: 999px; padding: 1px 9px; border: 1px solid var(--line2); color: var(--muted); }
.check.verified { color: var(--ok); border-color: var(--ok); } .check.mismatch { color: var(--bad); border-color: var(--bad); } .check.unverifiable { color: var(--late); border-color: var(--late); }
.ptable { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ptable th, .ptable td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ptable td.num { font-family: var(--mono); } .ptable td.bad { color: var(--bad); }
.verdict.better { color: var(--ok); font-weight: 700; } .verdict.worse { color: var(--early); font-weight: 700; } .verdict.same { color: var(--muted); }
.deckhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.rxdeck { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x mandatory; scrollbar-color: var(--line2) transparent; }
.rxcard { flex: 0 0 260px; scroll-snap-align: start; background: var(--bg2); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 16px; padding: 14px; display: grid; gap: 8px; align-content: start; }
.rxcard.phase-warmup { border-top-color: var(--ok); } .rxcard.phase-skill { border-top-color: var(--early); } .rxcard.phase-performance { border-top-color: var(--late); } .rxcard.phase-cooldown { border-top-color: var(--extra); }
.rxcard.loaded { box-shadow: 0 0 0 2px var(--accent); }
.rxtop { display: flex; justify-content: space-between; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.rxtitle { font-size: 1.02rem; }
.rxnota { width: 100%; height: 56px; background: var(--panel); border-radius: 10px; }
.rxmeta { margin: 0; font-family: var(--mono); font-size: 0.76rem; color: var(--ink2); }
.rxcue { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--accent); }
.rxwhy { margin: 0; font-size: 0.82rem; color: var(--muted); }
.rxnote { margin: 0; font-size: 0.78rem; color: var(--late); }
.load { justify-self: start; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 6px 18px; font-weight: 800; }
.next { margin: 0; font-weight: 600; }
.raw pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg2); border-radius: 10px; padding: 10px; font-size: 0.8rem; max-height: 320px; overflow: auto; }
.none { color: var(--muted); font-style: italic; list-style: none; }

/* examples + history */
.examples, .history { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px 20px; display: grid; gap: 8px; }
.examples p { margin: 0; }
.exrow { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg2); border: 1px solid var(--line2); border-radius: 999px; padding: 7px 14px; font-size: 0.88rem; color: var(--ink); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.histhead { display: flex; justify-content: space-between; align-items: center; }
.histlist { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.histitem { width: 100%; display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; align-items: center; text-align: left; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.histitem:hover { border-color: var(--accent); }
.hpocket { font-family: var(--mono); font-weight: 800; font-size: 1.05rem; } .hpocket.pocket { color: var(--accent); } .hpocket.mid { color: var(--late); } .hpocket.low { color: var(--early); }
.hname { font-weight: 600; min-width: 0; overflow-wrap: anywhere; } .hmeta { color: var(--muted); font-size: 0.82rem; text-align: right; }
.hdelta { grid-column: 2 / -1; font: 600 0.78rem var(--mono); color: var(--muted); } .hdelta.up { color: var(--accent); } .hdelta.down { color: var(--late); }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 4px solid var(--accent); border-radius: 12px; padding: 10px 14px; font-size: 0.9rem; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6); transition: opacity 0.5s; }
.toast.err { border-left-color: var(--early); } .toast.gone { opacity: 0; }
.foot { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 10px 20px 40px; }
.foot p { margin: 0 auto; max-width: 900px; }

@media (max-width: 900px) {
  .console { grid-template-columns: 1fr; }
  .twocol { grid-template-columns: 1fr; }
  .numbers { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .backlink { display: none; }
  .stage { padding: 14px 16px 190px; gap: 16px; }
  .deck-left, .deck-right, .results { padding: 16px; border-radius: 16px; }
  .statgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pit { grid-template-columns: 1fr; padding: 16px; }
  .pad { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: 132px; height: 132px; z-index: 30; grid-column: auto; grid-row: auto; }
  .pad.hit { animation: none; box-shadow: inset 0 0 0 2px var(--accent), 0 0 40px var(--accent); }
  .hint { flex-basis: 100%; }
  .library { max-height: 260px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .histitem { grid-template-columns: 56px 1fr; } .hmeta { grid-column: 2; text-align: left; }
  .rxcard { flex-basis: 78vw; }
  .toasts { bottom: 160px; }
}
@media (prefers-reduced-motion: reduce) {
  .led, .switch input, .switch input::after, .toast { transition: none; }
  .led.on { transform: none; }
  .pad.hit { animation: none; box-shadow: inset 0 0 0 3px var(--accent); }
}
/* grid tracks never grow to the timeline's intrinsic width - the frame scrolls instead */
.results, .coach, .coachresult, .tlwrap { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.tlwrap { display: grid; }

/* docs pages (api.html, tokens.html) */
.sep { color: var(--muted); }
.doc { max-width: 920px; margin: 0 auto; padding: 28px 20px 60px; }
.doc h1 { font-size: 2rem; margin-bottom: 10px; }
.doc h2 { font-size: 1.3rem; margin: 30px 0 10px; color: var(--accent); }
.doc h3 { font-size: 1.05rem; margin: 22px 0 8px; }
.doc p { color: var(--ink2); }
.doc code { font-family: var(--mono); font-size: 0.86em; background: var(--panel2); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }
.doc pre { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; overflow: auto; max-height: 520px; font-size: 0.82rem; }
.doc pre code { background: none; padding: 0; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.88rem; display: block; overflow-x: auto; }
.doc th, .doc td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
.codegroup { margin: 10px 0 18px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tab { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 0.8rem; color: var(--ink2); }
.tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.statebox { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin: 14px 0; }
.statebox p { margin: 4px 0 0; }
.muted { color: var(--muted); } .mono { font-family: var(--mono); overflow-wrap: anywhere; }
.tokenrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.tokenbox { font-family: var(--mono); font-size: 0.85rem; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; overflow-wrap: anywhere; }
