/* Open World Racer - printed sheet UI */
:root {
  --paper: #f2e3c8;
  --paper-hi: #f7ecd6;
  --paper-lo: #e4cfaa;
  --ink: #1b1f24;
  --ink-soft: #363b40;
  --orange: #e08a3c;
  --orange-hi: #f0a355;
  --rust: #c0432e;
  --teal: #2e6e6b;
  --teal-deep: #234f4d;
  --haze: #9cb6c2;
  --amber: #f0b429;
  --blood: #6e241c;
  --ash: #7d7a6c;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  --dots: radial-gradient(circle, rgba(27,31,36,.22) 0.8px, transparent 1px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #171a1d; color: var(--ink);
  font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
img { -webkit-user-drag: none; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------------- printed surfaces ---------------- */
.paper-screen {
  background-color: var(--paper);
  color: var(--ink);
}
.sheet {
  position: absolute; inset: 0; pointer-events: none;
  background-image: var(--grain);
  background-size: 160px 160px;
  opacity: .55; mix-blend-mode: multiply;
}
.grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--dots); background-size: 4px 4px;
  opacity: .22; mix-blend-mode: multiply;
}
.kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--teal-deep);
}
h1, h2, h3, .display { font-family: "Big Shoulders", "Arial Narrow", sans-serif; font-weight: 800; text-transform: uppercase; margin: 0; line-height: .9; }

.screen {
  position: fixed; inset: 0; z-index: 30;
  display: none; overflow: hidden;
}
.screen.active { display: flex; }

/* ---------------- boot ---------------- */
.boot {
  position: fixed; inset: 0; z-index: 90;
  background: #1b1f24;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  transition: opacity .35s ease;
}
.boot.gone { opacity: 0; pointer-events: none; }
.boot::before {
  content: ""; position: absolute; inset: 0;
  background-image: var(--dots); background-size: 5px 5px;
  opacity: .1;
}
.boot-card {
  position: relative; width: min(560px, 92vw);
  background: var(--paper);
  padding: clamp(28px, 5vw, 54px);
  border: 2px solid #101216;
  box-shadow: 8px 8px 0 rgba(0,0,0,.42), 16px 16px 0 rgba(224,138,60,.16);
  background-image: var(--grain);
}
.boot-card h1 {
  font-size: clamp(44px, 9vw, 86px); color: var(--orange);
  text-shadow: 3px 3px 0 var(--teal), 6px 6px 0 rgba(27,31,36,.35);
  margin: 14px 0 18px;
}
.boot-rule { height: 2px; background: var(--ink); margin: 0 0 16px; }
.boot-card p { font-family: "IBM Plex Mono", monospace; font-size: 12px; letter-spacing: .12em; margin: 0 0 12px; }
.boot-bar { height: 12px; border: 2px solid var(--ink); padding: 2px; }
.boot-bar i { display: block; height: 100%; width: 8%; background: var(--orange); transition: width .3s ease; }
.boot-hint { margin-top: 18px; font-size: 10px; letter-spacing: .2em; color: var(--teal-deep); }

/* ---------------- title ---------------- */
.title-screen {
  display: none;
  background: var(--paper);
  padding: clamp(16px, 2.6vw, 40px) clamp(16px, 3vw, 52px);
  flex-direction: column;
  justify-content: space-between;
}
.title-screen.active { display: flex; }
.title-backdrop {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 55%;
  filter: saturate(.82) contrast(1.02);
}
.title-screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 76% 22%, rgba(242,227,200,.0) 35%, rgba(227,205,166,.4) 100%),
    linear-gradient(to bottom, rgba(242,227,200,.16), rgba(242,227,200,0) 26%, rgba(242,227,200,.1) 62%, rgba(242,227,200,.9) 92%);
  mix-blend-mode: multiply;
}
.title-halftone {
  position: absolute; inset: 0; pointer-events: none;
  background-image: var(--dots); background-size: 3px 3px;
  mix-blend-mode: multiply; opacity: .3;
}
.title-top, .title-main, .title-foot { position: relative; z-index: 2; }
.title-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 4vw; }
.wordmark {
  width: clamp(280px, 44vw, 660px);
  height: auto; display: block;
  filter: drop-shadow(0 10px 0 rgba(27,31,36,.12));
}
.title-tag {
  font-family: "IBM Plex Mono", monospace; font-size: clamp(9px, .8vw, 12px);
  letter-spacing: .26em; color: var(--teal-deep);
  margin-top: 4px; padding-left: 6px;
  text-shadow: 0 1px 0 rgba(242,227,200,.6);
}
.title-map {
  width: clamp(190px, 21vw, 330px);
  transform: rotate(1.4deg);
  transition: transform .2s ease;
}
.title-map-inner {
  position: relative; background: var(--paper-hi);
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 rgba(27,31,36,.25);
  padding: 7px;
}
.title-map-inner img { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }
.title-map-inner::after {
  content: ""; position: absolute; inset: 7px; border: 1px solid rgba(27,31,36,.35); pointer-events: none;
}
.map-pin {
  position: absolute; left: 52%; top: 51%; width: 11px; height: 11px;
  background: var(--rust); border: 2px solid var(--paper-hi); border-radius: 50%;
  box-shadow: 0 0 0 1px var(--ink);
}
.title-map-label {
  font-size: 9px; letter-spacing: .16em; color: var(--ink);
  padding: 5px 2px 0; text-align: right;
}
.title-main {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: clamp(20px, 4vw, 70px);
  margin-top: auto; padding-bottom: 8px;
}
.title-copy { max-width: 480px; padding-bottom: 10px; }
.title-lede {
  font-size: clamp(12px, 1.15vw, 16px); line-height: 1.5;
  margin: 0 0 16px; max-width: 42ch;
  text-shadow: 0 1px 0 rgba(242,227,200,.65);
}
.title-stats {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 10px; letter-spacing: .12em; color: var(--teal-deep);
  border-top: 2px solid var(--ink); padding-top: 8px; max-width: 480px;
}
.title-stats b { color: var(--ink); font-weight: 700; }
.title-menu {
  display: grid; grid-template-columns: repeat(2, minmax(150px, 220px));
  gap: 8px; align-items: stretch;
}
.menu-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  min-height: 54px;
  padding: 10px 14px;
  background: var(--paper-hi);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(27,31,36,.3);
  text-align: left;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  overflow: hidden;
}
.menu-btn::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--dots); background-size: 3px 3px; opacity: .12;
}
.menu-btn:hover, .menu-btn:focus-visible { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 rgba(27,31,36,.32); outline: none; }
.menu-btn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 rgba(27,31,36,.3); }
.menu-btn .mb-main {
  font-family: "Big Shoulders", sans-serif; font-weight: 800;
  font-size: clamp(21px, 2vw, 30px); letter-spacing: .03em; line-height: .95;
}
.menu-btn .mb-sub {
  font-family: "IBM Plex Mono", monospace; font-size: 9px;
  letter-spacing: .12em; opacity: .7; margin-top: 4px;
}
.menu-btn .mb-key {
  position: absolute; right: 8px; top: 7px; font-size: 9px;
  border: 1px solid rgba(27,31,36,.5); padding: 1px 4px; opacity: .65;
}
.menu-btn.primary { background: var(--orange); }
.menu-btn.primary::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, rgba(255,255,255,.14), transparent 40%);
}
.menu-btn.primary .mb-main { font-size: clamp(27px, 2.8vw, 40px); }
.menu-btn.small { min-height: 44px; padding: 7px 10px; }
.menu-btn.small .mb-main { font-size: clamp(18px, 1.5vw, 22px); }
.menu-btn.ghost { background: transparent; box-shadow: none; border-color: rgba(27,31,36,.55); }
.menu-btn.ghost:hover { background: rgba(242,227,200,.45); }
.menu-btn.compact { min-height: 44px; }
.title-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border-top: 2px solid var(--ink); margin-top: 10px; padding-top: 7px;
  font-size: 9px; letter-spacing: .13em;
}
.pad-status { display: flex; align-items: center; gap: 7px; font-family: "IBM Plex Mono", monospace; }
.pad-status .led {
  width: 9px; height: 9px; border: 1.5px solid var(--ink); background: transparent; border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(46,110,107,.4);
}
.pad-status.live .led { background: var(--teal); }
.pad-status.live .led::after { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; animation: padpulse 2.4s ease-out infinite; }
@keyframes padpulse { 0% { box-shadow: 0 0 0 0 rgba(46,110,107,.5); } 100% { box-shadow: 0 0 0 12px rgba(46,110,107,0); } }
.title-records { color: var(--teal-deep); letter-spacing: .1em; }
.title-credit { color: var(--teal-deep); }

