:root {
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --asphalt: #0e1116;
  --navy: #1b2430;
  --red: #c8102e;
  --amber: #ffb43a;
  --blue: #3d5a99;
  --cream: #e8ecef;
  --grey: #6b7280;
  --pale: #cfd6dd;
  --display: "Big Shoulders Stencil", "Arial Narrow", sans-serif;
  --text: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "Azeret Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --glass: linear-gradient(180deg, rgba(16, 21, 28, .80), rgba(9, 12, 17, .88));
  --hairline: rgba(207, 214, 221, .18);
  --hairline-strong: rgba(207, 214, 221, .34);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #05070a;
  color: var(--cream);
  font-family: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
body { overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 1px solid var(--amber); outline-offset: 3px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

#app {
  position: fixed;
  inset: 0;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  isolation: isolate;
}

#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#view.dragging { cursor: grabbing; }

#grade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(0,0,0,0) 42%, rgba(3,5,9,.52) 100%),
    linear-gradient(to bottom, rgba(5,8,14,.18) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 68%, rgba(4,6,10,.4) 100%);
  mix-blend-mode: normal;
  z-index: 2;
}
#speedlines { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 2; }

/* ------------------------------------------------------------------ screens */

.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    calc(clamp(20px, 4.2vw, 64px) + var(--sat))
    calc(clamp(20px, 4.2vw, 64px) + var(--sar))
    calc(clamp(20px, 4.2vw, 64px) + var(--sab))
    calc(clamp(20px, 4.2vw, 64px) + var(--sal));
}
#menu {
  background:
    linear-gradient(to top, rgba(4, 7, 11, .92) 0%, rgba(5, 8, 12, .55) 26%, rgba(5, 8, 12, 0) 55%),
    linear-gradient(to right, rgba(5, 8, 12, .55) 0%, rgba(5, 8, 12, .14) 34%, rgba(5, 8, 12, 0) 60%);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: clamp(9px, .78vw, 11px);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--pale);
  opacity: .82;
}
.eyebrow .rule { display: inline-block; width: 34px; height: 1px; background: var(--amber); opacity: .85; }

/* wordmark */
.menu-top { max-width: 60vw; }
.wordmark {
  position: relative;
  margin: clamp(10px, 1.8vh, 22px) 0 0;
  padding: 0;
  display: table;
  font-family: var(--display);
  font-weight: 800;
  text-transform: uppercase;
  line-height: .78;
  letter-spacing: .012em;
  color: var(--cream);
  filter: drop-shadow(0 2px 0 rgba(4,6,10,.55));
}
.wordmark::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -2.2vw;
  top: 47%;
  width: 78%;
  height: .58em;
  background:
    repeating-linear-gradient(93deg, rgba(0,0,0,0) 0 18px, rgba(0,0,0,.16) 18px 20px, rgba(0,0,0,0) 20px 46px),
    linear-gradient(180deg, #d4142f 0%, #bd0e29 62%, #8f0a1f 100%);
  transform: rotate(-1.6deg);
  clip-path: polygon(0 18%, 96% 0, 100% 22%, 99% 60%, 94% 78%, 100% 88%, 87% 100%, 3% 94%, 0 62%, 4% 46%, 0 32%);
  opacity: .96;
}
.wm-line { display: block; position: relative; z-index: 1; }
.wm-1 { font-size: clamp(64px, 13.4vw, 152px); }
.wm-2 {
  font-size: clamp(26px, 4.5vw, 52px);
  letter-spacing: .42em;
  margin: .04em 0 .02em .12em;
  color: #d9d2c3;
  opacity: .93;
}
.wm-3 { font-size: clamp(64px, 13.4vw, 152px); }

.menu-tagline {
  margin: clamp(12px, 2vh, 22px) 0 0 4px;
  font-size: clamp(11px, 1vw, 14px);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--pale);
  opacity: .8;
}

