/* Interface art: shaped SVG objects carry the silhouette; live HTML remains on top. */
:root {
  --arcade-ink: #0b0d18;
  --arcade-blue: #36d9ff;
  --arcade-gold: #ffcf32;
  --arcade-paper: #fff3d0;
  --arcade-font: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
}

.brand { display: none; }
.game-shell:has(.start-screen:not(.hidden)) .hud,
.game-shell:has(.start-screen:not(.hidden)) .nitro-panel,
.game-shell:has(.start-screen:not(.hidden)) .touch-controls,
.game-shell:has(.start-screen:not(.hidden)) .weekly-race-badge { display: none; }
.hud { z-index: 6; inset: max(15px, env(safe-area-inset-top)) 20px auto; display: block; height: 175px; }
.race-stats { display: contents; overflow: visible; min-height: 0; border: 0; background: none; box-shadow: none; backdrop-filter: none; }
.stat { position: absolute; display: block; border: 0 !important; padding: 0; background-repeat: no-repeat; background-size: 100% 100%; text-align: center; filter: drop-shadow(0 6px 1px rgba(7, 8, 18, .35)); }
.stat-label { position: absolute; z-index: 2; top: 0; left: 4%; width: auto; margin: 0; padding: 5px 11px 4px; color: #11121d; background: var(--arcade-gold); border: 2px solid var(--arcade-ink); clip-path: polygon(0 12%, 98% 0, 100% 88%, 5% 100%); font: 900 13px/1 var(--arcade-font); letter-spacing: .03em; text-shadow: 1px 1px #fff4a1; transform: rotate(-7deg); }
.position-stat { left: 0; top: 7px; width: 154px; height: 133px; background-image: url('/assets/ui/position-badge.svg'); }
.position-stat .stat-label { top: 3px; left: 2px; }
.position-stat strong { position: absolute; top: 28px; left: 30px; margin: 0; color: white; font: italic 76px/.95 var(--arcade-font); letter-spacing: -.065em; text-shadow: 4px 5px 0 #070a13; transform: rotate(-8deg); transition: transform .2s ease, color .2s ease; }
.position-stat > span:last-child { position: absolute; top: 79px; left: 103px; color: white; font: 900 17px/1 var(--arcade-font); text-shadow: 2px 2px #090b13; }
.position-stat[data-place="1"] strong { color: #fff8e1; }
.position-stat[data-place="2"] strong { color: #d6f2ff; }
.position-stat[data-place="3"] strong { color: #ffc194; }
.position-stat.overtake strong { animation: position-pop .42s ease-out; }
@keyframes position-pop { 50% { transform: rotate(-8deg) scale(1.26); color: #ffe237; } }

.distance-stat { top: 7px; left: 50%; width: clamp(215px, 26vw, 360px); height: 92px; transform: translateX(-50%); background-image: url('/assets/ui/progress-rail.svg'); }
.distance-stat .stat-label { top: 0; left: 50%; transform: translateX(-50%) rotate(-2deg); background: #f8b928; }
.distance-track { position: absolute; top: 44px; left: 11%; width: 78%; height: 8px; margin: 0; overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.distance-track > i { position: absolute; left: 0; top: 0; height: 8px; border-radius: 0; background: #30d9fc; box-shadow: 0 0 7px #25dfff; transition: width .12s linear; }
.race-markers { position: absolute; inset: 0; }
.race-marker { position: absolute; top: -8px; width: 15px; height: 15px; border: 2px solid #080b16; border-radius: 50%; background: #ff6b44; box-shadow: 1px 2px 0 #050a13; transform: translateX(-50%); transition: left .16s linear; }
.race-marker.me { z-index: 2; background: #48dafa; border-color: #e6faff; box-shadow: 0 0 0 2px #0d1832, 0 0 10px #46e4ff; }
.race-marker:nth-child(3n) { background: #a1fd3c; }

.time-stat { top: 4px; right: 5px; min-width: 0; width: 207px; height: 73px; background-image: url('/assets/ui/timer-panel.svg'); }
.time-stat .stat-label { top: -1px; left: 20px; }
.time-stat .timer-icon { position: absolute; top: 29px; left: 19px; color: white; font: 900 28px/1 var(--arcade-font); }
.time-stat strong { position: absolute; top: 34px; left: 55px; margin: 0; color: white; font: italic 25px/1 var(--arcade-font); font-variant-numeric: tabular-nums; letter-spacing: .01em; text-shadow: 2px 2px #070910; }
.speed-stat { top: 76px; right: 1px; width: 252px; height: 131px; background-image: url('/assets/ui/speedometer.svg'); }
.speed-stat .stat-label { top: 2px; left: 0; transform: rotate(-7deg); }
.speed-stat strong { position: absolute; top: 57px; left: 24px; margin: 0; color: white; font: italic 57px/.9 var(--arcade-font); letter-spacing: -.035em; text-shadow: 3px 4px #070a12; }
.speed-stat > span:last-of-type { position: absolute; top: 87px; left: 111px; color: white; font: italic 16px/1 var(--arcade-font); }
.speed-needle { position: absolute; left: 196px; top: 84px; width: 54px; height: 4px; background: #f64c40; border: 1px solid #0c0b13; border-radius: 50% 0 0 50%; transform-origin: 4px 50%; transform: rotate(-170deg); transition: transform .13s ease-out; box-shadow: 1px 2px 2px #0b0e14; }
.hud-actions { position: fixed; z-index: 8; right: 24px; bottom: 20px; display: flex; gap: 8px; pointer-events: auto; }
.icon-button { width: 52px; height: 52px; border: 4px double #fff0d3; border-radius: 50%; background: radial-gradient(circle at 36% 22%, #474151, #15141f 64%); color: white; font: 900 27px/1 var(--arcade-font); box-shadow: 0 0 0 3px #17121b, 0 5px 0 #05060d, inset 0 2px 3px #a99c9c; backdrop-filter: none; transition: transform .12s ease; }
.icon-button:hover { background: radial-gradient(circle at 36% 22%, #685061, #1e1721 64%); transform: translateY(-3px); }
.icon-button:active { transform: translateY(3px); box-shadow: 0 0 0 3px #17121b, 0 1px 0 #05060d; }

.nitro-panel { left: 20px; bottom: max(16px, env(safe-area-inset-bottom)); width: 300px; height: 93px; padding: 0; border: 0; border-radius: 0; background: url('/assets/ui/nitro-tank.svg') center / 100% 100% no-repeat; box-shadow: none; backdrop-filter: none; filter: drop-shadow(0 5px 2px #0b1019); }
.nitro-title { position: absolute; top: 17px; left: 60px; color: #47dbff; font: 900 17px/1 var(--arcade-font); letter-spacing: .09em; text-shadow: 2px 2px #051320; }
.nitro-title .bolt { position: absolute; left: -42px; top: 7px; color: #41e6ff; font-size: 52px; line-height: .8; text-shadow: 2px 3px #051320, 0 0 10px #31d6ff; }
.nitro-meter { position: absolute; top: 52px; left: 60px; width: 206px; height: 18px; margin: 0; border: 2px solid #080f1e; border-radius: 0; background: repeating-linear-gradient(90deg, #14233a 0 23px, #091324 23px 26px); transform: skewX(-18deg); overflow: hidden; }
.nitro-meter i { height: 100%; border-radius: 0; background: repeating-linear-gradient(90deg, #149cd6 0 23px, #6aeaff 23px 25px, #0b719e 25px 27px); box-shadow: 0 0 12px #30ddff; transition: width .1s linear; }
.nitro-meter i[data-state="active"] { background: repeating-linear-gradient(90deg, #a8faff 0 23px, white 23px 25px, #2fbedc 25px 27px); animation: nitro-flash .2s alternate infinite; }
.nitro-panel.full { animation: nitro-ready 1.5s ease-in-out infinite; }
.nitro-key { right: 34px; top: 17px; color: #bbcbd2; font-size: 10px; }
@keyframes nitro-ready { 50% { filter: drop-shadow(0 0 10px #40dcff); } }
@keyframes nitro-flash { to { opacity: .72; } }

/* Start menu: hand painted signs and competition furniture. */
.menu-race-window { display: none; }
.start-screen { background: linear-gradient(90deg, rgba(18, 13, 25, .46), rgba(18, 13, 25, .02) 47%, rgba(18, 13, 25, .14)); }
.start-card > .eyebrow { color: #fff2df; font: italic 18px/1 var(--arcade-font); letter-spacing: .1em; text-shadow: 2px 2px #10121a; }
.start-card h1 { position: relative; width: fit-content; margin: 13px 0 26px; color: #fff8df; font: italic 900 clamp(4.4rem, 8vw, 8rem)/.77 var(--arcade-font); letter-spacing: -.05em; text-transform: uppercase; -webkit-text-stroke: 2px #101017; text-shadow: 5px 5px #101017, 9px 9px #101017, 13px 13px #d7332f; transform: rotate(-4deg); }
.start-card h1::before, .start-card h1::after { content: ''; position: absolute; z-index: -1; width: 50px; height: 66px; background: repeating-conic-gradient(#fff 0 25%, #101018 0 50%) 0 0 / 24px 24px; border: 4px solid #090b15; transform: rotate(18deg); }
.start-card h1::before { left: -19px; top: 31px; }.start-card h1::after { right: -37px; top: -10px; transform: rotate(-12deg); }
.start-card h1 span { color: #ffab19; -webkit-text-stroke: 2px #101017; text-shadow: 5px 5px #101017, 9px 9px #101017, 13px 13px #ee3d2b; }
.start-card h1 em { position: absolute; right: -35px; bottom: -25px; color: #42d9ff; font: italic 900 .54em/1 var(--arcade-font); -webkit-text-stroke: 2px #101017; text-shadow: 4px 5px #101017, 7px 8px #101017; transform: rotate(-7deg); }
.mode-tabs { display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: min(320px, 100%); margin: 0 0 22px; padding: 0; border: 0; border-radius: 0; background: none; }
.mode-tab, .mode-tab.active { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; height: 70px; padding: 0 38px 0 23px; border: 0; border-radius: 0; background: url('/assets/ui/sign-yellow.svg') center / 100% 100% no-repeat; color: #0b0d17; font: 900 clamp(16px, 2vw, 25px)/1 var(--arcade-font); letter-spacing: 0; text-align: left; white-space: nowrap; cursor: pointer; filter: drop-shadow(0 4px 0 #10121b); box-shadow: none; transform: rotate(-2deg); transition: transform .15s ease, filter .15s ease; }
.mode-tab:nth-child(2), .mode-tab:nth-child(2).active { background-image: url('/assets/ui/sign-blue.svg'); color: white; transform: rotate(2deg); }
.mode-tab:hover, .mode-tab.active:hover { transform: translateY(-4px) rotate(-2deg); filter: drop-shadow(0 9px 0 #10121b); }
.mode-tab:nth-child(2):hover { transform: translateY(-4px) rotate(2deg); }
.mode-tab:active { transform: translateY(2px) !important; filter: drop-shadow(0 1px 0 #10121b); }
.mode-tab .mode-icon { display: inline-grid; place-items: center; flex: 0 0 31px; width: 31px; height: 31px; color: #13131c; font: 900 26px/1 var(--arcade-font); text-shadow: 1px 1px #ffec99; }
.mode-tab:nth-child(2) .mode-icon { color: white; text-shadow: 1px 2px #0b2362; }
.mode-tab i { position: absolute; right: 19px; bottom: 4px; padding: 3px 8px; color: #11151c !important; background: #21e1d6; border: 2px solid #0a0e16; transform: rotate(-10deg); font: italic 900 12px/1 var(--arcade-font); }

.racer-field { position: relative; min-height: 128px; margin: 0; padding: 16px 19px 11px; background: url('/assets/ui/wood-plaque.svg') center / 100% 100% no-repeat; }
.racer-field > span { position: relative; z-index: 1; justify-self: start; margin: 0 0 3px; padding: 3px 9px; color: #11121a; background: #eaa341; border: 2px solid #1a1010; font: 900 15px/1 var(--arcade-font); letter-spacing: 0; transform: rotate(-2deg); }
.racer-field input { z-index: 1; height: 41px; padding: 0 42px 0 11px; border: 3px solid #15151f; border-radius: 3px; background: linear-gradient(#192132,#0f1421); color: white; font-size: 21px; font-weight: 900; box-shadow: inset 0 2px #8993a0, 3px 4px #311b1c; }
.racer-field::after { content: '✎'; position: absolute; right: 30px; top: 52px; color: white; font-size: 22px; pointer-events: none; }
.racer-field small { z-index: 1; margin: 2px 0 0; color: #fff4e5; font-size: 10px; line-height: 1.2; text-shadow: 1px 1px 2px #241216; }
.racer-field .field-error { z-index: 1; }
.record-preview { position: relative; min-height: 74px; margin: 4px 0 0; padding: 15px 20px 10px 53px; border: 0; border-radius: 0; background: url('/assets/ui/wood-plaque.svg') center / 100% 100% no-repeat; }
.record-preview::before { content: '🏆'; position: absolute; top: 25px; left: 15px; font-size: 26px; }
.record-preview > span { justify-self: start; align-self: start; padding: 2px 8px; color: #100e13; background: #e79b35; font: 900 15px/1 var(--arcade-font); letter-spacing: 0; transform: rotate(-2deg); }
.record-preview strong { align-self: center; color: #53e9ff; font: 900 20px/1 var(--arcade-font); }
.record-preview small { color: #fff4e8; font-size: 11px; }
.weekly-card { position: relative; border: 3px solid #100d14; border-radius: 0; background: #282330; box-shadow: 7px 8px 0 #100e19; clip-path: polygon(0 4%, 5% 0, 96% 2%, 100% 8%, 98% 92%, 94% 100%, 4% 97%, 0 91%); }
.weekly-card::before { content: ''; position: absolute; inset: 4px; z-index: -1; border: 2px dashed #8b693b; pointer-events: none; }
.weekly-card-top > span, .vehicle-picker-label { display: inline-block; padding: 4px 9px; color: #15131d; background: #f4ae35; font: 900 14px/1 var(--arcade-font); letter-spacing: .02em; transform: rotate(-2deg); }
.weekly-start-button { min-height: 46px; border: 0; border-radius: 0; background: url('/assets/ui/sign-yellow.svg') center / 100% 100% no-repeat; font: 900 17px/1 var(--arcade-font); filter: drop-shadow(0 3px #11121a); }
.weekly-start-button:hover { background: url('/assets/ui/sign-yellow.svg') center / 100% 100% no-repeat; transform: translateY(-2px); }
.home-leaderboard { position: relative; padding: 15px 20px 11px; border: 0; border-radius: 0; background: url('/assets/ui/wood-plaque.svg') center / 100% 100% no-repeat; filter: drop-shadow(0 6px 1px #080d17); }
.home-leaderboard-heading span, .home-leaderboard-heading strong { color: #ffe09a; font-family: var(--arcade-font); text-shadow: 2px 2px #100e18; }
.home-leaderboard-heading span { font-size: 16px; }.home-leaderboard-heading strong { font-size: 15px; }
.home-leaderboard-heading small { color: #f8e4ca; }
.ranking-link { padding: 6px 14px; border: 2px solid #0b0d16; background: #30d8fc; color: #111526; font: 900 14px/1 var(--arcade-font); transform: rotate(-3deg); clip-path: polygon(0 0, 92% 0, 100% 50%, 92% 100%, 0 100%, 5% 50%); }
.leaderboard-list.compact { gap: 9px; }
.leaderboard-list.compact li { min-height: 60px; border: 2px solid #495667; border-radius: 2px; background: linear-gradient(130deg,#202331,#101521); box-shadow: inset 0 2px #6a7380; }
.leaderboard-list.compact li:nth-child(1) { border-left: 10px solid #ffbd27; }.leaderboard-list.compact li:nth-child(2) { border-left: 10px solid #c8d8eb; }.leaderboard-list.compact li:nth-child(3) { border-left: 10px solid #e68b58; }
.leaderboard-list.compact li::before { font: italic 900 30px/1 var(--arcade-font); color: #ffcf48; text-shadow: 2px 2px #0a0d18; }
.leaderboard-list.compact li:nth-child(2)::before { color: #d8edff; }.leaderboard-list.compact li:nth-child(3)::before { color: #ffc092; }
.leaderboard-list.compact li time { color: #59eaff; font-family: var(--arcade-font); }
.primary-button { border-radius: 0; background: url('/assets/ui/sign-yellow.svg') center / 100% 100% no-repeat; color: #11131e; font: 900 22px/1 var(--arcade-font); letter-spacing: .02em; box-shadow: none; filter: drop-shadow(0 5px 0 #11121b); transition: transform .15s ease, filter .15s ease; }
.primary-button:hover { transform: translateY(-3px); background: url('/assets/ui/sign-yellow.svg') center / 100% 100% no-repeat; box-shadow: none; filter: drop-shadow(0 8px 0 #11121b); }
.primary-button:active { transform: translateY(3px); filter: drop-shadow(0 1px 0 #11121b); }
.start-note { color: #fff4dd; text-shadow: 2px 2px #11121b; }

/* Vehicle showroom uses the existing preview sprites. */
.vehicle-carousel-card { border: 0; border-radius: 0; background: url('/assets/ui/wood-plaque.svg') center / 100% 100% no-repeat, #44251f; box-shadow: 12px 13px 0 #0b0d16; }
.vehicle-carousel-card h2 { color: #ffe5a0; font-family: var(--arcade-font); text-transform: uppercase; text-shadow: 3px 3px #15101b; }
.vehicle-carousel-item { position: relative; min-height: 270px; padding: 25px 12px; border: 4px solid #2de4ff; border-radius: 4px; background: radial-gradient(ellipse at 50% 57%, #195a7e 0, #0e1b36 48%, #080d1a 76%); box-shadow: inset 0 0 0 2px #abf6ff, 0 0 18px #29ceff; clip-path: polygon(3% 0, 97% 0, 100% 5%, 100% 96%, 96% 100%, 3% 100%, 0 95%, 0 4%); }
.vehicle-carousel-item::after { content: ''; position: absolute; z-index: -1; left: 14%; right: 14%; top: 172px; height: 36px; border: 3px solid #8599a3; border-radius: 50%; background: radial-gradient(ellipse, #538fa4, #13293f 72%); }
.vehicle-carousel-item img { z-index: 1; height: 155px; object-fit: contain; image-rendering: auto; filter: drop-shadow(0 10px 7px #030913); }
.vehicle-carousel-item strong { z-index: 1; min-width: 50%; margin-top: 4px; padding: 4px 15px; border: 2px solid #080c17; background: #e9a93f; color: #11131b; font: 900 22px/1 var(--arcade-font); text-transform: uppercase; transform: rotate(-2deg); }
.vehicle-carousel-item small { z-index: 1; color: white; text-shadow: 1px 1px #0b0e18; }
.showroom-star { position: absolute; top: 6px; left: 10px; color: #53dfff; font-size: 27px; text-shadow: 0 0 9px #36e6ff; }
.carousel-arrow { height: 66px; border: 0; border-radius: 0; background: url('/assets/ui/sign-yellow.svg') center / 100% 100% no-repeat; color: #11121b; font: 900 42px/1 var(--arcade-font); filter: drop-shadow(0 4px #0b0d15); }
.carousel-arrow:hover { background: url('/assets/ui/sign-yellow.svg') center / 100% 100% no-repeat; transform: translateY(-3px); }
.vehicle-dots button { width: 18px; height: 18px; border: 3px solid #100e17; border-radius: 2px; background: #e9a53c; transform: rotate(45deg); }
.vehicle-dots button.active { border-color: white; background: #34e0ff; box-shadow: 0 0 10px #30dbff; }
.leaderboard-card, .modal-card:not(.vehicle-carousel-card) { border-radius: 3px; border: 4px solid #c6844e; background: #201c2a; box-shadow: 8px 9px #0b0d16, inset 0 0 0 3px #3a2631; }
.leaderboard-list:not(.compact) li { border: 2px solid #6b5a55; border-radius: 2px; background: #191b28; }
.online-card, .join-room-form, .lobby-card, .modal-card:not(.vehicle-carousel-card), .weekly-card { border: 0; border-radius: 0; background: url('/assets/ui/garage-panel.svg') center / 100% 100% no-repeat; box-shadow: none; filter: drop-shadow(7px 7px 0 #0a0c14); }
.online-card, .join-room-form { padding: 22px 24px; }
.online-card-title > span, .lobby-heading .eyebrow, .modal-card > .eyebrow { display: inline-block; padding: 4px 10px; background: #ecaa42; color: #11121b; font: 900 15px/1 var(--arcade-font); letter-spacing: .03em; transform: rotate(-2deg); }
.online-card input, .online-card select, .join-room-form input, .join-room-form select, .season-picker select { border: 3px solid #10151e; border-radius: 2px; background: linear-gradient(#1c2233,#101321); box-shadow: inset 0 2px #77818f; color: white; }
.online-card label, .join-room-form label { color: #fff2db; font-weight: 900; text-shadow: 1px 1px #080d16; }
.online-card .primary-button.compact { margin-top: 11px; font: 900 17px/1 var(--arcade-font); box-shadow: none; }
.room-item, .lobby-player, .online-result-row, .finish-records div { border: 2px solid #a6adac; border-radius: 1px; background: linear-gradient(125deg,#2c3541,#101827); box-shadow: inset 0 2px #d9dfd4, 3px 3px #0b0e17; clip-path: polygon(0 4%, 97% 0, 100% 9%, 100% 95%, 96% 100%, 2% 100%, 0 93%); }
.room-item:hover { border-color: #45dcff; background: #173c53; }
.lobby-heading h2, .modal-card h2 { color: #fff0bd; font-family: var(--arcade-font); text-transform: uppercase; text-shadow: 2px 3px #0c0e18; }
.lobby-code strong { color: #5de9ff; font-family: var(--arcade-font); }
.touch-controls button { border: 0; border-radius: 0; background: url('/assets/ui/timer-panel.svg') center / 100% 100% no-repeat; box-shadow: none; backdrop-filter: none; filter: drop-shadow(0 4px 0 #0a0c14); font-family: var(--arcade-font); }
.touch-controls .gas, .touch-controls .pedal.gas { width: 86px; height: 76px; padding: 13px 8px 10px; border: 0; border-radius: 0; background: url('/assets/ui/sign-yellow.svg') center / 100% 100% no-repeat; color: #10121a; box-shadow: none; }
.touch-controls .nitro-button { width: 74px; height: 72px; border: 0; border-radius: 0; background: url('/assets/ui/sign-blue.svg') center / 100% 100% no-repeat; color: white; box-shadow: none; }
.touch-controls button.active, .touch-controls .gas.active, .touch-controls .nitro-button.active { background-color: transparent; transform: translateY(3px); filter: drop-shadow(0 1px 0 #0a0c14) brightness(1.15); }

@media (min-width: 1000px) and (min-height: 650px) {
  .start-screen { display: block; padding: 0; overflow: hidden; }
  .start-card { position: relative; width: 100%; height: 100%; }
  .start-card > .eyebrow { position: absolute; top: 5%; left: 4%; }
  .start-card h1 { position: absolute; top: 9%; left: 4%; margin: 0; font-size: clamp(5.3rem, 8.5vw, 8.5rem); }
  .mode-tabs { position: absolute; top: 42%; left: 4%; width: 26%; margin: 0; }
  #offlinePanel, #onlinePanel { position: absolute; inset: 0; width: auto; pointer-events: none; }
  #offlinePanel { display: block; }
  #offlinePanel > *, #onlinePanel > * { pointer-events: auto; }
  #offlinePanel .offline-setup-grid { position: absolute; top: 6%; left: 40%; width: 32%; max-width: none; margin: 0; }
  #offlinePanel .offline-identity { display: block; }
  #offlinePanel .weekly-card { position: absolute; top: 6%; right: 3%; width: 24%; max-height: 39%; overflow-y: auto; margin: 0; }
  #offlinePanel .home-leaderboard { position: absolute; bottom: 5%; left: 34%; width: 63%; min-height: 157px; margin: 0; }
  #offlinePanel .control-guide { position: absolute; bottom: 4%; left: 4%; width: 26%; margin: 0; }
  #offlinePanel #startButton { position: absolute; top: 64%; left: 4%; width: 26%; min-height: 58px; margin: 0; }
  #offlinePanel #spriteLoadError { position: absolute; top: 74%; left: 4%; }
  #offlinePanel .start-note { position: absolute; top: 75%; left: 4%; margin: 0; }
  #onlinePanel { top: 9%; left: 39%; right: 3%; bottom: 6%; width: auto; overflow-y: auto; }
  #onlinePanel .online-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 999px), (max-height: 649px) {
  .start-screen { display: block; padding: 48px 22px 130px; overflow-y: auto; background: rgba(20,16,29,.42); }
  .start-card { width: min(640px, 100%); margin: auto; text-align: center; }
  .start-card h1 { margin: 18px auto 28px; font-size: clamp(4rem, 12vw, 6.5rem); }
  .mode-tabs { margin: 0 auto 24px; }
  #offlinePanel { display: flex; flex-direction: column; gap: 12px; }
  #offlinePanel .offline-setup-grid, #offlinePanel .home-leaderboard { width: 100%; max-width: none; margin: 0; }
  #offlinePanel .offline-identity { display: block; }
  #offlinePanel #startButton { align-self: center; width: min(100%, 350px); }
  #offlinePanel .control-guide { display: none; }
  .online-panel { width: 100%; }
}

@media (max-width: 820px) {
  .hud { inset: max(8px, env(safe-area-inset-top)) 8px auto; height: 154px; }
  .position-stat { width: 112px; height: 102px; }.position-stat .stat-label { font-size: 10px; }.position-stat strong { top: 24px; left: 23px; font-size: 55px; }.position-stat > span:last-child { top: 60px; left: 77px; font-size: 13px; }
  .distance-stat { top: 0; width: min(36vw, 260px); }
  .time-stat { top: 0; right: 0; width: 163px; height: 58px; }.time-stat .stat-label { font-size: 10px; }.time-stat .timer-icon { top: 24px; left: 14px; font-size: 20px; }.time-stat strong { top: 26px; left: 41px; font-size: 20px; }
  .speed-stat { display: block; top: 55px; right: 0; width: 170px; height: 93px; }.speed-stat .stat-label { font-size: 10px; }.speed-stat strong { top: 41px; left: 17px; font-size: 40px; }.speed-stat > span:last-of-type { top: 63px; left: 76px; font-size: 12px; }.speed-needle { top: 60px; left: 134px; width: 34px; }
  .hud-actions { right: 14px; bottom: max(169px, calc(env(safe-area-inset-bottom) + 160px)); }
  .nitro-panel { left: 50%; bottom: max(104px, calc(env(safe-area-inset-bottom) + 95px)); width: 210px; height: 70px; transform: translateX(-50%); }.nitro-title { top: 14px; left: 50px; font-size: 13px; }.nitro-title .bolt { left: -34px; font-size: 39px; }.nitro-meter { top: 40px; left: 50px; width: 135px; height: 13px; }.nitro-key { display: none; }
}

@media (max-width: 540px) {
  .start-screen { padding: 52px 16px 130px; }.start-card h1 { font-size: clamp(3.6rem, 16vw, 5.2rem); }.start-card h1 em { right: -18px; }.mode-tabs { width: min(330px, 100%); }.mode-tab { font-size: 18px; }
  .menu-race-window { display: block; position: relative; height: 178px; margin: -6px 0 18px; pointer-events: none; border-block: 2px solid rgba(255, 214, 119, .62); box-shadow: 0 -4px 0 rgba(15, 17, 28, .55), 0 4px 0 rgba(15, 17, 28, .55); }
  .menu-race-window span { position: absolute; top: 7px; left: 8px; padding: 3px 12px 4px; color: #fff1c2; background: #151622; border: 2px solid #ffd276; transform: rotate(-3deg); font: 15px/1 var(--arcade-font); letter-spacing: .05em; text-shadow: 1px 1px #0a0b12; }
  .distance-stat { top: 141px; left: 50%; width: min(240px, 54vw); }.distance-stat .stat-label { font-size: 10px; }
  .position-stat { width: 95px; height: 87px; }.position-stat strong { top: 20px; left: 20px; font-size: 48px; }.position-stat > span:last-child { top: 53px; left: 67px; font-size: 11px; }
  .time-stat { width: 145px; }.time-stat strong { font-size: 17px; }.speed-stat { top: 59px; width: 143px; height: 78px; }.speed-stat strong { top: 36px; left: 15px; font-size: 33px; }.speed-stat > span:last-of-type { top: 54px; left: 66px; font-size: 10px; }.speed-needle { left: 112px; top: 52px; width: 28px; }
  .home-leaderboard { padding: 13px; }.leaderboard-list.compact { grid-template-columns: 1fr; }.leaderboard-list.compact li { min-height: 48px; }
  .vehicle-carousel-item { min-height: 222px; }.vehicle-carousel-item img { height: 125px; }.vehicle-carousel-item::after { top: 138px; }
  .nitro-panel { left: 16px; bottom: max(107px, calc(env(safe-area-inset-bottom) + 104px)); width: 170px; height: 59px; transform: none; }.nitro-title { top: 12px; left: 43px; font-size: 11px; }.nitro-title .bolt { left: -28px; font-size: 32px; }.nitro-meter { top: 35px; left: 43px; width: 107px; height: 10px; }
  .icon-button { width: 44px; height: 44px; font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  .position-stat.overtake strong, .nitro-panel.full, .nitro-meter i[data-state="active"] { animation: none; }
}