/* ---------------- HUD ---------------- */
.hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hud-plate {
  position: relative;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(27,31,36,.28);
  padding: 5px 9px 6px;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
}
.hud-plate::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: var(--dots); background-size: 3px 3px; opacity: .12;
}
.hud-kicker { font-family: "IBM Plex Mono", monospace; font-size: 8px; letter-spacing: .2em; color: var(--teal-deep); }
.hud-big { font-size: clamp(20px, 2.2vw, 30px); font-weight: 600; line-height: 1; }
.hud-mid { font-size: clamp(15px, 1.5vw, 20px); font-weight: 600; line-height: 1.1; }
.hud-mini { font-size: 9px; letter-spacing: .1em; opacity: .72; }

.hud-timer { position: absolute; left: clamp(10px, 1.6vw, 22px); top: clamp(10px, 1.8vw, 20px); min-width: 118px; }
.hud-next { position: absolute; left: 50%; top: clamp(8px, 1.4vw, 18px); transform: translateX(-50%); display: flex; align-items: center; gap: 2px; }
.hud-next .chev { width: clamp(40px, 4vw, 64px); height: auto; transform-origin: center; filter: drop-shadow(1px 1px 0 rgba(27,31,36,.25)); }
.hud-cp { min-width: 92px; padding: 4px 8px 5px; }
.hud-cp .hud-mid { font-size: clamp(13px, 1.2vw, 17px); }
.hud-cp .hud-mini { display: flex; gap: 6px; }
.hud-topright { position: absolute; right: clamp(10px, 1.6vw, 22px); top: clamp(10px, 1.8vw, 20px); display: flex; align-items: flex-start; gap: 8px; pointer-events: auto; }
.hud-cash { min-width: 84px; }
.stampbtn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--orange); border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(27,31,36,.3);
  padding: 6px 10px; min-height: 42px;
  pointer-events: auto;
}
.stampbtn span { font-family: "Big Shoulders", sans-serif; font-weight: 800; font-size: 20px; line-height: .9; }
.stampbtn small { font-family: "IBM Plex Mono", monospace; font-size: 7px; letter-spacing: .12em; margin-top: 2px; opacity: .7; }
.stampbtn.close { background: var(--paper-hi); min-width: 68px; }
.stampbtn.tiny { min-height: 30px; padding: 3px 8px; }
.stampbtn.tiny span { font-size: 14px; }
.stampbtn:hover { filter: brightness(1.04); }

.hud-speed { position: absolute; right: clamp(8px, 1.4vw, 20px); bottom: clamp(32px, 4.4vw, 54px); display: flex; align-items: flex-end; gap: clamp(2px, .6vw, 10px); }
.dial-wrap { position: relative; width: clamp(132px, 15.5vw, 226px); aspect-ratio: 303 / 272; }
.dial { width: 100%; height: 100%; display: block; filter: drop-shadow(2px 3px 0 rgba(27,31,36,.22)); }
.needle {
  position: absolute; left: 50%; bottom: 49%; width: 2px; height: 39%;
  background: var(--rust); transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(-120deg);
  box-shadow: 0 0 0 .5px rgba(242,227,200,.4);
}
.needle::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); transform: translateX(-50%); }
.speed-read { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 6%; }
.speed-num { font-size: clamp(30px, 4.1vw, 62px); font-weight: 600; line-height: .85; color: var(--paper-hi); text-shadow: 2px 2px 0 rgba(27,31,36,.65); }
.speed-unit { font-family: "IBM Plex Mono", monospace; font-size: clamp(8px, .8vw, 11px); letter-spacing: .18em; color: var(--paper-hi); opacity: .8; }
.gear-block { display: flex; flex-direction: column; align-items: center; gap: 3px; padding-bottom: 4px; }
.gear-icon { width: clamp(44px, 4.6vw, 66px); height: auto; filter: drop-shadow(2px 2px 0 rgba(27,31,36,.25)); }
.gear-read {
  display: flex; align-items: baseline; gap: 5px;
  background: var(--paper); border: 2px solid var(--ink); padding: 2px 7px;
  box-shadow: 2px 2px 0 rgba(27,31,36,.3);
}
.gear-read span { font-family: "IBM Plex Mono", monospace; font-size: 7px; letter-spacing: .16em; color: var(--teal-deep); }
.gear-read b { font-size: clamp(15px, 1.7vw, 24px); font-weight: 600; line-height: 1; }