/* menu */
.menu-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}
.menu-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--grey);
  margin: 0 0 8px 2px;
}
.menu-strips { display: flex; flex-direction: column; gap: 7px; width: clamp(300px, 27vw, 400px); }
.strip {
  position: relative;
  display: flex;
  align-items: stretch;
  min-height: 62px;
  padding: 0;
  text-align: left;
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(12px) saturate(.8);
  -webkit-backdrop-filter: blur(12px) saturate(.8);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.strip:hover { border-color: var(--hairline-strong); background: linear-gradient(180deg, rgba(26,32,41,.86), rgba(12,16,22,.92)); }
.strip.selected { border-color: rgba(255,180,58,.45); }
.strip.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255,180,58,.18);
  pointer-events: none;
}
.strip-tab {
  display: grid;
  place-items: center;
  width: 47px;
  flex: 0 0 47px;
  border-right: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--grey);
  background: rgba(4,6,10,.35);
  transition: background .18s ease, color .18s ease;
}
.strip.selected .strip-tab { background: var(--amber); color: #17120a; border-right-color: rgba(255,180,58,.9); }
.strip-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 9px 12px; }
.strip-title { font-family: var(--display); font-weight: 800; font-size: 27px; line-height: .95; text-transform: uppercase; letter-spacing: .02em; color: var(--cream); }
.strip.selected .strip-title { color: #fff7e8; }
.strip-sub { margin-top: 4px; font-family: var(--text); font-size: 10.5px; letter-spacing: .06em; color: var(--grey); }
.strip-key {
  align-self: center;
  margin-right: 12px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(207,214,221,.4);
  border: 1px solid rgba(207,214,221,.16);
  padding: 4px 6px;
}
.strip-soon {
  position: absolute;
  top: 0;
  right: 0;
  padding: 3px 8px 4px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(207,214,221,.55);
  background: rgba(3,5,8,.6);
  border-left: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.strip.is-soon { opacity: .48; cursor: not-allowed; clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%); }
.strip.is-soon:hover { transform: none; border-color: var(--hairline); background: var(--glass); }
.menu-best {
  margin-top: 13px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--grey);
}
.menu-best b { color: var(--amber); font-weight: 500; margin-left: 6px; }

.menu-right { padding-bottom: 7px; }
.legend { font-size: 10px; color: var(--grey); max-width: 255px; }
.legend-title { font-family: var(--mono); font-size: 9px; letter-spacing: .3em; text-transform: uppercase; color: rgba(207,214,221,.45); margin-bottom: 9px; }
.legend-row { display: flex; gap: 18px; margin-bottom: 7px; }
.legend-row > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend-hint { margin-top: 11px; max-width: 235px; line-height: 1.55; color: rgba(207,214,221,.5); }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border: 1px solid rgba(207,214,221,.24);
  border-bottom-color: rgba(207,214,221,.36);
  background: rgba(11,15,21,.7);
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--pale);
}

.menu-footer {
  position: absolute;
  left: calc(clamp(20px, 4.2vw, 64px) + var(--sal));
  bottom: calc(clamp(12px, 1.6vh, 20px) + var(--sab));
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(207,214,221,.35);
}
.footer-sep { opacity: .5; }
.build-tag:empty { display: none; }

/* ------------------------------------------------------------------ garage */

