/* AI disclosure: Generated with GPT-6 in Codex; specification drafted with Claude (Anthropic). Visual redesign implemented from a design brief drafted with Claude (Anthropic). */

/* Tokens: the proving-ground palette, system fonts, spacing and motion. */
:root {
  --asphalt-0: #0C0E0F;
  --asphalt-1: #15181A;
  --asphalt-2: #1E2225;
  --plate: rgba(12, 14, 15, .86);
  --line-d: #2C3134;
  --line-d-strong: #666C70;
  --on-d1: #F2EFE8;
  --on-d2: #BDB8AE;
  --on-d3: #9A958C;
  --paper-0: #FFFFFF;
  --paper: #EDF1EB;
  --paper-2: #E0E6DE;
  --rule: #C3CBC1;
  --rule-strong: #6F7A73;
  --ink: #121614;
  --ink-2: #3E4742;
  --ink-3: #56605A;
  --grid: rgba(18, 22, 20, .07);
  --reaction-d: #B7A0FF;
  --reaction-l: #5A35C8;
  --braking-d: #45D3B6;
  --braking-l: #006257;
  --hazard-d: #FFB547;
  --hazard-l: #924600;
  --hazard-mark-l: #A85500;
  --collision-d: #FF7468;
  --collision-l: #B8281C;
  --focus-d: #8CC4FF;
  --focus-l: #1D5FD1;
  --error-bg: #8E1D14;
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-sign: "DIN Alternate", "Bahnschrift", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --gutter: 32px;
  --dur-1: 120ms;
  --dur-2: 200ms;
  --ease: cubic-bezier(.2, 0, 0, 1);
}

/* Base: no page can widen to fit an unwrapped C++ output line. */
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font: 400 17px/26px var(--font-ui); font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; }
main, section, article, header, footer, div, form, label, pre { min-width: 0; }
h1, h2, h3, p, pre { margin-top: 0; }
h1 { margin-bottom: 16px; font: 700 40px/44px var(--font-sign); }
h2 { margin-bottom: 16px; font: 700 24px/30px var(--font-ui); }
h3 { margin-bottom: 12px; font: 600 19px/26px var(--font-ui); }
p { margin-bottom: 16px; }
small, .small { font-size: 16px; line-height: 24px; }
strong { font-weight: 700; }
a { color: inherit; text-underline-offset: 3px; }
canvas { display: block; max-width: 100%; }
button, input, select, textarea, summary, a[href], [tabindex] { outline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.long, .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Surfaces: shared components use the aliases, scene instrumentation uses dark tokens. */
.surface-dark {
  color-scheme: dark;
  --bg: var(--asphalt-1); --fg: var(--on-d1); --fg-2: var(--on-d2); --fg-3: var(--on-d3);
  --line: var(--line-d); --line-strong: var(--line-d-strong);
  --reaction: var(--reaction-d); --braking: var(--braking-d);
  --hazard: var(--hazard-d); --hazard-mark: var(--hazard-d); --collision: var(--collision-d);
  --focus: var(--focus-d); --btn-bg: var(--on-d1); --btn-fg: var(--ink);
  --hover: var(--asphalt-2); --press: var(--line-d);
  background: var(--bg); color: var(--fg);
}
.surface-light {
  color-scheme: light;
  --bg: var(--paper); --fg: var(--ink); --fg-2: var(--ink-2); --fg-3: var(--ink-3);
  --line: var(--rule); --line-strong: var(--rule-strong);
  --reaction: var(--reaction-l); --braking: var(--braking-l);
  --hazard: var(--hazard-l); --hazard-mark: var(--hazard-mark-l); --collision: var(--collision-l);
  --focus: var(--focus-l); --btn-bg: var(--ink); --btn-fg: var(--paper);
  --hover: var(--paper-2); --press: var(--rule);
  background: var(--bg); color: var(--fg);
}

/* Shell: a full-width identity strip and two navigation groups. */
.app-shell { width: 100%; min-height: 100svh; }
.course-band { position: sticky; top: 0; z-index: 10; padding: 6px var(--gutter); background: var(--asphalt-0); color: var(--on-d2); font-size: 16px; line-height: 20px; }
.topbar { position: relative; display: flex; align-items: center; height: 56px; padding: 0 var(--gutter); gap: 16px; }
.wordmark { flex: none; position: relative; display: block; min-height: 44px; padding: 0 0 7px; border: 0; background: transparent; color: var(--on-d1); font: 700 22px/28px var(--font-sign); }
.wordmark:hover, .wordmark:active { background: transparent; }
.wordmark-ruler { position: absolute; left: 0; right: 0; bottom: 5px; height: 4px; display: flex; }
.wordmark-reaction { width: 34.72%; border: 1px solid var(--reaction-d); background: repeating-linear-gradient(45deg, var(--reaction-d) 0 2px, transparent 2px 5px); }
.wordmark-braking { width: 40.97%; background: var(--braking-d); }
.wordmark-margin { flex: 1; height: 1px; align-self: center; background: var(--on-d3); }
.wordmark-hazard { position: absolute; right: 0; width: 2px; height: 9px; top: -2px; background: var(--hazard-d); }
.site-nav { display: flex; align-items: center; gap: 0; }
.site-nav > [role="group"] { display: flex; align-items: center; }
.site-nav .nav-group-label, .site-nav .nav-project { display: none; }
.nav-divider { width: 1px; height: 20px; margin: 0 8px; background: var(--line-d-strong); flex: none; }
.site-nav button, .header-actions button { height: 44px; min-height: 44px; padding: 12px 8px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--on-d2); background: transparent; font: 600 16px/18px var(--font-ui); white-space: nowrap; }
.site-nav button:hover, .site-nav button:active, .header-actions button:hover, .header-actions button:active { color: var(--on-d1); background: transparent; }
.site-nav button.active, .site-nav button[aria-current="page"] { color: var(--on-d1); border-bottom-color: var(--on-d1); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 0; flex: none; }
#menu-button { display: none; }
#mute-button[aria-pressed="true"], #modal-mute[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); }
.site-footer { border-top: 1px solid var(--rule); padding: 16px max(var(--gutter), calc((100% - 1200px) / 2)) 24px; font-size: 16px; color: var(--ink-3); }
.footer-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.footer-links { display: flex; align-items: center; gap: 4px; }
.footer-links button { padding: 0 8px; }
.footer-links button:first-child { padding-left: 0; }
#result-disclaimer { color: var(--ink-3); margin: 8px 0 0; font-size: 16px; line-height: 24px; }