.hud-boost { position: absolute; left: clamp(10px, 1.6vw, 22px); bottom: clamp(48px, 7vw, 84px); width: clamp(196px, 25vw, 356px); pointer-events: none; }
.boost-bar { display: block; width: 100%; height: auto; filter: drop-shadow(2px 3px 0 rgba(27,31,36,.2)); }
.boost-covers { position: absolute; left: 17.2%; right: 4.2%; top: 27%; bottom: 27%; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2.4%; }
.boost-covers i { background: #31423d; clip-path: polygon(20% 0, 100% 0, 80% 100%, 0 100%); opacity: .96; transition: opacity .12s linear; }
.boost-covers i.off { opacity: 0; }
.boost-tag { position: absolute; left: 6px; top: -14px; }
.hud-tag {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--paper); border: 1.5px solid var(--ink);
  padding: 1px 4px 1px 2px; box-shadow: 1px 1px 0 rgba(27,31,36,.3);
}
.hud-tag img { width: 18px; height: 18px; object-fit: contain; }
.hud-tag span { font-family: "IBM Plex Mono", monospace; font-size: 8px; letter-spacing: .12em; }
.hud-pedals { position: absolute; left: clamp(10px, 1.6vw, 22px); bottom: clamp(44px, 6.4vw, 76px); display: flex; align-items: flex-end; gap: 8px; margin-left: calc(clamp(196px, 25vw, 356px) + 16px); }
.pedal { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.pedal-bar { width: 12px; height: 40px; border: 1.5px solid var(--ink); background: rgba(242,227,200,.65); display: flex; align-items: flex-end; padding: 1px; }
.pedal-bar i { display: block; width: 100%; height: 0%; background: var(--teal); transition: height .07s linear; }
.pedal-bar.brake i { background: var(--rust); }
.pedal.hb { opacity: .35; transition: opacity .1s; }
.pedal.hb.on { opacity: 1; }
.hb-label { font-family: "IBM Plex Mono", monospace; font-size: 6.5px; letter-spacing: .06em; line-height: 1.15; text-align: center; color: var(--ink); }
.hud-camtag { position: absolute; right: clamp(12px, 1.8vw, 26px); bottom: clamp(6px, 1vw, 12px); display: flex; align-items: center; gap: 4px; font-family: "IBM Plex Mono", monospace; font-size: 8px; letter-spacing: .1em; opacity: .8; }
.hud-camtag img { width: 18px; height: 18px; }
.hud-warning {
  position: absolute; left: 50%; top: 19%; transform: translateX(-50%);
  display: none; align-items: center; gap: 8px;
  background: var(--rust); color: var(--paper-hi);
  border: 2px solid var(--ink); padding: 4px 10px 4px 6px;
  box-shadow: 3px 3px 0 rgba(27,31,36,.35);
}
.hud-warning.show { display: flex; }
.hud-warning::after { content: ""; position: absolute; inset: 0; background-image: var(--dots); background-size: 3px 3px; opacity: .3; mix-blend-mode: multiply; pointer-events: none; }
.hud-warning img { width: 30px; height: 26px; object-fit: contain; }
.warn-text { display: flex; flex-direction: column; line-height: 1; }
.warn-text b { font-family: "Big Shoulders", sans-serif; font-size: 18px; letter-spacing: .04em; }
.warn-text span { font-family: "IBM Plex Mono", monospace; font-size: 8px; letter-spacing: .14em; opacity: .85; }

.hud-odometer { position: absolute; left: 0; right: 0; bottom: 0; height: 30px; background: var(--paper); border-top: 2px solid var(--ink); box-shadow: 0 -2px 0 rgba(27,31,36,.1); }
.odo-label { position: absolute; left: 10px; top: 4px; font-family: "IBM Plex Mono", monospace; font-size: 7px; letter-spacing: .2em; color: var(--teal-deep); }
.odo-tape { position: absolute; left: 0; right: 0; bottom: 0; height: 15px; }
.odo-track { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; background-image: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 2.5%); background-size: 2.5% 100%; opacity: .5; }
.odo-track::after { content: ""; position: absolute; inset: auto 0 0 0; height: 5px; background-image: repeating-linear-gradient(90deg, var(--ink) 0 1.5px, transparent 1.5px 12.5%); }
.odo-mark { position: absolute; bottom: 11px; left: 0%; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid var(--rust); transform: translateX(-50%); }
.odo-mark::after { content: ""; position: absolute; left: -1px; top: -10px; width: 2px; height: 8px; background: var(--rust); }

.hud-score { position: absolute; left: clamp(10px, 1.6vw, 22px); top: clamp(82px, 12vw, 116px); display: flex; flex-direction: column; gap: 4px; }
.score-plate { display: flex; align-items: baseline; gap: 7px; }
.score-plate .mono { font-size: clamp(15px, 1.8vw, 26px); font-weight: 600; }
.xp-wrap { width: clamp(110px, 13vw, 180px); height: 8px; border: 1.5px solid var(--ink); background: rgba(242,227,200,.5); position: relative; }
.xp-wrap i { display: block; height: 100%; width: 0%; background: var(--orange); }
.xp-label { font-family: "IBM Plex Mono", monospace; font-size: 7px; letter-spacing: .13em; color: var(--ink); opacity: .8; }
.kill-stamp { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-family: "Big Shoulders", sans-serif; color: var(--rust); font-size: 16px; opacity: .2; letter-spacing: .1em; pointer-events: none; }

.toast {
  position: absolute; left: 50%; top: 64%; transform: translate(-50%, 0);
  background: var(--paper); border: 2px solid var(--ink);
  padding: 5px 12px; font-family: "IBM Plex Mono", monospace;
  font-size: 10px; letter-spacing: .1em; opacity: 0;
  transition: opacity .2s ease; pointer-events: none; box-shadow: 3px 3px 0 rgba(27,31,36,.3);
  white-space: nowrap;
}
.toast.show { opacity: 1; }