#garage {
  z-index: 12;
  background:
    linear-gradient(rgba(6, 9, 13, .86), rgba(5, 8, 12, .94)),
    repeating-linear-gradient(0deg, rgba(120,145,180,.045) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(120,145,180,.045) 0 1px, transparent 1px 56px);
  backdrop-filter: blur(11px) saturate(.7);
  -webkit-backdrop-filter: blur(11px) saturate(.7);
  overflow-y: auto;
  gap: 18px;
  justify-content: flex-start;
}
.garage-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.garage-title { margin: 4px 0 0; font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(46px, 6vw, 74px); line-height: .8; letter-spacing: .02em; }
.garage-count { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--grey); padding-bottom: 6px; white-space: nowrap; }
.garage-count span { color: var(--amber); }
.garage-count .slash { color: rgba(207,214,221,.25); margin: 0 3px; }
.garage-body { display: grid; grid-template-columns: minmax(0, 1fr) clamp(265px, 24vw, 330px); gap: clamp(16px, 2.4vw, 34px); align-items: start; flex: 1; }
.garage-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; align-content: start; }
.tile {
  position: relative;
  aspect-ratio: 1.68;
  min-height: 96px;
  padding: 9px 9px 7px;
  text-align: left;
  background: rgba(13, 18, 24, .72);
  border: 1px solid rgba(207, 214, 221, .13);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
  overflow: hidden;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.tile.live:hover { border-color: rgba(207,214,221,.36); transform: translateY(-2px); }
.tile.selected { border-color: var(--amber); background: rgba(30, 27, 20, .78); box-shadow: inset 0 0 0 1px rgba(255,180,58,.3); }
.tile-num {
  position: absolute;
  left: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 27px;
  height: 19px;
  background: rgba(3,5,8,.8);
  border-top: 1px solid rgba(207,214,221,.16);
  border-right: 1px solid rgba(207,214,221,.16);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .06em;
  color: var(--grey);
}
.tile.selected .tile-num { background: var(--amber); color: #17120a; border-color: var(--amber); }
.tile-name {
  position: relative;
  z-index: 2;
  display: block;
  font-family: var(--text);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--pale);
  padding-left: 4px;
  padding-right: 26px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-class { position: relative; z-index: 2; display: block; padding-left: 4px; margin-top: 2px; font-family: var(--mono); font-size: 7px; letter-spacing: .14em; text-transform: uppercase; color: var(--grey); }
.tile-print { position: absolute; left: 4%; right: 4%; bottom: 12%; height: 64%; width: 92%; }
.tile-badge {
  position: absolute;
  top: 0; right: 0;
  padding: 3px 6px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,180,58,.9);
  background: rgba(3,5,8,.55);
  border-left: 1px solid rgba(255,180,58,.2);
  border-bottom: 1px solid rgba(255,180,58,.2);
}
.tile.locked {
  border-style: dashed;
  border-color: rgba(207,214,221,.13);
  background: rgba(10,14,19,.45);
  display: grid;
  place-items: center;
}
.tile.locked .tile-lock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: rgba(207,214,221,.22);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.tile.locked svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.2; }
.tile.locked .tile-num { color: rgba(207,214,221,.3); }

