/* =====================================================================
   Lagos Grand Prix — "Eko Night"
   Lagos after dark: deep night-blue asphalt, warm paper type, and one
   signature colour, danfo yellow (the city's yellow-and-black buses).
   The game UI is dark; the long-form guide stays on light paper.
   ===================================================================== */
:root {
  /* brand */
  --night: #090b10;
  --night-1: #10131a;
  --night-2: #181c25;
  --night-3: #232935;
  --paper: #f4f1ea;
  --paper-2: #b9bec8;
  --paper-3: #7d8491;
  --line: rgba(244,241,234,.1);
  --danfo: #ffc20e;       /* signature: you, Overtake Mode, primary actions */
  --danfo-ink: #171000;   /* text on danfo */
  --aero: #4f7bff;        /* active aero / Straight Mode */
  --boost: #ff5a24;       /* Boost */
  --deploy: #ffb020;      /* energy out of the battery */
  --harvest: #23d0e4;     /* energy into the battery */
  --good: #2fd07a;
  --bad: #ff4757;
  /* light-paper context (the guide, and the names older rules use) */
  --chalk: var(--paper);
  --chalk-2: #e7e2d6;
  --ink: var(--night);
  --ink-2: #3b414c;
  --ink-3: #6b7280;
  --cobalt: var(--aero);
  --orange: var(--boost);
  --sulphur: var(--danfo);
  --you-car: var(--danfo);
  --rival-car: #1e5a46;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --snap: cubic-bezier(0.2, 1.4, 0.4, 1);
  --out: cubic-bezier(0.23, 1, 0.32, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ink); color: var(--chalk); font-family: var(--body); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--sulphur); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- game frame ---------- */
.game { position: relative; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; background: #9fb6c9; user-select: none; -webkit-user-select: none; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }

/* painted plate: the building block of the HUD */
.plate { background: var(--chalk); color: var(--ink); border-radius: 3px; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.plate.ink { background: var(--ink); color: var(--chalk); }
.label { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }

/* timing tower (top left): 12 cars, interval to the car ahead */
.tower { position: absolute; top: 14px; left: 14px; display: grid; gap: 3px; width: 236px; }
.tower .lap { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; padding: 6px 10px; }
.tower .lap .label { grid-column: 1 / -1; }
.tower .lap b { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .02em; line-height: 1; }
.tower .lap .clock { font-family: var(--mono); font-size: 14px; font-weight: 500; }
.tower .rows { display: grid; gap: 2px; }
.row { display: grid; grid-template-columns: 24px 5px 1fr auto; align-items: center; gap: 7px; padding: 3px 9px 3px 7px; font-family: var(--display); font-weight: 700; font-size: 16px; text-transform: uppercase; letter-spacing: .04em; transition: background-color 160ms ease, transform 220ms var(--out); }
.row .pos { font-size: 16px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.row .tag { width: 5px; height: 16px; border-radius: 1px; background: var(--c, var(--ink)); }
.row .gap { font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: none; }
.row.you { background: var(--sulphur); font-size: 17px; }
.row.ot { box-shadow: inset -4px 0 0 var(--sulphur); }
.row.fin .gap { color: var(--ink-3); }
.row.gain { animation: gain 500ms ease; } .row.lose { animation: lose 500ms ease; }
@keyframes gain { 0% { background-color: var(--good); } 100% { background-color: var(--chalk); } }
@keyframes lose { 0% { background-color: var(--bad); } 100% { background-color: var(--chalk); } }
.row.you.gain, .row.you.lose { animation: none; }

/* minimap (top right) */
.map { position: absolute; top: 14px; right: 14px; width: 190px; padding: 10px; }
.map svg { width: 100%; height: auto; display: block; }
.map .trace { fill: none; stroke: var(--ink); stroke-width: 22; stroke-linejoin: round; }
.map .zone { fill: none; stroke: var(--cobalt); stroke-width: 22; stroke-linejoin: round; }
.map .det { stroke: var(--sulphur); stroke-width: 10; }
.map .car { stroke: var(--chalk); stroke-width: 6; }

/* coach strip (top centre) */
.coach { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); max-width: min(560px, calc(100% - 540px)); padding: 8px 14px; display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 15px; transition: opacity 200ms ease; }
.coach i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--cobalt); }
.coach.hidden { opacity: 0; }

/* state chips (left, under the tower) */
.chips { position: absolute; left: 14px; top: 392px; display: grid; gap: 6px; width: 236px; }
.chip { position: relative; overflow: hidden; padding: 8px 10px 9px; }
.chip .label { color: var(--ink-3); }
.chip b { display: block; font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1; letter-spacing: .02em; margin-top: 3px; text-transform: uppercase; }
.chip small { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); margin-top: 3px; }
.chip.aero.open b { color: var(--cobalt); }
.chip.ot.armed { background: var(--sulphur); }
.chip.ot.active { background: var(--sulphur); }
/* signature: three-stripe wipe on state change */
.chip::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-110%);
  background: repeating-linear-gradient(100deg, var(--wipe, var(--cobalt)) 0 14px, transparent 14px 22px);
}
.chip.wipe::after { animation: wipe 420ms var(--out); }
@keyframes wipe { 0% { transform: translateX(-110%); } 100% { transform: translateX(110%); } }