.pts-pop {
  position: absolute; z-index: 12; pointer-events: none;
  font-family: "Big Shoulders", sans-serif; font-weight: 800;
  font-size: 30px; color: var(--orange);
  text-shadow: 2px 2px 0 var(--ink);
  transform: translate(-50%,-50%);
  animation: popUp .9s ease-out forwards;
}
@keyframes popUp {
  0% { opacity: 1; transform: translate(-50%,-50%) scale(.9); }
  100% { opacity: 0; transform: translate(-50%,-160%) scale(1.12); }
}

/* ---------------- touch ---------------- */
.touch { position: fixed; inset: 0; z-index: 14; pointer-events: none; }
.touch-steer { position: absolute; left: max(10px, env(safe-area-inset-left)); bottom: 40px; display: flex; gap: 10px; }
.touch-pedals { position: absolute; right: max(10px, env(safe-area-inset-right)); bottom: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.tbtn {
  pointer-events: auto; touch-action: none;
  font-family: "Big Shoulders", sans-serif; font-weight: 800;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink); box-shadow: 3px 3px 0 rgba(27,31,36,.4);
  display: flex; align-items: center; justify-content: center;
  opacity: .9;
}
.tbtn:active, .tbtn.on { background: var(--orange); transform: translate(1px,1px); box-shadow: 1px 1px 0 rgba(27,31,36,.4); }
.tsteer { width: 66px; height: 66px; font-size: 25px; border-radius: 8px; }
.tpedal { width: 62px; height: 82px; font-size: 15px; letter-spacing: .04em; writing-mode: vertical-rl; transform: rotate(180deg); }
.tpedal.go { background: var(--orange); }
.tsmall { width: 48px; height: 44px; font-size: 12px; letter-spacing: .02em; }
.tsmall sub { font-size: 7px; }
.touch-note { position: absolute; right: 12px; bottom: 128px; font-family: "IBM Plex Mono", monospace; font-size: 7px; letter-spacing: .12em; opacity: .6; }

/* ---------------- garage / map sheets ---------------- */
.paper-screen { flex-direction: column; padding: clamp(12px, 1.8vw, 24px) clamp(12px, 2.4vw, 36px); }
.sheet-head { position: relative; z-index: 2; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 7px; }
.sheet-title h2 { font-size: clamp(38px, 5.4vw, 74px); color: var(--ink); letter-spacing: .01em; }
.sheet-title h2::after { content: ""; display: block; height: 4px; width: 62%; background: var(--orange); margin-top: 2px; }
.sheet-head-right { display: flex; align-items: center; gap: 14px; }
.head-cash { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.head-cash b { font-size: clamp(18px, 2.2vw, 30px); font-weight: 600; }
.garage-tabs { position: relative; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 7px 0 8px; border-bottom: 1px solid rgba(27,31,36,.25); }
.sheet-tab {
  font-family: "Big Shoulders", sans-serif; font-weight: 800; font-size: 19px;
  letter-spacing: .04em; padding: 2px 12px 3px;
  border: 2px solid transparent; color: rgba(27,31,36,.55);
}
.sheet-tab.active { border-color: var(--ink); background: var(--orange); color: var(--ink); box-shadow: 2px 2px 0 rgba(27,31,36,.25); }
.garage-note { margin-left: auto; font-size: 8px; letter-spacing: .14em; color: var(--teal-deep); }

.garage-body {
  position: relative; z-index: 2; flex: 1; min-height: 0;
  display: grid; grid-template-columns: 272px minmax(0, 1fr) 360px;
  gap: clamp(10px, 1.6vw, 22px); padding-top: 10px;
}
.garage-body.mode-cars { grid-template-columns: 272px minmax(0, 1fr); }
.garage-body.mode-cars .upgrade-panel { display: none; }
.garage-body.mode-shop { grid-template-columns: minmax(0, 1fr) 360px; }
.garage-body.mode-shop .car-list { display: none; }

.car-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: var(--ink) transparent; }
.car-card {
  position: relative; text-align: left; display: grid;
  grid-template-columns: 88px 1fr; align-items: center; gap: 6px;
  background: var(--paper-hi); border: 1.5px solid var(--ink);
  padding: 5px 7px; box-shadow: 2px 2px 0 rgba(27,31,36,.18);
  flex: 0 0 auto;
}
.car-card img { width: 88px; height: 42px; object-fit: contain; filter: contrast(1.08); }
.car-card .cc-name { font-family: "Big Shoulders", sans-serif; font-weight: 800; font-size: 17px; line-height: .95; }
.car-card .cc-meta { font-family: "IBM Plex Mono", monospace; font-size: 7.5px; letter-spacing: .08em; opacity: .7; display: flex; gap: 6px; }
.car-card .cc-price { font-family: "IBM Plex Mono", monospace; font-size: 8px; float: right; }
.car-card.active { border-width: 2.5px; background: var(--orange); box-shadow: 3px 3px 0 rgba(27,31,36,.3); }
.car-card.locked { opacity: .78; }
.car-card.locked img { filter: grayscale(.35) contrast(1.1); }
.car-card .owned-dot { position: absolute; right: 5px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); border: 1px solid var(--ink); }