/* spec panel */
.spec-panel {
  background: var(--glass);
  border: 1px solid var(--hairline);
  padding: clamp(16px, 1.8vw, 24px);
  position: sticky;
  top: 0;
  min-height: 380px;
}
.spec-kicker { font-family: var(--mono); font-size: 8.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--amber); }
.spec-name { margin: 8px 0 2px; font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(28px, 2.6vw, 38px); line-height: .9; letter-spacing: .015em; }
.spec-class { font-family: var(--text); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--grey); }
.spec-rows { margin: 18px 0 0; border-top: 1px solid rgba(207,214,221,.11); }
.spec-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(207,214,221,.08); }
.spec-row dt { margin: 0; font-family: var(--text); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--grey); }
.spec-row dd { margin: 0; font-family: var(--mono); font-size: 10px; color: var(--cream); text-align: right; }
.spec-row dd.amber { color: var(--amber); }
.spec-bars { margin-top: 16px; display: grid; gap: 8px; }
.spec-bar { display: grid; grid-template-columns: 58px 1fr 34px; align-items: center; gap: 8px; }
.spec-bar span { font-family: var(--text); font-size: 8px; letter-spacing: .12em; text-transform: uppercase; color: var(--grey); }
.spec-bar i { position: relative; display: block; height: 3px; background: rgba(207,214,221,.12); overflow: hidden; }
.spec-bar i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--fill, 50%); background: var(--amber); }
.spec-bar b { font-family: var(--mono); font-size: 8.5px; font-weight: 500; color: var(--pale); text-align: right; }
.spec-band { margin-top: 16px; }
.spec-band-label { font-family: var(--mono); font-size: 7.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--grey); margin-bottom: 5px; }
.spec-band-graph { position: relative; height: 26px; background: linear-gradient(90deg, rgba(61,90,153,.12), rgba(255,180,58,.04)); border-bottom: 1px solid rgba(207,214,221,.2); }
.spec-band-graph i { position: absolute; bottom: 0; width: 2px; background: rgba(255,180,58,.75); }
.spec-band-graph .peak { width: 3px; background: var(--red); bottom: -2px; height: 110%; opacity: .7; }
.spec-next { margin-top: 18px; padding-top: 10px; border-top: 1px dashed rgba(207,214,221,.14); }
.spec-next-title { font-family: var(--mono); font-size: 7.5px; letter-spacing: .2em; text-transform: uppercase; color: rgba(207,214,221,.32); margin-bottom: 6px; }
.spec-next-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed rgba(207,214,221,.08); font-size: 9.5px; color: rgba(207,214,221,.4); }
.spec-next-row span { letter-spacing: .06em; }
.spec-next-row b { font-family: var(--mono); font-size: 7px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: rgba(207,214,221,.28); border: 1px solid rgba(207,214,221,.13); padding: 2px 5px; }
.spec-locked-note { margin-top: 14px; font-size: 9px; line-height: 1.5; color: rgba(207,214,221,.35); }

.garage-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0 calc(6px + var(--sab));
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: linear-gradient(to top, rgba(6, 9, 13, .98) 40%, rgba(6, 9, 13, .9) 82%, rgba(6, 9, 13, 0));
}
.garage-note { font-family: var(--text); font-size: 9px; letter-spacing: .04em; color: rgba(207,214,221,.34); margin-left: auto; max-width: 380px; line-height: 1.4; text-align: right; }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 20px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid var(--hairline);
  background: rgba(11, 15, 21, .6);
  color: var(--cream);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.btn:hover { border-color: var(--hairline-strong); background: rgba(20, 26, 34, .8); transform: translateY(-1px); }
.btn-amber { background: var(--amber); color: #17120a; border-color: var(--amber); }
.btn-amber:hover { background: #ffc55e; border-color: #ffc55e; }
.btn-ghost { color: var(--pale); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ------------------------------------------------------------------ race HUD */

#hud { position: absolute; inset: 0; z-index: 14; pointer-events: none; }
#hud > * { pointer-events: auto; }

.hud-icon-btn {
  position: absolute;
  top: calc(clamp(12px, 2vw, 22px) + var(--sat));
  left: calc(clamp(12px, 2vw, 22px) + var(--sal));
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--glass);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--pale);
}
.hud-icon-btn:hover { border-color: var(--hairline-strong); color: var(--cream); }
.hud-icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: square; }

.map-frame {
  position: absolute;
  top: calc(clamp(12px, 2vw, 22px) + var(--sat));
  right: calc(clamp(12px, 2vw, 22px) + var(--sar));
  width: clamp(150px, 15vw, 208px);
  padding: 7px 7px 6px;
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: 17px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 34px rgba(0,0,0,.3);
}
#mapCanvas { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 11px; background: rgba(6, 9, 13, .55); }
.map-north {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 7px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: .1em;
  color: var(--amber);
  background: #10151c;
  border: 1px solid var(--hairline);
  border-radius: 0 0 4px 4px;
}
.map-strip { display: flex; justify-content: space-between; gap: 8px; padding: 6px 3px 0; font-family: var(--mono); font-size: 9px; letter-spacing: .06em; color: var(--pale); }
.map-strip-2 { padding-top: 3px; font-size: 9.5px; color: var(--cream); }
.map-strip .pos { color: var(--amber); }
.map-strip .dim { color: var(--grey); font-size: 8px; align-self: center; }

