/* DRIP KINGS - instrument-panel interface. Black etched glass, brushed steel,
   carbon weave, one anodised orange. No glow, no pills. */
:root {
  --bg: #070809;
  --ink: #0b0c0e;
  --carbon: #141517;
  --carbon-2: #1b1d20;
  --steel: #c7ccd1;
  --steel-mid: #8b9299;
  --steel-dim: #5c636b;
  --steel-dark: #2b2f34;
  --line: rgba(170, 180, 190, 0.26);
  --orange: #ff6b14;
  --orange-hot: #ff8a2a;
  --amber: #ffc15e;
  --paper: #f0f2f3;
  --muted: #7b838c;
  --danger: #b4241c;
  --font-text: "Barlow Semi Condensed", "Arial Narrow", Arial, sans-serif;
  --font-num: "Chakra Petch", "Consolas", monospace;
  --font-display: "Big Shoulders", "Barlow Semi Condensed", sans-serif;
  --pad: clamp(14px, 2.4vw, 40px);
  --plate-w: clamp(248px, 28vw, 388px);
  --plate-h: clamp(44px, 6.4vh, 72px);
  --plate-gap: clamp(4px, 0.65vh, 8px);
  --cluster-scale: 1;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--paper);
  font-family: var(--font-text);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body { font-weight: 500; }
#app { position: fixed; inset: 0; background: #050607; }
#scene { display: block; width: 100%; height: 100%; outline: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { -webkit-user-drag: none; }
.hidden { display: none !important; }
.kicker {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--steel-mid);
}
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

#vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 6;
  background:
    radial-gradient(ellipse at 50% 52%, rgba(0,0,0,0) 46%, rgba(0,0,0,0.34) 100%),
    linear-gradient(to bottom, rgba(0,0,0,0.28), rgba(0,0,0,0) 18%, rgba(0,0,0,0) 76%, rgba(0,0,0,0.4));
}
#speed-mask {
  position: absolute; inset: 0; pointer-events: none; z-index: 5; opacity: 0;
  background: radial-gradient(ellipse at 50% 55%, rgba(0,0,0,0) 52%, rgba(10,10,10,0.32) 100%);
  transition: opacity .3s linear;
}
#fade {
  position: absolute; inset: 0; z-index: 90; background: #030404; opacity: 0;
  pointer-events: none; transition: opacity .36s ease;
}
#fade.show { opacity: 1; pointer-events: auto; }