.car-sheet { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding-right: 2px; }
.preview-frame {
  position: relative; border: 2px solid var(--ink);
  background: var(--paper-hi);
  background-image: linear-gradient(rgba(27,31,36,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(27,31,36,.06) 1px, transparent 1px);
  background-size: 24px 24px;
  box-shadow: 4px 4px 0 rgba(27,31,36,.18);
  padding: 6px; flex: 0 0 auto;
}
#car-preview { width: 100%; height: auto; display: block; aspect-ratio: 760/470; }
.preview-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; letter-spacing: .2em; color: var(--teal-deep); background: rgba(242,227,200,.72); }
.preview-loading.hidden { display: none; }
.preview-corner { position: absolute; width: 12px; height: 12px; border: 2px solid var(--ink); pointer-events: none; }
.preview-corner.tl { left: 3px; top: 3px; border-right: 0; border-bottom: 0; }
.preview-corner.tr { right: 3px; top: 3px; border-left: 0; border-bottom: 0; }
.preview-corner.bl { left: 3px; bottom: 3px; border-right: 0; border-top: 0; }
.preview-corner.br { right: 3px; bottom: 3px; border-left: 0; border-top: 0; }
.preview-plate { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 6px 2px 1px; }
.car-title .kicker { font-size: 8px; }
.car-title h3 { font-size: clamp(26px, 3.2vw, 44px); line-height: .92; margin-top: 1px; }
.car-price { font-size: clamp(12px, 1.2vw, 16px); font-weight: 600; padding-bottom: 2px; color: var(--teal-deep); }
.car-price.buy { color: var(--rust); }
.car-blurb { font-size: 11px; line-height: 1.45; margin: 8px 0 6px; max-width: 54ch; }
.stat-sheet { display: flex; flex-direction: column; gap: 4px; margin: 3px 0 8px; }
.stat-row { display: grid; grid-template-columns: 78px 1fr 44px; gap: 8px; align-items: center; }
.stat-row span { font-family: "IBM Plex Mono", monospace; font-size: 8px; letter-spacing: .1em; }
.stat-blocks { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; height: 9px; }
.stat-blocks i { background: rgba(27,31,36,.12); border: 1px solid rgba(27,31,36,.2); }
.stat-blocks i.on { background: var(--teal); border-color: var(--ink); }
.stat-row:nth-child(2) .stat-blocks i.on { background: var(--orange); }
.stat-row:nth-child(4) .stat-blocks i.on { background: var(--rust); }
.stat-row b { font-family: "IBM Plex Mono", monospace; font-size: 8px; text-align: right; font-weight: 600; }
.car-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-bottom: 4px; }

.upgrade-panel { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding-right: 3px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-bottom: 1.5px solid var(--ink); padding-bottom: 3px; margin-bottom: 6px; }
.panel-head h3 { font-size: 22px; }
.panel-head span { font-family: "IBM Plex Mono", monospace; font-size: 8px; letter-spacing: .12em; color: var(--teal-deep); }
.upgrade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.up-cell {
  position: relative; border: 1.5px solid var(--ink); background: var(--paper-hi);
  padding: 5px 5px 4px; display: grid; grid-template-columns: 36px 1fr; gap: 4px;
  box-shadow: 2px 2px 0 rgba(27,31,36,.14);
}
.up-cell img { width: 36px; height: 36px; object-fit: contain; }
.up-name { font-family: "Big Shoulders", sans-serif; font-weight: 800; font-size: 16px; line-height: .95; display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.up-name em { font-style: normal; font-family: "IBM Plex Mono", monospace; font-size: 8px; color: var(--teal-deep); }
.up-meta { display: flex; align-items: center; justify-content: space-between; gap: 3px; margin-top: 2px; }
.up-pips { display: flex; gap: 1.5px; }
.up-pips i { width: 8px; height: 5px; border: 1px solid rgba(27,31,36,.45); }
.up-pips i.on { background: var(--orange); border-color: var(--ink); }
.up-buy {
  font-family: "IBM Plex Mono", monospace; font-size: 7.5px; letter-spacing: .02em;
  border: 1.5px solid var(--ink); background: var(--paper); padding: 1px 4px;
  white-space: nowrap;
}
.up-buy:hover { background: var(--orange); }
.up-buy[disabled] { opacity: .45; cursor: default; }
.up-buy.max { background: var(--teal); color: var(--paper-hi); border-color: var(--ink); }
.up-cell.installed { background: #ecdcb8; }
.up-cell.installed::after { content: "STAMPED"; position: absolute; right: 3px; top: -6px; font-family: "IBM Plex Mono", monospace; font-size: 6px; letter-spacing: .1em; color: var(--rust); transform: rotate(-8deg); }
.tune-section { margin-top: 10px; }
.tune-row { display: grid; grid-template-columns: 88px 1fr 46px; gap: 8px; align-items: center; margin-bottom: 6px; }
.tune-row label { font-family: "IBM Plex Mono", monospace; font-size: 7.5px; letter-spacing: .06em; text-transform: uppercase; line-height: 1.2; }
.tune-row input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 14px; background: transparent;
}
.tune-row input[type=range]::-webkit-slider-runnable-track { height: 6px; background: var(--paper-hi); border: 1.5px solid var(--ink); }
.tune-row input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 16px; margin-top: -6px; background: var(--orange); border: 1.5px solid var(--ink); }
.tune-row input[type=range]::-moz-range-track { height: 6px; background: var(--paper-hi); border: 1.5px solid var(--ink); }
.tune-row input[type=range]::-moz-range-thumb { width: 12px; height: 15px; background: var(--orange); border: 1.5px solid var(--ink); border-radius: 0; }
.tune-val { font-family: "IBM Plex Mono", monospace; font-size: 9px; text-align: right; font-weight: 600; }
.tune-note { font-family: "IBM Plex Mono", monospace; font-size: 7px; letter-spacing: .08em; opacity: .6; margin: 4px 0 10px; line-height: 1.5; }

/* ---------------- map ---------------- */
.map-body { position: relative; z-index: 2; flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 18px; padding-top: 10px; }
.map-frame { position: relative; border: 2px solid var(--ink); background: var(--paper-hi); padding: 8px; box-shadow: 5px 5px 0 rgba(27,31,36,.18); min-height: 0; display: flex; align-items: center; justify-content: center; }
.map-frame img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; mix-blend-mode: multiply; }
.map-overlay { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); pointer-events: none; }
.map-scale { position: absolute; left: 16px; bottom: 14px; font-size: 8px; letter-spacing: .12em; border-top: 1px solid var(--ink); padding-top: 1px; }
.map-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; }
.map-legend { border: 1.5px solid var(--ink); background: var(--paper-hi); padding: 8px 10px; }
.map-legend h3 { font-size: 20px; margin-bottom: 4px; }
.legend-row { display: flex; align-items: center; gap: 7px; font-size: 10px; padding: 2px 0; }
.sw { width: 18px; height: 10px; display: inline-block; flex: 0 0 auto; }
.sw.line { border-top: 2px solid var(--orange); transform: rotate(-8deg); }
.sw.dot { width: 9px; height: 9px; background: var(--rust); border: 1px solid var(--ink); border-radius: 50%; }
.sw.chev { background: var(--orange); clip-path: polygon(0 0, 55% 50%, 0 100%, 30% 100%, 85% 50%, 30% 0); }
.sw.town { background: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 4px), repeating-linear-gradient(0deg, var(--ink) 0 1px, transparent 1px 4px); opacity: .6; }
.map-checklist { display: flex; flex-direction: column; gap: 2px; font-size: 8.5px; letter-spacing: .04em; border-top: 1px solid rgba(27,31,36,.3); padding-top: 5px; }
.map-checklist div { display: flex; justify-content: space-between; gap: 8px; }
.map-checklist b { color: var(--rust); }