.speedo {
  position: absolute;
  right: calc(clamp(12px, 2vw, 22px) + var(--sar));
  bottom: calc(clamp(12px, 2vw, 22px) + var(--sab));
  width: clamp(168px, 23vh, 236px);
  aspect-ratio: 1;
  filter: drop-shadow(0 10px 30px rgba(0,0,0,.4));
}
.speedo svg { width: 100%; height: 100%; display: block; overflow: visible; }
.speedo .sp-bg { fill: rgba(10, 14, 20, .55); stroke: rgba(207,214,221,.16); stroke-width: 1; }
.speedo .sp-ticks { stroke: rgba(207,214,221,.38); stroke-width: 1; }
.speedo .sp-ticks-major { stroke: rgba(232,236,239,.72); stroke-width: 1.4; }
.speedo .sp-track { fill: none; stroke: rgba(207,214,221,.12); stroke-width: 4; stroke-linecap: round; }
.speedo .sp-arc { fill: none; stroke: var(--amber); stroke-width: 4; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(255,180,58,.5)); }
.speedo .sp-num { fill: #fff6e4; font-family: var(--mono); font-weight: 700; font-size: 34px; text-anchor: middle; letter-spacing: -1px; }
.speedo .sp-unit { fill: rgba(207,214,221,.55); font-family: var(--mono); font-size: 7.5px; letter-spacing: .22em; text-anchor: middle; }
.speedo .sp-gear-label { fill: rgba(207,214,221,.4); font-family: var(--mono); font-size: 6.5px; letter-spacing: .18em; text-anchor: middle; }
.speedo .sp-flag { fill: rgba(20, 16, 10, .8); stroke: rgba(255,180,58,.5); stroke-width: 1; }
.speedo .sp-gear { fill: var(--amber); font-family: var(--mono); font-weight: 700; font-size: 13px; text-anchor: middle; }
.speedo .sp-rpm { fill: none; stroke: rgba(232,236,239,.16); stroke-width: 1.5; }
.speedo .sp-rpm-arc { fill: none; stroke: rgba(232,236,239,.7); stroke-width: 1.5; stroke-linecap: round; }

.cam-stack {
  position: absolute;
  left: calc(clamp(12px, 2vw, 22px) + var(--sal));
  bottom: calc(clamp(12px, 2vw, 22px) + var(--sab));
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
}
.cam-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 82px;
  height: 34px;
  padding: 0 7px;
  color: rgba(207,214,221,.5);
  background: rgba(10, 14, 20, .58);
  border: 1px solid rgba(207,214,221,.13);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color .14s ease, border-color .14s ease, background .14s ease;
}
.cam-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.cam-btn span { font-family: var(--mono); font-size: 7.5px; letter-spacing: .13em; text-transform: uppercase; }
.cam-btn:hover { color: var(--pale); border-color: var(--hairline-strong); }
.cam-btn.active { color: var(--amber); border-color: rgba(255,180,58,.5); background: rgba(32, 26, 14, .55); }
.cam-btn.active svg { filter: drop-shadow(0 0 5px rgba(255,180,58,.45)); }
.cam-key {
  margin: 1px 0 0 2px;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .16em;
  color: rgba(207,214,221,.3);
}

.drag-hint {
  position: absolute;
  left: 50%;
  bottom: 21%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--amber);
  opacity: .9;
  transition: opacity 1.2s ease;
  pointer-events: none !important;
}
.drag-hint.fade { opacity: 0; }
.drag-hint svg { width: 48px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px rgba(255,180,58,.4)); }
.drag-hint span { font-family: var(--mono); font-size: 7.5px; letter-spacing: .22em; text-transform: uppercase; opacity: .8; }

.wrong-way {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #ffd9de;
  background: rgba(60, 6, 14, .62);
  border: 1px solid rgba(200, 16, 46, .7);
  animation: blink 0.9s steps(2, jump-none) infinite;
}
@keyframes blink { 50% { opacity: .35; } }

