/* Revvolt — motorsport instrument styling. Dark only (in-car use), high contrast, large targets, no motion. */

@font-face { font-family: "Michroma"; src: url("../fonts/michroma-Michroma-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Exo 2"; src: url("../fonts/exo2-variable.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #07090b;
  --bg-2: #0d1014;
  --panel: rgba(18, 21, 26, .78);
  --panel-solid: #12151a;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .16);
  --text: #eef1f5;
  --text-2: #aab3bf;
  --text-3: #788391;
  --lime: #c8f03c;
  --lime-2: #9fd62a;
  --amber: #ffb648;
  --ember: #ff7a2a;
  --red: #ff3b30;
  --volt: #4be1ff;
  --ok: #7ee04a;
  --warn: #ffc23d;
  --bad: #ff4d5e;
  --sim: #b48cff;
  --radius: 10px;
  --gutter: clamp(16px, 2.2vw, 36px);
  --label: "Michroma", "Eurostile", "Segoe UI", system-ui, sans-serif;
  --font: "Exo 2", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "Exo 2", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--text);
  font: 400 17px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  background:
    radial-gradient(900px 520px at 50% 34%, rgba(200, 240, 60, .045), transparent 70%),
    radial-gradient(1400px 700px at 50% 120%, #15191f 0%, transparent 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .012) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .012) 0 2px, transparent 2px 6px),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--lime); }
h1, h2 { margin: 0; font-weight: 400; }
h1 { font: 400 clamp(22px, 2.6vw, 32px) var(--label); letter-spacing: .12em; text-transform: uppercase; }
h2 { font: 400 13px var(--label); text-transform: uppercase; letter-spacing: .2em; color: var(--text-2); }
/* FocusOnNavigate moves focus to the page heading for screen readers; no visible ring needed there. */
h1:focus { outline: none; }
p { margin: .4em 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Boot */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 14px; }
.boot-mark { font: 400 40px var(--label); letter-spacing: .5em; }
.boot-mark span { color: var(--lime); }
.boot-sub { color: var(--text-3); font: 400 12px var(--label); letter-spacing: .3em; text-transform: uppercase; }
.boot-progress { color: var(--text-3); font: 400 12px var(--mono, monospace); min-height: 1em; }
.boot-help { display: grid; gap: 12px; justify-items: center; max-width: min(640px, 90vw); margin-top: 8px; }
.boot-help p { margin: 0; color: var(--text-2, #c8ced6); }
.boot-help button { font: inherit; padding: 12px 22px; border-radius: 10px; border: 1px solid var(--lime); background: transparent; color: var(--lime); }
.boot-help pre { margin: 0; color: var(--text-3); font-size: 12px; white-space: pre-wrap; word-break: break-word; text-align: left; }

/* Shell & header */
.shell { min-height: 100vh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 12px var(--gutter); border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 9, 11, .95), rgba(7, 9, 11, .6));
}
.brand { display: flex; align-items: center; gap: 28px; text-decoration: none; color: var(--text); }
.wordmark { font: 400 26px var(--label); letter-spacing: .48em; white-space: nowrap; }
.wordmark em { font-style: normal; color: var(--lime); text-shadow: 0 0 14px rgba(200, 240, 60, .45); }
.tagline {
  font: 400 9.5px/1.9 var(--label); letter-spacing: .32em; text-transform: uppercase; color: var(--text-3);
  padding-left: 28px; border-left: 1px solid var(--line-2);
}
.top-actions { display: flex; align-items: center; gap: 18px; }
.top-actions .divider { width: 1px; height: 32px; background: var(--line-2); }
.gps-state { display: inline-flex; align-items: center; gap: 10px; font: 400 11px var(--label); letter-spacing: .2em; text-transform: uppercase; color: var(--text-2); white-space: nowrap; }
.gps-state svg, .top-btn svg, .top-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; flex: none; }
.tone-ok .dot, .speaker.active .dot { background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.tone-warn .dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.tone-bad .dot { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.top-btn {
  display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 10px; background: none; border: 0; cursor: pointer;
  color: var(--text-2); font: 400 11px var(--label); letter-spacing: .25em; text-transform: uppercase;
}
.top-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; color: var(--text-2); }
.top-icon.active { color: var(--lime); background: rgba(200, 240, 60, .06); }
.content { flex: 1; padding: var(--gutter); }
.banner { margin: 12px var(--gutter) 0; padding: 12px 16px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); color: var(--text-2); }
.link { background: none; border: 0; color: var(--lime); cursor: pointer; text-decoration: underline; padding: 0 0 0 8px; }

/* Shared labels & badges */
.cp-label {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  font: 400 12px var(--label); letter-spacing: .22em; text-transform: uppercase; color: var(--text-2);
  padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.cp-label small { font: 400 11px var(--font); letter-spacing: .05em; text-transform: none; color: var(--text-3); margin-right: auto; }
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 5px; font: 600 12px var(--font); letter-spacing: .04em;
  background: rgba(255, 255, 255, .04); color: var(--text-2); border: 1px solid var(--line-2); text-transform: none;
}
.badge.tone-ok, .badge.prov-measured { color: var(--ok); border-color: rgba(126, 224, 74, .4); }
.badge.tone-warn, .badge.prov-derived { color: var(--warn); border-color: rgba(255, 194, 61, .4); }
.badge.tone-bad, .badge.prov-unavailable { color: var(--bad); border-color: rgba(255, 77, 94, .4); }
.badge.prov-simulated { color: var(--sim); border-color: rgba(180, 140, 255, .45); }
.badge.prov-external { color: var(--volt); border-color: rgba(75, 225, 255, .45); }
.hint { color: var(--text-3); font-size: 15px; }
.hint.warn { color: var(--warn); }
.notice { padding: 12px 16px; border-radius: var(--radius); border: 1px solid rgba(255, 194, 61, .5); background: rgba(255, 194, 61, .08); }

/* ---- Cockpit ---- */
.cockpit {
  max-width: 1760px; margin: 0 auto; display: grid; gap: 8px var(--gutter);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr) minmax(0, 1fr);
  grid-template-areas: "left center right" "bottom bottom bottom";
}
.cp-left { grid-area: left; display: flex; flex-direction: column; gap: 22px; padding-top: 16px; min-width: 0; }
.cp-center { grid-area: center; position: relative; display: grid; place-items: center; min-width: 0; }
.cp-right { grid-area: right; display: flex; flex-direction: column; gap: 22px; padding-top: 16px; min-width: 0; }
.cp-bottom { grid-area: bottom; display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); min-width: 0; }

.drive-mode {
  width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 56px;
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--amber);
}
.drive-mode-value { font: 400 26px var(--label); letter-spacing: .3em; text-transform: uppercase; text-shadow: 0 0 18px rgba(255, 182, 72, .35); }
.drive-mode svg { width: 26px; height: 26px; fill: none; stroke: var(--text-2); stroke-width: 1.5; }
.drive-mode:disabled { cursor: not-allowed; opacity: .6; }