/* ---------------- pause / overlay ---------------- */
.overlay-screen { background: rgba(27,31,36,.42); align-items: center; justify-content: center; padding: 18px; backdrop-filter: saturate(.8); }
.panel-shell { position: relative; width: min(560px, 94vw); max-height: 92vh; padding: clamp(20px, 3vw, 38px); }
.panel-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; filter: drop-shadow(6px 8px 0 rgba(0,0,0,.3)); }
.panel-inner { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 6px; max-height: 78vh; overflow-y: auto; padding-right: 4px; }
.panel-inner h2 { font-size: clamp(38px, 5vw, 60px); margin-bottom: 6px; }
.pause-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pause-actions .menu-btn.primary { grid-column: span 2; }
.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 2px 0 8px; }
.ctrl-row { display: flex; align-items: center; gap: 7px; border-bottom: 1px solid rgba(27,31,36,.16); padding: 3px 0; }
.ctrl-row .glyphs { display: flex; align-items: center; gap: 2px; min-width: 54px; }
.ctrl-row img { width: 24px; height: 24px; object-fit: contain; }
.ctrl-row .kb { font-family: "IBM Plex Mono", monospace; font-size: 8px; border: 1px solid rgba(27,31,36,.5); padding: 1px 3px; }
.ctrl-row span { font-size: 10px; line-height: 1.2; }
.controls-note { font-size: 9px; line-height: 1.45; opacity: .72; margin: 0 0 8px; }
.settings-list { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 8px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(27,31,36,.18); padding: 6px 0; }
.set-row .set-label { font-family: "IBM Plex Mono", monospace; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.set-row .set-hint { font-size: 9px; opacity: .6; display: block; margin-top: 2px; }
.toggle { width: 42px; height: 20px; border: 1.5px solid var(--ink); background: var(--paper-hi); position: relative; flex: 0 0 auto; }
.toggle i { position: absolute; left: 2px; top: 2px; width: 14px; height: 12px; background: rgba(27,31,36,.35); }
.toggle.on { background: var(--teal); }
.toggle.on i { left: auto; right: 2px; background: var(--paper-hi); }
.set-seg { display: flex; border: 1.5px solid var(--ink); }
.set-seg button { font-family: "IBM Plex Mono", monospace; font-size: 8px; padding: 2px 7px; border-right: 1px solid var(--ink); }
.set-seg button:last-child { border-right: 0; }
.set-seg button.on { background: var(--orange); }

/* ---------------- results ---------------- */
.results-screen { align-items: center; justify-content: center; padding: 20px; }
.results-card {
  position: relative; z-index: 2; width: min(680px, 94vw); max-height: 92vh; overflow-y: auto;
  background: var(--paper-hi); border: 2px solid var(--ink);
  box-shadow: 8px 8px 0 rgba(27,31,36,.22); padding: clamp(18px, 3vw, 34px);
}
.results-card h2 { font-size: clamp(40px, 6vw, 70px); margin: 2px 0 6px; }
.result-time { font-size: clamp(46px, 8vw, 92px); font-weight: 600; line-height: .9; color: var(--rust); text-shadow: 3px 3px 0 rgba(224,138,60,.35); }
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); margin: 12px 0; padding: 8px 0; }
.result-grid div { display: flex; flex-direction: column; gap: 2px; }
.result-grid b { font-size: clamp(15px, 1.7vw, 22px); font-weight: 600; }
.result-board { margin: 8px 0 14px; }
.result-board h3 { font-size: 20px; margin-bottom: 4px; }
.board-list { list-style: none; margin: 0; padding: 0; font-size: 9px; }
.board-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; border-bottom: 1px solid rgba(27,31,36,.15); padding: 3px 0; }
.board-list li a { color: var(--ink); text-decoration: none; border-bottom: 1px solid rgba(27,31,36,.4); }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- countdown ---------------- */
.countdown { position: fixed; inset: 0; z-index: 24; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.count-stamp {
  font-family: "Big Shoulders", sans-serif; font-weight: 800;
  font-size: clamp(120px, 24vw, 280px); line-height: .8; color: var(--orange);
  text-shadow: 5px 5px 0 var(--teal), 10px 10px 0 rgba(27,31,36,.35);
  animation: stamp .9s ease-out;
}
@keyframes stamp {
  0% { transform: scale(1.5) rotate(-4deg); opacity: 0; }
  22% { transform: scale(.97) rotate(1deg); opacity: 1; }
  80% { transform: scale(1) rotate(0); opacity: 1; }
  100% { opacity: .85; }
}
.count-kicker { font-size: 11px; letter-spacing: .3em; background: var(--paper); border: 2px solid var(--ink); padding: 3px 10px; margin-top: 14px; }

.rotate-note {
  position: fixed; left: 50%; bottom: 38px; transform: translateX(-50%);
  z-index: 40; background: var(--paper); border: 2px solid var(--ink);
  padding: 5px 12px; font-family: "IBM Plex Mono", monospace; font-size: 8px;
  letter-spacing: .12em; box-shadow: 3px 3px 0 rgba(27,31,36,.3);
}

/* ---------------- responsive ---------------- */
@media (max-width: 1180px) {
  .garage-body { grid-template-columns: 230px minmax(0, 1fr) 318px; }
  .garage-body.mode-cars { grid-template-columns: 230px minmax(0, 1fr); }
  .garage-body.mode-shop { grid-template-columns: minmax(0, 1fr) 318px; }
  .title-map { width: 200px; }
}
@media (max-width: 980px) {
  .title-menu { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .garage-body, .garage-body.mode-cars, .garage-body.mode-shop { grid-template-columns: 1fr; overflow-y: auto; }
  .garage-body.mode-cars .car-list { display: flex; flex-direction: row; overflow-x: auto; overflow-y: hidden; max-height: 64px; }
  .garage-body.mode-cars .car-card { min-width: 190px; grid-template-columns: 64px 1fr; }
  .garage-body.mode-cars .car-card img { width: 64px; height: 32px; }
  .upgrade-panel { overflow: visible; }
  .car-sheet { overflow: visible; }
  .map-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .map-side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .map-side .menu-btn { min-width: 150px; }
}
@media (max-width: 760px) {
  .title-screen { padding: 12px 12px calc(10px + env(safe-area-inset-bottom)); }
  .title-top { gap: 10px; }
  .wordmark { width: min(78vw, 420px); }
  .title-map { width: 26vw; max-width: 132px; }
  .title-map-label { display: none; }
  .title-main { flex-direction: column; align-items: stretch; gap: 8px; }
  .title-copy { padding-bottom: 0; }
  .title-lede { font-size: 10.5px; line-height: 1.4; margin-bottom: 8px; max-width: none; }
  .title-stats { font-size: 8px; gap: 4px 10px; padding-top: 5px; }
  .title-menu { grid-template-columns: 1fr 1fr; gap: 5px; }
  .menu-btn { min-height: 44px; padding: 6px 8px; }
  .menu-btn .mb-main { font-size: 20px; }
  .menu-btn .mb-sub { display: none; }
  .menu-btn.primary .mb-main { font-size: 27px; }
  .title-foot { font-size: 7.5px; gap: 6px; flex-wrap: wrap; }
  .title-credit { display: none; }
  .hud-big { font-size: 18px; }
  .hud-speed { bottom: 96px; }
  .hud-boost { bottom: 48px; width: 178px; left: 10px; }
  .hud-pedals { display: none; }
  .hud-topright { gap: 4px; }
  .hud-cash { min-width: 66px; padding: 3px 6px 4px; }
  .hud-cash .hud-mid { font-size: 13px; }
  .stampbtn { min-height: 36px; padding: 4px 7px; }
  .stampbtn span { font-size: 16px; }
  .hud-next { top: 6px; }
  .hud-next .chev { width: 34px; }
  .hud-cp { min-width: 0; padding: 3px 6px 4px; }
  .hud-cp .hud-mid { font-size: 12px; }
  .hud-cp .hud-kicker, .hud-cp .hud-mini { font-size: 7px; }
  .hud-warning { top: 15%; }
  .hud-score { top: 72px; }
  .hud-odometer { height: 26px; }
  .odo-label { top: 2px; font-size: 6px; }
  .hud-camtag { display: none; }
  .touch-steer { bottom: 36px; }
  .touch-pedals { bottom: 36px; }
  .tsteer { width: 58px; height: 58px; }
  .tpedal { width: 54px; height: 68px; font-size: 13px; }
  .tsmall { width: 42px; height: 38px; font-size: 10px; }
  .sheet-title h2 { font-size: 40px; }
  .sheet-head-right { gap: 8px; }
  .head-cash b { font-size: 18px; }
  .car-card { min-width: 168px; }
  .upgrade-grid { grid-template-columns: 1fr 1fr; }
  .panel-shell { width: min(560px, 96vw); }
  .pause-actions { grid-template-columns: 1fr; }
  .pause-actions .menu-btn.primary { grid-column: auto; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .controls-grid { grid-template-columns: 1fr; }
  .title-map { display: none; }
  .results-card { padding: 16px; }
}
@media (max-width: 460px) {
  .title-menu { grid-template-columns: 1fr 1fr; }
  .hud-cp { display: none; }
  .hud-next .chev { width: 40px; }
  .hud-speed { width: 118px; }
  .hud-speed .dial-wrap { width: 118px; }
  .hud-boost { width: 152px; }
  .hud-plate { box-shadow: 2px 2px 0 rgba(27,31,36,.25); }
  .title-stats span:nth-child(4) { display: none; }
}

/* landscape phone: pull HUD to edges */
@media (max-height: 520px) and (orientation: landscape) {
  .title-screen { padding: 8px 14px; }
  .wordmark { width: min(34vw, 300px); }
  .title-map { width: 17vw; }
  .title-main { margin-top: 0; }
  .title-copy { display: none; }
  .title-menu { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .title-foot { padding-top: 4px; margin-top: 4px; }
  .menu-btn { min-height: 40px; }
  .menu-btn.primary .mb-main { font-size: 24px; }
  .hud-speed { bottom: 34px; }
  .hud-boost { bottom: 44px; }
  .hud-pedals { display: flex; bottom: 40px; }
  .touch-steer { bottom: 34px; }
  .touch-pedals { bottom: 34px; }
  .garage-body { overflow-y: auto; }
}

/* mobile portrait touch adjustments */
@media (pointer: coarse) {
  .hud-pedals { display: none; }
  .hud-speed { bottom: 104px; }
  .hud-boost { bottom: 50px; width: 170px; }
  .hud-camtag { display: none; }
}
@media (pointer: coarse) and (orientation: landscape) {
  .hud-speed { bottom: 34px; }
  .hud-boost { bottom: 44px; width: 210px; }
  .hud-pedals { display: flex; margin-left: 226px; }
  .touch-pedals { right: 150px; }
}

/* score + level */
.xp-row { display: flex; align-items: center; gap: 5px; }
.score-plate { display: flex; align-items: baseline; gap: 7px; padding-right: 58px; }
.score-plate > b { font-size: clamp(16px, 1.7vw, 24px); font-weight: 600; line-height: 1; }
.kill-stamp { font-family: "IBM Plex Mono", monospace; font-size: 7px; letter-spacing: .08em; color: var(--rust); position: absolute; right: 7px; top: 50%; transform: translateY(-50%); }
.kill-stamp b { font-size: 8px; }
#app.levelup::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 18;
  box-shadow: inset 0 0 0 5px var(--orange), inset 0 0 70px rgba(224,138,60,.25);
  animation: levelflash 1.1s ease-out forwards;
}
@keyframes levelflash {
  0% { opacity: 1; } 55% { opacity: .75; } 100% { opacity: 0; }
}
@media (max-width: 760px) {
  .score-plate > b { font-size: 15px; }
  .kill-stamp { display: none; }
  .score-plate { padding-right: 8px; }
}

/* apocalypse grade on the printed layers */
.title-screen::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 82%, rgba(110,36,28,.22), transparent 42%),
    radial-gradient(ellipse at 82% 26%, rgba(224,138,60,.14), transparent 48%),
    linear-gradient(115deg, rgba(27,31,24,.18), transparent 36%, rgba(27,31,24,.08) 70%, transparent);
  mix-blend-mode: multiply;
}
.title-screen::after { content: ""; }
.title-halftone { opacity: .34; }

.title-alert {
  position: absolute; left: clamp(16px, 3vw, 52px); top: 47%;
  z-index: 3; transform: rotate(-2.5deg);
  background: var(--rust); color: var(--paper-hi);
  font-family: "Big Shoulders", sans-serif; font-weight: 800;
  font-size: clamp(14px, 1.7vw, 22px); letter-spacing: .08em;
  padding: 4px 10px 5px; border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(27,31,36,.25);
  pointer-events: none;
}
.title-alert::after { content: ""; position: absolute; inset: 0; background-image: var(--dots); background-size: 3px 3px; opacity: .2; mix-blend-mode: multiply; }
.kill-stamp { color: var(--ink); opacity: .7; }
#hud.racing .hud-score { top: clamp(82px, 12vw, 116px); }
#hud:not(.racing) .hud-score { top: clamp(12px, 1.8vw, 20px); }
@media (max-width: 760px) {
  .title-alert { top: auto; bottom: 31%; left: 14px; font-size: 12px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .title-alert { display: none; }
}
.odo-labels { position: absolute; left: 1.5%; right: 1.5%; top: 1px; display: flex; justify-content: space-between; font-family: "IBM Plex Mono", monospace; font-size: 6.5px; letter-spacing: .04em; color: var(--ink); opacity: .7; pointer-events: none; }
.odo-labels span:last-child { transform: translateX(50%); }

/* portrait title + touch HUD fit */
@media (max-width: 760px) {
  .title-alert { top: 24vh; bottom: auto; left: 14px; font-size: 11px; padding: 3px 8px 4px; }
  .title-main { gap: 6px; }
  .title-lede { font-size: 10px; line-height: 1.4; margin-bottom: 6px; }
  .title-stats { padding-top: 4px; }
  .title-menu { gap: 4px; }
  .menu-btn { min-height: 40px; }
  .menu-btn.small { min-height: 36px; padding: 5px 8px; }
  .menu-btn.primary { min-height: 42px; }
  .title-foot { margin-top: 4px; padding-top: 4px; font-size: 7px; }
  .title-screen { overflow-y: auto; }
}
@media (pointer: coarse) {
  .hud-speed { bottom: 200px; right: 8px; }
  .hud-boost { bottom: 138px; left: 10px; width: 168px; }
  .hud-pedals { display: none; }
  .touch-steer { bottom: 40px; }
  .touch-pedals { bottom: 40px; }
}
@media (pointer: coarse) and (max-height: 520px) and (orientation: landscape) {
  .hud-speed { bottom: 34px; right: 8px; }
  .hud-boost { bottom: 44px; left: 10px; width: 200px; }
  .touch-steer { bottom: 34px; }
  .touch-pedals { bottom: 34px; }
}

.title-alert { position: fixed; z-index: 4; }
@media (min-width: 761px) { .title-alert { top: 47%; } }
@media (max-width: 980px) {
  .map-body { grid-template-rows: auto auto; overflow-y: auto; }
  .map-frame { max-height: none; }
  .map-frame img { max-height: 42vh; }
  .map-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .map-legend { grid-column: 1; }
  .map-checklist { display: none; }
  .map-side .menu-btn { min-width: 0; }
}

/* keep the car sheet compact so stats and actions stay on the sheet */
.preview-frame { width: min(100%, 560px); margin: 0 auto; }
@media (min-width: 981px) {
  .preview-frame { width: min(100%, calc(36vh * 760 / 470)); }
}
@media (max-width: 980px) {
  .preview-frame { width: min(100%, 520px); }
}

#world-grade {
  position: absolute; inset: 0; z-index: 5; pointer-events: none; display: none;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(18,14,10,0) 58%, rgba(18,14,10,.2) 100%);
  mix-blend-mode: multiply;
}
#app.world-on #world-grade { display: block; }
#world-grade::after {
  content: ""; position: absolute; inset: 0;
  background-image: var(--grain); background-size: 180px 180px; opacity: .06;
}
.mirror { transform: scaleX(-1); }
.glyphs img.mirror { transform: scaleX(-1); }