/* ---------- Boot ---------- */
#boot {
  position: absolute; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 45%, #101214 0%, #050607 68%);
}
.boot-inner { width: min(460px, 82vw); text-align: left; }
.boot-crest { width: 56px; display: block; margin-bottom: 14px; opacity: .95; }
.boot-title { width: min(300px, 62vw); display: block; }
.boot-line { height: 2px; background: #22262a; margin: 26px 0 10px; position: relative; overflow: hidden; }
.boot-line i { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--orange); transition: width .25s ease; }
.boot-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--steel-dim); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; }
.boot-note { margin-top: 14px; color: #5b626a; font-size: 11px; letter-spacing: .08em; }

/* ---------- Start menu ---------- */
#screen-menu { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#screen-menu::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, rgba(4,5,6,.72) 0%, rgba(4,5,6,.44) 26%, rgba(4,5,6,0) 48%);
}
.brand {
  position: absolute; left: var(--pad); top: var(--pad);
  pointer-events: none;
  filter: drop-shadow(0 8px 22px rgba(0,0,0,.35));
}
.brand .crest { display: block; width: clamp(48px, 6.2vw, 86px); height: auto; margin-bottom: 8px; }
.brand .wordmark { display: block; width: clamp(250px, 29vw, 452px); height: auto; }
.menu-list {
  position: absolute; left: var(--pad);
  top: calc(var(--pad) + clamp(190px, 27vh, 300px));
  width: var(--plate-w);
  display: flex; flex-direction: column;
  gap: var(--plate-gap);
  pointer-events: auto;
}
.plate {
  position: relative;
  height: var(--plate-h);
  width: 100%;
  display: flex; align-items: center;
  padding: 0 17% 0 11%;
  background: url("../assets/elements/menu_plates_01_plate_resting.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 5px 9px rgba(0,0,0,.38));
  transition: transform .14s ease, filter .14s ease;
  outline: none;
  text-align: left;
}
.plate:hover, .plate:focus-visible {
  background-image: url("../assets/elements/menu_plates_02_plate_hovered.webp");
  transform: translateX(4px);
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.46));
}
.plate:active { transform: translateX(2px) scale(.997); }
.plate-label {
  font-family: var(--font-text);
  font-size: clamp(16px, 1.46vw, 21px);
  font-weight: 600;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: #eef1f3;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(0,0,0,.6);
}
.plate .chev {
  position: absolute; right: 7%; top: 50%; transform: translateY(-50%);
  width: 22px; height: auto; opacity: 0; transition: opacity .14s ease;
}
.plate:hover .chev, .plate:focus-visible .chev { opacity: .95; }
.plate.sealed { background-image: url("../assets/elements/menu_plates_03_plate_sealed.webp"); filter: drop-shadow(0 3px 6px rgba(0,0,0,.3)); }
.plate.sealed .plate-label { color: #697078; }
.plate.sealed:hover { transform: none; background-image: url("../assets/elements/menu_plates_03_plate_sealed.webp"); filter: drop-shadow(0 3px 6px rgba(0,0,0,.3)); }
.plate.sealed .chev { display: none; }
.plate .lock {
  position: absolute; right: 8%; top: 50%; transform: translateY(-50%);
  font-family: var(--font-num); font-size: 9px; letter-spacing: .16em; color: #555c63;
}
.legend {
  position: absolute; left: var(--pad); bottom: var(--pad);
  display: flex; align-items: center; gap: 10px;
  color: var(--steel-dim); font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  pointer-events: none;
}
.legend .key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 5px;
  border: 1px solid rgba(160,170,180,.28);
  background: linear-gradient(180deg, rgba(40,44,48,.9), rgba(14,16,18,.9));
  color: #b9c0c6; font-family: var(--font-num); font-size: 9px; letter-spacing: .06em;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 88% 100%, 0 100%);
}
.legend .sep { width: 1px; height: 12px; background: rgba(170,180,190,.2); }
.legend .legend-touch { display: none; }
.menu-note {
  position: absolute; right: var(--pad); bottom: var(--pad);
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: #596067;
  text-align: right; pointer-events: none;
}
.menu-note b { color: #8d949b; font-weight: 600; }

/* ---------- HUD ---------- */
#race-ui { position: absolute; inset: 0; z-index: 15; pointer-events: none; }
.top-rail {
  position: absolute; top: 13px; left: 50%; transform: translateX(-50%);
  width: min(52vw, 760px); height: 32px;
  display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(90deg, rgba(10,11,13,.0), rgba(18,20,22,.88) 12%, rgba(18,20,22,.88) 88%, rgba(10,11,13,0)),
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 2px, rgba(0,0,0,0) 2px 4px);
  clip-path: polygon(0 0, 100% 0, 97% 50%, 100% 100%, 0 100%, 3% 50%);
}
.top-rail::before {
  content: ""; position: absolute; left: 8%; right: 8%; bottom: 4px; height: 1px;
  background: linear-gradient(90deg, rgba(255,107,20,0), rgba(255,107,20,.8), rgba(255,107,20,0));
}
.top-rail .crest { width: 36px; height: auto; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); }
.race-line {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px;
  background: rgba(8,9,10,.64);
  border-top: 1px solid rgba(170,180,190,.18);
  border-bottom: 1px solid rgba(170,180,190,.12);
  color: var(--steel-mid); font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
  white-space: nowrap;
}
.race-line .dot { width: 3px; height: 3px; background: var(--orange); transform: rotate(45deg); }
.race-line .num { color: #e9edef; font-size: 12px; letter-spacing: .08em; }
.race-line .accent { color: var(--orange); }

.minimap-panel { position: absolute; left: var(--pad); top: var(--pad); width: clamp(138px, 13.5vw, 198px); }
.minimap-frame { position: relative; width: 100%; aspect-ratio: 281 / 274; filter: drop-shadow(0 7px 16px rgba(0,0,0,.42)); }
.minimap-frame > img { position: absolute; inset: 0; width: 100%; height: 100%; }
#minimap { position: absolute; left: 7.5%; top: 7.5%; width: 85%; height: 82%; display: block; }
.minimap-caption {
  display: flex; justify-content: space-between; margin-top: 4px; padding: 0 5px;
  color: var(--steel-dim); font-size: 9px; letter-spacing: .18em; text-transform: uppercase;
}
.minimap-caption b { color: #a6adb4; font-weight: 600; }

.objective-panel { position: absolute; left: var(--pad); top: 38%; width: clamp(226px, 22vw, 312px); filter: drop-shadow(0 7px 16px rgba(0,0,0,.4)); }
.objective-panel > img.plate-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.objective-body {
  position: relative; display: grid; grid-template-columns: 34px 1fr 40px; gap: 10px;
  align-items: center; padding: 13px 12px 14px 13px;
}
.objective-icon { width: 30px; height: auto; opacity: .9; }
.objective-title { font-size: 14px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #edf0f2; line-height: 1.15; }
.objective-sub { margin-top: 4px; color: var(--steel-mid); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; line-height: 1.2; }
.objective-sub .num { color: var(--orange); font-size: 12px; letter-spacing: .03em; }
.nav-chev { width: 30px; height: auto; transform-origin: 50% 50%; }

.cash-panel {
  position: absolute; right: var(--pad); top: var(--pad);
  width: clamp(182px, 17vw, 240px); aspect-ratio: 318 / 163;
  filter: drop-shadow(0 7px 16px rgba(0,0,0,.42));
}
.cash-panel > img.plate-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cash-icon { position: absolute; left: 3.5%; top: 23%; width: 15%; }
.cash-icon img { width: 100%; display: block; }
.cash-body { position: absolute; left: 22%; right: 6%; top: 17%; }
.cash-amount { margin-top: 5px; font-family: var(--font-num); font-weight: 600; font-variant-numeric: tabular-nums; font-size: clamp(20px, 2.05vw, 28px); line-height: 1; color: #f4f6f7; letter-spacing: .01em; }
.cash-amount .pre { color: var(--steel-mid); font-size: .62em; margin-right: 3px; }
.test-badge { position: absolute; right: 8%; bottom: 10%; font-family: var(--font-num); font-size: 8px; letter-spacing: .16em; color: var(--orange); border: 1px solid rgba(255,107,20,.45); padding: 1px 4px; }

.pause-btn {
  position: absolute; right: var(--pad); top: calc(var(--pad) + clamp(140px, 14vw, 178px));
  width: 38px; height: 34px; pointer-events: auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(28,31,34,.9), rgba(10,11,13,.94));
  border: 1px solid rgba(170,180,190,.24);
  clip-path: polygon(0 0, 100% 0, 100% 74%, 84% 100%, 0 100%);
}
.pause-btn img { width: 12px; height: auto; opacity: .82; }
.pause-btn:hover { border-color: rgba(255,107,20,.6); }

.cluster {
  position: absolute; right: var(--pad); bottom: var(--pad);
  display: flex; align-items: flex-end; gap: clamp(4px, .55vw, 9px);
  transform-origin: 100% 100%;
  filter: drop-shadow(0 9px 20px rgba(0,0,0,.45));
}
.gauge { position: relative; flex: none; }
.gauge.big { width: clamp(118px, 12.2vw, 176px); aspect-ratio: 1; }
.gauge.small { width: clamp(64px, 6.4vw, 92px); aspect-ratio: 1; }
.gauge > img.face { position: absolute; inset: 0; width: 100%; height: 100%; }
.gauge > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.gear-plate {
  position: relative; width: clamp(54px, 5.8vw, 82px); aspect-ratio: 221 / 214;
  margin: 0 clamp(1px, .4vw, 5px) clamp(8px, 1.1vw, 15px);
}
.gear-plate > img { position: absolute; inset: 0; width: 100%; height: 100%; }
.gear-recess {
  position: absolute; inset: 22% 20% 21% 20%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 50%, #0a0b0c 0%, #121417 70%, rgba(0,0,0,0) 100%);
}
.gear-recess .g { font-family: var(--font-num); font-weight: 600; font-size: clamp(20px, 2.4vw, 34px); line-height: .9; color: var(--orange); letter-spacing: 0; }
.gear-recess .cap { margin-top: 4px; font-size: 8px; letter-spacing: .16em; color: var(--steel-dim); }
.gauge .cap {
  position: absolute; left: 0; right: 0; bottom: 7%;
  text-align: center; font-size: 8px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--steel-dim); pointer-events: none;
}

/* ---------- Touch driving ---------- */
.touch { display: none; }
body.touch .touch { display: block; }
.touch-pad { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 3; pointer-events: auto; display: flex; gap: 10px; align-items: flex-end; }
.touch-left { left: max(16px, env(safe-area-inset-left)); }
.touch-right { right: max(16px, env(safe-area-inset-right)); }
.touch-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 62px; height: 62px;
  background: linear-gradient(180deg, rgba(31,34,37,.88), rgba(9,10,12,.92));
  border: 1px solid rgba(170,180,190,.28);
  color: #d9dee2; font-family: var(--font-num); font-size: 9px; letter-spacing: .12em;
  clip-path: polygon(0 0, 100% 0, 100% 76%, 82% 100%, 0 100%);
  touch-action: none;
  transition: background .08s linear, border-color .08s linear;
}
.touch-btn::after {
  content: ""; position: absolute; left: 10%; right: 10%; bottom: 4px; height: 2px;
  background: var(--orange); opacity: .8;
}
.touch-btn.on { background: linear-gradient(180deg, rgba(64,70,76,.95), rgba(17,19,21,.95)); border-color: var(--orange); }
.touch-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.touch-btn.pedal { width: 64px; height: 96px; flex-direction: column; gap: 7px; }
.touch-btn.pedal .label { font-size: 8px; letter-spacing: .14em; }
.touch-btn.hb { width: 50px; height: 50px; align-self: flex-end; margin-right: 4px; }
.touch-btn.hb span { font-size: 10px; letter-spacing: .06em; }
.touch-left .touch-btn { width: 72px; }
.touch-left .touch-btn svg { width: 26px; height: 26px; }

/* ---------- Modals ---------- */
.modal { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: var(--pad); }
.modal .dim { position: absolute; inset: 0; background: rgba(3,5,6,.62); backdrop-filter: blur(2px); }
.console {
  position: relative; z-index: 2;
  background:
    linear-gradient(180deg, rgba(26,28,31,.98), rgba(10,11,13,.985)),
    repeating-linear-gradient(45deg, rgba(255,255,255,.018) 0 2px, rgba(0,0,0,0) 2px 5px);
  border: 1px solid rgba(170,180,190,.3);
  box-shadow: 0 24px 70px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
}
.console::before {
  content: ""; position: absolute; left: 0; top: 26px; bottom: 26px; width: 2px;
  background: linear-gradient(180deg, rgba(255,107,20,0), var(--orange) 24%, var(--orange) 76%, rgba(255,107,20,0));
}
.console-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 26px 14px; border-bottom: 1px solid rgba(170,180,190,.18); }
.console-head .crest { width: 34px; }
.console-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(28px, 3.8vw, 54px); line-height: .92; letter-spacing: .07em; text-transform: uppercase; }
.console-title small { display: block; margin-bottom: 5px; font-family: var(--font-text); font-size: 9px; letter-spacing: .24em; color: var(--steel-dim); }
.console-close { width: 34px; height: 32px; border: 1px solid rgba(170,180,190,.26); color: var(--steel-mid); font-size: 14px; }
.console-close:hover { border-color: var(--orange); color: #fff; }
.console-body { padding: 18px 26px 24px; }

/* pause */
.pause-console { width: min(420px, 92vw); }
.pause-list { display: flex; flex-direction: column; gap: 8px; }
.pause-list .plate { height: 58px; width: 100%; }
.pause-list .plate-label { font-size: 16px; }
.pause-foot { margin-top: 14px; color: var(--steel-dim); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; display: flex; justify-content: space-between; }

/* race console */
.race-console { width: min(660px, 94vw); }
.event-card { padding: 18px 0 16px; border-bottom: 1px solid rgba(170,180,190,.16); }
.event-kicker { display: flex; justify-content: space-between; color: var(--steel-dim); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; }
.event-name { font-family: var(--font-display); font-weight: 700; font-size: clamp(36px, 5vw, 64px); letter-spacing: .03em; line-height: 1; margin-top: 6px; }
.event-name span { color: var(--orange); }
.event-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.stat { border-left: 1px solid rgba(170,180,190,.2); padding-left: 10px; }
.stat:first-child { border-left-color: var(--orange); }
.stat .k { display: block; color: var(--steel-dim); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
.stat .v { display: block; margin-top: 4px; font-family: var(--font-num); font-size: 17px; color: #eef1f3; }
.event-copy { margin-top: 14px; color: #aeb5bc; font-size: 13px; line-height: 1.45; max-width: 52ch; }
.console-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.action {
  position: relative; min-width: 158px; height: 52px; padding: 0 18px;
  background: url("../assets/elements/menu_plates_01_plate_resting.webp") center / 100% 100% no-repeat;
  font-family: var(--font-text); font-size: 13px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  text-align: left; color: #edf0f2;
}
.action:hover { background-image: url("../assets/elements/menu_plates_02_plate_hovered.webp"); }
.action.ghost { background: linear-gradient(180deg, rgba(30,33,36,.8), rgba(10,11,13,.9)); border: 1px solid rgba(170,180,190,.28); clip-path: polygon(0 0, 100% 0, 100% 74%, 88% 100%, 0 100%); }
.action.ghost:hover { border-color: rgba(255,107,20,.65); }
.action.sealed { background-image: url("../assets/elements/menu_plates_03_plate_sealed.webp"); color: #656c73; pointer-events: none; }
.future-events { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
.future-events .action { min-width: 0; height: 46px; font-size: 11px; }

/* settings */
.settings-console { width: min(760px, 95vw); display: flex; }
.settings-spine { position: relative; width: 56px; flex: none; overflow: hidden; background: #101113; }
.settings-spine img { height: 100%; width: auto; display: block; opacity: .9; }
.settings-body { flex: 1; min-width: 0; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(170,180,190,.13); min-height: 54px; }
.setting .sl { min-width: 0; }
.setting .sl b { display: block; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #dfe4e7; }
.setting .sl small { display: block; margin-top: 3px; color: var(--steel-dim); font-size: 10px; letter-spacing: .06em; }
.toggle { width: 46px; height: 24px; border: 1px solid rgba(170,180,190,.3); background: #111315; position: relative; flex: none; }
.toggle i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #596168; transition: all .16s ease; }
.toggle.on { border-color: rgba(255,107,20,.55); background: #18120c; }
.toggle.on i { left: 25px; background: var(--orange); }
.seg { display: flex; gap: 3px; }
.seg button { border: 1px solid rgba(170,180,190,.22); padding: 5px 8px; color: var(--steel-mid); font-family: var(--font-num); font-size: 10px; letter-spacing: .06em; }
.seg button.on { border-color: var(--orange); color: #fff; background: rgba(255,107,20,.1); }
.settings-dev { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,107,20,.24); }
.settings-dev .dev-title { color: var(--orange); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; margin-bottom: 8px; }
.dev-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.mini { border: 1px solid rgba(170,180,190,.26); padding: 6px 9px; font-family: var(--font-num); font-size: 10px; letter-spacing: .05em; color: #c6ccd1; }
.mini:hover { border-color: rgba(255,107,20,.6); color: #fff; }
.sky-slider { flex: 1; min-width: 140px; accent-color: var(--orange); }
.dev-note { color: #5f666d; font-size: 10px; letter-spacing: .05em; }
.controls-block { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 14px; padding-top: 14px; color: var(--steel-dim); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }

/* results */
.results-console { width: min(760px, 94vw); }
.results-top { display: grid; grid-template-columns: 0.9fr 1.6fr; gap: 20px; align-items: end; padding: 18px 0 20px; border-bottom: 1px solid rgba(170,180,190,.18); }
.place { font-family: var(--font-display); font-weight: 700; font-size: clamp(84px, 12vw, 150px); line-height: .78; letter-spacing: -0.02em; color: #f3f5f6; }
.place span { color: var(--orange); font-family: var(--font-num); font-size: .38em; letter-spacing: .04em; margin-left: 8px; vertical-align: super; }
.place-cap { margin-top: 10px; color: var(--steel-dim); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; }
.result-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 18px; }
.rstat .k { color: var(--steel-dim); font-size: 9px; letter-spacing: .18em; text-transform: uppercase; }
.rstat .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: clamp(18px, 2.2vw, 26px); color: #f0f3f4; }
.rstat.cash .v { color: var(--orange); font-weight: 600; }
.results-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 18px; flex-wrap: wrap; }
.result-note { color: var(--steel-dim); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

/* leave */
.leave-console { width: min(420px, 92vw); }

/* toast + countdown */
#toast-layer { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); z-index: 55; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  min-width: 200px; padding: 10px 18px 11px; text-align: center;
  background: linear-gradient(180deg, rgba(26,29,32,.94), rgba(8,9,11,.95));
  border-top: 1px solid rgba(170,180,190,.32);
  border-bottom: 1px solid rgba(255,107,20,.7);
  clip-path: polygon(0 0, 100% 0, 100% 76%, 94% 100%, 0 100%);
  animation: toastIn .18s ease both;
}
.toast b { display: block; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: #f1f4f5; font-weight: 600; }
.toast small { display: block; margin-top: 3px; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--steel-mid); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
#countdown {
  position: absolute; inset: 0; z-index: 58; display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; transition: opacity .18s ease;
}
#countdown.show { opacity: 1; }
#countdown .cd-num {
  font-family: var(--font-num); font-weight: 600; font-size: clamp(90px, 20vw, 240px); line-height: 1;
  color: #f2f4f5; letter-spacing: -0.02em;
  text-shadow: 0 0 0 rgba(0,0,0,0);
  -webkit-text-stroke: 1px rgba(0,0,0,.2);
}
#countdown.go .cd-num { color: var(--orange); font-size: clamp(110px, 24vw, 300px); }
#countdown .cd-cap { position: absolute; margin-top: 24vh; color: var(--steel-mid); font-size: 10px; letter-spacing: .26em; text-transform: uppercase; }

/* touch-only adjustments */
body.touch .legend .legend-keys { display: none; }
body.touch .legend .legend-touch { display: inline; }

@media (max-aspect-ratio: 1/1) {
  :root { --pad: 14px; --plate-w: calc(100vw - 28px); --plate-h: clamp(43px, 6.2vh, 58px); --plate-gap: 4px; }
  #screen-menu::before { background: linear-gradient(to top, rgba(4,5,6,.86) 0%, rgba(4,5,6,.45) 46%, rgba(4,5,6,0) 74%); }
  .brand { top: 14px; left: 14px; }
  .brand .crest { width: 44px; margin-bottom: 5px; }
  .brand .wordmark { width: min(58vw, 270px); }
  .menu-list { left: 14px; right: 14px; width: auto; top: auto; bottom: 44px; gap: 4px; }
  .plate { padding-left: 10%; padding-right: 14%; }
  .plate-label { font-size: clamp(15px, 4.2vw, 19px); }
  .legend { left: 14px; right: 14px; bottom: 14px; gap: 6px; font-size: 8px; letter-spacing: .12em; }
  .legend .key { min-width: 18px; height: 17px; font-size: 8px; }
  .menu-note { display: none; }
  .top-rail { width: 76vw; height: 28px; top: 8px; }
  .race-line { top: 40px; font-size: 8px; padding: 3px 8px; gap: 7px; }
  .minimap-panel { width: clamp(104px, 29vw, 132px); top: 10px; left: 10px; }
  .minimap-caption { font-size: 7px; letter-spacing: .1em; }
  .cash-panel { width: clamp(148px, 42vw, 188px); top: 10px; right: 10px; }
  .pause-btn { right: 10px; top: 74px; width: 32px; height: 29px; }
  .objective-panel { width: min(54vw, 226px); left: 10px; top: 33%; }
  .objective-body { grid-template-columns: 24px 1fr 26px; gap: 6px; padding: 9px 8px 10px 9px; }
  .objective-icon { width: 22px; }
  .objective-title { font-size: 11px; letter-spacing: .1em; }
  .objective-sub { font-size: 8px; }
  .objective-sub .num { font-size: 9px; }
  .nav-chev { width: 22px; }
  .cluster { right: 10px; bottom: calc(112px + env(safe-area-inset-bottom)); gap: 4px; transform: scale(.9); transform-origin: 100% 100%; }
  .gauge.big { width: clamp(86px, 24vw, 108px); }
  .gauge.small { width: clamp(44px, 12vw, 56px); }
  .gear-plate { width: clamp(38px, 10.5vw, 48px); margin: 0 1px 6px; }
  .gauge .cap { display: none; }
  .gear-recess .g { font-size: 18px; }
  .gear-recess .cap { font-size: 6px; }
  .modal { padding: 12px; align-items: flex-end; }
  .console { width: 100% !important; max-height: 92vh; overflow: auto; }
  .console-head { padding: 14px 16px 12px; }
  .console-body { padding: 14px 16px 18px; }
  .settings-console { display: block; }
  .settings-spine { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .results-top { grid-template-columns: 1fr; gap: 12px; }
  .place { font-size: 80px; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .future-events { grid-template-columns: 1fr; }
  .action { height: 48px; min-width: 132px; }
  .touch { display: block; }
}

@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  :root { --plate-h: clamp(38px, 8.2vh, 48px); --plate-gap: 3px; }
  .brand .crest { width: 38px; }
  .brand .wordmark { width: min(30vw, 240px); }
  .menu-list { top: auto; bottom: 38px; width: min(44vw, 360px); gap: 3px; }
  .legend { bottom: 8px; font-size: 8px; }
  .menu-note { display: none; }
  .cluster { transform: scale(.78); }
  .minimap-panel { width: 112px; }
  .objective-panel { top: 30%; width: 210px; }
  .cash-panel { width: 170px; }
}

@media (hover: none) {
  .plate:hover { transform: none; background-image: url("../assets/elements/menu_plates_01_plate_resting.webp"); filter: drop-shadow(0 5px 9px rgba(0,0,0,.38)); }
  .plate.sealed:hover { background-image: url("../assets/elements/menu_plates_03_plate_sealed.webp"); }
}

/* Shared mbcontrols-1 layer: keep it below the pause and result plates. */
#control-mount { position: absolute; inset: 0; pointer-events: none; }
body.modal-open [data-mbcontrols-layer] { display: none !important; }
body.touch .cluster { bottom: calc(150px + env(safe-area-inset-bottom)); }
@media (max-aspect-ratio: 1/1) {
  body.touch .cluster { bottom: calc(150px + env(safe-area-inset-bottom)); }
}

/* The page frame can arrive in a landscape touch viewport with its own
   body-hiding rule; this page lays out in every orientation, so keep it drawn. */
html body { display: block !important; }

/* Portrait: the console is a two-column plate grid so the car stays visible
   above it. The plate order is still the eight front doors, read across. */
@media (max-aspect-ratio: 1/1) {
  .menu-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: clamp(42px, 5.6vh, 52px);
    gap: 5px 6px;
    bottom: 44px;
    left: 14px;
    right: 14px;
    width: auto;
  }
  .menu-list .plate { height: 100%; padding: 0 9%; }
  .plate-label { font-size: clamp(13px, 3.5vw, 17px); letter-spacing: .14em; }
  .plate .lock { display: none; }
  .plate .chev { display: none; }
}

@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .menu-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 36px;
    gap: 4px 6px;
    width: min(46vw, 480px);
    top: auto;
    bottom: 38px;
  }
  .menu-list .plate { height: 100%; padding: 0 8%; }
  .plate-label { font-size: 12px; letter-spacing: .12em; }
  .plate .lock, .plate .chev { display: none; }
}

/* Portrait HUD: the phone gets a compact top strip and the shared controls
   carry the pause. The top rail was a desktop flourish, not a phone one. */
@media (max-aspect-ratio: 1/1) {
  .top-rail { display: none; }
  .race-line {
    top: 98px; right: 10px; left: auto; transform: none;
    font-size: 8px; padding: 3px 8px; gap: 7px;
  }
  .race-line .num { font-size: 10px; }
  .minimap-panel { width: clamp(96px, 27vw, 118px); }
  body.touch .pause-btn { display: none; }
  .cash-panel { width: clamp(148px, 41vw, 180px); }
  .cluster { bottom: calc(148px + env(safe-area-inset-bottom)); transform: scale(0.95); transform-origin: 100% 100%; }
}

@media (max-aspect-ratio: 1/1) {
  .cluster { transform: scale(0.95); }
  .gauge.big { width: clamp(92px, 25vw, 102px); }
  .gauge.small { width: clamp(46px, 12.5vw, 52px); }
  .gear-plate { width: clamp(40px, 11vw, 46px); }
}

/* The shared controller is one object, drawn with the page's own materials:
   a thumbstick for steering, plus gas and brake pedals and the E brake. */
[data-mbcontrols="gas"], [data-mbcontrols="brake"], [data-mbcontrols="handbrake"], [data-mbcontrols="pause"] {
  border-radius: 3px !important;
  border: 1px solid rgba(170,180,190,.42) !important;
  background: linear-gradient(180deg, rgba(38,42,46,.94), rgba(8,9,11,.96)) !important;
  color: #e9edef !important;
  font-family: var(--font-text) !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  letter-spacing: .08em !important;
  text-transform: uppercase;
  clip-path: polygon(0 0, 100% 0, 100% 76%, 84% 100%, 0 100%);
  box-shadow: 0 5px 14px rgba(0,0,0,.35);
}
[data-mbcontrols="gas"]::after, [data-mbcontrols="brake"]::after, [data-mbcontrols="handbrake"]::after {
  content: ""; position: absolute; left: 12%; right: 12%; bottom: 4px; height: 2px;
  background: var(--orange); opacity: .82;
}
[data-mbcontrols="gas"] { border-color: rgba(255,107,20,.58) !important; }
[data-mbcontrols="gas"]:active, [data-mbcontrols="brake"]:active, [data-mbcontrols="handbrake"]:active {
  background: linear-gradient(180deg, rgba(62,66,70,.96), rgba(16,18,20,.97)) !important;
}
body.touch .cluster { bottom: calc(180px + env(safe-area-inset-bottom)); }

/* Upright phone: the objective plate sits under the minimap, clear of the car. */
@media (max-aspect-ratio: 1/1) {
  .objective-panel { top: 136px; width: min(54vw, 214px); }
}
