/* WORLD VELOCITY — interface */
:root {
  --accent: #ff2e88;
  --accent-2: #38e8ff;
  --accent-ink: #ffffff;
  --char-accent: #ffcf3f;
  --bg: #07090d;
  --paper: #f4f1e9;
  --muted: rgba(244, 241, 233, .56);
  --faint: rgba(244, 241, 233, .16);
  --line: rgba(244, 241, 233, .14);
  --glass: rgba(10, 13, 19, .62);
  --display: "Bahnschrift", "Arial Narrow", "DIN Alternate", "Segoe UI", sans-serif;
  --body: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: var(--bg);
  color: var(--paper);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  touch-action: manipulation;
}
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { display: block; }
.hidden { display: none !important; }

#scene-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}
#grade-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 7, 11, .8) 0%, rgba(5, 7, 11, .3) 38%, transparent 68%),
    linear-gradient(0deg, rgba(3, 5, 8, .9) 0%, transparent 34%),
    radial-gradient(ellipse at 65% 42%, transparent 30%, rgba(3, 5, 8, .3) 100%);
  transition: opacity .6s ease;
}
body.race-active #grade-layer {
  background:
    radial-gradient(ellipse at center, transparent 48%, rgba(3, 5, 8, .34) 100%),
    linear-gradient(0deg, rgba(3, 5, 8, .28), transparent 25%);
}
#grain-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: .055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%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='.8'/%3E%3C/svg%3E");
}
#speed-fx {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s linear;
  background:
    radial-gradient(ellipse at center, transparent 35%, rgba(255, 255, 255, .02) 55%, rgba(6, 8, 12, .42) 100%),
    repeating-conic-gradient(from 0deg at 50% 50%, transparent 0deg 7deg, rgba(255,255,255,.06) 7.2deg 7.5deg, transparent 7.7deg 18deg);
  mask-image: radial-gradient(ellipse at center, transparent 34%, #000 72%);
}

/* ————————————— boot ————————————— */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255, 46, 136, .1), transparent 45%),
    #05070b;
  transition: opacity .8s ease, visibility .8s;
}
.boot-screen.done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-glow {
  position: absolute;
  width: 70vw;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .5;
  top: 50%;
  filter: blur(1px);
}
.boot-inner { width: min(620px, 86vw); text-align: center; position: relative; }
.brand-mark { color: var(--accent); width: 34px; height: 34px; display: inline-block; flex: none; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-mark.large { width: 64px; height: 64px; }
.boot-kicker {
  margin-top: 28px;
  color: var(--muted);
  font: 600 11px/1 var(--display);
  letter-spacing: .42em;
}
.boot-inner h1 {
  font: 900 clamp(46px, 9vw, 104px)/.8 var(--display);
  letter-spacing: -.045em;
  margin: 22px 0 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--paper);
}
.boot-inner h1 span {
  color: transparent;
  -webkit-text-stroke: 1.3px rgba(244, 241, 233, .7);
}
.boot-bar { height: 2px; background: rgba(255,255,255,.1); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 3%; background: var(--accent); box-shadow: 0 0 18px var(--accent); transition: width .4s ease; }
.boot-status {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  color: rgba(244,241,233,.4);
  font: 500 10px/1 var(--mono);
  letter-spacing: .12em;
}

/* ————————————— top bar ————————————— */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 86px;
  padding: 0 42px;
  display: flex;
  align-items: center;
  gap: 26px;
  transition: opacity .4s, transform .4s;
}
body.race-active #topbar, body.results-active #topbar { opacity: 0; pointer-events: none; transform: translateY(-10px); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--paper); }
.brand-text { display: flex; flex-direction: column; line-height: .84; }
.brand-text b { font: 800 17px/1 var(--display); letter-spacing: .12em; }
.brand-text em { font: 400 9px/1.3 var(--display); letter-spacing: .52em; color: var(--accent); font-style: normal; margin-left: 2px; }
.top-meta {
  display: flex; align-items: center; gap: 10px;
  color: rgba(244, 241, 233, .46);
  font: 500 10px/1 var(--mono);
  letter-spacing: .09em;
  white-space: nowrap;
}
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(255,46,136,.12); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.72); } }
.top-divider { width: 1px; height: 13px; background: var(--line); margin: 0 2px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  color: rgba(244,241,233,.7);
  background: rgba(8, 10, 14, .28);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  transition: .2s;
}
.icon-btn svg { width: 17px; height: 17px; fill: currentColor; }
.icon-btn .ico-sound-off { display: none; }
body.muted .icon-btn .ico-sound-on { display: none; }
body.muted .icon-btn .ico-sound-off { display: block; }
.icon-btn:hover { color: var(--paper); border-color: rgba(244,241,233,.45); transform: translateY(-1px); }
.share-btn {
  height: 36px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 17px;
  margin-left: 5px;
  color: var(--paper);
  border: 1px solid rgba(244,241,233,.24);
  background: rgba(8, 10, 14, .28);
  backdrop-filter: blur(10px);
  font-size: 12px;
  letter-spacing: .08em;
  transition: .2s;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}