.source-list { display: flex; flex-direction: column; gap: 6px; }
.source-list button {
  text-align: left; min-height: 48px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: transparent;
  color: var(--text-2); font: 400 12px var(--label); letter-spacing: .14em; text-transform: uppercase; cursor: pointer;
}
.source-list button.active { color: var(--text); border-color: rgba(200, 240, 60, .55); background: rgba(200, 240, 60, .06); }
.source-list button:disabled { opacity: .5; cursor: not-allowed; }

.accel-value { display: flex; align-items: baseline; gap: 12px; font: 200 58px/1 var(--font); font-variant-numeric: tabular-nums; }
.accel-value span { font: 300 20px var(--font); color: var(--text-2); }
.accel-bar { margin-top: 14px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.accel-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), var(--lime)); box-shadow: 0 0 10px var(--lime); }

.tach { width: min(100%, 620px); height: auto; display: block; }
.tach-scale { fill: none; stroke: url(#tachScale); stroke-width: 6; opacity: .55; }
.tach-value { fill: none; stroke: url(#tachScale); stroke-width: 9; stroke-linecap: round; }
.tach-inner { fill: none; stroke: rgba(255, 138, 42, .18); stroke-width: 1; }
.tach-tick { stroke: rgba(255, 255, 255, .35); stroke-width: 1.5; }
.tach-tick.major { stroke: rgba(255, 255, 255, .85); stroke-width: 3; }
.tach-tick.red { stroke: var(--red); }
.tach-num { fill: var(--text); font: 300 38px var(--font); text-anchor: middle; dominant-baseline: middle; }
.tach-num.red { fill: var(--red); }

.cp-readout {
  position: absolute; left: 50%; top: 57%; transform: translate(-50%, -42%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.speed { display: flex; font: 300 clamp(84px, 8.6vw, 150px)/0.9 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.speed .dim { color: rgba(255, 255, 255, .1); }
.speed-unit { display: flex; align-items: center; gap: 10px; font: 300 22px var(--font); letter-spacing: .2em; color: var(--text-2); }
.rpm-readout { margin-top: 10px; font: 300 40px var(--font); font-variant-numeric: tabular-nums; min-height: 1.1em; }
.rpm-readout span { font: 400 14px var(--label); letter-spacing: .25em; color: var(--text-2); }
.gear-box {
  min-width: 70px; padding: 10px 18px; text-align: center; border: 1px solid var(--line-2); border-radius: 6px; background: rgba(0, 0, 0, .45);
  font: 400 26px var(--label);
}
.gear-box.limiter { color: var(--red); border-color: var(--red); box-shadow: 0 0 16px rgba(255, 59, 48, .45); }

.gforce { display: grid; grid-template-columns: minmax(150px, 200px) 1fr; gap: 20px; align-items: center; }
.gforce svg { width: 100%; height: auto; }
.gforce svg circle { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 1; }
.gforce svg line { stroke: rgba(255, 255, 255, .28); stroke-width: 1; stroke-dasharray: 3 4; }
.gforce svg .gforce-dot { fill: var(--amber); stroke: none; filter: drop-shadow(0 0 8px var(--ember)); }
.gforce dl { margin: 0; display: grid; gap: 4px; }
.gforce dt { font: 400 10px var(--label); letter-spacing: .18em; text-transform: uppercase; color: var(--text-3); border-left: 1px solid var(--line-2); padding-left: 10px; }
.gforce dd { margin: 0 0 10px; padding-left: 10px; border-left: 1px solid var(--line-2); font: 300 28px var(--font); font-variant-numeric: tabular-nums; }
.gforce dd span { font-size: 15px; color: var(--text-2); margin-left: 4px; }
.gforce dd.na { font-size: 15px; color: var(--text-3); padding-top: 8px; }

.speaker {
  width: 100%; display: grid; grid-template-columns: 30px 1fr 10px 76px; align-items: center; gap: 14px; min-height: 52px;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 0; cursor: pointer; text-align: left;
  color: var(--text-2); font: 400 11px var(--label); letter-spacing: .16em; text-transform: uppercase;
}
.speaker svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.speaker.active { color: var(--text); }
.speaker:disabled { cursor: default; }
.speaker .level { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.speaker .level i { display: block; height: 100%; background: rgba(255, 255, 255, .7); }

.strip-head { width: 100%; max-width: 1360px; margin-bottom: 0; border: 0; padding: 0; }
.strip-head a { font: 400 11px var(--label); letter-spacing: .14em; color: var(--text-2); text-decoration: none; }
.profile-strip {
  width: 100%; max-width: 1360px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, calc((100% - 32px) / 3));
  gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 12px; scrollbar-width: thin;
}
.profile-card {
  scroll-snap-align: start; display: grid; grid-template-columns: 64px 1fr 26px; align-items: center; gap: 16px;
  min-height: 72px; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; text-align: left;
}
.profile-card.selected { border-color: var(--lime); box-shadow: 0 0 0 1px rgba(200, 240, 60, .35), 0 0 22px rgba(200, 240, 60, .15); }
.profile-card:disabled { cursor: not-allowed; opacity: .55; }
.profile-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.profile-title { font: 400 12px/1.35 var(--label); letter-spacing: .08em; text-transform: uppercase; color: var(--text); }
.profile-sub { font: 400 9.5px var(--label); letter-spacing: .2em; text-transform: uppercase; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--text-2); display: grid; place-items: center; }
.profile-card.selected .radio { border-color: var(--lime); }
.profile-card.selected .radio::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.engine-icon { width: 56px; height: 40px; fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.engine-icon.tone-lime { stroke: var(--lime); }
.engine-icon.tone-amber { stroke: var(--ember); }
.engine-icon.tone-red { stroke: var(--red); }

.start-sound {
  width: min(100%, 480px); min-height: 68px; display: grid; grid-template-columns: 40px 1fr 28px; align-items: center; gap: 2px 12px;
  padding: 10px 28px; border-radius: 8px; cursor: pointer; color: var(--lime);
  border: 1.5px solid var(--lime); background: linear-gradient(180deg, rgba(200, 240, 60, .08), rgba(200, 240, 60, .02));
  box-shadow: 0 0 24px rgba(200, 240, 60, .18), inset 0 0 18px rgba(200, 240, 60, .06);
}
.start-sound svg { width: 24px; height: 24px; fill: currentColor; grid-column: 3; grid-row: 1 / span 2; }
.start-title { grid-column: 2; font: 400 18px var(--label); letter-spacing: .28em; overflow-wrap: anywhere; text-transform: uppercase; color: var(--text); text-align: center; }
.start-sub { grid-column: 2; font: 400 13px var(--font); color: var(--text-2); text-align: center; }
.start-sound .wave { grid-column: 1; grid-row: 1 / span 2; height: 26px; background:
  linear-gradient(currentColor, currentColor) 0 50% / 2px 40% no-repeat, linear-gradient(currentColor, currentColor) 6px 50% / 2px 80% no-repeat,
  linear-gradient(currentColor, currentColor) 12px 50% / 2px 100% no-repeat, linear-gradient(currentColor, currentColor) 18px 50% / 2px 60% no-repeat,
  linear-gradient(currentColor, currentColor) 24px 50% / 2px 90% no-repeat, linear-gradient(currentColor, currentColor) 30px 50% / 2px 45% no-repeat; }
.start-sound:disabled { color: var(--text-3); border-color: var(--line-2); box-shadow: none; background: transparent; cursor: not-allowed; }
.start-sound.on { color: var(--red); border-color: var(--red); background: linear-gradient(180deg, rgba(255, 59, 48, .12), rgba(255, 59, 48, .03)); box-shadow: 0 0 24px rgba(255, 59, 48, .2); }

.confirm { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line-2); cursor: pointer; font-size: 17px; margin-bottom: 8px; }
.confirm input { width: 28px; height: 28px; accent-color: var(--lime); }
.pedals { display: flex; gap: 16px; justify-content: center; padding: 6px 0; }
.pedal {
  position: relative; width: 120px; height: 170px; border-radius: 12px; background: rgba(0, 0, 0, .4); border: 1px solid var(--line-2);
  overflow: hidden; touch-action: none; user-select: none; cursor: pointer;
}
.pedal.disabled { opacity: .4; pointer-events: none; }
.pedal-fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, var(--lime-2), var(--lime)); opacity: .8; }
.pedal-brake .pedal-fill { background: linear-gradient(0deg, #6b7686, #9aa5b5); }
.pedal-label { position: absolute; top: 12px; left: 0; right: 0; text-align: center; font: 400 12px var(--label); letter-spacing: .25em; }
.pedal-value { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font: 400 18px var(--mono); }

/* Calm while moving: no glowing value arc, quieter chrome. */
.cockpit.is-calm .profile-strip, .cockpit.is-calm .cp-left .source-list { opacity: .6; }

.btn {
  min-height: 52px; padding: 0 22px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-solid);
  font: 400 12px var(--label); letter-spacing: .14em; text-transform: uppercase; cursor: pointer;
}
.btn-wide { width: min(100%, 480px); border-color: var(--warn); color: var(--warn); }

/* ---- Other pages ---- */
.page { max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-direction: column; gap: 8px; }
.lead { color: var(--text-2); max-width: 75ch; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px; }
.kv span:first-child { color: var(--text-3); }
.kv span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 10px; }
.segmented button {
  flex: 1 1 0; min-height: 52px; padding: 0 14px; border-radius: 7px; border: 0; background: transparent; color: var(--text-2);
  font: 400 11px var(--label); letter-spacing: .12em; text-transform: uppercase; cursor: pointer;
}
.segmented button.active { background: rgba(200, 240, 60, .08); color: var(--text); box-shadow: inset 0 -2px 0 var(--lime); }
.segmented button:disabled { opacity: .45; cursor: not-allowed; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card {
  text-align: left; display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line-2); min-height: 220px;
}
.card.selected { border-color: var(--lime); box-shadow: 0 0 22px rgba(200, 240, 60, .12); }
.card-title { font: 400 15px/1.4 var(--label); letter-spacing: .1em; text-transform: uppercase; }
.card-sub { color: var(--text-2); font-weight: 500; }
.card-text { color: var(--text-3); }
.card-specs { display: flex; gap: 18px; color: var(--text-2); font-size: 15px; }
.card-specs b { color: var(--text); font-size: 18px; font-weight: 500; }
.card-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; align-items: center; }
.card-select { all: unset; display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.card-select:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
.card-link { margin-left: auto; font: 400 11px var(--label); letter-spacing: .14em; text-transform: uppercase; color: var(--lime); text-decoration: none; padding: 10px 0; }
.back { font: 400 11px var(--label); letter-spacing: .16em; text-transform: uppercase; color: var(--text-2); text-decoration: none; }
.bank-rhythm { width: 100%; height: auto; }
.bank-rhythm .br-label, .bank-rhythm .br-scale { fill: var(--text-2); font: 400 22px var(--font); }
.bank-rhythm .br-axis { stroke: var(--line-2); stroke-width: 1; }
.bank-rhythm .br-pulse { stroke-width: 6; stroke-linecap: round; }
.bank-rhythm .br-pulse.b0 { stroke: var(--lime); }
.bank-rhythm .br-pulse.b1 { stroke: var(--amber); }
.settings { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.settings:disabled { opacity: .5; }
.setting {
  display: grid; grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.2fr); gap: 20px; align-items: center;
  padding: 18px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line);
}
.setting-label p { color: var(--text-3); font-size: 15px; }
.range-row { display: flex; align-items: center; gap: 14px; }
.range-row input[type=range] { flex: 1; height: 44px; accent-color: var(--lime); }
.range-row output { min-width: 4ch; text-align: right; font: 400 18px var(--mono); }
.toggle {
  justify-self: start; display: inline-flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 16px 6px 6px;
  border-radius: 999px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .35); cursor: pointer;
}
.toggle-knob { width: 40px; height: 40px; border-radius: 50%; background: var(--text-3); }
.toggle.on { border-color: var(--lime); }
.toggle.on .toggle-knob { background: var(--lime); }
.info-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.check { display: flex; gap: 10px; align-items: center; padding: 4px 0; }
.check-mark { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; }
.check.ok .check-mark { color: var(--ok); background: rgba(126, 224, 74, .12); }
.check.no .check-mark { color: var(--bad); background: rgba(255, 77, 94, .12); }

#blazor-error-ui {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; padding: 14px 20px;
  background: #3a1218; color: var(--text); border-top: 1px solid var(--bad);
}
#blazor-error-ui .dismiss { float: right; background: none; border: 0; cursor: pointer; font-size: 18px; }
#blazor-error-ui .reload { color: var(--lime); margin-left: 12px; }

/* Responsive: Tesla landscape first, then tablet and phone. */
@media (max-width: 1240px) {
html:not(.stage-mode):not(.page-zoom) .cockpit { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "center center" "left right" "bottom bottom"; }
html:not(.stage-mode):not(.page-zoom) .cp-left, html:not(.stage-mode):not(.page-zoom) .cp-right { padding-top: 0; }
html:not(.stage-mode):not(.page-zoom) .tagline { display: none; }
}
@media (max-width: 760px) {
html:not(.stage-mode):not(.page-zoom) body { font-size: 16px; }
html:not(.stage-mode):not(.page-zoom) .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
html:not(.stage-mode):not(.page-zoom) .wordmark { font-size: 20px; letter-spacing: .36em; }
html:not(.stage-mode):not(.page-zoom) .top-btn-text, html:not(.stage-mode):not(.page-zoom) .top-actions .divider, html:not(.stage-mode):not(.page-zoom) .gps-state > span { display: none; }
html:not(.stage-mode):not(.page-zoom) .top-icon, html:not(.stage-mode):not(.page-zoom) .top-btn { width: 44px; height: 44px; padding: 0; justify-content: center; }
html:not(.stage-mode):not(.page-zoom) .top-actions { gap: 6px; }
html:not(.stage-mode):not(.page-zoom) .content { padding: 16px; }
html:not(.stage-mode):not(.page-zoom) .cockpit { grid-template-columns: minmax(0, 1fr); grid-template-areas: "center" "bottom" "left" "right"; }
html:not(.stage-mode):not(.page-zoom) .cp-left { gap: 24px; }
html:not(.stage-mode):not(.page-zoom) .speed { font-size: 84px; }
html:not(.stage-mode):not(.page-zoom) .rpm-readout { font-size: 30px; margin-top: 8px; }
html:not(.stage-mode):not(.page-zoom) .gear-box { font-size: 20px; padding: 6px 14px; }
html:not(.stage-mode):not(.page-zoom) .speed-unit { font-size: 16px; }
html:not(.stage-mode):not(.page-zoom) .profile-strip { grid-auto-columns: 82%; }
html:not(.stage-mode):not(.page-zoom) .setting { grid-template-columns: 1fr; }
html:not(.stage-mode):not(.page-zoom) .info-grid, html:not(.stage-mode):not(.page-zoom) .cards { grid-template-columns: 1fr; }
html:not(.stage-mode):not(.page-zoom) .gforce { grid-template-columns: 140px 1fr; }
}

/* ===== Stage mode: the cockpit is a fixed 1280×720 canvas scaled to the window (see js stageFit) ===== */
html.stage-mode, html.stage-mode body { overflow: hidden; height: 100%; }
.stage-viewport { position: fixed; inset: 0; overflow: hidden; background: var(--bg); }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.stage .topbar { padding: 10px 28px; height: 64px; flex: none; }
.stage .wordmark { font-size: 22px; }
.stage .tagline { font-size: 9px; }
.stage .gps-state, .stage .top-btn { font-size: 12px; }
.stage .content { flex: 1; min-height: 0; padding: 14px 28px 16px; }

/* Instrument dashboard inside the stage */
.stage .cockpit { height: 100%; max-width: none; gap: 0 24px; grid-template-columns: 300px 1fr 330px; grid-template-rows: minmax(0, 1fr) auto; }
.stage .cp-left, .stage .cp-right { padding-top: 4px; gap: 16px; }
.stage .cp-label { font-size: 13px; padding-bottom: 8px; margin-bottom: 10px; }
.stage .drive-mode { min-height: 44px; }
.stage .drive-mode-value { font-size: 24px; }
.stage .source-list button { min-height: 44px; font-size: 13px; }
.stage .accel-value { font-size: 48px; }
.stage .accel-bar { margin-top: 10px; }
.stage .tach { width: 460px; }
.stage .cp-readout { top: 56%; }
.stage .speed { font-size: 108px; }
.stage .speed-unit { font-size: 18px; }
.stage .rpm-readout { font-size: 32px; margin-top: 4px; }
.stage .gear-box { font-size: 22px; padding: 6px 16px; }
.stage .gforce { grid-template-columns: 140px 1fr; gap: 14px; }
.stage .gforce dd { font-size: 22px; margin-bottom: 4px; }
.stage .speaker { min-height: 46px; font-size: 12px; }
.stage .cp-right .hint { font-size: 13px; }
.stage .cp-right:has(.pedals) .speaker ~ .hint { display: none; }
.stage .pedal { width: 110px; height: 150px; }
.stage .confirm { font-size: 15px; padding: 8px 12px; }
.stage .cp-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto auto; align-items: center; gap: 8px 20px; padding-top: 10px; }
.stage .strip-head { grid-column: 1; max-width: none; font-size: 12px; }
.stage .profile-strip { grid-column: 1; grid-row: 2; max-width: none; grid-auto-columns: minmax(250px, calc((100% - 24px) / 3)); padding-bottom: 6px; }
.stage .profile-card { min-height: 64px; padding: 8px 14px; grid-template-columns: 48px 1fr 22px; gap: 12px; }
.stage .profile-title { font-size: 12px; }
.stage .engine-icon { width: 44px; height: 32px; }
.stage .start-sound { grid-column: 2; grid-row: 1 / span 2; width: 100%; min-height: 72px; }
.stage .cp-bottom .notice, .stage .cp-bottom .btn-wide { grid-column: 1 / -1; padding: 6px 12px; font-size: 14px; }