/* countdown */
.countdown {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
  text-align: center;
  background: radial-gradient(ellipse at 50% 50%, rgba(4,7,11,.30), rgba(4,7,11,0) 55%);
}
.count-lights { display: flex; gap: 9px; }
.count-lights i {
  width: 9px; height: 9px;
  border: 1px solid rgba(255,180,58,.5);
  background: rgba(8, 10, 14, .6);
  border-radius: 50%;
  transition: background .15s ease, box-shadow .15s ease;
}
.count-lights i.on { background: var(--amber); box-shadow: 0 0 12px rgba(255,180,58,.85); border-color: var(--amber); }
.count-text {
  font-family: var(--display);
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(92px, 17vw, 190px);
  line-height: .72;
  letter-spacing: .02em;
  color: #fff7e6;
  text-shadow: 0 6px 40px rgba(0,0,0,.55), 0 0 60px rgba(255,180,58,.16);
}
.count-sub { font-family: var(--mono); font-size: 8.5px; letter-spacing: .32em; text-transform: uppercase; color: rgba(232,236,239,.55); }
.countdown.going .count-text { color: var(--amber); text-shadow: 0 6px 40px rgba(0,0,0,.55), 0 0 55px rgba(255,180,58,.5); }

/* touch controls */
#touchControls { pointer-events: none !important; }
.touch-controls { position: absolute; inset: 0; display: none; pointer-events: none; }
body.touch .touch-controls { display: block; }
.touch-steer { position: absolute; left: calc(clamp(12px, 2vw, 22px) + var(--sal)); bottom: calc(clamp(12px, 2vw, 22px) + var(--sab)); display: flex; gap: 8px; pointer-events: none; }
.touch-pedals { position: absolute; right: calc(clamp(12px, 2vw, 22px) + var(--sar)); bottom: calc(clamp(12px, 2vw, 22px) + var(--sab)); display: flex; gap: 8px; align-items: flex-end; pointer-events: none; }
.touch-btn {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 66px;
  height: 66px;
  background: rgba(10, 14, 20, .55);
  border: 1px solid rgba(207,214,221,.2);
  border-radius: 4px;
  color: var(--pale);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  touch-action: none;
  user-select: none;
}
.touch-btn svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.touch-btn span { font-family: var(--mono); font-size: 7px; letter-spacing: .16em; text-transform: uppercase; color: rgba(207,214,221,.55); }
.touch-btn.on { background: rgba(255,180,58,.22); border-color: var(--amber); color: var(--amber); }
.pedal { width: 72px; height: 78px; }
.handbrake { width: 44px; height: 44px; align-self: flex-end; font-family: var(--mono); font-size: 9px; letter-spacing: .1em; color: rgba(207,214,221,.6); }
.handbrake span { font-size: 9px; color: inherit; }
body.touch .speedo { width: clamp(112px, 21vh, 142px); bottom: calc(104px + var(--sab)); }
body.touch .cam-stack { top: calc(60px + var(--sat)); bottom: auto; flex-direction: row; gap: 5px; }
body.touch .cam-btn { min-width: 0; width: 44px; height: 44px; justify-content: center; padding: 0; }
body.touch .hud-icon-btn { width: 44px; height: 44px; }
body.touch .cam-btn span { display: none; }
body.touch .cam-key { display: none; }
body.touch .drag-hint { bottom: 34%; }

/* ------------------------------------------------------------------ modals */