.share-btn svg { width: 15px; height: 15px; fill: currentColor; }
.share-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ————————————— menu ————————————— */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
.screen > * { pointer-events: auto; }
.menu-hero {
  position: absolute;
  left: 4.7vw;
  top: 15.5vh;
  width: min(680px, 52vw);
  z-index: 3;
}
.eyebrow {
  display: flex; align-items: center; gap: 11px;
  color: rgba(244,241,233,.53);
  font: 600 9px/1 var(--mono);
  letter-spacing: .27em;
  margin-bottom: 24px;
  animation: revealUp .8s .15s both;
}
.eyebrow-line { width: 24px; height: 1px; background: var(--accent); }
.display-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(62px, 8.6vw, 144px);
  line-height: .78;
  letter-spacing: -.055em;
  display: flex;
  flex-direction: column;
  animation: revealUp .85s .23s both;
}
.display-title span:first-child { color: var(--paper); text-shadow: 0 5px 40px rgba(0,0,0,.5); }
.display-title .outline {
  color: transparent;
  -webkit-text-stroke: 1.4px rgba(244,241,233,.8);
  font-size: .86em;
  letter-spacing: -.035em;
  background: linear-gradient(100deg, rgba(244,241,233,.92), rgba(244,241,233,.34) 72%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.title-en {
  display: flex; align-items: center; gap: 10px;
  margin-top: 22px;
  font: 500 10px/1 var(--mono);
  letter-spacing: .46em;
  color: rgba(244,241,233,.45);
  animation: revealUp .8s .34s both;
}
.title-en span { color: var(--accent); }
.title-en i { display: inline-block; width: 38px; height: 1px; background: var(--line); }
.lede {
  margin: 30px 0 0;
  color: rgba(244, 241, 233, .65);
  font-size: 13px;
  line-height: 2;
  letter-spacing: .06em;
  max-width: 440px;
  animation: revealUp .8s .42s both;
}
.start-row { display: flex; align-items: center; gap: 24px; margin-top: 31px; animation: revealUp .8s .5s both; }
.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  min-width: 240px;
  height: 64px;
  padding: 0 18px 0 25px;
  background: var(--accent);
  color: var(--accent-ink);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  transition: transform .25s, filter .25s;
  text-align: left;
}
.cta::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid rgba(255,255,255,.22);
  clip-path: inherit;
  pointer-events: none;
}
.cta:hover { transform: translateY(-2px); filter: brightness(1.08); }
.cta:active { transform: translateY(0); }
.cta-label { display: block; font: 700 17px/1.2 var(--body); letter-spacing: .05em; }
.cta-sub { display: block; font: 500 8px/1 var(--mono); letter-spacing: .3em; opacity: .62; margin-top: 5px; }
.cta-arrow { margin-left: auto; font: 300 26px/1 var(--display); transform: translateY(-1px); }
.cta.small { min-width: 196px; height: 54px; padding: 0 15px 0 20px; }
.cta.small .cta-label { font-size: 14px; }
.cta.small .cta-arrow { font-size: 21px; }
.start-note { display: flex; flex-direction: column; gap: 5px; padding-left: 2px; }
.start-note b { font-size: 11px; font-weight: 600; letter-spacing: .1em; color: rgba(244,241,233,.82); }
.start-note span { font-size: 10px; letter-spacing: .04em; color: rgba(244,241,233,.38); }
.control-strip {
  display: flex;
  align-items: center;
  gap: 21px;
  margin-top: 29px;
  animation: revealUp .8s .58s both;
}
.control-strip > div { display: flex; align-items: center; gap: 5px; color: rgba(244,241,233,.36); font-size: 9px; letter-spacing: .06em; }
kbd {
  min-width: 22px;
  height: 21px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(244,241,233,.2);
  background: rgba(244,241,233,.055);
  color: rgba(244,241,233,.72);
  font: 600 9px/1 var(--mono);
}
@keyframes revealUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }

/* character panel */
.menu-side {
  position: absolute;
  right: 4.1vw;
  top: 11.5vh;
  width: 348px;
  z-index: 4;
  animation: revealRight .9s .3s both;
}
@keyframes revealRight { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: translateX(0); } }
.panel {
  position: relative;
  background: linear-gradient(160deg, rgba(15, 18, 25, .76), rgba(9, 11, 16, .56));
  border: 1px solid rgba(244,241,233,.14);
  backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: 0 30px 80px rgba(0,0,0,.34);
  padding: 18px;
}
.panel::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 34px; height: 2px;
  background: var(--accent);
}
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 13px; }
.panel-head > div, .section-head > div { display: flex; align-items: baseline; gap: 9px; }
.panel-head h2, .section-head h2 { margin: 0; font: 600 15px/1 var(--body); letter-spacing: .1em; }
.panel-index { color: var(--accent); font: 600 10px/1 var(--mono); letter-spacing: .13em; }
.panel-meta { color: rgba(244,241,233,.36); font: 500 9px/1 var(--mono); letter-spacing: .07em; white-space: nowrap; }
.driver-showcase {
  position: relative;
  height: 194px;
  overflow: hidden;
  background: #0a0d12;
  border: 1px solid rgba(244,241,233,.1);
}
.portrait { position: absolute; inset: 0; }
.avatar-svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.flag-svg { display: block; width: 100%; height: 100%; }
.portrait-sheen {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(8,10,14,.72) 100%), linear-gradient(90deg, transparent 60%, rgba(8,10,14,.22));
  pointer-events: none;
}
.driver-number {
  position: absolute;
  right: 10px;
  bottom: 4px;
  font: 900 70px/.8 var(--display);
  color: rgba(255,255,255,.08);
  letter-spacing: -.05em;
  pointer-events: none;
}
.driver-flag {
  position: absolute;
  left: 12px;
  bottom: 11px;
  width: 39px;
  height: 27px;
  padding: 2px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(5,8,12,.64);
  backdrop-filter: blur(6px);
}
.driver-country { color: var(--accent); font: 600 9px/1 var(--mono); letter-spacing: .16em; margin-top: 14px; }
.driver-meta h3 { margin: 7px 0 1px; font-size: 23px; font-weight: 650; letter-spacing: .04em; }
.driver-en { color: rgba(244,241,233,.32); font: 500 8px/1 var(--mono); letter-spacing: .25em; }
.driver-quote { margin: 10px 0 12px; color: rgba(244,241,233,.54); font-size: 11px; letter-spacing: .04em; }
.stat-grid { display: grid; gap: 6px; }
.stat { display: grid; grid-template-columns: 40px 1fr 14px; align-items: center; gap: 8px; }
.stat span { font-size: 9px; color: rgba(244,241,233,.38); letter-spacing: .06em; }
.stat i { display: block; height: 2px; background: rgba(244,241,233,.12); overflow: hidden; }
.stat i b { display: block; height: 100%; background: var(--char-accent); transition: width .4s ease; }
.stat em { font: 500 9px/1 var(--mono); color: rgba(244,241,233,.48); font-style: normal; text-align: right; }
.character-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid rgba(244,241,233,.1);
}
.char-btn {
  position: relative;
  min-height: 45px;
  padding: 6px 4px 5px;
  border: 1px solid rgba(244,241,233,.09);
  background: rgba(244,241,233,.025);
  color: rgba(244,241,233,.5);
  transition: .2s;
  text-align: center;
}
.char-btn:hover { color: var(--paper); border-color: rgba(244,241,233,.26); background: rgba(244,241,233,.06); }
.char-btn.selected { color: var(--paper); border-color: var(--char-accent); background: color-mix(in srgb, var(--char-accent) 12%, transparent); }
.char-btn .cb-flag { display: flex; justify-content: center; align-items: center; height: 15px; line-height: 1.1; }
.char-btn .cb-flag .flag-svg { width: 23px; height: 14px; border: 1px solid rgba(255,255,255,.22); }
.char-btn .cb-country { display: block; font-size: 8px; letter-spacing: .05em; margin-top: 3px; opacity: .75; }
.char-btn.selected::after { content: ""; position: absolute; left: 50%; bottom: -1px; width: 14px; height: 1px; background: var(--char-accent); transform: translateX(-50%); }