/* dash (bottom centre): gauge + pedal cluster */
.dash { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: grid; grid-template-columns: minmax(300px, 380px) 236px; gap: 8px; align-items: stretch; }
.pedals { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 6px; }
.pedal {
  position: relative; border: 0; border-radius: 3px; cursor: pointer; padding: 9px 10px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .04em; text-transform: uppercase; line-height: 1; text-align: left;
  transition: transform 120ms var(--snap), filter 120ms ease; touch-action: none; min-height: 60px; user-select: none; -webkit-user-select: none;
}
.pedal.throttle { grid-row: 1 / 3; background: var(--cobalt); color: var(--chalk); font-size: 26px; }
.pedal small { font-family: var(--mono); font-weight: 500; font-size: 10.5px; letter-spacing: 0; text-transform: none; opacity: .85; }
.pedal kbd { font-family: var(--mono); font-size: 10.5px; font-weight: 500; padding: 1px 5px; border-radius: 3px; background: rgba(0,0,0,.22); }
.pedal.boost { background: var(--orange); color: #1b0d03; }
.pedal.brake { background: var(--bad); color: #fff3f0; }
.pedal[aria-pressed="true"] { transform: scale(0.96); filter: brightness(1.12); box-shadow: inset 0 0 0 3px rgba(0,0,0,.35); }
.pedal:disabled { opacity: .45; cursor: default; }
.gauge { padding: 10px 14px 10px; display: grid; gap: 7px; }
.speed { display: flex; align-items: baseline; justify-content: space-between; }
.speed b { font-family: var(--display); font-weight: 800; font-size: 60px; line-height: .9; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.speed span { font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: .14em; color: var(--ink-3); }
.flow { font-family: var(--mono); font-size: 12.5px; text-align: right; }
.flow b { display: block; font-size: 18px; font-weight: 500; }
.flow.dep b { color: #b36a00; } .flow.har b { color: #0c7f93; }
.batt { display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; height: 12px; }
.batt i { background: rgba(29,32,36,.12); border-radius: 1px; transition: background-color 120ms ease; }
.batt i.on { background: var(--ink); }
.batt.low i.on { background: var(--bad); }
.battrow { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.budget { height: 4px; background: rgba(29,32,36,.12); border-radius: 2px; overflow: hidden; }
.budget b { display: block; height: 100%; background: var(--harvest); transform-origin: left; transform: scaleX(0); }
.neighbours { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-2); border-top: 2px solid rgba(29,32,36,.1); padding-top: 6px; }
.neighbours i { font-style: normal; font-size: 10px; margin-right: 4px; color: var(--ink-3); }
.neighbours .who { font-family: var(--display); font-weight: 800; font-size: 14px; letter-spacing: .04em; margin-right: 6px; color: var(--ink); }
.neighbours .behind { text-align: right; }
.neighbours .sector { display: flex; gap: 6px; align-items: baseline; }
.neighbours .sector .label { font-size: 10.5px; }
.neighbours .st { font-size: 13px; font-weight: 500; }
.neighbours .st.purple { color: #8a3ffc; } .neighbours .st.green { color: var(--good); }

/* touch steering: drag anywhere on the left half of the view */
.steerpad { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; display: none; z-index: 2; touch-action: none; }
.steerpad .steer-ind { position: absolute; left: 14px; right: 14px; bottom: 150px; height: 6px; border-radius: 3px; background: rgba(240,235,221,.35); }
.steerpad .steer-ind i { position: absolute; top: -6px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--sulphur); box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.steerpad span { position: absolute; left: 14px; bottom: 128px; font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--chalk); text-shadow: 0 1px 0 rgba(0,0,0,.4); opacity: .8; }
body.touch .game.racing .steerpad { display: block; }
body.touch .pedal kbd { display: none; }

/* camera switcher (bottom right) */
.cams { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 3px; padding: 3px; }
.cams button { border: 0; background: transparent; padding: 7px 10px; border-radius: 2px; cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--chalk); transition: background-color 120ms ease, transform 120ms var(--snap); }
.cams button[aria-pressed="true"] { background: var(--chalk); color: var(--ink); }
.cams button:active { transform: scale(0.95); }

/* full-bleed signal wash on big moments */
.wash { position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: multiply; }
.wash.go { animation: wash 260ms ease-out; }
@keyframes wash { 0% { opacity: .38; } 100% { opacity: 0; } }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: linear-gradient(180deg, rgba(29,32,36,.15), rgba(29,32,36,.65)); transition: opacity 260ms ease, visibility 0s; z-index: 4; }
.screen[hidden] { display: grid; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 200ms ease, visibility 0s 200ms; }
.sheet { width: min(760px, 100%); max-height: calc(100% - 20px); overflow-y: auto; }
.sheet .head { background: var(--ink); color: var(--chalk); padding: 18px 22px 16px; position: relative; overflow: hidden; }
.sheet .head::before { content: ""; position: absolute; right: -40px; top: 0; bottom: 0; width: 220px; background: repeating-linear-gradient(100deg, var(--orange) 0 18px, transparent 18px 30px); opacity: .9; }
.kicker { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--sulphur); }
.title { font-family: var(--display); font-weight: 800; font-size: clamp(44px, 8vw, 86px); line-height: .88; letter-spacing: -.01em; text-transform: uppercase; margin: 6px 0 0; position: relative; }
.sheet .body { background: var(--chalk); color: var(--ink); padding: 18px 22px 20px; display: grid; gap: 16px; }
.lede { font-size: 17px; line-height: 1.45; margin: 0; color: var(--ink-2); }
.lede b { color: var(--ink); }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.trio > div { background: var(--chalk-2); border-radius: 3px; padding: 10px 12px 12px; border-top: 5px solid var(--c, var(--cobalt)); }
.trio b { display: block; font-family: var(--display); font-weight: 800; font-size: 20px; text-transform: uppercase; letter-spacing: .02em; }
.trio p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cta {
  border: 0; border-radius: 3px; background: var(--ink); color: var(--chalk); padding: 14px 22px; cursor: pointer;
  font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .06em; text-transform: uppercase; transition: transform 120ms var(--snap), background-color 120ms ease;
}
.cta.alt { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.cta:active { transform: scale(0.96); }
.cta.go { background: var(--orange); color: #1b0d03; }
.keys { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
.keys kbd { font-family: var(--mono); background: var(--ink); color: var(--chalk); border-radius: 3px; padding: 1px 6px; }
.result { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.result b { font-family: var(--display); font-weight: 800; font-size: 42px; text-transform: uppercase; line-height: 1; }
.result span { font-family: var(--mono); font-size: 14px; color: var(--ink-2); }
.lessons { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lessons li { background: var(--chalk-2); border-left: 6px solid var(--c, var(--ink-3)); border-radius: 3px; padding: 9px 12px; }
.lessons b { display: block; font-family: var(--display); font-weight: 800; font-size: 19px; text-transform: uppercase; letter-spacing: .02em; }
.lessons p { margin: 3px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.results-wrap { overflow-x: auto; }
.results { width: 100%; border-collapse: collapse; font-size: 14px; }
.results th { text-align: left; font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding: 4px 8px; border-bottom: 2px solid var(--ink); }
.results td { padding: 5px 8px; border-bottom: 1px solid rgba(29,32,36,.12); white-space: nowrap; }
.results .num, .results td.num { text-align: right; font-family: var(--mono); font-size: 13px; }
.results td.p { font-family: var(--display); font-weight: 800; font-size: 17px; width: 36px; }
.results td.d { font-weight: 600; }
.results td.d i { display: inline-block; width: 4px; height: 14px; margin-right: 8px; vertical-align: -2px; background: var(--c, var(--ink)); border-radius: 1px; }
.results tr.you td { background: var(--sulphur); }
.results td.t { color: var(--ink-2); }
.assists { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.assists .label { color: var(--ink-3); }
.toggle { border: 0; border-radius: 3px; padding: 8px 12px; cursor: pointer; background: var(--chalk-2); color: var(--ink-2); font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; box-shadow: inset 0 0 0 2px transparent; transition: transform 120ms var(--snap), background-color 120ms ease; }
.toggle::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: var(--ink-3); vertical-align: 1px; }
.toggle[aria-pressed="true"] { background: var(--ink); color: var(--chalk); }
.toggle[aria-pressed="true"]::before { background: var(--good); }
.toggle:active { transform: scale(0.96); }
.assist-note { flex-basis: 100%; }
.trace-wrap { background: var(--ink); border-radius: 3px; padding: 10px 12px 8px; }
.trace-wrap canvas { width: 100%; height: 150px; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-family: var(--mono); font-size: 11.5px; color: var(--chalk); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: 6px; }
/* start lights: five reds, then out */
.lights { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); display: grid; justify-items: center; gap: 12px; pointer-events: none; z-index: 3; opacity: 0; transition: opacity 240ms ease; }
.lights.show { opacity: 1; }
.lamps { display: flex; gap: 10px; padding: 12px 14px; background: var(--ink); border-radius: 4px; box-shadow: 0 3px 0 rgba(0,0,0,.35); }
.lamps i { width: 44px; height: 44px; border-radius: 50%; background: #3a1414; box-shadow: inset 0 0 0 3px rgba(0,0,0,.4); transition: background-color 80ms ease, box-shadow 80ms ease; }
.lamps i.on { background: #ff2a1f; box-shadow: 0 0 22px #ff3b2f, inset 0 0 0 3px rgba(0,0,0,.2); }
.lights .msg { font-family: var(--display); font-weight: 800; font-size: 64px; line-height: 1; letter-spacing: .02em; text-transform: uppercase; color: var(--chalk); text-shadow: 0 4px 0 rgba(0,0,0,.35); min-height: 64px; }
.lights.out .lamps i { background: #2a2a2a; }

.loading { position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; gap: 10px; background: var(--ink); color: var(--chalk); text-align: center; transition: opacity 300ms ease, visibility 0s 300ms; }
.loading b { font-family: var(--display); font-weight: 800; font-size: 32px; letter-spacing: .06em; text-transform: uppercase; }
.loading .bar { width: 220px; height: 4px; background: rgba(240,235,221,.15); }
.loading .bar i { display: block; height: 100%; width: 40%; background: var(--orange); animation: load 1s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
.game.ready .loading { opacity: 0; visibility: hidden; }
.loading .err { display: none; max-width: 380px; color: var(--chalk-2); }
.game.failed .loading .err { display: block; }
.game.failed .loading .bar { display: none; }

@media (max-width: 900px) {
  .coach { top: auto; bottom: 150px; left: 10px; right: auto; transform: none; max-width: calc(50% - 14px); font-size: 12.5px; padding: 6px 10px; }
  .map { width: 104px; padding: 5px; top: 212px; }
  .chips { top: auto; bottom: 196px; left: 10px; right: auto; width: 46vw; gap: 4px; }
  .chips .chip:nth-child(n+2) { display: none; }
  .chip { padding: 5px 8px 6px; } .chip b { font-size: 16px; } .chip small { display: none; }
  .tower { top: 10px; left: 10px; width: 164px; gap: 2px; }
  .tower .lap { padding: 4px 8px; } .tower .lap b { font-size: 16px; } .tower .lap .clock { font-size: 12px; }
  .tower .lap .label { display: none; }
  .row { font-size: 13px; padding: 2px 6px 2px 5px; grid-template-columns: 18px 4px 1fr auto; gap: 5px; }
  .row .pos { font-size: 13px; } .row .tag { height: 12px; } .row .gap { font-size: 10.5px; }
  .row.you { font-size: 14px; }
  .tower .row:not(.near) { display: none; }
  .dash { left: auto; right: 10px; bottom: 10px; transform: none; grid-template-columns: 1fr; width: min(46vw, 230px); gap: 6px; }
  .gauge { padding: 6px 10px 6px; gap: 4px; }
  .speed b { font-size: 34px; } .flow { font-size: 10px; } .flow b { font-size: 13px; }
  .batt { height: 8px; } .battrow, .budget { display: none; }
  .neighbours { font-size: 10.5px; padding-top: 4px; gap: 4px; grid-template-columns: 1fr 1fr; white-space: nowrap; } .neighbours .who { font-size: 12px; margin-right: 3px; } .neighbours .sector { display: none; }
  .pedals { grid-template-columns: 1fr 1fr; grid-template-rows: 64px 64px; }
  .pedal { font-size: 16px; padding: 7px 8px; min-height: 0; } .pedal.throttle { font-size: 18px; }
  .pedal small { display: none; }
  .cams { right: 10px; bottom: auto; top: 10px; flex-direction: column; }
  .cams button { padding: 5px 7px; font-size: 11px; }
  .lights { top: 14%; } .lamps i { width: 30px; height: 30px; } .lights .msg { font-size: 44px; min-height: 44px; }
  .trio { grid-template-columns: 1fr; }
  .steerpad .steer-ind { bottom: 118px; } .steerpad span { bottom: 98px; }
  .results th:nth-child(3), .results td:nth-child(3), .results th:nth-child(5), .results td:nth-child(5) { display: none; }
}
@media (max-width: 900px) and (max-height: 500px) {
  /* phone held sideways: keep the view clear */
  .chips, .coach { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .chip.wipe::after, .wash.go, .row.gain, .row.lose { animation: none; }
  .pedal, .cta { transition: none; }
}

/* ---------- learn sections ---------- */
.learn { background: var(--chalk); color: var(--ink); }
.learn .wrap { max-width: 1160px; margin: 0 auto; padding: 72px 20px; }
.learn h2 { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 8cqi, 60px); line-height: .92; text-transform: uppercase; margin: 6px 0 12px; letter-spacing: -.005em; }
.learn .sub { font-size: 18px; line-height: 1.5; color: var(--ink-2); max-width: 720px; margin: 0; }
.learn section + section { border-top: 6px solid var(--ink); }
.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; margin-top: 28px; align-items: start; }
.tunnel { position: relative; background: var(--ink); border-radius: 3px; overflow: hidden; aspect-ratio: 16 / 10; }
.tunnel canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tunnel .tbar { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--chalk); border-radius: 3px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--ink); padding: 7px 12px; border-radius: 2px; cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; transition: transform 120ms var(--snap); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--chalk); }
.seg button:active { transform: scale(0.95); }
.slider { flex: 1; min-width: 160px; display: flex; align-items: center; gap: 8px; background: var(--chalk); border-radius: 3px; padding: 6px 10px; font-family: var(--mono); font-size: 12.5px; }
.slider input { flex: 1; accent-color: var(--orange); }
.numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.num { background: var(--chalk-2); border-radius: 3px; padding: 10px 12px; border-top: 5px solid var(--c, var(--ink)); }
.num .label { color: var(--ink-3); }
.num b { display: block; font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.num small { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.copy p { font-size: 16px; line-height: 1.55; color: var(--ink-2); margin: 0 0 12px; }
.copy b { color: var(--ink); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 28px; }
.card { background: var(--chalk-2); border-radius: 3px; padding: 14px 16px 16px; border-top: 6px solid var(--c, var(--ink)); }
.card b { display: block; font-family: var(--display); font-weight: 800; font-size: 24px; text-transform: uppercase; letter-spacing: .01em; }
.card .big { font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1; margin: 6px 0 4px; }
.card p { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); margin: 6px 0 0; }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 28px; }
.vs > div { border-radius: 3px; padding: 16px; }
.vs .old { background: var(--chalk-2); }
.vs .new { background: var(--ink); color: var(--chalk); }
.vs h3 { font-family: var(--display); font-weight: 800; font-size: 26px; text-transform: uppercase; margin: 0 0 8px; }
.vs ul { margin: 0; padding-left: 18px; line-height: 1.6; font-size: 15px; }
.sources { margin-top: 24px; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.sources a { color: var(--ink); }
.foot { background: var(--ink); color: var(--chalk-2); padding: 28px 20px; font-size: 13.5px; }
.foot .wrap { max-width: 1160px; margin: 0 auto; }
@container guide (max-width: 760px) { .split, .vs { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .learn .wrap { padding: 52px 16px; } }

/* ---------- garage / teardown ---------- */
.garage > * { min-width: 0; }
.garage { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; margin-top: 28px; align-items: stretch; }
.bay { position: relative; min-width: 0; width: 100%; background: radial-gradient(120% 90% at 50% 30%, #3a3f46, #1d2024 70%); border-radius: 3px; overflow: hidden; aspect-ratio: 16 / 10; }
.bay canvas, .bay .leaders { position: absolute; inset: 0; width: 100%; height: 100%; }
.bay .leaders { pointer-events: none; }
.bay .leaders line { stroke: rgba(240,235,221,.7); stroke-width: 1; }
.bay .leaders circle { fill: var(--sulphur); }
.bay .tags { position: absolute; inset: 0; pointer-events: none; }
.tag-btn {
  position: absolute; left: 0; top: 0; pointer-events: auto; border: 0; cursor: pointer; white-space: nowrap; transform-origin: left center;
  background: var(--chalk); color: var(--ink); border-radius: 2px; padding: 3px 7px; font-family: var(--display); font-weight: 700; font-size: 13px;
  letter-spacing: .05em; text-transform: uppercase; box-shadow: 0 2px 0 rgba(0,0,0,.35); transition: opacity 160ms ease, background-color 120ms ease;
}
.tag-btn.int { background: var(--sulphur); }
.tag-btn[aria-pressed="true"] { background: var(--orange); color: #1b0d03; }
.tag-btn:active { transform: scale(0.95); }
.bay .tbar { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cta.small { padding: 9px 14px; font-size: 16px; }
.part { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.part .label { color: var(--ink-3); }
.part h3 { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; text-transform: uppercase; margin: 0; }
.part p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.part dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 0; }
.part dl div { background: var(--chalk-2); border-radius: 2px; padding: 7px 9px; }
.part dt { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.part dd { margin: 2px 0 0; font-family: var(--display); font-weight: 800; font-size: 20px; }
.part-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 10px; border-top: 2px solid var(--chalk-2); }
.part-list button { border: 0; background: var(--chalk-2); color: var(--ink); border-radius: 2px; padding: 4px 8px; cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; transition: transform 120ms var(--snap); }
.part-list button[aria-pressed="true"] { background: var(--ink); color: var(--chalk); }
.part-list button:active { transform: scale(0.95); }
@container guide (max-width: 760px) { .garage { grid-template-columns: 1fr; } .bay { aspect-ratio: 4 / 3.4; } }
.foot a { color: var(--chalk); text-underline-offset: 2px; }
#view { cursor: grab; } #view.grabbing { cursor: grabbing; }
.loading .why { font-size: 11px; opacity: .6; margin-top: 8px; }

/* ---------- shell: race + guide side by side ---------- */
:root { --ease-out: cubic-bezier(0.23, 1, 0.32, 1); --guide-w: clamp(400px, 36vw, 560px); }
.learn { container: guide / inline-size; }
.guide-head { position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; align-items: center;
  padding: 14px 20px 12px; background: var(--ink); color: var(--chalk); }
.guide-title { display: grid; gap: 2px; }
.guide-title .kicker { font-size: 11.5px; }
.guide-title b { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1; text-transform: uppercase; letter-spacing: .01em; }
.guide-nav { grid-column: 1 / -1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 0 2px; }
.guide-nav::-webkit-scrollbar { display: none; }
.guide-nav a { flex: none; padding: 6px 10px; border-radius: 2px; background: rgba(240,235,221,.1); color: var(--chalk-2); text-decoration: none;
  font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; transition: background-color 150ms ease, color 150ms ease; }
.guide-nav a[aria-current="true"] { background: var(--chalk); color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .guide-nav a:hover { background: rgba(240,235,221,.2); } }
.guide-close, .guide-open { border: 0; cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; transition: transform 160ms var(--ease-out); }
.guide-close { background: rgba(240,235,221,.1); color: var(--chalk); padding: 7px 12px; border-radius: 2px; }
.guide-close:active, .guide-open:active { transform: scale(0.96); }
.guide-open { position: absolute; right: 14px; bottom: 62px; padding: 9px 14px; display: none; z-index: 1; }
.learn section { scroll-margin-top: 96px; }

@media (min-width: 1100px) {
  /* the race and the guide share the screen; each scrolls on its own */
  .shell { display: grid; grid-template-columns: minmax(0, 1fr) var(--guide-w); height: 100vh; height: 100svh; overflow: hidden; transition: grid-template-columns 340ms var(--ease-out); }
  .shell.guide-closed { --guide-w: 0px; }
  .shell .game { height: 100%; min-height: 0; }
  .learn { height: 100%; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; box-shadow: inset 6px 0 0 var(--ink); }
  .learn .wrap { padding: 40px 28px 56px; }
  .shell.guide-closed .learn { visibility: hidden; transition: visibility 0s 340ms; }
  .shell.guide-closed .guide-open { display: block; }
}
@media (max-width: 1099.98px) {
  /* stacked: keep the guide's header peeking under the race so it's clear there's more below */
  .game { height: calc(100svh - 92px); min-height: 480px; }
  .guide-close { display: none; }
  .guide-title .kicker::after { content: " ↓"; }
}
@media (prefers-reduced-motion: reduce) { .shell { transition: none; } .learn { scroll-behavior: auto; } }
.tag-btn.pin { min-width: 20px; padding: 2px 5px; text-align: center; font-size: 12px; }
.part-list .n { display: inline-block; min-width: 1.4em; margin-right: 5px; opacity: .55; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  /* the explainer kicker is longer than the old one: keep it clear of the stripe motif */
  .sheet .head::before { width: 96px; opacity: .7; }
  .sheet .head .kicker { max-width: calc(100% - 90px); }
}

/* pause */
.pause-sheet { max-width: 520px; }
.pause-sheet .actions { flex-wrap: wrap; }
.pause-sheet .assists { margin-top: 14px; }
.game.paused .count, .game.paused .coach { visibility: hidden; }

/* ---------- phones and tablets: thumb controls, a clear view ----------
   left thumb steers (drag anywhere on the left half), right thumb works the pedals.
   Only what you need at speed stays on screen; Smoke and Sound live in the pause menu. */
.touch-only { display: none; }
body.touch .touch-only { display: block; }
body.touch .cams [data-cam], body.touch .cams [data-flow], body.touch .cams [data-sound] { display: none; }
body.touch .cams { top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); bottom: auto; flex-direction: row; gap: 0; }
body.touch .cams button { padding: 9px 11px; font-size: 12px; min-height: 36px; }
body.touch .chips { display: none; }
body.touch .pedal kbd, body.touch .pedal small { display: none; }
body.touch .tower { top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); width: 152px; gap: 2px; opacity: .94; }
body.touch .tower .lap { padding: 3px 7px; } body.touch .tower .lap b { font-size: 14px; white-space: nowrap; } body.touch .tower .lap .clock { font-size: 11px; }
body.touch .tower .lap .label { display: none; }
body.touch .row { font-size: 12px; padding: 1px 5px 1px 4px; grid-template-columns: 16px 3px 1fr auto; gap: 4px; }
body.touch .row .pos { font-size: 12px; } body.touch .row .tag { height: 10px; } body.touch .row .gap { font-size: 10px; }
body.touch .row.you { font-size: 13px; }
body.touch .tower .row:not(.near) { display: none; }
body.touch .map { top: calc(max(8px, env(safe-area-inset-top)) + 44px); right: max(8px, env(safe-area-inset-right)); width: 78px; padding: 4px; opacity: .9; }
body.touch .coach { top: auto; left: 50%; right: auto; transform: translateX(-50%); bottom: 196px; max-width: min(92%, 420px); font-size: 12.5px; padding: 6px 10px; }
/* the dash splits: a small speed/battery readout bottom-left (above the steering bar), pedals bottom-right */
body.touch .dash { display: contents; }
body.touch .gauge { position: absolute; left: max(8px, env(safe-area-inset-left)); bottom: calc(max(10px, env(safe-area-inset-bottom)) + 58px); width: 132px; padding: 5px 8px 6px; gap: 4px; pointer-events: none; opacity: .94; }
body.touch .speed b { font-size: 28px; } body.touch .flow { font-size: 9.5px; } body.touch .flow b { font-size: 12px; } body.touch .flow .label { display: none; }
body.touch .batt { height: 6px; } body.touch .battrow, body.touch .budget, body.touch .neighbours { display: none; }
body.touch .pedals { position: absolute; right: max(8px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); width: min(46vw, 210px); height: 150px;
  grid-template-columns: 1fr 1.15fr; grid-template-rows: 1fr 1fr; gap: 6px; }
body.touch .pedal { min-height: 0; padding: 8px; font-size: 15px; opacity: .82; box-shadow: 0 2px 0 rgba(0,0,0,.3); }
body.touch .pedal.throttle { grid-column: 2; grid-row: 1 / 3; font-size: 16px; }
body.touch .pedal.brake { grid-column: 1; grid-row: 2; }
body.touch .pedal.boost { grid-column: 1; grid-row: 1; }
body.touch .pedal[aria-pressed="true"] { opacity: 1; }
body.touch .steerpad .steer-ind { left: max(14px, env(safe-area-inset-left)); right: 14px; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 26px); }
body.touch .steerpad span { left: max(14px, env(safe-area-inset-left)); bottom: calc(max(10px, env(safe-area-inset-bottom)) + 4px); font-size: 11px; }
body.touch .lights { top: 16%; } body.touch .lamps i { width: 28px; height: 28px; } body.touch .lights .msg { font-size: 40px; min-height: 40px; }
/* while racing, the race fills the screen; the guide is one scroll (or the pause menu) away */
body.touch .shell:has(.game.racing) .game { height: 100svh; min-height: 0; }
@media (orientation: landscape) and (max-height: 520px) { body.touch .game { min-height: 0; height: 100svh; } }
@media (orientation: landscape) and (max-height: 520px) {
  body.touch .coach { bottom: auto; top: max(8px, env(safe-area-inset-top)); max-width: 40%; }
  body.touch .pedals { width: 200px; height: 118px; }
  body.touch .gauge { left: 50%; transform: translateX(-50%); bottom: max(8px, env(safe-area-inset-bottom)); width: 150px; }
  body.touch .steerpad { width: 45%; }
  body.touch .map { width: 64px; }
  body.touch .lights { top: 8%; }
}

/* ---------- controls tour: a ring on the real control + a small card beside it ---------- */
.tour { position: absolute; inset: 0; z-index: 5; background: rgba(16,18,21,.28); }
.tour[hidden] { display: none; }
.tour-ring { position: absolute; border-radius: 6px; pointer-events: none; box-shadow: 0 0 0 3px var(--sulphur), 0 0 0 9999px rgba(16,18,21,.38);
  transition: left 220ms var(--out, ease-out), top 220ms var(--out, ease-out), width 220ms var(--out, ease-out), height 220ms var(--out, ease-out), opacity 160ms ease; }
.tour-card { position: absolute; width: min(320px, calc(100% - 20px)); padding: 12px 14px 12px; display: grid; gap: 6px;
  transition: left 220ms var(--out, ease-out), top 220ms var(--out, ease-out); }
.tour-step { color: var(--ink-3); }
.tour-title { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1; letter-spacing: .02em; text-transform: uppercase; }
.tour-text { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.tour-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px; align-items: center; margin-top: 4px; }
.tour-actions .cta { padding: 9px 16px; font-size: 16px; }
.tour-skip, .tour-back { border: 0; background: transparent; color: var(--ink-2); font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; padding: 9px 6px; cursor: pointer; }
.tour-back[hidden], .tour-skip[hidden] { display: none; }
.tour-skip:active, .tour-back:active { transform: scale(0.96); }
.game.touring .lights { opacity: 0; }
.game.touring .coach { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .tour-ring, .tour-card { transition: none; } }

/* race options + share card */
.toggle:disabled { opacity: .45; cursor: default; }
.share-card { margin: 0; display: grid; gap: 6px; }
.share-card img { width: min(100%, 520px); aspect-ratio: 1200 / 630; border-radius: 3px; box-shadow: 0 2px 0 rgba(0,0,0,.25); background: var(--ink); }
.share-card img:not([src]) { visibility: hidden; }

/* race control: yellow flags and the Virtual Safety Car */
.flag { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: baseline; padding: 7px 14px; background: #ffd21f; color: #1b1500; pointer-events: none; white-space: nowrap; }
.flag[hidden] { display: none; }
.flag b { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .08em; text-transform: uppercase; }
.flag span { font-family: var(--mono); font-size: 12.5px; }
.flag.vsc { background: var(--ink); color: #ffd21f; box-shadow: inset 0 0 0 3px #ffd21f, 0 2px 0 rgba(0,0,0,.25); }
.row.out { opacity: .55; } .row.out .gap { color: var(--bad); }
body.touch .flag { top: auto; bottom: 236px; padding: 5px 10px; } body.touch .flag b { font-size: 16px; } body.touch .flag span { font-size: 11px; }
@media (orientation: landscape) and (max-height: 520px) { body.touch .flag { bottom: auto; top: max(8px, env(safe-area-inset-top)); } }

/* time trial: live gap to your best lap */
.delta { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); padding: 6px 12px; font-size: 18px; font-weight: 500; pointer-events: none; background: var(--bad); color: #fff3f0; }
.delta.up { background: var(--good); color: #06210f; }
.delta[hidden] { display: none; }
body.touch .delta { top: auto; bottom: 236px; font-size: 15px; padding: 4px 9px; }
.game:has(.delta:not([hidden])) .coach { top: 58px; }

/* =====================================================================
   Eko Night: the game side is dark. Inside the HUD, the screens and the
   tour the light-paper names flip, so older rules read correctly on night.
   ===================================================================== */
.hud, .screen, .tour {
  --chalk: var(--night-1); --chalk-2: var(--night-2);
  --ink: var(--paper); --ink-2: var(--paper-2); --ink-3: var(--paper-3);
}
.hud .plate, .tour .plate { background: rgb(16 19 26 / .88); color: var(--paper); box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(0,0,0,.28); border-radius: 4px; }
.hud .plate.ink { background: rgb(9 11 16 / .92); }
.row.you { color: var(--danfo-ink); }
.row.you .gap { color: rgba(23,16,0,.75); }
@keyframes gain { 0% { background-color: var(--good); } 100% { background-color: transparent; } }
@keyframes lose { 0% { background-color: var(--bad); } 100% { background-color: transparent; } }
.chip.ot.armed, .chip.ot.active { color: var(--danfo-ink); }
.chip.ot.armed .label, .chip.ot.armed small, .chip.ot.active .label, .chip.ot.active small { color: rgba(23,16,0,.72); }
.batt i { background: rgba(244,241,234,.1); }
.budget { background: rgba(244,241,234,.1); }
.neighbours { border-top-color: var(--line); }
.flow.dep b { color: var(--deploy); } .flow.har b { color: var(--harvest); }
.hud .cams button { color: var(--paper-2); }
.hud .cams button[aria-pressed="true"] { background: var(--danfo); color: var(--danfo-ink); }
.pedal.throttle { color: var(--paper); }
.pedal.boost { color: #1d0800; }
.flag.vsc { background: var(--night); }
.loading .bar i { background: var(--danfo); }
.cta.go { background: var(--danfo); color: var(--danfo-ink); }
.toggle[aria-pressed="true"] { background: var(--danfo); color: var(--danfo-ink); }
.toggle[aria-pressed="true"]::before { background: var(--danfo-ink); }
.screen { background: linear-gradient(180deg, rgb(9 11 16 / .2), rgb(9 11 16 / .72)); }
.screen .sheet { border-radius: 6px; overflow: hidden auto; box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(0,0,0,.45); }
.screen .sheet .head { background: var(--night); color: var(--paper); }
.screen .sheet .head::before { background: repeating-linear-gradient(0deg, var(--danfo) 0 16px, transparent 16px 24px); transform: skewX(-14deg); right: -60px; width: 200px; opacity: .95; }
.results tr.you td { color: var(--danfo-ink); }
.screen .trace-wrap { background: var(--night); box-shadow: 0 0 0 1px var(--line); }
.learn .kicker { color: var(--ink-3); }
.guide-head .kicker { color: var(--danfo); }
.tag-btn.int { color: var(--danfo-ink); }

/* ---------- brand mark ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; }
.brand-mark { width: 38px; height: 38px; flex: none; display: block; }
.brand-word { display: grid; line-height: 1; }
.brand-word b { font-family: var(--display); font-weight: 800; font-size: 25px; letter-spacing: .03em; text-transform: uppercase; transform: skewX(-8deg); transform-origin: left bottom; }
.brand-word b i { font-style: normal; color: var(--danfo); margin-left: .18em; }
.brand-word small { font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--paper-3); margin-top: 3px; }

/* ---------- menu hub (the start screen) ---------- */
.screen.hub { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; place-items: stretch; padding: 22px 28px 18px; gap: 18px;
  background:
    linear-gradient(90deg, rgb(9 11 16 / .94) 0%, rgb(9 11 16 / .78) 34%, rgb(9 11 16 / .12) 66%, rgb(9 11 16 / .3) 100%),
    linear-gradient(0deg, rgb(9 11 16 / .8), transparent 34%); }
.screen.hub[hidden] { display: grid; }
.hub-top { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.hub-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 6px; background: rgb(16 19 26 / .7); box-shadow: 0 0 0 1px var(--line); }
.hub-tabs [role="tab"] { border: 0; background: transparent; color: var(--paper-2); padding: 9px 16px; border-radius: 4px; cursor: pointer;
  font-family: var(--display); font-weight: 700; font-size: 16px; letter-spacing: .1em; text-transform: uppercase; transition: transform 160ms var(--out), color 150ms ease; }
.hub-tabs [role="tab"][aria-selected="true"] { background: var(--danfo); color: var(--danfo-ink); }
.hub-tabs [role="tab"]:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .hub-tabs [role="tab"]:not([aria-selected="true"]):hover { color: var(--paper); } }
.hub-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; width: min(640px, 100%); display: grid; align-content: start; gap: 18px; padding: 2px 2px 8px; scrollbar-width: thin; }
.hub-panel[hidden] { display: none; }
.hub-intro { display: grid; gap: 8px; }
.hub-intro .kicker { color: var(--danfo); }
.hub-title { font-family: var(--display); font-weight: 800; font-size: clamp(40px, 5.4vw, 72px); line-height: .88; letter-spacing: -.005em; text-transform: uppercase; margin: 0; color: var(--paper); }
.hub-h2 { font-family: var(--display); font-weight: 800; font-size: 40px; line-height: .9; text-transform: uppercase; margin: 2px 0 0; color: var(--paper); }
.hub-lede { margin: 0; font-size: 16px; line-height: 1.5; color: var(--paper-2); max-width: 54ch; }
.hub-lede b { color: var(--paper); font-weight: 600; }
.hub-foot { display: flex; justify-content: space-between; gap: 16px; align-items: end; flex-wrap: wrap; }
.hub-foot .keys { color: var(--paper-3); }
.hub-foot .keys kbd { background: var(--night-3); color: var(--paper); }
.hub-legal { font-size: 11.5px; color: var(--paper-3); max-width: 46ch; text-align: right; margin: 0; }

/* tiles: pick a race; each one plays */
.tiles { display: grid; grid-template-columns: 1.25fr 1fr; grid-template-rows: auto auto; gap: 10px; }
.tile { position: relative; overflow: hidden; border: 0; text-align: left; cursor: pointer; color: var(--paper); border-radius: 6px; padding: 16px 16px 14px;
  display: grid; align-content: start; gap: 5px; min-height: 128px;
  background: rgb(16 19 26 / .86); box-shadow: 0 0 0 1px var(--line);
  transition: transform 160ms var(--out), box-shadow 160ms ease, background-color 160ms ease; }
.tile-hero { grid-row: 1 / 3; min-height: 266px; background:
  linear-gradient(160deg, rgb(255 194 14 / .16), transparent 55%), rgb(16 19 26 / .9); }
.tile-hero::after { content: ""; position: absolute; right: -30px; bottom: 34px; width: 210px; height: 58px; transform: skewX(-14deg); pointer-events: none;
  background: repeating-linear-gradient(0deg, var(--danfo) 0 13px, transparent 13px 22px); opacity: .9; }
.tile-k { font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--danfo); }
.tile b { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: .95; text-transform: uppercase; letter-spacing: .01em; }
.tile-hero b { font-size: 46px; }
.tile-d { font-size: 13.5px; line-height: 1.4; color: var(--paper-2); max-width: 30ch; }
.tile-d strong { color: var(--paper); font-weight: 600; }
.tile-go { position: absolute; left: 16px; bottom: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 11px; border-radius: 3px;
  background: var(--night-3); color: var(--paper); font-family: var(--display); font-weight: 800; font-size: 14px; letter-spacing: .14em; text-transform: uppercase;
  transition: background-color 150ms ease, color 150ms ease; }
.tile-go::after { content: ""; width: 0; height: 0; border-left: 7px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.tile-hero .tile-go, .tile:focus-visible .tile-go { background: var(--danfo); color: var(--danfo-ink); }
.tile:not(.tile-hero) { padding-bottom: 48px; }
.tile-hero { padding-bottom: 56px; }
.tile:active { transform: scale(0.98); }
.tile:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--danfo), 0 10px 30px rgba(0,0,0,.35); }
@media (hover: hover) and (pointer: fine) {
  .tile:hover { box-shadow: 0 0 0 1px rgb(255 194 14 / .55), 0 10px 30px rgba(0,0,0,.35); }
  .tile:hover .tile-go { background: var(--danfo); color: var(--danfo-ink); }
}

/* race setup under the tiles */
.setup { display: grid; gap: 8px; padding: 12px 14px; border-radius: 6px; background: rgb(16 19 26 / .78); box-shadow: 0 0 0 1px var(--line); }
.setup .assists .label { min-width: 62px; }
.setup .toggle, .hub-panel .toggle { background: var(--night-2); color: var(--paper-2); font-size: 14px; padding: 7px 11px; }
.setup .toggle[aria-pressed="true"], .hub-panel .toggle[aria-pressed="true"] { background: var(--danfo); color: var(--danfo-ink); }
.setup .assist-note { color: var(--paper-3); font-size: 12px; }

/* settings + rules cards */
.hub-card { display: grid; gap: 12px; padding: 16px; border-radius: 6px; background: rgb(16 19 26 / .86); box-shadow: 0 0 0 1px var(--line); }
.hub-card .keys { color: var(--paper-3); line-height: 1.9; }
.hub-card .keys kbd { background: var(--night-3); color: var(--paper); }
.hub-card .trio > div { background: var(--night-2); }
.hub-card .trio p { color: var(--paper-2); }
.hub-card .actions .cta { font-size: 17px; padding: 11px 16px; }
.hub-card .cta.alt { color: var(--paper); box-shadow: inset 0 0 0 2px var(--night-3); background: transparent; }

/* ---------- garage: paint your car ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { border: 0; cursor: pointer; padding: 0; width: 64px; border-radius: 5px; overflow: hidden; background: var(--night-2); box-shadow: 0 0 0 1px var(--line);
  display: grid; transition: transform 160ms var(--out), box-shadow 150ms ease; }
.swatch i { display: block; height: 30px; background: linear-gradient(180deg, var(--p) 0 58%, var(--a) 58% 70%, var(--s) 70%); }
.swatch span { font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--paper-2); padding: 4px 0 5px; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--danfo); }
.swatch[aria-checked="true"] span { color: var(--paper); }
.swatch:active { transform: scale(0.96); }
.paints { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.paint { display: grid; gap: 6px; padding: 8px; border-radius: 5px; background: var(--night-2); cursor: pointer; }
.paint input[type="color"] { width: 100%; height: 34px; border: 0; padding: 0; background: none; border-radius: 4px; cursor: pointer; }
.paint input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.paint input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 4px; }
.paint input[type="color"]::-moz-color-swatch { border: 0; border-radius: 4px; }
.idents { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ident { display: grid; gap: 6px; padding: 8px 10px; border-radius: 5px; background: var(--night-2); }
.ident input { width: 100%; border: 0; border-radius: 4px; padding: 6px 8px; background: var(--night); color: var(--paper); box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: .08em; text-transform: uppercase; }
.ident input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--danfo); }
.hub-card .label { color: var(--paper-3); }
.tower-preview { display: grid; gap: 6px; }
.tower-preview .row { background: var(--danfo); border-radius: 3px; width: 236px; }
.tower-preview .row .tag { background: var(--you-paint, var(--danfo-ink)); box-shadow: 0 0 0 1px rgba(23,16,0,.35); }

/* phones and narrow windows: the menu takes the screen; the 3D view still shows through the top */
@media (max-width: 900px) {
  .screen.hub { padding: max(14px, env(safe-area-inset-top)) 14px 12px; gap: 12px;
    background: linear-gradient(180deg, rgb(9 11 16 / .55) 0%, rgb(9 11 16 / .9) 30%, rgb(9 11 16 / .96) 100%); }
  .hub-top { gap: 12px; }
  .hub-tabs { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .hub-tabs [role="tab"] { flex: 1 0 auto; padding: 9px 12px; font-size: 14px; }
  .hub-panel { width: 100%; }
  .tiles { grid-template-columns: 1fr; }
  .tile-hero { grid-row: auto; min-height: 168px; } .tile-hero b { font-size: 38px; }
  .tile { min-height: 0; }
  .hub-foot .keys { display: none; } .hub-legal { text-align: left; }
  .paints { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
body.touch .hub-foot .keys { display: none; }

/* first view of the menu: tiles settle in, once */
@media (prefers-reduced-motion: no-preference) {
  .hub.intro .tile, .hub.intro .setup { animation: tileIn 260ms var(--out) both; }
  .hub.intro .tile:nth-child(2) { animation-delay: 50ms; } .hub.intro .tile:nth-child(3) { animation-delay: 100ms; } .hub.intro .tile:nth-child(4) { animation-delay: 130ms; } .hub.intro .setup { animation-delay: 150ms; }
}
@keyframes tileIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tile, .swatch, .hub-tabs [role="tab"] { transition: none; } }
/* the menu owns the screen: no race HUD behind it */
.game:has(#start:not([hidden])) .hud { visibility: hidden; }
/* multiplayer: announced, not playable yet */
.tile-soon { grid-column: 1 / -1; min-height: 0; cursor: default; padding-bottom: 14px !important; padding-right: 110px;
  background: repeating-linear-gradient(135deg, rgb(244 241 234 / .03) 0 10px, transparent 10px 20px), rgb(16 19 26 / .7); }
.tile-soon b { font-size: 26px; color: var(--paper-2); }
.tile-soon .tile-k { color: var(--paper-3); }
.tile-soon .tile-go { left: auto; right: 16px; bottom: 50%; transform: translateY(50%); background: transparent; color: var(--danfo); box-shadow: inset 0 0 0 1.5px rgb(255 194 14 / .6); }
.tile-soon .tile-go::after { display: none; }
.tile-soon:active { transform: none; }
@media (hover: hover) and (pointer: fine) { .tile-soon:hover { box-shadow: 0 0 0 1px var(--line); } .tile-soon:hover .tile-go { background: transparent; color: var(--danfo); } }
@media (max-width: 900px) { .tile-soon { padding-right: 16px; padding-bottom: 48px !important; } .tile-soon .tile-go { right: auto; left: 16px; bottom: 14px; transform: none; } }
.hud .row.you { background: var(--danfo); }
.hud .chip.ot.armed, .hud .chip.ot.active { background: var(--danfo); }

/* Race tab fits one screen: one row of tiles across the width, setup in one strip under them */
@media (min-width: 901px) {
  #panel-race { width: min(1180px, 100%); align-content: end; gap: 14px; overflow: visible; }
  #panel-race .hub-title { font-size: clamp(38px, 4.4vw, 60px); }
  #panel-race .hub-lede { font-size: 15px; max-width: 70ch; }
  .tiles { grid-template-columns: 1.35fr 1fr 1fr 1fr; grid-template-rows: none; }
  .tile, .tile-hero { grid-row: auto; min-height: clamp(150px, 24vh, 210px); padding-bottom: 50px; }
  .tile-hero b { font-size: 40px; }
  .tile-hero::after { width: 150px; height: 46px; bottom: 26px; background: repeating-linear-gradient(0deg, var(--danfo) 0 10px, transparent 10px 18px); }
  .tile-soon { grid-column: auto; padding-right: 16px; padding-bottom: 50px !important; }
  .tile-soon .tile-go { right: auto; left: 16px; bottom: 14px; transform: none; }
  .setup { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; padding: 10px 14px; }
  .setup .assists .label { min-width: 0; }
}
@media (min-width: 901px) and (max-height: 720px) {
  #panel-race .hub-lede { display: none; }
  .tile, .tile-hero { min-height: 140px; }
}
/* phones: a compact 2 x 2 of race tiles so the whole Race tab fits one screen */
@media (max-width: 900px) {
  #panel-race { gap: 12px; }
  #panel-race .hub-title { font-size: 34px; }
  #panel-race .hub-lede { display: none; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile, .tile-hero, .tile-soon { grid-column: auto; min-height: 112px; padding: 12px 12px 44px !important; }
  .tile b, .tile-hero b, .tile-soon b { font-size: 24px; }
  .tile-d { display: none; }
  .tile-k { font-size: 10.5px; letter-spacing: .14em; }
  .tile-hero::after { display: none; }
  .tile-go, .tile-soon .tile-go { left: 12px; bottom: 11px; font-size: 12px; padding: 4px 8px 4px 9px; }
  .setup { padding: 10px; gap: 6px; }
  .setup .toggle { font-size: 12.5px; padding: 6px 9px; }
  .setup .toggle::before { width: 8px; height: 8px; margin-right: 6px; }
}

/* =====================================================================
   Desktop race HUD: a round rev gauge bottom right, an icon toolbar top
   right, a round minimap bottom left, thin translucent panels. Phones
   (body.touch) keep the thumb layout above.
   ===================================================================== */
.desk-only { display: none; }
body:not(.touch) .desk-only { display: block; }
body:not(.touch) .dash, body:not(.touch) .cams { display: none; }
body:not(.touch) .hud .plate { background: rgb(10 12 17 / .72); box-shadow: 0 0 0 1px rgb(244 241 234 / .07); backdrop-filter: none; }

/* toolbar */
body:not(.touch) .tools { position: absolute; top: 18px; right: 18px; display: flex; gap: 6px; }
.tool { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 42px; min-width: 42px; padding: 0 11px; border: 0; border-radius: 4px; cursor: pointer;
  background: rgb(10 12 17 / .78); color: var(--paper); box-shadow: 0 0 0 1px rgb(244 241 234 / .08);
  transition: transform 140ms var(--out), background-color 140ms ease, color 140ms ease; }
.tool svg { width: 20px; height: 20px; flex: none; }
.tool-label { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.tool[aria-pressed="true"] { background: var(--danfo); color: var(--danfo-ink); }
.tool[data-sound][aria-pressed="false"] .wave { opacity: .2; }
.tool:active { transform: scale(0.95); }
@media (hover: hover) and (pointer: fine) { .tool:not([aria-pressed="true"]):hover { background: rgb(24 28 37 / .9); } }

/* round minimap, bottom left */
body:not(.touch) .map { top: auto; right: auto; left: 18px; bottom: 18px; width: 200px; height: 200px; padding: 16px; border-radius: 50%;
  background: radial-gradient(circle, rgb(10 12 17 / .55) 0 60%, rgb(10 12 17 / .78) 100%); box-shadow: 0 0 0 1px rgb(244 241 234 / .12), inset 0 0 0 6px rgb(10 12 17 / .35); }
body:not(.touch) .map .trace { stroke: rgb(244 241 234 / .85); stroke-width: 18; }
body:not(.touch) .map .zone { stroke: var(--aero); stroke-width: 18; }

/* the gauge */
body:not(.touch) .speedo { position: absolute; right: 22px; bottom: 16px; width: 250px; height: 250px; pointer-events: none; }
.speedo-dial { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dial-bg { fill: rgb(10 12 17 / .5); stroke: rgb(244 241 234 / .08); stroke-width: 1; }
.dial-track { fill: none; stroke: rgb(244 241 234 / .14); stroke-width: 4; }
.dial-red { fill: none; stroke: var(--bad); stroke-width: 4; opacity: .9; }
.dial-rpm { fill: none; stroke: var(--paper); stroke-width: 4; stroke-linecap: round; }
.dial-rpm.hot { stroke: var(--bad); }
.dial-ticks line { stroke: rgb(244 241 234 / .7); stroke-width: 1.6; }
.dial-ticks line.hot, .dial-ticks text.hot { stroke: var(--bad); fill: var(--bad); }
.dial-ticks text { fill: rgb(244 241 234 / .75); font-family: var(--display); font-weight: 700; font-size: 13px; text-anchor: middle; }
.dial-batt-track { fill: none; stroke: rgb(35 208 228 / .16); stroke-width: 5; stroke-linecap: round; }
.dial-batt { fill: none; stroke: var(--harvest); stroke-width: 5; stroke-linecap: round; }
.dial-batt.low { stroke: var(--bad); }
.dial-needle { stroke: var(--danfo); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 4px rgb(255 194 14 / .6)); }
.dial-hub { fill: var(--night); stroke: rgb(244 241 234 / .55); stroke-width: 2; }
.dial-gear { fill: var(--paper); font-family: var(--display); font-weight: 800; font-size: 32px; text-anchor: middle; }
.speedo-read { position: absolute; right: 6px; bottom: 30px; display: grid; justify-items: end; line-height: .85; }
.speedo-read b { font-family: var(--display); font-weight: 800; font-style: italic; font-size: 64px; color: var(--paper); font-variant-numeric: tabular-nums; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.speedo-read span { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--paper-2); order: -1; margin-bottom: 4px; }
.speedo-flow { position: absolute; left: 50%; top: 152px; transform: translateX(-50%); display: grid; justify-items: center; gap: 1px; font-size: 11.5px; color: var(--paper-2); white-space: nowrap; }
.sp-kw { font-size: 14px; font-weight: 500; color: var(--paper); }
.sp-kw.dep { color: var(--deploy); } .sp-kw.har { color: var(--harvest); }
.speedo-pills { position: absolute; left: -6px; bottom: -4px; display: flex; gap: 4px; }
.pill { font-family: var(--display); font-weight: 700; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; padding: 3px 6px; border-radius: 2px;
  color: var(--paper-3); box-shadow: inset 0 0 0 1px rgb(244 241 234 / .16); background: rgb(10 12 17 / .6); transition: background-color 120ms ease, color 120ms ease; }
.pill-boost.on { background: var(--boost); color: #1d0800; box-shadow: none; }
.pill-aero.on { background: var(--aero); color: #fff; box-shadow: none; }
.pill-ot.armed { color: var(--danfo); box-shadow: inset 0 0 0 1px var(--danfo); }
.pill-ot.on { background: var(--danfo); color: var(--danfo-ink); box-shadow: none; }
.pill-regen.on { background: var(--harvest); color: #002a30; box-shadow: none; }
.speedo-inputs { position: absolute; left: -22px; top: 70px; display: flex; gap: 4px; height: 110px; }
.speedo-inputs i { width: 6px; height: 100%; border-radius: 3px; background: rgb(244 241 234 / .12); overflow: hidden; display: flex; align-items: flex-end; }
.speedo-inputs b { display: block; width: 100%; height: 100%; transform-origin: bottom; transform: scaleY(0); }
.in-thr b { background: var(--good); } .in-brk b { background: var(--bad); }

/* gaps strip, bottom centre */
body:not(.touch) .gaps { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); min-width: 360px; padding: 7px 14px; border-radius: 4px; background: rgb(10 12 17 / .72); box-shadow: 0 0 0 1px rgb(244 241 234 / .07); }
.gaps .neighbours { border-top: 0; padding-top: 0; color: var(--paper-2); }
.gaps .neighbours .who { color: var(--paper); }

/* slimmer left column: thin panels with a white edge, like a race graphics package */
body:not(.touch) .chip { padding: 7px 10px 8px 12px; box-shadow: inset 3px 0 0 rgb(244 241 234 / .85), 0 0 0 1px rgb(244 241 234 / .07); }
body:not(.touch) .chip b { font-size: 21px; }
body:not(.touch) .tower { width: 224px; }
body:not(.touch) .guide-open { bottom: 280px; right: 22px; }
@media (prefers-reduced-motion: reduce) { .tool, .pill { transition: none; } .dial-needle { filter: none; } }
body:not(.touch) .hud .row.you { background: var(--danfo); }
body:not(.touch) .hud .chip.ot.armed, body:not(.touch) .hud .chip.ot.active { background: var(--danfo); box-shadow: none; }
body:not(.touch) .coach { max-width: min(560px, calc(100% - 560px)); }
@media (max-width: 1180px) { .tool-label { display: none; } }

/* loading: centred, a real progress bar once steps start reporting, and a retry when it stalls */
.loading { justify-items: center; text-align: center; }
.loading .bar { width: min(280px, 70vw); height: 3px; border-radius: 2px; overflow: hidden; }
.loading.measured .bar i { width: 100%; animation: none; transform-origin: left; transition: transform 400ms var(--out); }
.load-step { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--paper-3); min-height: 1.4em; }
.load-retry { margin-top: 6px; font-size: 16px; padding: 10px 18px; }
.load-retry[hidden] { display: none; }
.game.failed .load-step { display: none; }
.game.failed .load-retry { display: inline-block; }
@media (prefers-reduced-motion: reduce) { .loading.measured .bar i { transition: none; } }
/* Garage: designed liveries, previewed as side-view ribbons */
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.swatch { width: auto; }
.swatch canvas { display: block; width: 100%; height: 34px; }
.swatch span { font-size: 11px; }
.livery-blurb { margin: -2px 0 0; font-size: 13px; line-height: 1.4; color: var(--paper-2); min-height: 1.4em; }
@media (max-width: 900px) { .swatches { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; } .swatch canvas { height: 26px; } }
/* results: the buttons stay in view at the bottom of the sheet while the classification scrolls */
#finish .sheet { display: flex; flex-direction: column; }
#finish .sheet .body { padding-bottom: 0; }
.finish-actions { position: sticky; bottom: 0; z-index: 1; margin: 0 -22px; padding: 14px 22px 16px;
  background: linear-gradient(180deg, rgb(16 19 26 / 0), var(--night-1) 22%); }

/* multiplayer lobby */
.tile-mp b { color: var(--paper); }
.mp-join-row { display: flex; gap: 8px; }
.mp-join-row input { flex: 1; min-width: 0; }
.mp-join-row .cta { padding: 8px 16px; font-size: 18px; }
.mp-room { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mp-code { font-size: 34px; letter-spacing: .18em; color: var(--danfo); }
.mp-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mp-players li { display: grid; grid-template-columns: 6px 44px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 4px; background: var(--night-2); }
.mp-players i { width: 6px; height: 22px; border-radius: 2px; background: var(--c); }
.mp-players b { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .06em; }
.mp-players span { color: var(--paper-2); font-size: 14px; }
.mp-players em { font-style: normal; font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--paper-3); }
.mp-players em.ok { color: var(--good); }
.mp-players li.me { box-shadow: inset 0 0 0 1px rgb(255 194 14 / .5); }
.mp-status { min-height: 1.3em; margin: 0; }
.mp-status.bad { color: var(--bad); }
.cta[data-mp-ready][aria-pressed="true"] { background: var(--good); color: #06210f; box-shadow: none; }
.mp-host[hidden], .mp-in[hidden], .mp-out[hidden] { display: none; }

/* voice chat */
.mp-voice { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mp-voice .label { color: var(--paper-3); }
.mp-voice [data-voice-mute][aria-pressed="true"] { background: var(--good); color: #06210f; }
.mp-voice [data-voice-mute][aria-pressed="false"]:not([hidden]) { background: var(--bad); color: #fff; }
.voice-note { flex-basis: 100%; color: var(--paper-3); }
.mic { display: inline-block; padding: 1px 6px; border-radius: 3px; color: var(--good); box-shadow: inset 0 0 0 1px rgb(47 208 122 / .5); transition: background-color 90ms linear, color 90ms linear; }
.mic.off { color: var(--paper-3); box-shadow: inset 0 0 0 1px var(--line); }
.mic.talking { background: var(--good); color: #06210f; }
.voice-btn { position: absolute; top: 18px; right: 276px; width: 42px; height: 42px; border: 0; border-radius: 4px; cursor: pointer; display: grid; place-items: center; color: var(--paper); overflow: hidden; }
.voice-btn[hidden] { display: none; }
.voice-btn svg { width: 20px; height: 20px; position: relative; z-index: 1; }
.voice-btn .slash { opacity: 1; }
.voice-btn[aria-pressed="true"] .slash { opacity: 0; }
.voice-btn[aria-pressed="false"] { color: var(--bad); }
.voice-level { position: absolute; inset: 0; background: rgb(47 208 122 / .35); transform-origin: bottom; transform: scaleY(0); }
.voice-btn[aria-pressed="false"] .voice-level { display: none; }
body.touch .voice-btn { top: calc(max(8px, env(safe-area-inset-top)) + 44px); right: max(8px, env(safe-area-inset-right)); left: auto; width: 40px; height: 40px; }
body.touch .hud:has(.voice-btn:not([hidden])) .map { top: calc(max(8px, env(safe-area-inset-top)) + 90px); }
.row.talking .tag { box-shadow: 0 0 0 2px var(--good); }
.row.talking .code::after { content: " ●"; color: var(--good); font-size: .8em; }
@media (max-width: 1180px) { body:not(.touch) .voice-btn { right: 262px; } }
.ident-name { grid-column: 1 / -1; }
.ident-name input { text-transform: none; letter-spacing: .02em; }
.cta:disabled { opacity: .5; cursor: default; transform: none; }

/* voice signal meters */
.vbars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; margin-right: 6px; vertical-align: -2px; }
.vbars i { width: 3px; border-radius: 1px; background: rgb(244 241 234 / .18); transition: background-color 80ms linear; }
.vbars i:nth-child(1) { height: 4px; } .vbars i:nth-child(2) { height: 6px; } .vbars i:nth-child(3) { height: 9px; } .vbars i:nth-child(4) { height: 11px; } .vbars i:nth-child(5) { height: 14px; }
.vbars i.on { background: var(--good); }
.vbars i.on:nth-child(5) { background: var(--danfo); }
.vbars.muted i { background: rgb(255 71 87 / .35); }
.voice-hud { position: absolute; top: 70px; right: 18px; display: grid; gap: 4px; padding: 8px 10px; min-width: 120px; pointer-events: none; }
.voice-hud[hidden] { display: none; }
.vh-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vh-row b { font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .06em; color: var(--paper-2); }
.vh-row.me b { color: var(--danfo); }
.vh-row:has(.vbars.talking) b { color: var(--paper); }
body.touch .voice-hud { top: calc(max(8px, env(safe-area-inset-top)) + 176px); right: max(8px, env(safe-area-inset-right)); min-width: 0; padding: 5px 7px; }   /* under the mic button and minimap */