.modal-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: calc(clamp(14px, 3vw, 30px) + var(--sat)) calc(clamp(14px, 3vw, 30px) + var(--sar)) calc(clamp(14px, 3vw, 30px) + var(--sab)) calc(clamp(14px, 3vw, 30px) + var(--sal));
  background: radial-gradient(ellipse at 50% 45%, rgba(6,9,14,.55), rgba(3,5,8,.82));
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.modal {
  width: min(620px, 94vw);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: clamp(20px, 3.4vw, 38px);
  background: var(--glass);
  border: 1px solid var(--hairline-strong);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
}
.modal-kicker { font-family: var(--mono); font-size: 8.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--amber); }
.modal-title { margin: 8px 0 18px; font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(46px, 6vw, 64px); line-height: .82; }
.modal-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 22px; }
.pause-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.pause-keys .legend.row { display: flex; gap: 18px; margin-bottom: 8px; }
.pause-stats { font-size: 10px; line-height: 1.8; color: var(--pale); border-left: 1px solid var(--hairline); padding-left: 16px; }
.pause-stats b { color: var(--amber); font-weight: 500; }

.result-top { display: flex; align-items: flex-end; gap: 20px; margin: 8px 0 18px; }
.result-place { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(80px, 12vw, 128px); line-height: .72; color: var(--amber); letter-spacing: -.01em; }
.result-copy { padding-bottom: 4px; }
.result-headline { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(30px, 4vw, 42px); line-height: .9; }
.result-sub { margin-top: 5px; font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--grey); }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.result-stats > div { padding: 12px 8px; border-right: 1px solid rgba(207,214,221,.08); }
.result-stats > div:last-child { border-right: 0; }
.result-stats span { display: block; font-family: var(--text); font-size: 8px; letter-spacing: .14em; text-transform: uppercase; color: var(--grey); margin-bottom: 5px; }
.result-stats b { font-size: 12px; font-weight: 500; color: var(--cream); }
.result-stats b.amber { color: var(--amber); }
.record-line {
  margin-top: 12px;
  display: inline-block;
  padding: 4px 9px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #17120a;
  background: var(--amber);
}

/* toast, fade, loader */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(26px + var(--sab));
  transform: translateX(-50%);
  z-index: 60;
  padding: 10px 15px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cream);
  background: rgba(9,13,18,.92);
  border: 1px solid var(--hairline-strong);
  border-left: 2px solid var(--amber);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  max-width: 88vw;
  text-align: center;
}
.fade {
  position: absolute;
  inset: 0;
  z-index: 70;
  background: #05070a;
  opacity: 0;
  pointer-events: none;
  transition: opacity .32s ease;
}
.fade.on { opacity: 1; pointer-events: auto; }
.loader {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 42%, #131c2a, #05070a 70%);
  transition: opacity .5s ease, visibility .5s;
}
.loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.loader-word { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(26px, 3.4vw, 40px); letter-spacing: .08em; color: var(--cream); }
.loader-bar { width: min(260px, 62vw); height: 2px; background: rgba(207,214,221,.13); overflow: hidden; }
.loader-bar i { display: block; width: 40%; height: 100%; background: var(--amber); animation: load 1.1s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }
.loader-sub { font-family: var(--mono); font-size: 8px; letter-spacing: .26em; text-transform: uppercase; color: var(--grey); }

/* ------------------------------------------------------------------ adaptive */

@media (max-width: 1080px) {
  .garage-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .menu-top { max-width: 76vw; }
}