/* pause sheet: keep every action inside the printed frame */
.panel-shell { width: min(700px, 94vw); padding: clamp(42px, 7vh, 72px) clamp(34px, 5vw, 62px); }
.panel-inner { max-height: 68vh; padding: 2px 4px 4px; }
.panel-inner h2 { margin-bottom: 8px; }
.pause-actions { gap: 5px; }
.pause-actions .menu-btn { min-height: 46px; }
.controls-grid { gap: 3px 14px; }
@media (max-width: 760px) {
  .panel-shell { padding: 38px 26px; width: min(560px, 96vw); }
  .panel-inner { max-height: 76vh; }
}

.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; border-bottom: 1px solid rgba(27,31,36,.3); padding: 7px 0; }
.result-stats div { display: flex; flex-direction: column; gap: 1px; }
.result-stats b { font-size: clamp(20px, 2.4vw, 30px); font-weight: 600; }
.board-list li.empty { grid-template-columns: 1fr; opacity: .6; letter-spacing: .08em; }
.board-list li a { color: var(--ink); }
@media (max-width: 760px) {
  .result-stats { grid-template-columns: 1fr 1fr; }
}

/* keep the kill count visible on phones: it is the point of the hunt */
@media (max-width: 760px) {
  .score-plate { flex-wrap: wrap; padding-right: 8px; }
  .kill-stamp { position: static; transform: none; display: inline-block; margin-left: auto; }
  .score-plate > b { margin-right: 2px; }
}

/* the loading card is visual only; early taps queue the title action for when the world is ready */
.boot, .boot-card, .boot::before { pointer-events: none; }
