:root {
  --ink: #0a1018;
  --panel: rgba(10, 16, 26, 0.82);
  --panel-soft: rgba(12, 20, 32, 0.68);
  --line: rgba(255, 255, 255, 0.14);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f4f6f8;
  --muted: #a7b2c0;
  --dim: #6f7c8c;
  --orange: #ff6a2b;
  --gold: #ffc35c;
  --green: #42d392;
  --red: #ff4655;
  --yellow: #ffc93c;
  --radius: 18px;
  --font: "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  background: #070b11; color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
body { touch-action: none; }
.screen, .garage-panel, .help-card { touch-action: pan-y; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
canvas { display: block; }

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

#hitflash {
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(120% 100% at 50% 50%, transparent 40%, rgba(255, 40, 50, 0.55) 100%);
  opacity: 0; transition: opacity 120ms ease;
}
#hitflash.on { opacity: 1; transition: opacity 60ms ease; }
#grade {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background:
    radial-gradient(130% 95% at 50% 38%, transparent 52%, rgba(4, 8, 14, 0.42) 100%),
    linear-gradient(180deg, rgba(4, 8, 14, 0.10) 0%, transparent 22%, transparent 70%, rgba(4, 8, 14, 0.34) 100%);
}

/* ---------- shared type ---------- */
.eyebrow {
  font-size: 10px; letter-spacing: 0.24em; font-weight: 700;
  color: var(--gold); text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.eyebrow .pip { width: 6px; height: 6px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 10px var(--orange); }
kbd {
  font-family: var(--mono); font-size: 10px; line-height: 1;
  padding: 5px 7px; border-radius: 5px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  color: #e8edf3;
}

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0; z-index: 30;
  display: none; opacity: 0;
  transition: opacity 220ms ease;
}
.screen.on { display: flex; }
.screen.visible { opacity: 1; }
.screen.hidden { display: none !important; }