/* Controls: only colour changes on ordinary controls; the pedal has no transitions. */
button { min-height: 44px; padding: 0 16px; border: 1px solid var(--fg); border-radius: 2px; background: transparent; color: var(--fg); cursor: pointer; font: 600 16px/24px var(--font-ui); transition: color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
button.primary { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
button.primary:hover { background: var(--fg-2); border-color: var(--fg-2); }
button.primary:active { background: var(--fg-3); border-color: var(--fg-3); }
:where(button:not(.primary, .text, .pedal)):hover { background: var(--hover); }
:where(button:not(.primary, .text, .pedal)):active { background: var(--press); }
button.text { border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
button.text:hover { text-decoration-thickness: 2px; }
button.text:active { color: var(--fg-2); }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 24px 0; }
.button-row:last-child { margin-bottom: 0; }
.segmented-control { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 2px; margin-bottom: 32px; }
.segmented-control button { border: 0; border-right: 1px solid var(--rule-strong); border-radius: 0; display: inline-flex; align-items: center; gap: 8px; }
.segmented-control button:last-child { border-right: 0; }
.segmented-control button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.mode-number { font: 700 16px/20px var(--font-sign); }
.mode-short { display: none; }
input, select, textarea { display: block; width: 100%; min-height: 44px; margin-top: 8px; padding: 8px 12px; border: 1px solid var(--rule-strong); border-radius: 2px; background: var(--paper-0); color: var(--ink); font-size: 16px; line-height: 24px; }
label { display: block; color: var(--fg-2); font-size: 16px; line-height: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.form-help { display: block; margin: 4px 0 0; color: var(--ink-2); font-size: 16px; line-height: 24px; }
.form-errors { color: var(--collision-l); margin: 12px 0; font-size: 16px; line-height: 24px; }
.form-errors:not(:empty) { border-left: 3px solid var(--collision-l); padding-left: 12px; }
input[type="range"] { height: 44px; padding: 0; background: transparent; border: 0; accent-color: var(--ink); }
input[type="checkbox"] { display: inline-block; vertical-align: middle; flex: none; width: 24px; height: 24px; min-height: 24px; margin: 0 8px 0 0; padding: 0; accent-color: var(--fg); }
.settings-line, .checkbox-row, label:has(input[type="checkbox"]) { display: flex; align-items: center; min-height: 44px; gap: 4px; }
.key, kbd { display: inline-block; border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; background: var(--paper-0); color: var(--ink); font: 400 16px/18px var(--font-ui); }

/* Sheet parts: ruled sections, readable tables and exact unwrapped console output. */
#page-content { width: min(100% - 2 * var(--gutter), 1200px); margin: 0 auto; padding: 32px 0 48px; }
.page-head, .page-heading { margin-bottom: 32px; }
.page-head h1, .page-heading h1 { margin: 8px 0 16px; }
.page-head h1:first-child { margin-top: 0; }
.kicker { margin: 0 0 8px; color: var(--fg-2); font: 700 16px/20px var(--font-sign); }
.lead { max-width: 68ch; margin-bottom: 24px; color: var(--fg-2); font: 400 19px/28px var(--font-ui); }
.sheet-section, .card { padding: 16px 0 0; margin: 48px 0 0; border: 0; border-top: 2px solid var(--fg); border-radius: 0; background: transparent; }
.sheet-section:first-child, .card:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.section-head .button-row { margin: 0; }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.prose { max-width: 68ch; }
.prose p, .prose li { color: var(--ink-2); }
.prose li { margin-bottom: 8px; }
.prose ol, .prose ul { padding-left: 24px; }
.note { padding: 12px 16px; border-left: 3px solid var(--ink-3); background: var(--paper-2); color: var(--ink-2); font: 400 16px/24px var(--font-ui); }
.note.caution, .caution-note, .note.warning { border-left-color: var(--hazard-mark-l); }
.note.error, .error-note { border-left-color: var(--collision-l); }
.table-wrap { max-width: 100%; overflow-x: auto; }
.verification-table, .data-table, .sheet-table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 24px; }
.verification-table th, .verification-table td, .data-table th, .data-table td, .sheet-table th, .sheet-table td { padding: 10px 12px; border-bottom: 1px solid var(--rule); text-align: right; }
.verification-table th, .data-table th, .sheet-table th { background: var(--paper-2); color: var(--ink-2); font-weight: 600; }
.verification-table th:first-child, .verification-table td:first-child, .data-table th:first-child, .data-table td:first-child, .sheet-table th:first-child, .sheet-table td:first-child { text-align: left; }
.text-cell { text-align: left !important; }
.number-cell { text-align: right !important; }
.code-result, .calculation, #source-banner { max-width: 100%; margin: 0; border-left: 3px solid var(--ink); padding: 16px; background: var(--paper-2); color: var(--ink); font: 400 16px/24px var(--font-mono); }
.code-result, #source-banner { white-space: pre; overflow-x: auto; }
.calculation { white-space: pre-wrap; overflow-wrap: anywhere; background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 12px 12px; }
.result-code, .result-hand { min-width: 0; }
.result-code .code-result, .evidence-grid .code-result { margin-top: -24px; }
.code-label { position: relative; margin-bottom: 24px; font-size: 16px; color: var(--ink-2); }
.result-strip, .sweep-chart { display: block; width: 100%; height: auto; background: var(--paper); border-radius: 0; }
.strip-caption { margin: 16px 0 0; color: var(--ink-2); font-size: 16px; line-height: 24px; }
.data-m { font: 700 26px/30px var(--font-sign); }
.unit { font: 400 16px/20px var(--font-ui); }
.pass, .safe, .verdict.safe, .result-value.safe, .road-outcome.safe, .lab-verdict.safe { color: var(--braking); }
.fail, .collision, .verdict.collision, .result-value.collision, .road-outcome.collision, .lab-verdict.collision { color: var(--collision); }
.verdict.wait { color: var(--hazard); }
.verdict.neutral { color: var(--fg); }
.muted, #score-result .muted { color: var(--ink-2); }

/* Cockpit: all controls are docked below the scene, never over the approach corridor. */
.visual-stage { position: relative; width: 100%; max-width: 1600px; margin: 0 auto; overflow: hidden; background: var(--asphalt-0); aspect-ratio: 1280 / 720; }
.visual-stage > canvas { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
#stage-content { position: absolute; inset: 0; }
body[data-screen="drive"] { overflow: hidden; background: var(--asphalt-0); }
body[data-screen="drive"] .app-shell { height: 100svh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
body[data-screen="drive"] .course-band { flex: none; }
body[data-screen="drive"] .topbar, body[data-screen="drive"] .site-footer { display: none; }
body[data-screen="drive"] main { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--asphalt-0); }
body[data-screen="drive"] .visual-stage { flex: 1; min-height: 0; aspect-ratio: auto; }
body[data-screen="drive"] .visual-stage > canvas { position: absolute; inset: 0; }
.road-plate, .speed-plate { position: absolute; top: 20px; z-index: 2; border: 0; border-radius: 2px; background: var(--plate); color: var(--on-d1); padding: 10px 14px; }
.road-plate { left: 24px; display: flex; align-items: center; gap: 12px; max-width: 46%; }
.road-badge { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 2px solid var(--on-d1); font: 700 26px/30px var(--font-sign); }
.road-plate h1 { margin: 0; font: 700 24px/28px var(--font-sign); }
.road-detail { margin: 4px 0 0; color: var(--on-d2); font-size: 16px; line-height: 24px; }
.drive-mode { display: block; margin: 4px 0 0; font: 700 16px/20px var(--font-sign); }
.speed-plate { right: 24px; text-align: right; }
#live-speed { display: block; min-width: 3ch; font: 700 56px/56px var(--font-sign); }
.speed-plate .unit { display: block; color: var(--on-d2); }
#visual-stage[data-plate="compact"] .road-detail, #visual-stage[data-plate="compact"] .drive-mode { display: none; }
#visual-stage[data-plates="hidden"] .road-plate, #visual-stage[data-plates="hidden"] .speed-plate { visibility: hidden; }
#drive-message { position: absolute; z-index: 2; left: var(--vanish-x, 50%); bottom: calc(100% - var(--horizon-y, 42.64%) + max(24px, 24px * var(--scene-scale, 1))); transform: translateX(-50%); width: max-content; max-width: 46%; height: 70px; min-height: 70px; max-height: 70px; padding: 8px 16px; border: 0; border-radius: 2px; background: var(--plate); color: var(--on-d1); text-align: center; transition: none; animation: none; }
#drive-message strong { display: block; font: 700 20px/30px var(--font-sign); }
#drive-message span { display: block; font: 400 16px/24px var(--font-ui); color: var(--on-d2); }
#drive-message[data-phase="hazard"], #drive-message.hazard { background: var(--hazard-d); color: var(--ink); }
#drive-message[data-phase="hazard"] strong, #drive-message.hazard strong { font: 700 26px/30px var(--font-sign); letter-spacing: .04em; }
#drive-message[data-phase="hazard"] span, #drive-message.hazard span { color: var(--ink); }
#drive-message[data-phase="braking"].safe strong, #drive-message[data-phase="braking"] .safe { color: var(--braking-d); }
#drive-message[data-phase="braking"].collision strong, #drive-message[data-phase="braking"] .collision, #drive-message[data-phase="rejected"] strong { color: var(--collision-d); }
#visual-stage[data-cue="hidden"] #drive-message { visibility: hidden; }
.telemetry { display: none; }
body[data-screen="drive"] .telemetry { display: grid; flex: none; grid-template-columns: minmax(0, 1fr) 264px; grid-template-areas: "ruler controls" "inputs controls" "status controls"; column-gap: 24px; row-gap: 4px; border-top: 1px solid var(--line-d); padding: 10px 32px 12px; background: var(--asphalt-1); }
.input-readout { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
#hud-inputs { grid-area: inputs; }
.datum { border-left: 1px solid var(--line); padding: 0 8px; min-width: 0; }
.datum:first-child { padding-left: 0; border-left: 0; }
.datum-label { display: block; white-space: nowrap; color: var(--fg-2); font: 400 16px/20px var(--font-ui); }
.datum-value { display: block; min-height: 30px; white-space: nowrap; color: var(--fg); font: 700 26px/30px var(--font-sign); }
.datum-value .unit, .datum-value small { font: 400 16px/20px var(--font-ui); color: var(--fg-2); }
.datum-value.precise { white-space: normal; overflow-wrap: anywhere; font: 700 16px/24px var(--font-sign); }
.datum-value.precise .unit, .datum-value.precise small { display: block; }
.datum-value .pending, .datum-value.pending, .telemetry .datum-value.pending { font: 400 16px/20px var(--font-ui); color: var(--on-d3); }
.hud-status { grid-area: status; }
#hud-verdict { display: block; height: 24px; min-height: 24px; max-height: 24px; white-space: normal; margin: 0; font: 700 20px/24px var(--font-sign); letter-spacing: .02em; transition: none; animation: none; }
#hud-note { height: 24px; min-height: 24px; max-height: 24px; white-space: normal; margin: 0; color: var(--on-d2); font: 400 16px/24px var(--font-ui); }
.hazard-distance-strip { grid-area: ruler; display: flex; align-items: center; gap: 16px; height: 24px; min-height: 24px; max-height: 24px; margin: 0; font: 400 16px/20px var(--font-ui); color: var(--on-d2); transition: none; animation: none; }
body[data-screen="drive"] #hazard-distance-strip[hidden] { display: flex !important; visibility: hidden; }
body:not([data-screen="drive"]) #hazard-distance-strip { display: none; }
.hazard-distance-strip > span { white-space: nowrap; }
#hazard-strip-label { font: 700 16px/20px var(--font-sign); color: var(--hazard-d); }
.hazard-strip-track { flex: 1; position: relative; height: 12px; border-bottom: 1px solid var(--line-d-strong); }
.ruler-ticks { position: absolute; inset: 0; pointer-events: none; }
.ruler-ticks > * { position: absolute; bottom: 0; height: 6px; width: 1px; background: var(--line-d-strong); }
.hazard-strip-car { position: absolute; left: 0; top: 50%; width: 8px; height: 12px; transform: translate(-50%, -50%); background: var(--on-d1); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.hazard-strip-marker { position: absolute; right: 0; top: 50%; width: 3px; height: 22px; transform: translate(50%, -50%); background: var(--hazard-d); }
.strip-fill { position: absolute; bottom: 0; height: 10px; width: 0; pointer-events: none; transition: none; animation: none; }
.strip-fill.reaction { left: 0; border: 1px solid var(--reaction-d); background: repeating-linear-gradient(45deg, var(--reaction-d) 0 2px, transparent 2px 5px); }
.strip-fill.braking { background: var(--braking-d); }
#drive-controls { grid-area: controls; align-self: start; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 12px; }
#drive-phase-label { grid-column: 1 / -1; height: 20px; min-height: 20px; max-height: 20px; margin: 0; font: 700 16px/20px var(--font-sign); color: var(--on-d2); transition: none; animation: none; }
#drive-controls.fixed-reaction #drive-phase-label { height: 40px; min-height: 40px; max-height: 40px; }
#drive-controls .drive-running-control { height: 64px; padding: 0 8px; }
#drive-controls .key, #drive-controls kbd { background: transparent; color: inherit; border-color: currentColor; }
#drive-controls .control-keys, #drive-controls .pedal-keys, #drive-controls .key-caps { display: flex; align-items: center; justify-content: center; gap: 4px; }
#drive-controls [data-action="pause"] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.pedal { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; border: 0; border-radius: 2px; padding: 0 8px; background: var(--asphalt-2); color: var(--on-d1); box-shadow: inset 0 0 0 2px var(--on-d2); font: 700 28px/28px var(--font-sign); letter-spacing: .04em; touch-action: manipulation; transition: none; animation: none; }
.pedal > span:not(.control-keys, .pedal-keys, .key-caps), .pedal .key, .pedal kbd { letter-spacing: 0; }
.pedal.hazard { background: var(--hazard-d); color: var(--ink); box-shadow: none; }
.pedal.is-pressed { background: var(--on-d2); color: var(--ink); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25); }
#drive-controls.fixed-reaction .pedal { opacity: .5; }
.drive-void-actions { display: none; grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.drive-void-actions button { height: 64px; padding: 0 8px; }
#drive-controls[data-phase="void"] .drive-running-control, #drive-controls[data-phase="rejected"] .drive-running-control { display: none; }
#drive-controls[data-phase="void"] .drive-void-actions, #drive-controls[data-phase="rejected"] .drive-void-actions { display: grid; }

/* Title: the dark test setup, its proportional ruler and engineering title block. */
body[data-screen="title"] main { background: var(--asphalt-0); }
body[data-screen="title"] .visual-stage { height: calc(100svh - 32px - 56px); aspect-ratio: auto; overflow: visible; }
body[data-screen="title"] .visual-stage > canvas { position: absolute; inset: 0; }
.title-col { position: absolute; left: 0; top: 0; bottom: 0; width: min(680px, 62%); padding: 40px 32px 40px 48px; background: rgba(12, 14, 15, .88); border-right: 1px solid var(--line-d); display: flex; flex-direction: column; justify-content: center; }
.title-col .kicker { margin: 0 0 8px; color: var(--on-d2); }
.title-col h1 { margin: 0 0 16px; font: 700 56px/60px var(--font-sign); letter-spacing: -.005em; color: var(--on-d1); }
.title-col .lead, .title-lead { margin: 0 0 24px; max-width: 46ch; font: 400 19px/28px var(--font-ui); color: var(--on-d2); }
.title-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.title-subline { margin: 12px 0 0; color: var(--on-d2); font-size: 16px; line-height: 24px; }
.ref-ruler { margin-top: 32px; max-width: 560px; }
.ref-ruler-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; color: var(--on-d2); font-size: 16px; line-height: 20px; }
.ref-ruler-head strong, .ref-ruler-head b { font: 700 16px/20px var(--font-sign); color: var(--on-d1); }
.ref-ruler-track { position: relative; height: 12px; background: repeating-linear-gradient(90deg, var(--line-d-strong) 0 1px, transparent 1px 8.333333%); }
.ref-ruler-track .reaction { position: absolute; left: 0; top: 0; height: 12px; border: 1px solid var(--reaction-d); background: repeating-linear-gradient(45deg, var(--reaction-d) 0 2px, transparent 2px 5px); }
.ref-ruler-track .braking { position: absolute; top: 0; height: 12px; background: var(--braking-d); }
.ref-ruler-track .margin, .ref-ruler-track .ref-margin { position: absolute; top: 6px; height: 1px; border-top: 1px dashed var(--on-d3); }
.ref-ruler-track .hazard, .ref-ruler-track .hazard-marker { position: absolute; top: -5px; right: 0; width: 3px; height: 22px; background: var(--hazard-d); }
.ref-ruler-labels { position: relative; margin-top: 12px; height: 40px; font-size: 16px; line-height: 20px; color: var(--on-d2); }
.ref-ruler-labels > * { position: absolute; }
.ref-ruler-labels strong, .ref-ruler-labels b { display: block; font: 700 16px/20px var(--font-sign); color: var(--on-d1); }
.ref-ruler-labels span { display: block; }
.title-block { border: 1px solid var(--line-d-strong); background: var(--plate); color: var(--on-d2); }
.title-block > * { margin: 0; padding: 8px 12px; font: 400 16px/22px var(--font-ui); }
.title-block > * + * { border-top: 1px solid var(--line-d); }
.title-block > :first-child { font: 700 18px/24px var(--font-sign); color: var(--on-d1); }
body[data-screen="title"] .title-block { position: absolute; right: 48px; bottom: 32px; max-width: 520px; }
#page-content .title-block { background: var(--paper); border-color: var(--rule-strong); color: var(--ink-2); }
#page-content .title-block > * + * { border-color: var(--rule); }
#page-content .title-block > :first-child { color: var(--ink); }
body[data-screen="title"] .title-block-flow { position: static; max-width: none; margin: 0; background: var(--asphalt-1); border-left: 0; border-right: 0; }

/* Debrief: the result first, then its ruler, evidence and complete test conditions. */
.debrief-head { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; padding-bottom: 24px; border-bottom: 2px solid var(--ink); }
.debrief-head .page-head { margin-bottom: 0; }
.debrief-head h1 { margin-bottom: 12px; }
.debrief-head p:last-child { margin-bottom: 0; }
.debrief-actions { display: flex; gap: 12px; flex: none; }
.result-figure { display: grid; grid-template-columns: 2fr 3fr; gap: 24px; padding: 24px 0; }
.result-value { font: 700 72px/72px var(--font-sign); }
.result-value .unit, .result-value small { font: 700 28px/32px var(--font-sign); color: var(--ink-2); }
.result-value-label, .result-caption { color: var(--ink-2); margin: 8px 0 0; font-size: 16px; line-height: 24px; }
.result-figure.safe .result-value { color: var(--braking-l); }
.result-figure.collision .result-value { color: var(--collision-l); }
.result-lesson { margin: 0; max-width: 44ch; color: var(--ink); font: 400 20px/30px var(--font-ui); }
.result-lesson strong { font-family: var(--font-sign); font-weight: 700; }
.result-figure + .sheet-section { margin-top: 0; }
.distance-ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 16px; }
.distance-ledger:has(> :nth-child(5)) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.distance-ledger > * { padding: 0 16px; border-left: 1px solid var(--rule); }
.distance-ledger > :first-child { padding-left: 0; border-left: 0; }
.distance-ledger .ledger-label, .distance-ledger dt { color: var(--ink-2); font-size: 16px; line-height: 24px; }
.distance-ledger .ledger-value, .distance-ledger dd, .distance-ledger strong { display: block; margin: 4px 0 0; font: 700 26px/30px var(--font-sign); }
.swatch { display: inline-block; width: 16px; height: 10px; margin-right: 6px; }
.swatch.reaction { border: 1px solid var(--reaction-l); background: repeating-linear-gradient(45deg, var(--reaction-l) 0 2px, transparent 2px 5px); }
.swatch.braking { background: var(--braking-l); }
.score-medals, .evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.score-medals > * + * { border-left: 1px solid var(--rule); padding-left: 24px; }
#score-result h2, #score-result h3 { font: 700 26px/30px var(--font-sign); }
#score-result p { color: var(--ink-2); font-size: 16px; line-height: 24px; }
#debrief-exports { display: flex; gap: 12px; flex-wrap: wrap; }
.ghost-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.ghost-outcomes { margin-top: 24px; }
.ghost-outcomes p { margin: 8px 0; }
.test-conditions .input-readout { margin: 24px 0; }
.test-conditions > p { color: var(--ink-2); font-size: 16px; line-height: 24px; }
.pullout-layer { position: fixed; inset: 0; z-index: 8; background: var(--asphalt-1); pointer-events: none; animation: pullout-fade 450ms ease-out both; }
.pullout-snapshot{position:fixed;z-index:8;object-fit:cover;pointer-events:none;transform-origin:center;animation:scene-pullout 450ms ease-out both}
.pullout-enter{animation:debrief-reveal 450ms ease-out both}
.pullout-strip{transform-origin:center;animation:strip-pullout 450ms ease-out both}
@keyframes pullout-fade { from { opacity: 1; } to { opacity: 0; } }
@keyframes scene-pullout { from { transform: scale(1); } to { transform: scale(.96); } }
@keyframes debrief-reveal{from{opacity:.25}to{opacity:1}}
@keyframes strip-pullout{from{opacity:0;transform:scale(1.04)}to{opacity:1;transform:scale(1)}}

/* Roads: one shared distance scale, one row per road. */
.road-table, .roads-table { width: 100%; }
.road-row, .road-table-head, .road-scale-row { display: grid; grid-template-columns: 56px 1.3fr 1fr 2fr 168px 96px; gap: 16px; align-items: center; }
.road-row { padding: 16px 0; border-top: 1px solid var(--rule); }
.road-row:hover { background: var(--paper-2); }
.road-row h3 { margin-bottom: 4px; }
.road-row p { margin-bottom: 4px; color: var(--ink-2); font-size: 16px; line-height: 24px; }
.road-number { font: 700 26px/30px var(--font-sign); }
.road-inputs { color: var(--ink-2); font-size: 16px; line-height: 24px; }
.road-outcome { font: 700 18px/24px var(--font-sign); }
.road-outcome p, .road-outcome small { display: block; margin-top: 4px; color: var(--ink-2); font: 400 16px/24px var(--font-ui); }
.road-outcome p.pass { color: var(--braking-l); font: 700 18px/24px var(--font-sign); }
.road-outcome p.fail { color: var(--collision-l); font: 700 18px/24px var(--font-sign); }
.road-bar { position: relative; height: 12px; background: repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 6.25%); }
.road-bar > span { position: absolute; height: 12px; top: 0; }
.road-bar .reaction { border: 1px solid var(--reaction-l); background: repeating-linear-gradient(45deg, var(--reaction-l) 0 2px, transparent 2px 5px); }
.road-bar .braking { background: var(--braking-l); }
.road-bar .overrun { border: 1px solid var(--collision-l); background: color-mix(in srgb, var(--collision-l) 35%, transparent); }
.road-bar .hazard, .road-bar .hazard-marker { width: 3px; height: 22px; top: -5px; background: var(--hazard-mark-l); }
.road-scale { position: relative; height: 24px; font-size: 16px; line-height: 24px; color: var(--ink-3); }
.road-scale > span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.road-scale > :first-child { transform: none; }
.road-scale > :last-child { transform: translateX(-100%); }
.road-scale-row { margin-bottom: 12px; }
.road-scale-row .road-scale { grid-column: 4; }
.road-row-note, .road-row > .note, .road-row .road-note { grid-column: 1 / -1; }
.fog-ladder { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 2px; height: 16px; }
.fog-ladder > * { height: 16px; background: var(--collision-l); }
.fog-ladder > .safe, .fog-ladder > .pass, .fog-ladder > .stops { background: var(--braking-l); }
.fog-ladder > .selected, .fog-ladder > [aria-selected="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }
.fog-ladder-labels { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--ink-2); font-size: 16px; line-height: 24px; }

/* Lab and free drive: a pinned input panel beside the paper output. */
.lab-workbench, .free-workbench { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 32px; align-items: start; }
.lab-input-panel, .input-panel { position: sticky; top: 48px; align-self: start; max-height: calc(100svh - 64px); display: flex; flex-direction: column; margin: 0; }
.lab-input-scroll, .panel-scroll { overflow-y: auto; min-height: 0; padding-right: 4px; }
.lab-input-actions, .panel-actions { flex: none; padding-top: 12px; background: var(--paper); border-top: 1px solid var(--rule); }
.lab-input-actions .primary, .panel-actions .primary { width: 100%; }
.lab-input-actions .form-errors, .panel-actions .form-errors { margin-top: 0; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; column-gap: 12px; align-items: center; margin: 16px 0; }
.field-row input, .field-row select { grid-column: 2; margin: 0; }
.field-row .form-help { grid-column: 1 / -1; }
.field-diff { border-left: 3px solid var(--reaction-l); padding-left: 8px; }
.lab-output > .sheet-section, .workbench-results > .sheet-section { margin-top: 32px; }
.lab-output > .sheet-section:first-child, .workbench-results > .sheet-section:first-child { margin-top: 0; }
.lab-verdict { font: 700 24px/30px var(--font-sign); }
.lab-results { display: grid; gap: 24px; }
.lab-results .grid-two { grid-template-columns: 1fr; }
.compare-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.compare-inputs > .sheet-section { margin-top: 0; }
.compare-presets { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.beyond-v0 { margin-top: 32px; }
.planned-card, .extension-card { margin-top: 16px; padding: 16px; border: 1px dashed var(--rule-strong); border-radius: 0; background: transparent; }
.feature-label { display: block; margin-bottom: 12px; color: var(--ink-2); font: 600 16px/24px var(--font-ui); }
.replay-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 16px 0; }
.replay-controls select { min-width: 80px; width: auto; }
.replay-controls label { display: flex; align-items: center; gap: 8px; }
.replay-controls label select { margin: 0; }
.free-workbench output { font: 700 26px/30px var(--font-sign); color: var(--ink); }
.input-group + .input-group { border-top: 1px solid var(--rule); margin-top: 24px; padding-top: 16px; }
.input-rows > label, .range-field { margin-bottom: 16px; }
.reference-label { color: var(--ink-2); font: 700 16px/20px var(--font-sign); }
.workbench-results .outcome { font: 700 24px/30px var(--font-sign); }

/* Records, verification, documents, challenge and fixed-reaction sheets. */
.medal-chips { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.medal-item { flex: 1 1 120px; }
.medal-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 8px; border: 1px solid var(--rule-strong); border-radius: 2px; color: var(--ink-3); font-size: 16px; line-height: 24px; }
.medal-chip.earned { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.medal-rule { display: block; margin: 8px 0 0; color: var(--ink-2); font-size: 16px; line-height: 24px; }
.verification-total { font: 700 26px/30px var(--font-sign); }
details { margin: 0; border-bottom: 1px solid var(--rule); }
summary { min-height: 44px; padding: 10px 12px; cursor: pointer; font-size: 16px; line-height: 24px; font-weight: 600; }
summary:focus-visible { outline-offset: -2px; }
.verification-row summary, .verification-list summary { display: grid; grid-template-columns: 72px minmax(0, 1fr) 100px; align-items: center; gap: 16px; }
.verification-id, .test-id { font-family: var(--font-mono); }
.verification-list summary > :last-child { justify-self: end; }
.verification-row[open], .verification-list details[open] { background: var(--paper-2); }
body[data-screen="about"] #page-content, body[data-screen="credits"] #page-content, body[data-screen="ai"] #page-content { max-width: 720px; }
.identity p { margin: 0; }
.disclosure { border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); padding: 16px 0; }
.challenge-ladder { position: relative; margin: 32px 0; padding-top: 48px; padding-bottom: 32px; }
.challenge-ladder-window { overflow: visible; }
.challenge-ladder-scale { position: relative; }
.challenge-track, .challenge-ladder-track { position: relative; height: 12px; background: repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 8.333333%); border-bottom: 1px solid var(--rule-strong); }
.challenge-ladder .ruler-ticks > * { background: var(--rule); }
.challenge-marker { position: absolute; top: -5px; width: 3px; height: 22px; background: var(--rule-strong); }
.challenge-marker.start { background: var(--hazard-mark-l); }
.challenge-labels { display: flex; justify-content: space-between; margin-top: 12px; color: var(--ink-3); font-size: 16px; line-height: 24px; }
.challenge-tick-labels { position: relative; height: 24px; margin-top: 12px; color: var(--ink-3); font-size: 16px; line-height: 24px; }
.challenge-tick-labels > span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.challenge-tick-labels > :first-child { transform: none; }
.challenge-tick-labels > :last-child { transform: translateX(-100%); }
.challenge-start, .challenge-start-label, .challenge-step-label { position: absolute; top: -48px; color: var(--ink-2); font-size: 16px; line-height: 24px; white-space: nowrap; }
.challenge-start, .challenge-start-label { right: 0; text-align: right; }
.challenge-step-label { right: 8.333333%; }
.challenge-bracket { position: absolute; top: -16px; left: 83.333333%; width: 12.5%; height: 8px; border: 1px solid var(--rule-strong); border-top: 0; }
.recording-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.recording-grid .sheet-section { margin-top: 0; }

/* Modal: the one elevated surface in the system. */
.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; background: rgba(12, 14, 15, .72); }
.modal { width: 100%; max-width: 560px; max-height: calc(100svh - 48px); overflow-y: auto; padding: 32px; border-radius: 4px; box-shadow: 0 24px 64px rgba(0, 0, 0, .45); }
.modal h1 { margin-bottom: 24px; font: 700 28px/32px var(--font-sign); }
.modal p { color: var(--ink-2); }
.settings-line { margin-top: 16px; }