/* tracks */
.track-panel {
  position: absolute;
  left: 4.7vw;
  bottom: 5.7vh;
  width: min(860px, calc(100vw - 470px));
  z-index: 3;
  animation: revealUp .9s .68s both;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.track-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.track-card {
  position: relative;
  height: 132px;
  padding: 0;
  text-align: left;
  overflow: hidden;
  border: 1px solid rgba(244,241,233,.14);
  background: #0b0e14;
  transition: transform .25s, border-color .25s;
}
.track-card:hover { transform: translateY(-3px); border-color: rgba(244,241,233,.42); }
.track-card.selected { border-color: var(--tc-accent); box-shadow: 0 0 0 1px var(--tc-accent), 0 18px 40px rgba(0,0,0,.3); }
.track-visual {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 70% 30%, color-mix(in srgb, var(--tc-accent) 26%, transparent), transparent 54%),
    linear-gradient(170deg, color-mix(in srgb, var(--tc-secondary) 13%, #0b0e14) 0%, #0a0c12 60%, #07090d 100%);
}
.track-visual::before {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000, transparent 86%);
}
.track-skyline { position: absolute; left: 0; right: 0; bottom: 0; height: 54px; opacity: .38; display: flex; align-items: flex-end; gap: 4px; padding: 0 11px; }
.track-skyline i { display: block; flex: 1; background: var(--tc-secondary); opacity: .25; }
.track-circuit { position: absolute; right: 8px; top: 12px; width: 92px; height: 66px; opacity: .72; }
.track-circuit svg { width: 100%; height: 100%; }
.track-badge {
  position: absolute; left: 10px; top: 9px;
  font: 600 7px/1 var(--mono); letter-spacing: .18em;
  color: var(--tc-secondary);
  border: 1px solid color-mix(in srgb, var(--tc-secondary) 45%, transparent);
  padding: 4px 5px;
  background: rgba(5,8,12,.4);
}
.track-info { position: absolute; left: 11px; right: 11px; bottom: 10px; z-index: 2; }
.track-city { display: block; color: rgba(244,241,233,.42); font: 500 8px/1 var(--mono); letter-spacing: .2em; margin-bottom: 4px; }
.track-info b { display: block; font: 600 15px/1.1 var(--body); letter-spacing: .08em; }
.track-meta { display: flex; align-items: center; gap: 7px; margin-top: 5px; color: rgba(244,241,233,.38); font: 500 8px/1 var(--mono); letter-spacing: .05em; }
.track-meta i { width: 2px; height: 2px; background: var(--tc-accent); border-radius: 50%; }
.track-select-mark { position: absolute; right: 9px; bottom: 9px; width: 17px; height: 17px; border: 1px solid rgba(255,255,255,.26); display: grid; place-items: center; font-size: 9px; color: transparent; z-index: 2; }
.track-card.selected .track-select-mark { color: var(--tc-accent); border-color: var(--tc-accent); background: color-mix(in srgb, var(--tc-accent) 13%, transparent); }
.track-record { position: absolute; right: 10px; top: 9px; color: rgba(244,241,233,.34); font: 500 7px/1 var(--mono); letter-spacing: .06em; }
.menu-footer {
  position: absolute; left: 4.7vw; right: 4.1vw; bottom: 16px;
  display: flex; justify-content: space-between; align-items: center;
  color: rgba(244,241,233,.22); font: 500 8px/1 var(--mono); letter-spacing: .12em;
  z-index: 3;
}
.footer-mid { letter-spacing: .28em; }

/* ————————————— HUD ————————————— */
#race-hud { position: fixed; inset: 0; z-index: 14; pointer-events: none; }
#race-hud button { pointer-events: auto; }
.hud-top-left { position: absolute; left: 28px; top: 26px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.hud-pos-card {
  position: relative;
  width: 152px;
  padding: 12px 15px 12px;
  background: linear-gradient(135deg, rgba(8,11,16,.82), rgba(8,11,16,.45));
  border-left: 2px solid var(--accent);
  backdrop-filter: blur(16px);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
}
.hud-label { display: block; color: rgba(244,241,233,.38); font: 500 8px/1 var(--mono); letter-spacing: .2em; }
.hud-pos { display: flex; align-items: flex-start; margin-top: 2px; }
.hud-pos > span { font: 900 52px/.9 var(--display); letter-spacing: -.04em; }
.hud-pos small { font: 500 14px/1 var(--display); color: rgba(244,241,233,.35); margin: 8px 0 0 3px; }
.hud-lap-row { display: flex; align-items: baseline; gap: 5px; margin-top: 6px; padding-top: 7px; border-top: 1px solid rgba(244,241,233,.12); color: rgba(244,241,233,.38); font: 500 8px/1 var(--mono); letter-spacing: .1em; }
.hud-lap-row b { color: var(--paper); font: 700 20px/1 var(--display); }
.hud-lap-row i { color: rgba(244,241,233,.24); font-style: normal; font-size: 10px; }
.hud-pause { width: 33px; height: 33px; border: 1px solid rgba(244,241,233,.2); background: rgba(8,11,16,.5); color: rgba(244,241,233,.7); font: 600 12px/1 var(--display); letter-spacing: 1px; backdrop-filter: blur(10px); }
.hud-pause:hover { border-color: var(--accent); color: var(--accent); }

.hud-timing { position: absolute; top: 27px; left: 50%; transform: translateX(-50%); width: min(360px, 34vw); text-align: center; }
.timing-main { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 14px 8px; background: linear-gradient(180deg, rgba(8,11,16,.66), rgba(8,11,16,.22)); backdrop-filter: blur(12px); border-top: 1px solid rgba(244,241,233,.16); }
.timing-main b { font: 500 24px/1 var(--mono); letter-spacing: .04em; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.timing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 1px; background: rgba(244,241,233,.1); }
.timing-grid > div { padding: 6px 3px; background: rgba(8,11,16,.5); backdrop-filter: blur(12px); display: flex; flex-direction: column; gap: 3px; }
.timing-grid span { color: rgba(244,241,233,.3); font-size: 8px; letter-spacing: .08em; }
.timing-grid b { font: 500 11px/1 var(--mono); color: rgba(244,241,233,.78); }

.hud-map { position: absolute; right: 28px; top: 26px; width: 214px; padding: 10px 11px 8px; background: linear-gradient(160deg, rgba(8,11,16,.74), rgba(8,11,16,.32)); border: 1px solid rgba(244,241,233,.13); backdrop-filter: blur(16px); }
.map-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.map-head b { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; margin-top: 4px; }
.map-head > span { color: var(--accent); font: 600 9px/1 var(--mono); letter-spacing: .1em; padding: 4px 5px; border: 1px solid rgba(255,255,255,.12); }
#minimap-canvas { width: 190px; height: 142px; display: block; }
.map-foot { display: flex; align-items: center; gap: 6px; padding-top: 6px; border-top: 1px solid rgba(244,241,233,.1); color: rgba(244,241,233,.26); font: 500 7px/1 var(--mono); letter-spacing: .12em; }
.map-foot .live-dot { width: 4px; height: 4px; }

.hud-speed { position: absolute; left: 27px; bottom: 24px; width: 224px; }
.rpm-bar-row { display: flex; gap: 3px; width: 177px; margin: 0 0 4px 8px; height: 4px; }
.rpm-bar { flex: 1; height: 100%; background: rgba(244,241,233,.13); transform: skewX(-20deg); transition: background .1s; }
.rpm-bar.lit { background: var(--accent); box-shadow: 0 0 7px color-mix(in srgb, var(--accent) 60%, transparent); }
.rpm-bar.redline { background: #ff3b46; }
.speed-gauge { position: relative; width: 137px; height: 137px; filter: drop-shadow(0 8px 24px rgba(0,0,0,.5)); }
.speed-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-track { fill: rgba(8,11,16,.36); stroke: rgba(244,241,233,.12); stroke-width: 5; }
.gauge-fill { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 65%, transparent)); transition: stroke-dashoffset .12s linear; }
.speed-readout { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 3px; }
.speed-readout span { font: 800 48px/.85 var(--display); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.speed-readout small { margin-top: 5px; color: rgba(244,241,233,.34); font: 500 7px/1 var(--mono); letter-spacing: .2em; }
.gear-readout { position: absolute; right: -13px; bottom: 22px; width: 43px; height: 47px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: rgba(8,11,16,.64); border: 1px solid rgba(244,241,233,.16); backdrop-filter: blur(10px); clip-path: polygon(0 0, 100% 0, 100% 100%, 7px 100%, 0 calc(100% - 7px)); }
.gear-readout span { font: 500 6px/1 var(--mono); color: rgba(244,241,233,.3); letter-spacing: .12em; }
.gear-readout b { font: 700 22px/1 var(--display); color: var(--accent); }
.speed-meta { display: flex; justify-content: space-between; width: 183px; margin-top: 5px; color: rgba(244,241,233,.22); font: 500 7px/1 var(--mono); letter-spacing: .08em; }

.hud-driver { position: absolute; right: 28px; bottom: 25px; display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.hud-driver-card { display: flex; align-items: center; gap: 9px; padding: 8px 11px; background: rgba(8,11,16,.55); border: 1px solid rgba(244,241,233,.14); backdrop-filter: blur(12px); }
.hud-flag { display: grid; width: 23px; height: 15px; line-height: 1; }
.hud-flag .flag-svg { border: 1px solid rgba(255,255,255,.24); }
.hud-driver-card div { display: flex; flex-direction: column; gap: 4px; text-align: right; }
.hud-driver-card b { font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.hud-driver-card span:not(.hud-flag) { font: 500 6px/1 var(--mono); color: rgba(244,241,233,.28); letter-spacing: .18em; }
.hud-boost { width: 173px; padding: 7px 9px 8px; background: rgba(8,11,16,.55); border: 1px solid rgba(244,241,233,.14); backdrop-filter: blur(12px); }
.boost-top { display: flex; justify-content: space-between; color: rgba(244,241,233,.32); font: 500 7px/1 var(--mono); letter-spacing: .12em; }
.boost-top i { font-style: normal; color: var(--accent); opacity: 0; transition: opacity .2s; }
.hud-boost.active .boost-top i, #boost-label.show { opacity: 1; }
.boost-track { height: 3px; background: rgba(244,241,233,.13); margin-top: 7px; overflow: hidden; }
.boost-track i { display: block; height: 100%; width: calc(var(--boost, 0) * 100%); background: linear-gradient(90deg, var(--accent), #ffd23f); box-shadow: 0 0 8px var(--accent); transition: width .1s linear; }
.drift-indicator { position: absolute; left: 50%; bottom: 175px; transform: translate(-50%, 10px); display: flex; align-items: center; gap: 9px; opacity: 0; transition: .2s; color: var(--accent); }
.drift-indicator.show { opacity: 1; transform: translate(-50%, 0); }
.drift-indicator span { font: 600 8px/1 var(--mono); letter-spacing: .3em; }
.drift-indicator b { font-size: 11px; font-weight: 600; letter-spacing: .14em; color: rgba(244,241,233,.7); }
.wrong-way { position: absolute; left: 50%; top: 27%; transform: translate(-50%, -8px); display: flex; flex-direction: column; align-items: center; gap: 5px; opacity: 0; transition: .2s; }
.wrong-way.show { opacity: 1; transform: translate(-50%, 0); animation: wrongPulse 1s infinite; }
.wrong-way b { font: 800 21px/1 var(--display); letter-spacing: .2em; color: #ff3b46; text-shadow: 0 0 30px rgba(255,59,70,.55); }
.wrong-way span { font-size: 10px; letter-spacing: .2em; color: rgba(255,255,255,.6); }
@keyframes wrongPulse { 50% { opacity: .55; } }
.speed-lines { position: absolute; inset: 0; pointer-events: none; opacity: .2; background: repeating-conic-gradient(from 0deg at 50% 50%, transparent 0deg 5deg, rgba(255,255,255,.4) 5.05deg 5.12deg, transparent 5.2deg 13deg); mask-image: radial-gradient(ellipse at center, transparent 42%, #000 80%); }

/* ————————————— countdown + toast ————————————— */
.countdown { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; background: radial-gradient(ellipse at center, rgba(3,5,8,.22), transparent 62%); }
.countdown-label { margin-bottom: 14px; color: rgba(244,241,233,.42); font: 600 9px/1 var(--mono); letter-spacing: .5em; }
.countdown span { font: 900 25vw/.72 var(--display); letter-spacing: -.06em; line-height: .8; color: var(--paper); text-shadow: 0 10px 80px rgba(0,0,0,.55); }
.countdown span.pop { animation: countPop .78s cubic-bezier(.2,.8,.2,1) both; }
.countdown span.go { color: var(--accent); font-size: 20vw; }
@keyframes countPop { 0% { opacity: 0; transform: scale(1.42); filter: blur(8px); } 24% { opacity: 1; filter: blur(0); } 72% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.94); } }
.countdown-line { width: 58px; height: 1px; background: var(--accent); margin-top: 30px; opacity: .6; }
.game-toast {
  position: fixed; top: 18%; left: 50%; z-index: 32;
  min-width: 250px; padding: 11px 18px 12px;
  transform: translate(-50%, -12px);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(8,11,16,.82); border: 1px solid rgba(244,241,233,.16);
  backdrop-filter: blur(16px); opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
}
.game-toast.show { opacity: 1; transform: translate(-50%, 0); }
.game-toast.accent { border-color: var(--accent); }
.game-toast span { color: var(--accent); font: 600 7px/1 var(--mono); letter-spacing: .25em; }
.game-toast b { font-size: 13px; font-weight: 600; letter-spacing: .08em; }
.game-toast small { color: rgba(244,241,233,.42); font-size: 9px; letter-spacing: .06em; }
.race-notice {
  position: fixed; top: 25%; left: 50%; z-index: 31;
  transform: translate(-50%, -10px); opacity: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: .35s;
}
.race-notice.show { opacity: 1; transform: translate(-50%, 0); }
.race-notice span { color: var(--accent); font: 600 9px/1 var(--mono); letter-spacing: .32em; }
.race-notice b { font-size: 24px; font-weight: 650; letter-spacing: .1em; text-shadow: 0 4px 30px rgba(0,0,0,.4); }

/* ————————————— touch ————————————— */
.touch-controls { display: none; position: fixed; inset: 0; z-index: 18; pointer-events: none; }
body.touch-device.race-active .touch-controls { display: block; }
.touch-steer { position: absolute; left: max(16px, env(safe-area-inset-left)); bottom: max(22px, env(safe-area-inset-bottom)); display: flex; gap: 10px; pointer-events: auto; }
.touch-pedals { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 9px; pointer-events: auto; }
.touch-btn {
  width: 64px; height: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1px solid rgba(244,241,233,.28);
  background: rgba(8,11,16,.42);
  backdrop-filter: blur(12px);
  color: rgba(244,241,233,.8);
  border-radius: 50%;
  touch-action: none;
  transition: transform .1s, background .1s;
}
.touch-btn.pressed { transform: scale(.93); background: color-mix(in srgb, var(--accent) 35%, rgba(8,11,16,.6)); border-color: var(--accent); }
.touch-btn span { font-size: 11px; font-weight: 600; letter-spacing: .05em; }
.touch-btn small { color: rgba(244,241,233,.3); font: 500 6px/1 var(--mono); letter-spacing: .12em; }
.touch-arrow { width: 70px; height: 70px; border-radius: 14px; }
.touch-arrow span { font: 300 34px/1 var(--display); transform: translateY(-2px); }
.touch-drift { width: 60px; height: 60px; }
.touch-brake { width: 66px; height: 66px; }
.touch-throttle { width: 72px; height: 72px; background: color-mix(in srgb, var(--accent) 24%, rgba(8,11,16,.58)); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
body.auto-throttle .touch-throttle { display: none; }

/* ————————————— overlays / modals ————————————— */
.overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(4,6,9,.52); backdrop-filter: blur(8px); overflow-y: auto; }
.modal {
  position: relative;
  width: min(540px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  padding: 26px;
  background: linear-gradient(155deg, rgba(16,20,28,.96), rgba(7,9,13,.94));
  border: 1px solid rgba(244,241,233,.16);
  box-shadow: 0 40px 120px rgba(0,0,0,.65);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
}
.modal::before { content: ""; position: absolute; top: 0; left: 26px; width: 58px; height: 2px; background: var(--accent); }
.modal-kicker { color: var(--accent); font: 600 8px/1 var(--mono); letter-spacing: .3em; }
.modal h2 { margin: 13px 0 7px; font: 650 34px/1.05 var(--body); letter-spacing: .03em; }
.modal > p { margin: 0 0 22px; color: rgba(244,241,233,.45); font-size: 11px; line-height: 1.9; }
.modal-close { position: absolute; right: 16px; top: 13px; color: rgba(244,241,233,.42); font: 300 28px/1 var(--display); }
.modal-close:hover { color: var(--paper); }
.ghost-btn { height: 50px; padding: 0 18px; border: 1px solid rgba(244,241,233,.18); color: rgba(244,241,233,.68); font-size: 11px; letter-spacing: .08em; transition: .2s; }
.ghost-btn:hover { border-color: rgba(244,241,233,.5); color: var(--paper); }
.ghost-btn.wide { width: 100%; }
.pause-settings { display: flex; flex-direction: column; gap: 1px; background: rgba(244,241,233,.1); margin-bottom: 22px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 13px; background: rgba(8,11,16,.55); cursor: pointer; }
.toggle-row span { display: flex; flex-direction: column; gap: 4px; }
.toggle-row b { font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.toggle-row small { font-size: 9px; color: rgba(244,241,233,.35); }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 34px; height: 18px; background: rgba(244,241,233,.16); border-radius: 10px; flex: none; transition: .2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: rgba(244,241,233,.55); transition: .2s; }
.toggle-row input:checked + .switch { background: var(--accent); }
.toggle-row input:checked + .switch::after { left: 19px; background: #fff; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-actions .cta { margin-right: auto; }

.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: rgba(244,241,233,.1); margin: 19px 0; }
.help-item { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 7px; padding: 10px; background: rgba(8,11,16,.58); }
.help-item span { font-size: 10px; }
.help-item small { grid-column: 1 / -1; color: rgba(244,241,233,.33); font-size: 8px; }
.help-tip { padding: 12px 13px; margin-bottom: 17px; border-left: 2px solid var(--accent); background: rgba(255,255,255,.035); }
.help-tip b { font-size: 10px; letter-spacing: .07em; }
.help-tip p { margin: 5px 0 0; color: rgba(244,241,233,.42); font-size: 9px; line-height: 1.8; }
.help-modal .cta { width: 100%; }

.share-link { display: flex; gap: 1px; background: rgba(244,241,233,.12); margin: 18px 0 12px; }
.share-link input { flex: 1; min-width: 0; height: 46px; border: 0; background: rgba(8,11,16,.7); padding: 0 12px; color: rgba(244,241,233,.7); font: 500 10px/1 var(--mono); }
.share-link button { width: 76px; background: var(--accent); color: var(--accent-ink); font-size: 11px; letter-spacing: .1em; }
.share-note { color: rgba(244,241,233,.34); font-size: 9px; line-height: 1.8; margin-bottom: 18px; }
.share-note b { color: rgba(244,241,233,.6); }

/* results */
.results-overlay {
  background:
    radial-gradient(ellipse at 18% 45%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 44%),
    linear-gradient(90deg, rgba(4,6,9,.88), rgba(4,6,9,.46));
  backdrop-filter: blur(10px);
  align-items: stretch;
  padding: 5vh 5vw;
  animation: resultsIn .55s ease both;
}
@keyframes resultsIn { from { opacity: 0; } to { opacity: 1; } }
.results-wrap { width: 100%; display: grid; grid-template-columns: 1.05fr 1fr; gap: 4vw; align-items: center; }
.results-hero { max-width: 560px; }
.results-kicker { color: var(--accent); font: 600 9px/1 var(--mono); letter-spacing: .34em; }
.results-place { display: flex; align-items: flex-start; margin-top: 17px; }
.results-place span { font: 900 132px/.72 var(--display); letter-spacing: -.06em; }
.results-place small { margin: 10px 0 0 7px; color: rgba(244,241,233,.35); font: 500 18px/1 var(--mono); }
.results-hero h2 { margin: 22px 0 5px; font: 700 44px/1 var(--body); letter-spacing: .04em; }
.results-hero > p { margin: 0 0 26px; color: rgba(244,241,233,.43); font-size: 11px; letter-spacing: .05em; }
.results-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: rgba(244,241,233,.1); }
.results-stats > div { padding: 13px; background: rgba(8,11,16,.48); display: flex; flex-direction: column; gap: 6px; }
.results-stats span { color: rgba(244,241,233,.32); font-size: 8px; letter-spacing: .1em; }
.results-stats b { font: 500 17px/1 var(--mono); letter-spacing: .02em; }
.results-stats b small { font-size: 8px; color: rgba(244,241,233,.36); }
.results-actions { display: flex; gap: 8px; margin-top: 25px; }
.results-board { background: rgba(8,11,16,.5); border: 1px solid rgba(244,241,233,.13); padding: 22px; backdrop-filter: blur(12px); }
.board-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 13px; border-bottom: 1px solid rgba(244,241,233,.12); }
.board-head > div { display: flex; align-items: baseline; gap: 8px; }
.board-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .1em; }
.board-head > span { color: rgba(244,241,233,.32); font: 500 9px/1 var(--mono); }
.results-list { display: flex; flex-direction: column; }
.result-row { display: grid; grid-template-columns: 30px 34px 1fr auto; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid rgba(244,241,233,.07); }
.result-row.player { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent); margin: 0 -8px; padding-left: 10px; padding-right: 10px; }
.result-pos { font: 800 17px/1 var(--display); color: rgba(244,241,233,.4); }
.result-row:nth-child(1) .result-pos { color: #ffd15a; }
.result-row:nth-child(2) .result-pos { color: #cfd8de; }
.result-row:nth-child(3) .result-pos { color: #c8966a; }
.result-flag { display: grid; width: 24px; height: 15px; }
.result-flag .flag-svg { border: 1px solid rgba(255,255,255,.22); }
.result-name b { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.result-name span { display: block; margin-top: 3px; color: rgba(244,241,233,.3); font: 500 7px/1 var(--mono); letter-spacing: .1em; }
.result-time { text-align: right; font: 500 11px/1 var(--mono); color: rgba(244,241,233,.78); }
.result-time small { display: block; font-size: 7px; color: rgba(244,241,233,.26); margin-top: 4px; }
.board-foot { display: flex; justify-content: space-between; gap: 10px; padding-top: 13px; color: rgba(244,241,233,.22); font: 500 7px/1 var(--mono); letter-spacing: .08em; }
body.results-active #race-hud { opacity: 0; }

/* transition */
.screen-transition {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: #05070b;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .45s ease, visibility .45s;
}
.screen-transition.show { opacity: 1; visibility: visible; pointer-events: auto; }
.transition-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.transition-inner span { color: var(--accent); font: 600 8px/1 var(--mono); letter-spacing: .32em; }
.transition-inner b { font-size: 22px; font-weight: 600; letter-spacing: .12em; }
.transition-bar { width: 180px; height: 1px; background: rgba(255,255,255,.14); overflow: hidden; margin-top: 5px; }
.transition-bar i { display: block; width: 40%; height: 100%; background: var(--accent); animation: loadSlide 1s infinite ease-in-out; }
@keyframes loadSlide { 0% { transform: translateX(-110%); } 100% { transform: translateX(370%); } }

/* responsive */
@media (max-width: 1180px) {
  .menu-side { width: 320px; right: 3vw; }
  .menu-hero { width: 48vw; }
  .track-panel { width: calc(100vw - 390px); left: 4vw; }
  .hud-map { width: 195px; }
  #minimap-canvas { width: 171px; height: 128px; }
  .hud-timing { width: 300px; }
}
@media (max-height: 780px) and (min-width: 901px) {
  .menu-hero { top: 13vh; }
  .display-title { font-size: clamp(56px, 7.5vw, 116px); }
  .lede { margin-top: 20px; line-height: 1.7; }
  .start-row { margin-top: 20px; }
  .control-strip { margin-top: 22px; }
  .menu-side { top: 9.5vh; }
  .driver-showcase { height: 168px; }
  .driver-meta h3 { font-size: 20px; }
  .driver-quote { margin: 7px 0 9px; }
  .character-list { margin-top: 10px; padding-top: 9px; }
  .track-card { height: 116px; }
  .track-panel { bottom: 4.5vh; }
}
@media (max-width: 900px) {
  body { overflow: hidden; }
  #topbar { height: 62px; padding: 0 16px; gap: 12px; }
  .brand-mark { width: 27px; height: 27px; }
  .brand-text b { font-size: 14px; }
  .brand-text em { font-size: 7px; }
  .top-meta { display: none; }
  .top-actions { gap: 4px; }
  .icon-btn { width: 31px; height: 31px; }
  .icon-btn svg { width: 15px; height: 15px; }
  .share-btn { height: 31px; padding: 0 11px; font-size: 10px; }
  .screen { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #menu-screen {
    display: flex; flex-direction: column; gap: 18px;
    padding: 78px 16px 26px;
    pointer-events: auto;
    touch-action: pan-y;
    background: linear-gradient(180deg, rgba(5,7,11,.35), rgba(5,7,11,.8) 30%, rgba(5,7,11,.94));
  }
  .menu-hero, .menu-side, .track-panel, .menu-footer { position: static; width: 100%; max-width: none; }
  .menu-side { animation: none; }
  .menu-footer { order: 5; padding: 4px 0 0; font-size: 7px; flex-wrap: wrap; gap: 5px; }
  .footer-mid { display: none; }
  .eyebrow { margin-bottom: 16px; font-size: 8px; }
  .display-title { font-size: clamp(58px, 19vw, 92px); line-height: .8; }
  .display-title .outline { font-size: .84em; }
  .title-en { margin-top: 16px; font-size: 8px; letter-spacing: .32em; }
  .lede { margin-top: 20px; font-size: 11px; line-height: 1.8; }
  .start-row { margin-top: 21px; gap: 13px; align-items: stretch; }
  .cta { min-width: 0; flex: 1; height: 58px; }
  .cta.small { flex: none; min-width: 180px; }
  .start-note { justify-content: center; max-width: 130px; }
  .start-note b { font-size: 9px; }
  .start-note span { font-size: 8px; line-height: 1.5; }
  .control-strip { margin-top: 17px; gap: 12px; flex-wrap: wrap; }
  .control-strip > div { font-size: 8px; }
  .panel { padding: 13px; }
  .panel-head { padding-bottom: 9px; }
  .driver-showcase { height: 180px; width: 100%; margin-right: 0; }
  .driver-meta { min-height: 0; }
  .driver-country { margin-top: 12px; }
  .driver-meta h3 { font-size: 19px; }
  .driver-quote { font-size: 10px; margin: 7px 0 9px; }
  .driver-number { font-size: 45px; }
  .driver-flag { width: 31px; height: 22px; font-size: 14px; left: 8px; bottom: 8px; }
  .stat-grid { clear: none; }
  .character-list { clear: both; padding-top: 10px; margin-top: 12px; }
  .char-btn { min-height: 42px; }
  .track-panel { margin-top: 2px; }
  .track-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .track-list::-webkit-scrollbar { display: none; }
  .track-card { flex: 0 0 220px; height: 122px; }
  .track-panel .section-head { margin-bottom: 8px; }
  .track-panel .panel-meta { display: none; }
  .menu-footer { margin-top: 8px; }
  .hud-top-left { left: 10px; top: max(10px, env(safe-area-inset-top)); gap: 6px; }
  .hud-pos-card { width: 108px; padding: 8px 10px; }
  .hud-pos > span { font-size: 38px; }
  .hud-pos small { font-size: 10px; margin-top: 5px; }
  .hud-lap-row { font-size: 7px; margin-top: 4px; padding-top: 5px; }
  .hud-lap-row b { font-size: 15px; }
  .hud-pause { width: 27px; height: 27px; }
  .hud-timing { top: max(10px, env(safe-area-inset-top)); width: 180px; }
  .timing-main { padding: 6px 8px; }
  .timing-main b { font-size: 16px; }
  .timing-grid > div { padding: 4px 2px; }
  .timing-grid span { font-size: 6px; }
  .timing-grid b { font-size: 8px; }
  .hud-map { right: 10px; top: max(10px, env(safe-area-inset-top)); width: 132px; padding: 7px; }
  .map-head b { font-size: 9px; }
  .map-head > span { display: none; }
  #minimap-canvas { width: 118px; height: 88px; }
  .map-foot { font-size: 5px; padding-top: 4px; }
  body.touch-device .hud-speed { bottom: calc(100px + env(safe-area-inset-bottom)); }
  body.touch-device .hud-driver { bottom: calc(100px + env(safe-area-inset-bottom)); }
  .hud-speed { left: 12px; bottom: max(14px, env(safe-area-inset-bottom)); width: 145px; }
  .speed-gauge { width: 98px; height: 98px; }
  .speed-readout span { font-size: 34px; }
  .speed-readout small { font-size: 6px; }
  .gear-readout { width: 34px; height: 38px; right: -6px; bottom: 15px; }
  .gear-readout b { font-size: 17px; }
  .rpm-bar-row { width: 120px; margin-left: 4px; }
  .speed-meta { width: 125px; font-size: 5px; }
  .hud-driver { right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); gap: 6px; }
  .hud-boost { width: 124px; padding: 6px 7px; }
  .hud-driver-card { padding: 6px 8px; }
  .hud-driver-card b { font-size: 9px; }
  .hud-flag { font-size: 15px; }
  .drift-indicator { bottom: 145px; }
  .drift-indicator b { font-size: 9px; }
  .countdown span { font-size: 36vw; }
  .results-overlay { padding: 14px; overflow-y: auto; }
  .results-wrap { grid-template-columns: 1fr; gap: 16px; align-items: start; padding: 12px 0; }
  .results-place span { font-size: 84px; }
  .results-hero h2 { font-size: 30px; margin-top: 10px; }
  .results-hero > p { margin-bottom: 16px; font-size: 10px; }
  .results-stats b { font-size: 14px; }
  .results-actions { margin-top: 16px; flex-wrap: wrap; }
  .results-actions .cta { flex: 1; }
  .results-board { padding: 14px; }
  .result-row { padding: 8px 2px; }
  .results-place { margin-top: 10px; }
  .results-kicker { font-size: 8px; }
  .modal { padding: 20px; }
  .modal h2 { font-size: 27px; }
  .help-grid { grid-template-columns: 1fr; }
  .help-item { grid-template-columns: auto auto 1fr; }
  .game-toast { top: 14%; min-width: 220px; }
  .touch-controls { z-index: 25; }
  .touch-btn { width: 57px; height: 57px; }
  .touch-arrow { width: 64px; height: 64px; }
  .touch-brake { width: 59px; height: 59px; }
  .touch-drift { width: 54px; height: 54px; }
  .wrong-way { top: 23%; }
  .wrong-way b { font-size: 16px; }
}
@media (max-width: 620px) {
  .hud-timing { top: calc(88px + env(safe-area-inset-top)); width: 144px; }
  .hud-timing .timing-main { padding: 5px 8px; }
  .timing-main b { font-size: 15px; }
  .hud-map { width: 122px; }
  #minimap-canvas { width: 108px; height: 82px; }
  .hud-pos-card { width: 96px; }
  .hud-pos > span { font-size: 34px; }
  .countdown span { font-size: 34vw; }
  body.touch-device .hud-speed { bottom: calc(88px + env(safe-area-inset-bottom)); }
  body.touch-device .hud-driver { bottom: calc(88px + env(safe-area-inset-bottom)); }
}
@media (max-width: 430px) {
  .menu-hero .display-title { font-size: 17vw; }
  .start-note { display: none; }
  .control-strip { gap: 9px; }
  .driver-showcase { width: 100%; height: 154px; }
  .driver-meta { min-height: 0; }
  .driver-quote { display: none; }
  .stat { grid-template-columns: 34px 1fr 12px; }
  .character-list { grid-template-columns: repeat(4, 1fr); }
  .track-card { flex-basis: 205px; height: 116px; }
  .hud-timing { width: 156px; }
  .timing-grid b { font-size: 7px; }
  .hud-map { width: 112px; }
  #minimap-canvas { width: 98px; height: 74px; }
  .hud-speed { width: 128px; }
  .speed-gauge { width: 88px; height: 88px; }
  .speed-readout span { font-size: 30px; }
  .hud-driver .hud-boost { width: 108px; }
  .hud-driver-card b { font-size: 8px; }
  .touch-steer { left: 10px; gap: 7px; }
  .touch-pedals { right: 10px; gap: 7px; }
  .touch-btn { width: 52px; height: 52px; }
  .touch-arrow { width: 58px; height: 58px; }
  .touch-brake { width: 54px; height: 54px; }
  .touch-drift { width: 50px; height: 50px; }
  .results-stats > div { padding: 9px; }
  .results-stats b { font-size: 12px; }
}
@media (hover: none) {
  .track-card:hover { transform: none; }
  .cta:hover { transform: none; }
}