@media (max-width: 860px) {
  .screen { padding: calc(20px + var(--sat)) calc(20px + var(--sar)) calc(20px + var(--sab)) calc(20px + var(--sal)); }
  .menu-top { max-width: 100%; }
  .menu-bottom { align-items: flex-end; gap: 16px; }
  .menu-right { display: none; }
  .menu-strips { width: min(390px, 100%); }
  .menu-footer { display: none; }
  .garage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .garage-body { grid-template-columns: 1fr; }
  .spec-panel { position: relative; min-height: 0; }
  .garage-note { margin-left: 0; text-align: left; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .result-stats > div:nth-child(2) { border-right: 0; }
  .result-stats > div:nth-child(-n+2) { border-bottom: 1px solid rgba(207,214,221,.08); }
}

@media (max-width: 620px) {
  .screen { padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); }
  .wm-1, .wm-3 { font-size: clamp(56px, 16.4vw, 92px); }
  .wm-2 { font-size: clamp(21px, 6.4vw, 30px); letter-spacing: .34em; }
  .menu-tagline { font-size: 10px; letter-spacing: .06em; }
  .strip { min-height: 56px; }
  .strip-tab { width: 40px; flex-basis: 40px; }
  .strip-title { font-size: 23px; }
  .strip-key { display: none; }
  .menu-strips { width: 100%; }
  .menu-best { margin-top: 9px; }
  .garage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .tile { min-height: 84px; }
  .map-frame { width: 122px; padding: 5px 5px 4px; border-radius: 13px; }
  .map-strip { font-size: 7.5px; padding-top: 4px; }
  .map-strip-2 { font-size: 8px; }
  .speedo { width: 128px; }
  .speedo .sp-num { font-size: 30px; }
  .cam-btn { min-width: 76px; height: 31px; }
  .cam-btn svg { width: 17px; height: 17px; }
  .cam-btn span { font-size: 6.5px; }
  .pause-grid { grid-template-columns: 1fr; }
  .pause-stats { border-left: 0; border-top: 1px solid var(--hairline); padding-left: 0; padding-top: 10px; }
  .result-top { gap: 13px; }
  .result-place { font-size: clamp(70px, 20vw, 104px); }
  .result-stats b { font-size: 10px; }
  .modal-actions .btn { flex: 1; min-width: 120px; }
  .modal { padding: 19px; }
}

@media (max-height: 430px) and (orientation: landscape) {
  .menu-top .eyebrow { display: none; }
  .wm-1, .wm-3 { font-size: clamp(44px, 9.4vw, 74px); }
  .wm-2 { font-size: clamp(17px, 2.7vw, 24px); }
  .menu-tagline { display: none; }
  .strip { min-height: 49px; }
  .strip-title { font-size: 22px; }
  .strip-sub { display: none; }
  .menu-best { display: none; }
  .menu-strips { width: clamp(270px, 34vw, 340px); }
  .menu-bottom { align-items: flex-end; }
  body.touch .speedo { width: 106px; bottom: calc(96px + var(--sab)); }
  body.touch .map-frame { width: 106px; }
  .touch-btn { width: 58px; height: 58px; }
  .pedal { width: 64px; height: 70px; }
  .handbrake { width: 40px; height: 40px; }
  .garage-title { font-size: 40px; }
  .garage-head { align-items: center; }
  .garage-body { grid-template-columns: minmax(0, 1fr) 240px; }
  .garage-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tile { min-height: 70px; }
  .spec-panel { min-height: 0; max-height: 62vh; overflow-y: auto; }
}

@media (max-width: 380px) {
  .touch-btn { width: 56px; height: 56px; }
  .pedal { width: 60px; height: 66px; }
  .handbrake { width: 36px; height: 36px; }
  body.touch .cam-btn { width: 40px; height: 40px; }
  body.touch .cam-stack { top: calc(64px + var(--sat)); }
  body.touch .speedo { width: 112px; }
  body.touch .map-frame { width: 110px; }
  .map-strip { font-size: 7px; }
  .map-strip-2 { font-size: 7.5px; }
}

@media (max-height: 360px) and (orientation: landscape) {
  body.touch .map-frame { width: 90px; }
  body.touch .speedo { width: 92px; bottom: calc(86px + var(--sab)); }
  body.touch .cam-btn { width: 34px; height: 34px; }
  body.touch .cam-stack { top: calc(54px + var(--sat)); }
  .touch-btn { width: 54px; height: 54px; }
  .pedal { width: 58px; height: 64px; }
  .handbrake { width: 36px; height: 36px; }
  .map-strip { font-size: 6.5px; padding-top: 3px; }
  .map-strip-2 { font-size: 7px; }
  .menu-strips { width: clamp(250px, 33vw, 300px); }
}

@media (max-width: 700px) and (max-height: 430px) and (orientation: landscape) {
  .garage-body { grid-template-columns: 1fr; }
  .garage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .spec-panel { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