/* Errors and the offline self-test remain readable even if the application stops. */
#error-panel { position: fixed; z-index: 100; left: 0; right: 0; top: 0; padding: 16px 24px; background: var(--error-bg); color: var(--paper-0); font-size: 16px; line-height: 24px; }
noscript .card { margin: 0; padding: 24px; background: var(--paper); color: var(--ink); }
.selftest-summary { margin: 0; padding: 16px 24px; border-left: 3px solid var(--braking-l); background: var(--paper-2); color: var(--ink); font: 400 16px/24px var(--font-mono); }
.selftest-summary.fail, .selftest-summary.failed { border-left-color: var(--collision-l); }

/* Breakpoints: desktop, tablet, phone; the short-window drive is a distinct layout. */
@media (min-width: 1000px) and (max-width: 1099px) and (min-height: 501px) {
  .telemetry .datum-value .unit, .telemetry .datum-value small { display: block; }
}
@media (max-height: 800px) {
  .title-col { padding-top: 24px; padding-bottom: 24px; }
  .title-col h1 { font-size: 44px; line-height: 48px; }
  .title-col .lead, .title-lead { font-size: 17px; line-height: 26px; }
  body[data-screen="title"] .title-block { bottom: 24px; }
  #drive-message { height: 46px; min-height: 46px; max-height: 46px; }
  #drive-message span { display: none; }
  #drive-controls .drive-running-control, .drive-void-actions button, .pedal { height: 56px; min-height: 56px; }
}
@media (min-width: 1000px) and (min-height: 501px) and (max-height: 800px) {
  body[data-screen="drive"] .telemetry { padding: 8px 32px 10px; }
  .telemetry .datum-label { line-height: 18px; }
  .telemetry .datum-value { min-height: 26px; font-size: 22px; line-height: 26px; }
}
@media (max-width: 1279px) and (min-width: 700px) and (orientation: landscape) and (min-height: 501px) {
  body[data-screen="title"] .title-block-flow { position: static; top: auto; right: auto; bottom: auto; max-width: none; margin: 0; background: var(--asphalt-1); border-left: 0; border-right: 0; }
}
@media (min-width: 700px) and (max-width: 999px) {
  :root { --gutter: 24px; }
  h1 { font-size: 34px; line-height: 38px; }
  h2 { font-size: 22px; line-height: 28px; }
  .lead { font-size: 18px; line-height: 28px; }
  .title-col h1 { font-size: 44px; line-height: 48px; }
  .data-m, .datum-value { font-size: 24px; line-height: 28px; }
  .result-value { font-size: 64px; line-height: 64px; }
  #live-speed { font-size: 48px; line-height: 48px; }
}
@media (max-width: 999px) {
  .site-nav { position: absolute; z-index: 25; top: 100%; left: 0; right: 0; display: flex; flex-direction: column; align-items: stretch; padding: 16px var(--gutter) 24px; background: var(--asphalt-1); border-top: 1px solid var(--line-d); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--dur-2) var(--ease), visibility 0s linear var(--dur-2); max-height: calc(100svh - 88px); overflow-y: auto; }
  .site-nav.is-open, body.menu-open .site-nav { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
  .site-nav > [role="group"], .site-nav .nav-project { display: flex; flex-direction: column; align-items: stretch; }
  .site-nav > [role="group"] + [role="group"] { margin-top: 16px; }
  .site-nav .nav-group-label { display: block; margin: 8px 0; color: var(--on-d3); font: 700 16px/20px var(--font-sign); }
  .site-nav button { min-height: 48px; height: 48px; padding: 12px 8px; text-align: left; }
  .nav-divider { display: none; }
  #menu-button { display: block; }
  #mute-button { display: none; }
  .header-actions { gap: 8px; }
  .grid-two, .result-figure, .score-medals, .evidence-grid, .lab-workbench, .free-workbench, .compare-inputs, .recording-grid { grid-template-columns: minmax(0, 1fr); }
  .lab-input-panel, .input-panel { position: static; max-height: none; }
  .lab-input-scroll, .panel-scroll { overflow: visible; }
  .score-medals > * + * { border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; padding-top: 24px; }
  .input-readout { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 4px; }
  .datum:nth-child(5) { border-left: 0; padding-left: 0; }
  .datum-value { min-height: 26px; font-size: 22px; line-height: 26px; }
  body[data-screen="drive"] .telemetry { grid-template-columns: minmax(0, 1fr); grid-template-areas: "ruler" "inputs" "status" "controls"; padding: 10px 24px 12px; }
  #drive-controls { width: 100%; }
  #drive-controls .drive-running-control, .drive-void-actions button, .pedal { min-height: 56px; height: 56px; }
  .road-row, .road-table-head { grid-template-columns: 56px minmax(0, 1fr) 168px 96px; }
  .road-row .road-inputs { grid-column: 2; grid-row: 2; }
  .road-row .road-bar-wrap, .road-row .road-graphic { grid-column: 3 / -1; grid-row: 2; }
  .road-row .road-outcome { grid-column: 3; grid-row: 1; }
  .road-row > button, .road-row .road-action { grid-column: 4; grid-row: 1; }
  .road-scale-row, .road-table-head { display: none; }
  .distance-ledger, .distance-ledger:has(> :nth-child(5)) { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; }
  .distance-ledger > :nth-child(odd) { padding-left: 0; border-left: 0; }
}
@media (max-width: 699px) {
  :root { --gutter: 16px; }
  h1 { font-size: 28px; line-height: 32px; }
  h2 { font-size: 21px; line-height: 28px; }
  h3 { font-size: 18px; line-height: 24px; }
  .lead { font-size: 17px; line-height: 26px; }
  .data-m { font-size: 22px; line-height: 26px; }
  .topbar { gap: 8px; }
  .header-actions { gap: 0; }
  .footer-row { align-items: flex-start; flex-direction: column; gap: 4px; }
  .site-footer { padding-bottom: 24px; }
  #page-content { padding-top: 24px; padding-bottom: 32px; }
  .page-head { margin-bottom: 24px; }
  .section-head, .ghost-heading { flex-wrap: wrap; }
  .sheet-section, .card { margin-top: 32px; }
  .form-grid, .field-row { grid-template-columns: minmax(0, 1fr); }
  .field-row input, .field-row select { grid-column: 1; margin-top: 8px; }
  .field-row .form-help { grid-column: 1; }
  .road-plate, .speed-plate { top: 16px; }
  .road-plate { left: 16px; max-width: calc(100% - 160px); padding: 10px 14px; gap: 8px; }
  .road-plate .road-detail, .road-plate .drive-mode { display: none; }
  .road-plate h1 { font-size: 20px; line-height: 24px; }
  .road-badge { width: 36px; height: 36px; font-size: 22px; line-height: 26px; }
  .speed-plate { right: 16px; display: flex; align-items: baseline; gap: 6px; }
  #live-speed { min-width: 3ch; font-size: 40px; line-height: 40px; }
  .speed-plate .unit { display: inline; }
  #drive-message { display: none; }
  body[data-screen="drive"] .telemetry { padding: 10px 16px 12px; }
  .datum { padding: 0 4px; }
  .datum-label { font-size: 16px; line-height: 20px; }
  .datum-value { font-size: 22px; line-height: 26px; }
  #hud-verdict { height: 44px; min-height: 44px; max-height: 44px; font-size: 18px; line-height: 22px; }
  #hud-note { height: 48px; min-height: 48px; max-height: 48px; }
  .hazard-distance-strip { gap: 12px; }
  .title-col h1 { font-size: 34px; line-height: 38px; }
  .title-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .title-actions button { width: 100%; }
  .ref-ruler-head { gap: 8px; flex-wrap: wrap; }
  .debrief-head { flex-direction: column; align-items: stretch; gap: 16px; padding-bottom: 24px; }
  .debrief-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .debrief-actions button { height: 48px; padding: 0 8px; }
  .result-figure { gap: 24px; }
  .result-value { font-size: 56px; line-height: 56px; }
  .distance-ledger { column-gap: 0; }
  .distance-ledger > * { padding: 0 12px; }
  .distance-ledger .ledger-value, .distance-ledger dd, .distance-ledger strong { font-size: 22px; line-height: 26px; }
  .segmented-control { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .segmented-control button { justify-content: center; gap: 4px; padding: 0 8px; }
  .mode-full { display: none; }
  .mode-short { display: inline; }
  .road-row { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
  .road-row > :not(.road-number) { grid-column: 2; grid-row: auto; }
  .road-row .road-inputs, .road-row .road-outcome { grid-column: 2; grid-row: auto; }
  .road-row .road-bar-wrap, .road-row .road-graphic, .road-row > .note, .road-row .road-note, .road-row-note { grid-column: 1 / -1; grid-row: auto; }
  .road-row > button, .road-row .road-action { grid-column: 1 / -1; grid-row: auto; width: 100%; }
  .road-table-head { display: none; }
  .road-number { font-size: 22px; line-height: 26px; align-self: start; }
  .road-bar { margin: 8px 0; }
  .verification-row summary, .verification-list summary { grid-template-columns: 54px minmax(0, 1fr) 84px; gap: 8px; padding-left: 4px; padding-right: 4px; }
  .challenge-ladder-window { overflow: hidden; padding-top: 48px; margin-top: -48px; }
  .challenge-ladder-scale { width: 200%; margin-left: -100%; }
  .challenge-tick-labels > :nth-child(4) { transform: none; }
  .modal-backdrop { padding: 16px; }
  .modal { padding: 24px; max-height: calc(100svh - 32px); }
}
@media (max-width: 699px), (orientation: portrait), (max-height: 500px) {
  body[data-screen="title"] .visual-stage { height: auto; margin-bottom: 0; overflow: hidden; }
  body[data-screen="title"] .visual-stage > canvas { position: static; width: 100%; height: clamp(180px, 30svh, 300px); object-fit: cover; object-position: 72% 50%; }
  body[data-screen="title"] #stage-content { position: static; }
  .title-col { position: static; width: 100%; padding: 24px var(--gutter) 32px; border: 0; background: var(--asphalt-1); }
  body[data-screen="title"] .title-block { position: static; max-width: none; margin: 0 var(--gutter) 32px; background: var(--asphalt-1); }
}
@media (max-height: 500px) {
  body[data-screen="drive"] .telemetry { grid-template-columns: minmax(0, 1fr) 200px; grid-template-areas: "ruler controls" "inputs controls" "status controls"; column-gap: 24px; row-gap: 4px; padding: 6px 24px; }
  .telemetry .input-readout { grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 0; }
  .telemetry .datum { padding: 0 6px; border-left: 1px solid var(--line-d); }
  .telemetry .datum:first-child { border-left: 0; padding-left: 0; }
  .telemetry .datum-label { font-size: 16px; line-height: 20px; }
  .telemetry .datum-value { min-height: 24px; font-size: 20px; line-height: 24px; }
  .telemetry .datum-value .unit, .telemetry .datum-value small { display: block; }
  .telemetry #hud-verdict { height: 24px; min-height: 24px; max-height: 24px; font-size: 20px; line-height: 24px; }
  .telemetry #hud-note { height: 24px; min-height: 24px; max-height: 24px; }
  .road-plate, .speed-plate { top: 8px; padding: 6px 10px; }
  .road-plate h1 { font-size: 20px; line-height: 24px; }
  .road-detail, .drive-mode { display: none; }
  .speed-plate { display: flex; align-items: baseline; gap: 6px; }
  #live-speed { font-size: 32px; line-height: 32px; }
  #drive-message { display: none; }
  #drive-controls .key, #drive-controls kbd { display: none; }
  #drive-controls .pedal { font-size: 20px; line-height: 20px; }
  #drive-controls[data-phase="void"] #drive-phase-label, #drive-controls[data-phase="rejected"] #drive-phase-label { display: none; }
  .drive-void-actions { grid-template-columns: 1fr; }
  .drive-void-actions button { min-height: 44px; height: 44px; }
}
@media (pointer: coarse) {
  #drive-controls .key, #drive-controls kbd { display: none; }
}

/* Motion never contributes delay to a reaction cue; the player's setting also wins. */
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { transition-duration: 0s !important; transition-delay: 0s !important; animation-duration: 0s !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; transition-delay: 0s !important; animation-duration: 0s !important; }
}