.start-screen {
  align-items: stretch;
  background:
    linear-gradient(90deg, rgba(5,9,15,0.92) 0%, rgba(5,9,15,0.56) 28%, rgba(5,9,15,0.02) 54%, rgba(5,9,15,0.5) 100%),
    linear-gradient(180deg, rgba(5,9,15,0.38) 0%, transparent 30%, transparent 62%, rgba(5,9,15,0.68) 100%);
  padding: clamp(18px, 4vw, 56px);
  gap: 24px;
  overflow-y: auto;
}
.start-brand {
  align-self: center;
  max-width: 620px;
  min-width: 280px;
  flex: 1 1 52%;
  padding-left: clamp(0px, 2vw, 22px);
}
.start-brand h1 {
  margin: 18px 0 12px;
  font-size: clamp(52px, 7.2vw, 108px);
  line-height: 0.86;
  letter-spacing: -0.035em;
  font-weight: 800;
  text-transform: uppercase;
  text-shadow: 0 18px 60px rgba(0,0,0,0.45);
}
.start-brand h1 span {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255,255,255,0.82);
}
.cityline {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-top: 14px;
}
.cityline b {
  font-size: clamp(18px, 2vw, 27px); letter-spacing: 0.16em; font-weight: 800;
  color: var(--gold);
}
.cityline span { font-size: 10px; letter-spacing: 0.22em; color: var(--muted); font-weight: 600; }
.lede {
  margin: 18px 0 0; max-width: 460px;
  color: #c8d1dc; font-size: 14px; line-height: 1.65;
}
.start-meta {
  display: flex; gap: clamp(18px, 3vw, 40px); margin-top: 30px;
  padding-top: 18px; border-top: 1px solid var(--line-soft);
}
.start-meta div { display: flex; flex-direction: column; gap: 5px; }
.start-meta b { font-size: 22px; letter-spacing: 0.02em; }
.start-meta span { font-size: 9px; letter-spacing: 0.18em; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.viewer-line { margin-top: 22px; min-height: 16px; font-size: 11px; letter-spacing: 0.08em; color: var(--muted); }

.garage-panel {
  align-self: center;
  flex: 0 0 clamp(300px, 30vw, 372px);
  max-width: 372px;
  min-width: 0;
  margin-left: auto;
  padding: 22px;
  border-radius: var(--radius);
  background: rgba(10,16,26,0.92);
  border: 1px solid var(--line);
  box-shadow: 0 30px 90px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 9px; letter-spacing: 0.2em; font-weight: 700; color: var(--muted);
}
.panel-head span:last-child { color: var(--gold); }
.car-name {
  margin: 7px 0 20px;
  font-size: 26px; font-weight: 800; letter-spacing: 0.03em;
  display: flex; align-items: baseline; gap: 7px;
}
.car-name b { color: var(--orange); }
.car-name span {
  font-size: 10px; color: var(--muted); border: 1px solid var(--line);
  padding: 2px 6px; border-radius: 4px; letter-spacing: 0.15em;
}
.swatch-group { margin-bottom: 16px; }
.swatch-group > label {
  display: block; margin-bottom: 9px;
  font-size: 9px; letter-spacing: 0.2em; color: var(--muted); font-weight: 700;
}
.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch {
  width: 27px; height: 27px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  box-shadow: inset 0 2px 6px rgba(255,255,255,0.22), 0 2px 8px rgba(0,0,0,0.4);
  position: relative; transition: transform 140ms ease, border-color 140ms ease;
}
.swatch:hover { transform: translateY(-2px); }
.swatch.sel { border-color: #fff; transform: translateY(-2px) scale(1.06); }
.swatch.sel::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.45);
}
.segmented { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-btn {
  flex: 1 1 0; min-width: 74px;
  padding: 9px 6px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--muted);
  font-size: 9px; letter-spacing: 0.14em; font-weight: 700;
  background: rgba(255,255,255,0.03);
  transition: all 140ms ease;
}
.seg-btn.sel { background: rgba(255,106,43,0.16); border-color: rgba(255,106,43,0.7); color: #ffd9c7; }

.primary-btn {
  width: 100%; margin-top: 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px; border-radius: 11px;
  background: linear-gradient(135deg, #ff7a37, #ff4f1f);
  color: #170b04; font-size: 12px; font-weight: 800; letter-spacing: 0.16em;
  box-shadow: 0 10px 28px rgba(255, 84, 30, 0.28);
  transition: transform 140ms ease, filter 140ms ease;
}
.primary-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.primary-btn:active { transform: translateY(0); }
.primary-btn .arrow { font-size: 18px; line-height: 1; }
.panel-actions { display: flex; gap: 8px; margin-top: 10px; }
.ghost-btn {
  flex: 1 1 0; padding: 12px 10px; border-radius: 9px;
  border: 1px solid var(--line); color: #cbd3dd;
  font-size: 9px; letter-spacing: 0.16em; font-weight: 700;
  background: rgba(255,255,255,0.03);
  transition: all 140ms ease;
}
.ghost-btn:hover { background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.28); }
.ghost-btn.wide { width: 100%; flex: none; margin-top: 9px; }
.ghost-btn.danger { color: #ff9f9f; }
.ghost-btn.danger:hover { background: rgba(255,70,85,0.12); border-color: rgba(255,70,85,0.5); }

/* ---------- modal cards ---------- */
.modal-screen {
  align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(4, 8, 14, 0.74);
  overflow-y: auto;
}
.menu-card, .garage-card, .summary-card, .help-card {
  width: min(430px, 100%);
  padding: 28px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 40px 120px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
}
.menu-card h2, .garage-card h2, .summary-card h2, .help-card h2 {
  margin: 12px 0 6px; font-size: 34px; letter-spacing: -0.02em; line-height: 1;
}
.menu-sub { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 10px 0 20px; }
.garage-card { width: min(470px, 100%); }
.garage-card .swatch-group { margin-top: 18px; }
.summary-card { width: min(560px, 100%); }
.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin: 22px 0 16px;
}
.stat-grid > div {
  padding: 14px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 5px;
}
.stat-grid b { font-size: 20px; font-weight: 800; letter-spacing: 0.01em; }
.stat-grid span { font-size: 8px; letter-spacing: 0.19em; color: var(--muted); font-weight: 700; }
.summary-note {
  margin: 0 0 18px; padding: 12px 14px; border-radius: 10px;
  background: rgba(255, 195, 92, 0.08); border: 1px solid rgba(255, 195, 92, 0.22);
  color: #e8d9b8; font-size: 12px; line-height: 1.55;
}
.summary-note:empty { display: none; }
.help-card { width: min(720px, 100%); }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin: 20px 0 6px; }
.help-cols h3 { margin: 0 0 10px; font-size: 9px; letter-spacing: 0.2em; color: var(--gold); }
.keylist, .rulelist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.keylist li { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #d4dbe4; }
.keylist li span { margin-left: 7px; color: var(--muted); }
.rulelist li { font-size: 12px; color: var(--muted); line-height: 1.5; padding-left: 13px; position: relative; }
.rulelist li::before { content: ""; position: absolute; left: 0; top: 7px; width: 4px; height: 4px; border-radius: 50%; background: var(--orange); }
.rulelist b { color: var(--text); }
.help-foot { color: var(--dim); font-size: 11px; margin: 18px 0 16px; }

/* ---------- loading / fatal ---------- */
.loading-screen {
  z-index: 60; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(110% 80% at 50% 42%, #101a28, #05080d 72%);
  gap: 4px; text-align: center; opacity: 1;
}
.load-logo { font-size: clamp(34px, 6vw, 56px); font-weight: 800; letter-spacing: 0.02em; }
.load-logo b { color: var(--orange); }
.load-sub { font-size: 9px; letter-spacing: 0.34em; color: var(--muted); font-weight: 700; }
.load-bar {
  width: min(300px, 70vw); height: 2px; margin-top: 26px;
  background: rgba(255,255,255,0.10); border-radius: 2px; overflow: hidden;
}
.load-bar span {
  display: block; width: 40%; height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--orange), var(--gold));
  animation: loadslide 1.15s ease-in-out infinite;
}
@keyframes loadslide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(360%); }
}
.load-text { margin-top: 14px; font-size: 10px; letter-spacing: 0.16em; color: var(--dim); text-transform: uppercase; }
.fatal-screen { z-index: 70; align-items: center; justify-content: center; background: #070b11; }
.fatal-card { max-width: 480px; padding: 30px; text-align: center; }
.fatal-card h2 { margin: 0 0 10px; font-size: 26px; }
.fatal-card p { color: var(--muted); line-height: 1.6; font-size: 13px; }

/* ---------- HUD ---------- */
#hud {
  position: absolute; inset: 0; z-index: 10;
  pointer-events: none;
  opacity: 0; transition: opacity 260ms ease;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
#hud.on { opacity: 1; }
#hud button { pointer-events: auto; }

.hud-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.hud-brand { display: flex; flex-direction: column; gap: 3px; padding-top: 3px; }
.brand-mark {
  font-size: 15px; font-weight: 800; letter-spacing: 0.12em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.brand-mark b { color: var(--orange); }
.brand-sub { font-size: 7.5px; letter-spacing: 0.28em; color: rgba(255,255,255,0.62); font-weight: 700; }

.signal-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 13px 8px 10px; border-radius: 999px;
  background: rgba(8, 13, 21, 0.66); border: 1px solid var(--line-soft);
  transition: opacity 180ms ease;
}
.signal-chip.idle { opacity: 0.5; }
.sig-lamps { display: flex; flex-direction: column; gap: 2px; padding: 2px; }
.sig-lamps i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.12); display: block; }
.sig-lamps i.r.on { background: #ff3b48; box-shadow: 0 0 8px #ff3b48; }
.sig-lamps i.y.on { background: #ffc93c; box-shadow: 0 0 8px #ffc93c; }
.sig-lamps i.g.on { background: #3ee08b; box-shadow: 0 0 8px #3ee08b; }
.sig-text { display: flex; flex-direction: column; gap: 1px; }
.sig-text b { font-size: 9px; letter-spacing: 0.16em; }
.sig-text span { font-size: 8px; color: var(--muted); letter-spacing: 0.06em; }

.hud-actions { display: flex; gap: 6px; }
.icon-btn {
  min-width: 36px; height: 32px; padding: 0 10px;
  border-radius: 8px; border: 1px solid var(--line-soft);
  background: rgba(8, 13, 21, 0.62); color: #d7dee7;
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
  transition: all 140ms ease;
}
.icon-btn:hover { background: rgba(255,255,255,0.12); }
.icon-btn.muted { color: var(--dim); }

.hud-map {
  position: absolute; top: 64px; right: max(14px, env(safe-area-inset-right));
  width: clamp(118px, 13vw, 168px); aspect-ratio: 1;
  border-radius: 18px; overflow: hidden;
  background: #0c1620;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
}
#minimap { width: 100%; height: 100%; }
.map-frame {
  position: absolute; inset: 0; pointer-events: none;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), inset 0 0 40px rgba(0,0,0,0.35);
}
.map-n {
  position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(8,13,21,0.8); border: 1px solid rgba(255,255,255,0.22);
  color: #fff; font-size: 8px; font-weight: 800; letter-spacing: 0.05em;
  display: flex; align-items: center; justify-content: center;
}

.hud-bottom {
  position: absolute; left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
}
.speedo-wrap { position: relative; flex: 0 0 auto; width: clamp(180px, 20vw, 250px); }
#speedo { width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 24px rgba(0,0,0,0.45)); }
.lane-chip {
  position: absolute; left: 12px; bottom: -2px;
  padding: 5px 9px; border-radius: 5px;
  font-size: 8px; font-weight: 800; letter-spacing: 0.14em;
  color: #07110b; background: var(--green);
  box-shadow: 0 3px 12px rgba(0,0,0,0.35);
  transition: all 180ms ease;
}
.lane-chip.warn { color: #170b04; background: var(--orange); }
.lane-chip.bad { color: #fff; background: var(--red); }

.guide {
  flex: 1 1 auto; max-width: 430px;
  margin-bottom: 4px; padding: 8px 12px;
  display: flex; flex-direction: column; gap: 4px;
  background: rgba(8,13,21,0.58);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  text-shadow: 0 2px 14px rgba(0,0,0,0.6);
}
.guide-street { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.guide-street b { font-size: clamp(14px, 1.5vw, 18px); letter-spacing: 0.08em; font-weight: 800; }
.guide-street span { font-size: 9px; letter-spacing: 0.14em; color: var(--gold); font-weight: 700; }
.guide-tip { font-size: 10px; letter-spacing: 0.06em; color: rgba(255,255,255,0.74); }

.keys-hint {
  position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%);
  font-size: 8px; letter-spacing: 0.14em; color: rgba(255,255,255,0.36);
  white-space: nowrap; font-weight: 600;
}
.touch-controls { display: none; }

.toast {
  position: absolute; left: 50%; bottom: 26%; transform: translate(-50%, 10px);
  padding: 10px 16px; border-radius: 8px;
  background: rgba(8,13,21,0.9); border: 1px solid var(--line);
  font-size: 11px; letter-spacing: 0.08em; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity 200ms ease, transform 200ms ease;
  white-space: nowrap;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { border-color: rgba(255,106,43,0.55); color: #ffcdb8; }
.toast.bad { border-color: rgba(255,70,85,0.6); color: #ffb6bc; }

.speed-warn {
  position: absolute; left: 50%; top: 72px; transform: translateX(-50%);
  padding: 7px 12px; border-radius: 6px;
  background: rgba(255,70,85,0.14); border: 1px solid rgba(255,70,85,0.55);
  color: #ffd4d8; font-size: 9px; font-weight: 800; letter-spacing: 0.14em;
  opacity: 0; transition: opacity 160ms ease;
}
.speed-warn.on { opacity: 1; }

/* ---------- touch ---------- */
body.touch-device .touch-controls { display: flex; }
body.touch-device .keys-hint { display: none; }
.touch-controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  align-items: flex-end; justify-content: space-between;
  pointer-events: none;
  padding: 0 max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
}
.tc-steer { display: flex; gap: 10px; pointer-events: auto; }
.tc-pedals { display: flex; align-items: flex-end; gap: 8px; pointer-events: auto; }
.tc-btn {
  pointer-events: auto;
  width: clamp(62px, 12vw, 82px); height: clamp(62px, 12vw, 82px);
  border-radius: 50%;
  background: rgba(10, 16, 26, 0.66);
  border: 1px solid rgba(255,255,255,0.24);
  color: #f2f5f8; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.tc-btn:active, .tc-btn.on {
  background: rgba(255,106,43,0.32);
  border-color: rgba(255,140,90,0.8);
  transform: scale(0.96);
}
.tc-btn.gas {
  height: clamp(96px, 18vw, 130px); border-radius: 26px;
  background: rgba(255,106,43,0.24); border-color: rgba(255,130,70,0.55);
  font-size: 11px; letter-spacing: 0.12em; font-weight: 800;
}
.tc-btn.brake {
  height: clamp(82px, 15vw, 108px); border-radius: 22px;
  font-size: 9px; letter-spacing: 0.1em; font-weight: 800;
  background: rgba(255,70,85,0.16); border-color: rgba(255,70,85,0.45);
}
.tc-btn.hand {
  width: clamp(48px, 9vw, 58px); height: clamp(48px, 9vw, 58px);
  font-size: 9px; letter-spacing: 0.06em; font-weight: 800;
  background: rgba(255,201,60,0.14); border-color: rgba(255,201,60,0.4);
}
body.touch-device .guide { max-width: 46%; margin-bottom: clamp(90px, 20vw, 140px); }
body.touch-device .speedo-wrap { width: clamp(130px, 24vw, 190px); margin-bottom: clamp(86px, 18vw, 120px); }
body.touch-device .lane-chip { bottom: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .start-screen { flex-direction: column; justify-content: flex-start; padding: 22px; gap: 16px; }
  .start-brand { align-self: stretch; flex: none; padding-left: 0; }
  .start-brand h1 { font-size: clamp(46px, 11vw, 78px); }
  .garage-panel { align-self: stretch; flex: 1 1 auto; max-width: none; margin: 0; }
  .start-meta { margin-top: 20px; }
  .lede { font-size: 13px; }
}
@media (pointer: coarse) {
  #speedo { filter: none; }
}
body.low-power #speedo { filter: none; }
body.low-power .start-brand h1 { text-shadow: 0 4px 18px rgba(0,0,0,0.55); }
body.low-power .guide { text-shadow: none; }
body.low-power .brand-mark { text-shadow: none; }
body.low-power .map-frame { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); }
body.low-power .garage-panel { box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
body.low-power .menu-card,
body.low-power .garage-card,
body.low-power .summary-card,
body.low-power .help-card { box-shadow: 0 12px 32px rgba(0,0,0,0.55); }
body.low-power .hud-map { box-shadow: 0 6px 18px rgba(0,0,0,0.4); }
body.low-power .tc-btn { box-shadow: 0 6px 16px rgba(0,0,0,0.35); }
body.low-power .primary-btn { box-shadow: 0 6px 16px rgba(255,84,30,0.25); }
@media (max-width: 640px) {
  .hud-map { width: 104px; top: 58px; }
  .brand-sub { display: none; }
  .signal-chip { padding: 6px 10px 6px 8px; }
  .sig-text span { display: none; }
  .icon-btn { min-width: 32px; height: 30px; padding: 0 8px; }
  .guide {
    display: flex; position: fixed; left: 12px; top: 60px;
    max-width: 52vw; padding: 8px 10px; border-radius: 10px;
    background: rgba(8,13,21,0.6); border: 1px solid var(--line-soft);
    gap: 2px; margin: 0;
  }
  .guide-street { gap: 6px; }
  .guide-street b { font-size: 12px; }
  .guide-street span { font-size: 8px; }
  .guide-tip { font-size: 9px; line-height: 1.35; }
  body.touch-device .guide { max-width: 52vw; margin: 0; }
  .hud-bottom { align-items: flex-end; }
  body.touch-device .speedo-wrap { width: 116px; margin-bottom: 96px; }
  .start-screen {
    flex-direction: column; justify-content: flex-end;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
    gap: 0; overflow: hidden;
  }
  .start-brand {
    position: absolute; top: 16px; left: 16px; right: 16px;
    flex: none; align-self: flex-start; max-width: none; padding: 0;
  }
  .start-brand h1 { font-size: clamp(38px, 12vw, 56px); margin: 8px 0 4px; }
  .start-brand .lede { display: none; }
  .start-meta { display: none; }
  .cityline { margin-top: 8px; gap: 8px; }
  .cityline b { font-size: 16px; }
  .cityline span { font-size: 8px; }
  .viewer-line { margin-top: 8px; font-size: 9px; max-width: 78%; }
  .garage-panel {
    position: relative; width: 100%; max-width: none; flex: none;
    margin: 0; padding: 14px; max-height: 56vh; overflow-y: auto;
  }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .help-cols { grid-template-columns: 1fr; gap: 20px; }
  .help-card, .menu-card, .garage-card, .summary-card { padding: 22px; }
  .menu-card h2, .garage-card h2, .summary-card h2, .help-card h2 { font-size: 28px; }
  .toast { font-size: 10px; bottom: 30%; }
  .speed-warn { top: 58px; font-size: 8px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  .modal-screen { align-items: flex-start; padding: 8px; }
  .help-card {
    max-height: calc(100vh - 16px); overflow-y: auto;
    padding: 16px 20px; width: min(760px, 100%);
  }
  .menu-card, .garage-card, .summary-card {
    max-height: calc(100vh - 16px); overflow-y: auto; touch-action: pan-y;
  }
  .help-card h2 { font-size: 26px; margin: 6px 0 4px; }
  .help-cols { gap: 22px; margin: 10px 0 2px; }
  .keylist, .rulelist { gap: 5px; }
  .keylist li, .rulelist li { font-size: 11px; }
  .help-foot { display: none; }
  .help-card .primary-btn { padding: 11px 12px; margin-top: 6px; }
  .start-screen {
    flex-direction: row; align-items: stretch; justify-content: space-between;
    padding: 10px 16px; gap: 14px; overflow: hidden;
  }
  .start-brand { flex: 1 1 46%; align-self: center; max-width: none; padding-left: 0; }
  .start-brand h1 { font-size: clamp(36px, 10vh, 58px); margin: 6px 0 4px; }
  .start-brand .lede { display: none; }
  .start-brand .eyebrow { font-size: 8px; }
  .cityline { margin-top: 8px; gap: 8px; }
  .cityline b { font-size: 16px; }
  .cityline span { font-size: 8px; }
  .start-meta { display: none; }
  .viewer-line { margin-top: 10px; font-size: 9px; }
  .garage-panel {
    flex: 0 0 clamp(250px, 36vw, 300px); max-width: 300px; min-width: 0;
    margin-left: auto; align-self: center;
    max-height: calc(100vh - 16px); overflow-y: auto;
    padding: 12px 14px; border-radius: 14px;
  }
  .panel-head { font-size: 8px; }
  .car-name { margin: 3px 0 8px; font-size: 18px; }
  .car-name span { font-size: 8px; }
  .swatch-group { margin-bottom: 7px; }
  .swatch-group > label { font-size: 8px; margin-bottom: 5px; }
  .swatch { width: 20px; height: 20px; }
  .swatches { gap: 6px; }
  .seg-btn { padding: 6px 4px; font-size: 8px; min-width: 0; }
  .primary-btn { padding: 11px 12px; font-size: 10px; margin-top: 4px; }
  .panel-actions { margin-top: 6px; }
  .ghost-btn { padding: 8px 6px; font-size: 8px; }
  .hud-map { width: 100px; }
}
@media (prefers-reduced-motion: reduce) {
  .load-bar span { animation: none; width: 100%; }
}