/* Dialog */
.dialog-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0, 0, 0, .6); }
.stage .dialog-backdrop { position: absolute; }
.dialog { width: min(640px, 92%); background: #0d1117; border: 1px solid var(--line-2); border-radius: 14px; padding: 24px 28px; display: flex; flex-direction: column; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.btn-primary { border-color: var(--lime); color: var(--lime); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ===== Wave dashboard (alternative cockpit): navy/black base, electric cyan, sparse lime ===== */
.theme-wave { --cyan: #22d3ee; --cyan-2: #0ea5e9; --wave-lime: #bef264; --ink: #e6f1ff; --mute: #8aa0b8; --edge: rgba(125, 170, 220, .16);
  background: radial-gradient(900px 600px at 28% 70%, #0a1f3d 0%, transparent 70%), linear-gradient(180deg, #050b17, #02060d); }
.theme-wave.stage, .theme-wave .topbar { background: transparent; }
.stage-viewport:has(.theme-wave) { background: #02060d; }
.theme-wave .topbar { border-bottom-color: transparent; }
.theme-wave .wordmark em { color: var(--cyan); text-shadow: 0 0 16px rgba(34, 211, 238, .55); }
.theme-wave .tagline { display: none; }
.theme-wave .gps-state { color: var(--ink); }
.theme-wave .tone-ok .dot { background: #4ade80; box-shadow: 0 0 10px #4ade80; }
.theme-wave .top-icon.active { color: var(--cyan); background: rgba(34, 211, 238, .08); }
/* Quieter top row: the profile is chosen in the right-hand panel, so the picker is hidden here; logo, unlock chip and
   icons step back so the wave and the speed lead. Nothing is removed that is not available elsewhere on the page. */
.stage.theme-wave .topbar { height: 54px; padding-top: 6px; padding-bottom: 6px; }
.stage.theme-wave .wordmark { font-size: 17px; letter-spacing: .42em; opacity: .85; }
.theme-wave .topbar .car-picker { display: none; }
.theme-wave .top-actions { gap: 10px; }
.theme-wave .top-actions .divider { height: 22px; background: rgba(125, 170, 220, .14); }
.theme-wave .top-icon, .theme-wave .top-btn, .theme-wave .gps-state { color: var(--mute); }
.theme-wave .top-icon { width: 42px; height: 42px; }
.theme-wave .top-icon svg, .theme-wave .top-btn svg { width: 20px; height: 20px; }
.stage.theme-wave .free-chip { min-height: 32px; padding: 0 12px; font-size: 10px; border-color: rgba(34, 211, 238, .28); color: rgba(150, 220, 240, .85); background: transparent; }

.wave-dash { position: relative; height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 430px; grid-template-rows: minmax(0, 1fr) auto; gap: 0 28px; }
.wave-main { position: relative; min-height: 0; }
.wave-canvas { position: absolute; left: -28px; right: -60px; bottom: 0; top: 70px; width: calc(100% + 88px); height: calc(100% - 70px);
  /* Static backdrop (horizon haze and glossy ground) lives in CSS so the canvas never copies it per frame. */
  background: radial-gradient(60% 30% at 60% 34%, rgba(40, 140, 200, .16), transparent 70%),
    linear-gradient(180deg, transparent 0%, rgba(7, 22, 44, .55) 30%, rgba(5, 14, 30, .7) 36%, rgba(3, 9, 20, .55) 75%, transparent 100%); }
.wave-speed { position: relative; display: flex; align-items: baseline; padding: 4px 0 0 10px; font: 200 190px/0.95 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: #fff; text-shadow: 0 0 40px rgba(255, 255, 255, .12); }
.wave-speed .dim { color: rgba(120, 150, 190, .3); text-shadow: none; }
.wave-speed .lit { color: #fff; text-shadow: 0 0 22px rgba(34, 211, 238, .45), 0 0 60px rgba(34, 211, 238, .18); }
.wave-speed.unknown .none { color: rgba(140, 170, 205, .5); text-shadow: none; font-weight: 200; font-size: 64px; line-height: 1; }
.wave-speed.unknown small { color: rgba(138, 160, 184, .6); }
.wave-speed small { font: 300 34px var(--font); color: var(--mute); margin-left: 14px; letter-spacing: 0; text-shadow: none; }
.wave-prov { position: relative; display: flex; gap: 10px; align-items: center; padding-left: 14px; color: var(--mute); font-size: 15px; }
.wave-controls { position: absolute; left: 10px; bottom: 12px; display: flex; gap: 14px; align-items: flex-end; z-index: 2; }
.wave-controls .confirm { background: rgba(5, 12, 24, .7); }
.theme-wave .pedal { width: 96px; height: 140px; background: rgba(5, 12, 24, .7); }
.theme-wave .pedal-fill { background: linear-gradient(0deg, var(--cyan-2), var(--cyan)); }

.wave-panel { position: relative; z-index: 2; align-self: stretch; margin: 6px 0 14px; padding: 20px 20px 16px; border-radius: 22px; border: 1px solid var(--edge);
  /* No backdrop-filter: the animated wave runs underneath and a blur would be recomputed every frame. */
  background: linear-gradient(180deg, rgba(14, 26, 46, .9), rgba(6, 12, 24, .94)); display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.wave-head { display: flex; align-items: center; gap: 14px; font: 400 13px var(--label); letter-spacing: .38em; text-transform: uppercase; color: var(--mute); padding: 2px 4px; }
.wave-head svg { width: 26px; height: 26px; fill: none; stroke: var(--mute); stroke-width: 1.6; stroke-linecap: round; }
.wave-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; flex: 1; padding: 2px; scrollbar-width: thin; }
.wave-item { flex: none; display: grid; grid-template-columns: 96px minmax(0, 1fr) 40px; gap: 12px; align-items: center; padding: 7px 10px 7px 7px; border-radius: 12px;
  border: 1px solid var(--edge); background: rgba(10, 20, 36, .7); text-align: left; cursor: pointer; color: var(--ink); }
.wave-item .engine-art { width: 96px; height: 60px; display: block; }
.wave-item.selected { border-color: var(--cyan); background: rgba(14, 40, 60, .55); box-shadow: 0 0 0 1px rgba(34, 211, 238, .25), 0 0 26px rgba(34, 211, 238, .22); }
.wave-item:disabled { cursor: not-allowed; opacity: .6; }
/* Calm names: sentence case, normal letter spacing, room for two lines before anything is cut. */
.wave-item-text { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.wave-item b { font: 500 16px/1.2 var(--font); letter-spacing: .01em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wave-item small { font: 400 12px var(--font); letter-spacing: .04em; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wave-round { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid rgba(160, 190, 220, .45); display: grid; place-items: center; }
.wave-round svg { width: 18px; height: 18px; fill: rgba(220, 235, 250, .85); stroke: none; }
.wave-round.on { border-color: var(--cyan); box-shadow: 0 0 16px rgba(34, 211, 238, .45); }
.wave-round.on svg { fill: none; stroke: var(--cyan); stroke-width: 2; stroke-linecap: round; }
.wave-out { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wave-tile { display: flex; align-items: center; gap: 14px; min-height: 70px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--edge); background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.wave-tile svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; flex: none; }
.wave-tile span { display: flex; flex-direction: column; gap: 4px; }
.wave-tile b { font: 400 12px var(--label); letter-spacing: .16em; text-transform: uppercase; }
.wave-tile small { font: 400 10px var(--label); letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
.wave-tile.active { border-color: var(--cyan); background: rgba(34, 211, 238, .07); box-shadow: 0 0 18px rgba(34, 211, 238, .18); }
.wave-tile.active svg { color: var(--cyan); }
.wave-tile.active small { color: var(--cyan); }
.wave-tile.unavailable { color: var(--mute); opacity: .6; cursor: default; }
.wave-ext { align-self: flex-start; padding: 2px 4px; color: var(--cyan); font-size: 14px; text-decoration: none; }

/* Under the speed, above the wave: not over the pedals and the park checkbox at the bottom. */
.wave-toast { position: absolute; z-index: 3; left: 24px; right: 470px; top: 262px; padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(255, 194, 61, .5); background: rgba(40, 30, 6, .85); color: var(--ink); font-size: 15px; }
.wave-bar { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 24px; padding: 14px 6px 0; border-top: 1px solid var(--edge); }
.wave-mode { justify-self: start; display: flex; align-items: center; gap: 16px; background: none; border: 0; padding: 4px; color: var(--ink); text-align: left; cursor: pointer; }
.wave-mode:disabled { cursor: not-allowed; opacity: .6; }
.wave-mode-icon { width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid rgba(160, 190, 220, .55); display: grid; place-items: center; font: 400 20px var(--font); }
.wave-mode span:last-child { display: flex; flex-direction: column; gap: 4px; }
.wave-mode b { font: 400 13px var(--label); letter-spacing: .26em; text-transform: uppercase; }
.wave-mode small { color: var(--mute); font-size: 14px; }
.wave-start { display: flex; align-items: center; justify-content: center; gap: 18px; min-width: 400px; min-height: 70px; border: 0; border-radius: 999px; cursor: pointer;
  color: #031321; font: 400 17px var(--label); letter-spacing: .34em; text-transform: uppercase;
  background: linear-gradient(90deg, #22d3ee 0%, #34d6d0 45%, #a3e635 100%); box-shadow: 0 0 34px rgba(34, 211, 238, .45), 0 0 60px rgba(163, 230, 53, .15); }
.wave-start svg { width: 22px; height: 22px; fill: currentColor; }
.wave-go { display: flex; align-items: center; gap: 16px; }
.wave-go.with-park { grid-column: 2 / -1; justify-self: end; }
.wave-go.with-park .wave-start { min-width: 320px; }
.wave-bar .wave-park { margin: 0; min-height: 70px; max-width: 330px; padding: 8px 16px; border-radius: 14px; border: 1px solid var(--edge); background: rgba(8, 18, 32, .8); color: var(--ink); }
.wave-park input { accent-color: var(--cyan); flex: none; }
.wave-park > span { display: flex; flex-direction: column; gap: 3px; }
.wave-park b { font: 500 15px/1.25 var(--font); }
.wave-park small { font: 400 13px var(--font); color: var(--warn); }
.wave-park.pending { border-color: rgba(255, 194, 61, .55); box-shadow: 0 0 18px rgba(255, 194, 61, .12); }
.wave-go-hint { max-width: 200px; font: 400 13px/1.3 var(--font); color: var(--warn); }
.wave-start:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.wave-start.on { background: transparent; color: #ff6b6b; border: 1.5px solid #ff6b6b; box-shadow: 0 0 24px rgba(255, 80, 80, .2); }
.wave-tagline { justify-self: end; display: flex; align-items: center; gap: 16px; color: var(--mute); font: 400 11px var(--label); letter-spacing: .22em; white-space: nowrap; text-transform: uppercase; padding-left: 20px; border-left: 1px solid var(--edge); }
.wave-tagline svg { width: 28px; height: 28px; fill: none; stroke: var(--mute); stroke-width: 1.6; stroke-linecap: round; }

.stage .start-title { letter-spacing: .24em; font-size: 17px; white-space: nowrap; }
.start-title.long, .stage .start-title.long { letter-spacing: .1em; font-size: 15px; }

/* Scroll buttons and visible scrollbars for the car lists (touch-friendly in the Tesla browser). */
.scroll-btns { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.scroll-btn { width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04); color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.scroll-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-wave .scroll-btn { border-color: var(--edge); color: var(--ink); }
.profile-strip, .wave-list { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.profile-strip { touch-action: pan-x; scroll-snap-type: x proximity; }
.wave-list { touch-action: pan-y; }
.profile-strip::-webkit-scrollbar, .wave-list::-webkit-scrollbar { width: 6px; height: 6px; }
.profile-strip::-webkit-scrollbar-thumb { background: rgba(200, 240, 60, .45); border-radius: 3px; }
.wave-list::-webkit-scrollbar-thumb { background: rgba(34, 211, 238, .5); border-radius: 3px; }
.profile-strip::-webkit-scrollbar-track, .wave-list::-webkit-scrollbar-track { background: rgba(255, 255, 255, .05); border-radius: 3px; }
.stage .strip-head { gap: 12px; }

/* Smaller engine panel in the wave dashboard. */
.wave-dash { grid-template-columns: minmax(0, 1fr) 360px; }
.wave-toast { right: 400px; }
.wave-panel { padding: 16px 14px 12px; gap: 10px; }
.wave-head { font-size: 12px; letter-spacing: .32em; gap: 10px; }
.wave-head svg { width: 22px; height: 22px; }
.wave-item { grid-template-columns: 84px minmax(0, 1fr) 36px; gap: 12px; padding: 6px 10px 6px 6px; }
.wave-item .engine-art, .wave-item .car-art { width: 84px; height: 54px; display: block; }
.wave-item-text { gap: 5px; }
.stage .wave-item { min-height: 0; }
.wave-item b, .stage .wave-item b { font-size: 12px; letter-spacing: .1em; }
.wave-item small, .stage .wave-item small { font-size: 9px; margin-top: 0; }
.wave-round { width: 36px; height: 36px; }
.wave-round svg { width: 15px; height: 15px; }
.wave-tile { min-height: 58px; padding: 10px 12px; gap: 10px; }
.wave-tile svg { width: 24px; height: 24px; }
.wave-tile b { font-size: 11px; }
.wave-tile small { font-size: 9px; }

/* The wave canvas carries the evening sky, so it fills the whole main area behind the speed. */
.wave-canvas { top: -16px; height: calc(100% + 16px); left: -28px; width: calc(100% + 28px + 388px); }
/* The sky canvas (evening sky, mountains, ground) carries the backdrop; the wave canvas above it is transparent. */
.wave-canvas.wave-sky, .wave-sky + .wave-canvas { background: none; }
/* The scene continues behind the (semi-transparent) engine panel. */
.wave-dash { isolation: isolate; }
.wave-main { overflow: visible; }
.wave-speed, .wave-prov { z-index: 1; }

/* Legend: which sound layer each wave layer is (front to back). */
/* Legend and note stacked top right, so a two-line legend pushes the note down instead of overlapping it. */
.wave-meta { position: absolute; z-index: 1; right: 8px; top: 4px; max-width: 70%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.wave-legend { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px;
  font: 400 10px var(--label); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.wave-legend li { display: flex; align-items: center; gap: 8px; opacity: calc(1 - var(--depth) * 0.13); }
.wave-legend i { width: 18px; height: 2px; border-radius: 1px; background: linear-gradient(90deg, #22d3ee, #bef264); }
.wave-legend li:first-child i { height: 3px; box-shadow: 0 0 6px #22d3ee; }

/* Car illustrations in the instrument dashboard strip. */
.profile-card .car-art { width: 64px; height: 40px; display: block; border-radius: 4px; }
.stage .profile-card { grid-template-columns: 64px 1fr 22px; }
.card .car-art { width: 100%; max-width: 220px; height: auto; border-radius: 8px; }

.car-photo { object-fit: cover; object-position: center 60%; border-radius: 8px; background: #050b16; }
.card .car-photo { width: 100%; max-width: 260px; aspect-ratio: 3 / 2; }

/* Country picker */
.setting-wide { grid-template-columns: 1fr; }
.country-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.country { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 92px; padding: 12px 8px; border-radius: 10px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .02); color: var(--text-2); cursor: pointer; font: 400 15px var(--font); }
.country .flag { width: 42px; height: 28px; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
.country.active { border-color: var(--lime); color: var(--text); background: rgba(200, 240, 60, .06); }
.theme-wave .country.active { border-color: var(--cyan); background: rgba(34, 211, 238, .07); }

/* Localized labels vary in length: keep the top bar on one line and tighten spacing instead of wrapping. */
.tagline, .top-btn { white-space: nowrap; }
.stage .gps-state, .stage .top-btn { letter-spacing: .14em; }
.stage .top-actions { gap: 14px; }
/* Wide tracking suits Latin capitals but makes Korean, Japanese and Chinese look scattered. */
html:is(:lang(ko), :lang(ja), :lang(zh)) .shell *:not(.wordmark, .wordmark *, .speed *, .wave-speed *) { letter-spacing: .04em !important; }
.wave-note { margin: 0; font: 400 10px var(--font); color: var(--text-3); letter-spacing: .04em; }
.update-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 10px var(--gutter) 0; padding: 10px 16px;
  border: 1px solid var(--lime); border-radius: 8px; background: rgba(200, 240, 60, .06); color: var(--text); }
.stage .update-bar { margin: 6px 24px 0; }

/* ===== Phone remote: toggle on the car screen ===== */
.remote-toggle { display: flex; align-items: center; gap: 10px; margin-top: 8px; min-width: 0; }
.remote-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 8px; flex: none;
  border: 1px solid var(--line-2); background: var(--panel-solid); font: 400 11px var(--label); letter-spacing: .14em; text-transform: uppercase; cursor: pointer;
}
.remote-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.remote-btn.on { border-color: var(--lime); color: var(--lime); }
.theme-wave .remote-btn.on { border-color: var(--cyan); color: var(--cyan); }
.pedals .remote-toggle { flex-direction: column; align-items: flex-start; justify-content: center; margin: 0; width: 180px; }
.wave-controls .remote-toggle { flex-direction: column; align-items: flex-start; margin: 0; width: 190px; padding: 8px 10px; border-radius: 8px; background: rgba(5, 12, 24, .7); }
.remote-state { font-size: 13px; color: var(--text-2); line-height: 1.25; overflow-wrap: anywhere; min-width: 0; }

/* ===== Phone remote page (/remote) ===== */
.remote-shell { min-height: 100vh; min-height: 100dvh; }
.remote { max-width: 520px; margin: 0 auto; padding: 14px 16px 28px; display: flex; flex-direction: column; gap: 14px; }
.remote-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.remote-head .wordmark { font-size: 18px; letter-spacing: .34em; }
.remote-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.remote-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.remote-card h1 { font-size: 20px; margin-bottom: 6px; }
.remote-steps { margin: 10px 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }
.remote-wide { width: 100%; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.remote-rpm { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 10px; }
.remote-rpm-value { font: 400 44px var(--label); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.remote-rpm-unit { color: var(--text-3); font: 400 12px var(--label); letter-spacing: .2em; text-transform: uppercase; }
.remote-rpm-bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.remote-rpm-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--volt), var(--lime) 70%, var(--amber)); transition: width .12s linear; }
.remote-rpm.limiter .remote-rpm-value { color: var(--red); }
.remote-rpm.limiter .remote-rpm-bar i { background: var(--red); }
.remote-actions { display: flex; align-items: center; gap: 14px; }
.remote-actions .btn { flex: 1; min-height: 56px; }
.remote-stop { border-color: var(--bad); color: var(--bad); }
.remote-left { color: var(--text-2); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.remote-pad {
  position: relative; height: min(46vh, 380px); border-radius: 16px; border: 1px solid rgba(200, 240, 60, .45); overflow: hidden;
  background: rgba(0, 0, 0, .4); touch-action: none; user-select: none; -webkit-user-select: none; cursor: ns-resize;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.remote-pad-fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, rgba(200, 240, 60, .55), rgba(200, 240, 60, .12)); transition: height .05s linear; }
.remote-pad-label { position: relative; font: 400 28px var(--label); letter-spacing: .3em; color: var(--lime); }
.remote-pad-hint { position: relative; font-size: 13px; color: var(--text-2); text-align: center; padding: 0 16px; }
.remote-pad.disabled { opacity: .4; border-color: var(--line-2); }
.remote-safety { font-size: 12.5px; color: var(--text-3); margin: 0; }

/* Car picker (top bar drop-down) */
.car-picker { position: relative; flex: 0 1 340px; min-width: 0; }
.car-picker-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 4px 12px 4px 4px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 12px; background: rgba(255, 255, 255, .04); color: var(--text); text-align: left;
}
.car-picker.open .car-picker-btn, .car-picker-btn:hover { border-color: rgba(200, 240, 60, .5); }
.car-picker-btn .car-art { width: 66px; height: 42px; flex: none; border-radius: 8px; }
.car-picker-text { display: grid; min-width: 0; gap: 2px; }
.car-picker-text b { font: 600 15px/1.2 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-picker-text small { font: 400 9.5px var(--label); letter-spacing: .22em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-picker-item .car-picker-text small { font: 400 12.5px var(--font); letter-spacing: 0; text-transform: none; }
.car-picker-chev { width: 22px; height: 22px; margin-left: auto; flex: none; fill: none; stroke: var(--lime); stroke-width: 2; transition: transform .15s; }
.car-picker.open .car-picker-chev { transform: rotate(180deg); }
.car-picker-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .35); border: 0; cursor: default; }
.car-picker-menu {
  position: absolute; z-index: 41; top: calc(100% + 8px); left: 0; width: max(100%, 420px); display: grid; gap: 8px; padding: 10px;
  border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel-solid); box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}
.car-picker-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 8px; font: 400 10px var(--label); letter-spacing: .24em; text-transform: uppercase; color: var(--text-3); }
.car-picker-head .scroll-btns { display: flex; gap: 6px; }
.car-picker-list { display: grid; gap: 6px; max-height: min(520px, 62vh); overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.stage .car-picker-list { max-height: 540px; }
.car-picker-item {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 6px 12px 6px 6px; cursor: pointer; text-align: left;
  border: 1px solid transparent; border-radius: 10px; background: rgba(255, 255, 255, .03); color: var(--text);
}
.car-picker-item .car-art { width: 84px; height: 54px; flex: none; border-radius: 7px; }
.car-picker-item .radio { margin-left: auto; flex: none; }
.car-picker-item.selected { border-color: rgba(200, 240, 60, .45); background: rgba(200, 240, 60, .06); }
.car-picker-item.selected .radio { border-color: var(--lime); }
.car-picker-item.selected .radio::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.stage .tagline { display: none; }
.stage .brand { gap: 0; }
@media (max-width: 760px) {
  html:not(.stage-mode):not(.page-zoom) .topbar .car-picker { order: 3; flex: 1 0 100%; }
  html:not(.stage-mode):not(.page-zoom) .topbar .car-picker-menu { width: 100%; }
}
.theme-wave .car-picker-btn { border-color: var(--edge); background: rgba(10, 20, 36, .7); }
.theme-wave .car-picker-chev { stroke: var(--cyan); }
.theme-wave .car-picker-menu { border-color: var(--edge); background: #0a1424; }
.theme-wave .car-picker-item.selected { border-color: rgba(34, 211, 238, .5); background: rgba(34, 211, 238, .08); }
.theme-wave .car-picker-item.selected .radio { border-color: var(--cyan); }
.theme-wave .car-picker-item.selected .radio::after { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.remote .car-picker { flex: none; width: 100%; }
.remote .car-picker-btn { min-height: 76px; }
.remote .car-picker-btn .car-art { width: 108px; height: 68px; }
.remote .car-picker-text b { font-size: 17px; white-space: normal; }
.remote .car-picker-menu { width: 100%; }
.remote .car-picker-list { max-height: 60vh; }
.remote-volume { display: grid; gap: 8px; }
.remote-volume span { display: flex; justify-content: space-between; color: var(--text-2); font-size: 14px; }
.remote-volume input { width: 100%; accent-color: var(--lime); height: 36px; }
.help-steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; line-height: 1.5; color: var(--text); }
.help-steps li::marker { color: var(--lime); }
.help .panel p { margin: 0; line-height: 1.5; }
.help .panel .hint { color: var(--text-3); }
.flag-inline { width: 21px; height: 14px; object-fit: cover; border-radius: 2px; vertical-align: -2px; margin-right: 4px; }

/* License */
.free-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(200, 240, 60, .45);
  color: var(--lime); text-decoration: none; font: 400 10.5px var(--label); letter-spacing: .18em; text-transform: uppercase; white-space: nowrap; }
.free-chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.theme-wave .free-chip { border-color: rgba(34, 211, 238, .5); color: var(--cyan); }
.source-list button.locked { opacity: .55; }
.qr-panel { align-items: flex-start; }
.qr { width: 220px; height: 220px; border-radius: 12px; background: #fff; padding: 6px; }
.pair-code { font: 400 28px var(--label); letter-spacing: .3em; color: var(--text); overflow-wrap: anywhere; }
.key-input { width: 100%; min-height: 50px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-solid);
  color: var(--text); font: 500 18px var(--font); letter-spacing: .06em; text-transform: uppercase; }
.notice.ok { border-color: rgba(126, 224, 74, .55); background: rgba(126, 224, 74, .08); }
.btn-danger { border-color: rgba(255, 77, 94, .6); color: var(--bad); }
.license-cars { margin: 0; padding-left: 18px; color: var(--text-2); display: grid; gap: 4px; }
.admin-field { display: grid; gap: 4px; }
.admin-field input, .admin-field select, .admin-field textarea, .admin-search { min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel-solid); color: var(--text); font: inherit; width: 100%; }
.admin-field textarea { padding: 10px 12px; resize: vertical; min-height: 140px; line-height: 1.45; }
.admin-inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.admin-tabs, .admin-range { margin-bottom: 14px; flex-wrap: wrap; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.kpi span { color: var(--text-3); font-size: 13px; }
.kpi b { font: 400 24px var(--label); color: var(--text); }
.kpi small { color: var(--text-2); font-size: 13px; }
.admin-chart { display: flex; align-items: flex-end; gap: 2px; height: 160px; padding-top: 16px; }
.admin-chart .bar { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; min-width: 2px; }
.admin-chart i { display: block; width: 100%; border-radius: 2px 2px 0 0; }
.admin-chart i.paid, .swatch.paid { background: var(--lime); }
.admin-chart i.free, .swatch.free { background: rgba(75, 225, 255, .45); }
.admin-chart .sale { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--amber); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
.admin-usage { display: grid; gap: 2px; color: var(--text-2); font-size: 14px; }
.feedback-message { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.diag-preview { max-height: 320px; overflow: auto; margin: 0; padding: 10px; border-radius: 8px; background: rgba(0, 0, 0, .35); color: var(--text-2);
  font: 12px/1.4 ui-monospace, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-form { max-width: 760px; }
.feedback-form .setting { padding: 0; border: 0; }
.admin-table { display: grid; gap: 10px; }
.admin-row { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.admin-row.revoked { opacity: .55; }
.admin-row small { color: var(--text-3); }
.admin-cars { display: flex; flex-wrap: wrap; gap: 10px; color: var(--text-2); font-size: 14px; }
.admin-car { padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, .05); }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.car-picker { min-width: 230px; }
@media (max-width: 1500px) { .topbar .tagline { display: none; } .topbar .brand { gap: 0; } }
@media (max-width: 1360px) { html:not(.stage-mode) .gps-state > span, html:not(.stage-mode) .top-btn-text { display: none; } }
.stage .top-btn-text { display: none; }

/* ---- Shop: owned and locked engines, buying from the car (QR) and on the phone (/buy) ---- */
.card.locked .car-art, .card.locked .card-title, .card.locked .card-sub, .card.locked .card-text, .card.locked .card-specs { opacity: .45; }
.card.locked .car-art { filter: grayscale(.6); }
.btn-buy { min-height: 38px; padding: 0 14px; gap: 6px; font-size: 12px; }
.btn-buy svg, .car-picker-lock { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.car-picker-lock { flex: none; color: var(--text-3); margin-left: auto; }
.shop-banner { flex-direction: row; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.shop-banner h2 { margin: 0 0 4px; }
.shop-banner p { margin: 0; color: var(--text-2); }
.buy-dialog { align-items: center; text-align: center; }
.buy-prices { color: var(--text-2); margin: 0; }
.shop-list { display: grid; gap: 8px; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-solid); color: var(--text); font: inherit; text-align: left; width: 100%; }
.shop-item .car-art { width: 84px; height: auto; flex: none; border-radius: 8px; }
.shop-item b { display: block; font-weight: 600; }
.shop-item small { color: var(--text-3); }
.shop-item .shop-check { margin-left: auto; width: 22px; height: 22px; flex: none; accent-color: var(--lime); }
.shop-item.selected { border-color: var(--lime); }
.shop-item.owned { opacity: .6; }
.shop-bundle { border-color: rgba(200, 240, 60, .45); background: linear-gradient(180deg, rgba(200, 240, 60, .08), transparent); }
.shop-summary { display: grid; gap: 4px; }
.shop-summary .kv b { font-size: 20px; }
.shop-key { font: 600 22px var(--font); letter-spacing: .08em; padding: 12px; border-radius: 10px; background: rgba(255, 255, 255, .06); text-align: center; overflow-wrap: anywhere; user-select: all; }
.admin-engines { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-engines label { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 8px; font-size: 14px; }

/* Swipe between dashboards: the wrapper adds no box, and horizontal pans are left to the page script. */
.cockpit-swipe { display: contents; }
.cockpit, .wave-dash { touch-action: pan-y; }
