:root {
  color-scheme: dark;
  --ink: #e2e9e7;
  --muted: #829093;
  --faint: #526063;
  --panel: #101719;
  --panel-2: #141d20;
  --line: #293437;
  --ice: #b3d4d7;
  --amber: #e5a766;
  --green: #7ea58d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #0b1114; color: var(--ink); }
body { min-width: 320px; background-image: radial-gradient(ellipse at 42% -24%, #203034 0, #0b1114 55%); }
button { font: inherit; }
.page-shell { width: min(1512px, calc(100% - 56px)); margin: 0 auto; }
.topbar { height: 78px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(188, 213, 215, .12); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 850; letter-spacing: .19em; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #789194; color: #d3e3e1; font-size: 18px; font-family: Georgia, serif; font-style: italic; font-weight: 700; letter-spacing: 0; }
.brand-sub { display: block; margin-top: 4px; color: #708084; font-size: 8px; letter-spacing: .28em; }
.topbar-right { display: flex; align-items: center; gap: 11px; color: #9ba9aa; font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #d89b5e; box-shadow: 0 0 8px rgba(216,155,94,.75); }
.top-separator { height: 15px; width: 1px; margin: 0 7px; background: #394548; }
.conditions { color: #748387; font-weight: 600; letter-spacing: .08em; }
.conditions span { color: #b7794d; padding: 0 4px; }
.main-grid { display: grid; grid-template-columns: minmax(0, 1fr) 294px; gap: 28px; padding-top: 32px; }
.drive-column { min-width: 0; }
.stage-heading { min-height: 78px; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 2px 16px; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; color: #8c9b9d; font-size: 9px; letter-spacing: .2em; font-weight: 800; }
.eyebrow-line { width: 18px; height: 1px; background: var(--amber); }
h1 { margin: 0; color: #e5ece9; font-size: clamp(28px, 3vw, 38px); font-weight: 600; letter-spacing: -.045em; line-height: 1; }
h1 span { color: #8c9b9a; font-weight: 350; }
.stage-meta { display: flex; align-items: center; gap: 9px; padding-bottom: 3px; color: #a1b0b0; font-size: 10px; letter-spacing: .06em; }
.stage-meta strong { color: #d2dbd8; font-size: 10px; font-weight: 700; }
.meta-label { color: #758285; font-size: 8px; letter-spacing: .18em; }
.meta-divider { width: 1px; height: 17px; margin: 0 8px; background: #344043; }
.game-frame { overflow: hidden; border: 1px solid #344246; background: #0d1416; box-shadow: 0 18px 54px rgba(0,0,0,.35), inset 0 1px rgba(255,255,255,.035); }
.frame-topline, .frame-bottomline { height: 35px; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; color: #8e9b9d; background: #11191b; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.frame-topline { border-bottom: 1px solid rgba(206,224,224,.08); }
.frame-bottomline { height: 39px; justify-content: flex-start; gap: 18px; border-top: 1px solid rgba(206,224,224,.08); font-size: 8px; }
.frame-topline b { color: #d4dcda; }
.square-icon { display: inline-block; width: 6px; height: 6px; margin-right: 7px; background: var(--amber); vertical-align: 1px; }
.condition-pip { display: inline-block; width: 5px; height: 5px; margin-left: 7px; border-radius: 50%; background: #a2c3ca; vertical-align: 1px; box-shadow: 0 0 6px rgba(162,195,202,.65); }
.canvas-wrap { position: relative; overflow: hidden; background: #182326; aspect-ratio: 16 / 9; min-height: 280px; }
#game { display: block; width: 100%; height: 100%; object-fit: cover; }
.hud-top { position: absolute; z-index: 2; top: 16px; left: 17px; right: 17px; display: flex; align-items: flex-start; gap: 8px; pointer-events: none; }
.hud-badge { min-width: 106px; padding: 9px 11px 8px; border: 1px solid rgba(208,226,224,.15); background: rgba(11,17,19,.72); backdrop-filter: blur(8px); }
.hud-label { display: block; margin-bottom: 5px; color: #92a1a1; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.hud-badge strong { color: #e6edea; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; letter-spacing: .05em; }
.next-gate { min-width: 128px; }
.next-gate strong { color: #c1d2d0; font-size: 11px; }
.speed-badge { display: flex; align-items: baseline; gap: 6px; min-width: 98px; margin-left: auto; text-align: right; justify-content: flex-end; }
.speed-badge strong { color: #e6edea; font-size: 26px; letter-spacing: -.06em; }
.speed-badge span { color: #91a0a1; font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.minimap-wrap { position: absolute; z-index: 2; right: 17px; bottom: 16px; width: 220px; padding: 8px 9px 7px; border: 1px solid rgba(208,226,224,.15); background: rgba(11,17,19,.73); backdrop-filter: blur(8px); pointer-events: none; }
.map-caption { display: flex; justify-content: space-between; margin: 0 3px 4px; color: #a0adae; font-size: 7px; font-weight: 800; letter-spacing: .16em; }
.map-caption span { color: #b4c6c3; }
#map { display: block; width: 100%; height: auto; }
.map-legend { display: flex; justify-content: flex-end; align-items: center; gap: 5px; margin-top: 3px; color: #9eaeac; font-size: 7px; letter-spacing: .1em; }
.map-legend i { width: 5px; height: 5px; border-radius: 50%; background: #e4a260; box-shadow: 0 0 4px #e4a260; }
.map-legend b { color: #596668; }
.road-status { position: absolute; z-index: 2; left: 17px; bottom: 18px; display: flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid rgba(208,226,224,.12); background: rgba(11,17,19,.67); color: #aab7b4; font-size: 8px; letter-spacing: .09em; pointer-events: none; }
.road-status b { color: #d2dfda; }
.status-light { width: 5px; height: 5px; border-radius: 50%; background: #86a995; }
.frame-bottomline .keycap { display: inline-grid; min-width: 16px; height: 16px; margin-right: 2px; place-items: center; border: 1px solid #3d494b; background: #1a2427; color: #c4ceca; font-size: 8px; letter-spacing: 0; }
.frame-bottomline .keycap.wide { min-width: 39px; margin-left: 3px; }
.frame-bottomline > span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.frame-bottomline .bottom-hint { margin-left: auto; color: #667578; }
.overlay { position: absolute; z-index: 4; inset: 0; display: grid; place-items: center; padding: 20px; background: linear-gradient(90deg, rgba(4,10,12,.69), rgba(6,12,14,.45) 57%, rgba(6,12,14,.35)); transition: opacity .28s ease, visibility .28s ease; }
.overlay.is-hidden { visibility: hidden; opacity: 0; pointer-events: none; }
.modal-card, .end-card { width: min(490px, 100%); margin-right: auto; padding: 36px 38px 30px; border: 1px solid rgba(195,216,214,.22); background: rgba(11,17,19,.91); box-shadow: 0 24px 70px rgba(0,0,0,.43); backdrop-filter: blur(14px); }
.modal-kicker { display: flex; align-items: center; gap: 8px; color: #b3c0bd; font-size: 8px; font-weight: 850; letter-spacing: .19em; }
.modal-kicker span { width: 6px; height: 6px; background: var(--amber); }
.modal-card h2, .end-card h2 { margin: 17px 0 13px; color: #eff3ef; font-size: clamp(48px, 7vw, 67px); line-height: .88; letter-spacing: -.075em; font-weight: 650; }
.modal-card h2 em, .end-card h2 em { color: #9db7b8; font-family: Georgia, serif; font-weight: 400; }
.modal-copy { max-width: 380px; margin: 0; color: #a9b6b4; font-size: 12px; line-height: 1.7; }
.briefing-row { display: flex; justify-content: space-between; gap: 8px; margin: 20px 0 18px; padding: 12px 0; border-top: 1px solid #2b3738; border-bottom: 1px solid #2b3738; color: #809091; font-size: 8px; letter-spacing: .08em; }
.briefing-row b { color: #d59a61; margin-right: 3px; }
.primary-button { width: 100%; height: 46px; display: flex; justify-content: space-between; align-items: center; padding: 0 14px; border: 1px solid #b77d4f; background: #b77d4f; color: #12181a; cursor: pointer; font-size: 10px; font-weight: 900; letter-spacing: .16em; transition: background .15s ease, transform .15s ease; }
.primary-button:hover { background: #d69d69; transform: translateY(-1px); }
.primary-button span { font-size: 17px; }
.modal-controls { margin-top: 15px; color: #728184; text-align: center; font-size: 7px; font-weight: 800; letter-spacing: .08em; }
.modal-controls b { color: #526064; padding: 0 3px; }
.end-card[hidden] { display: none; }
.end-card .result-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 18px 0; padding: 14px 0; border-top: 1px solid #2b3738; border-bottom: 1px solid #2b3738; color: #829193; font-size: 8px; letter-spacing: .13em; }
.end-card .result-row strong { color: #e4eae7; font-family: ui-monospace, monospace; font-size: 11px; text-align: right; }
.telemetry { position: relative; min-height: 680px; padding: 14px 17px 18px; border: 1px solid #273235; background: linear-gradient(160deg, rgba(21,30,32,.93), rgba(13,19,21,.93)); }
.telemetry-heading { display: flex; justify-content: space-between; color: #c4cecb; font-size: 9px; font-weight: 850; letter-spacing: .17em; }
.telemetry-number { color: #788689; font-family: ui-monospace, monospace; font-size: 9px; }
.panel-rule { height: 1px; margin: 15px 0 21px; background: #303c3e; }
.section-label { display: flex; justify-content: space-between; align-items: center; color: #829092; font-size: 8px; font-weight: 850; letter-spacing: .14em; }
.section-label > span { color: #c2cfcb; font-family: ui-monospace, monospace; font-size: 9px; letter-spacing: .04em; }
.progress-track { height: 4px; margin-top: 11px; background: #2c383a; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #82a59b, #d3a06f); transition: width .2s linear; }
.progress-caption { display: flex; justify-content: space-between; margin-top: 7px; color: #607073; font-size: 7px; font-weight: 750; letter-spacing: .12em; }
.checkpoint-section { margin-top: 27px; }
.checkpoint-list { display: grid; gap: 0; margin: 9px 0 0; padding: 0; list-style: none; }
.checkpoint-list li { display: grid; grid-template-columns: 28px 1fr 10px; align-items: center; gap: 8px; min-height: 51px; border-bottom: 1px solid rgba(173,194,190,.09); opacity: .56; transition: opacity .2s, color .2s; }
.checkpoint-list li.active { opacity: 1; }
.checkpoint-list li.complete { opacity: .8; }
.cp-symbol { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid #3d4b4b; color: #90a09e; font-family: ui-monospace, monospace; font-size: 8px; }
.checkpoint-list li.active .cp-symbol { border-color: #c18b5c; color: #e1ac78; }
.checkpoint-list li.complete .cp-symbol { border-color: #719483; color: #9bc4ab; }
.checkpoint-list li b { display: block; color: #c2ceca; font-size: 9px; font-weight: 750; letter-spacing: .05em; }
.checkpoint-list li small { display: block; margin-top: 3px; color: #748386; font-size: 7px; letter-spacing: .15em; }
.checkpoint-list li > i { width: 5px; height: 5px; border-radius: 50%; background: #425052; }
.checkpoint-list li.active > i { background: #d89e69; box-shadow: 0 0 6px rgba(216,158,105,.7); }
.checkpoint-list li.complete > i { background: #84aa94; }
.vehicle-section { margin-top: 24px; }
.vehicle-status { color: #9bc2a8 !important; }
.vehicle-card { display: flex; align-items: center; gap: 10px; margin-top: 11px; padding: 10px; border: 1px solid #2c393a; background: rgba(255,255,255,.018); }
.car-thumb { width: 48px; height: 47px; display: grid; place-items: center; background: #202b2e; }
.car-art { position: relative; width: 19px; height: 36px; display: block; border: 1px solid #c58a5d; border-radius: 7px 7px 4px 4px; background: linear-gradient(90deg, #7c4e37, #bd8051 44%, #694532); transform: rotate(90deg); }
.car-art:before, .car-art:after { position: absolute; left: 4px; width: 9px; height: 7px; border-radius: 3px; background: #243439; content: ""; }
.car-art:before { top: 5px; }
.car-art:after { bottom: 5px; }
.car-art i { position: absolute; top: -3px; left: 5px; width: 7px; height: 3px; border-radius: 2px; background: #f2cd81; }
.vehicle-copy { display: grid; gap: 4px; color: #809092; font-size: 7px; letter-spacing: .08em; }
.vehicle-copy b { color: #d3dbd8; font-size: 8px; }
.telemetry-readout { display: flex; justify-content: space-between; margin-top: 12px; color: #839193; font-size: 8px; letter-spacing: .11em; }
.telemetry-readout b { color: #ced7d2; font-family: ui-monospace, monospace; font-size: 9px; }
.radio-callout { display: flex; gap: 10px; margin-top: 24px; padding: 12px 10px; border-left: 2px solid #a57852; background: rgba(170,117,76,.07); }
.radio-icon { color: #d49a65; font-size: 12px; }
.radio-callout b { color: #b6c1bd; font-size: 7px; letter-spacing: .17em; }
.radio-callout p { margin: 5px 0 0; color: #889595; font-size: 9px; line-height: 1.5; }
.sidebar-bottom { position: absolute; right: 17px; bottom: 14px; left: 17px; display: flex; justify-content: space-between; padding-top: 10px; border-top: 1px solid #2a3638; color: #536164; font-size: 7px; font-weight: 800; letter-spacing: .13em; }
.footer-note { display: flex; align-items: center; gap: 9px; padding: 13px 3px; color: #738184; font-size: 8px; letter-spacing: .07em; }
.weather-glyph { color: #a7c1c3; font-size: 13px; }
.footer-divider { width: 1px; height: 12px; background: #344043; }
.footer-spacer { flex: 1; }
.footer-tag { color: #7f938a; font-size: 7px; font-weight: 850; letter-spacing: .15em; }
.footer-tag i { display: inline-block; width: 5px; height: 5px; margin-left: 4px; border-radius: 50%; background: #82a58f; vertical-align: 1px; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; padding: 15px 2px 25px; border-top: 1px solid rgba(188,213,215,.11); color: #59676a; font-size: 7px; font-weight: 800; letter-spacing: .17em; }
.touch-controls { display: none; }

@media (max-width: 1040px) {
  .page-shell { width: min(100% - 32px, 900px); }
  .main-grid { grid-template-columns: 1fr; gap: 18px; padding-top: 23px; }
  .telemetry { min-height: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 22px; row-gap: 17px; padding-bottom: 50px; }
  .telemetry-heading, .panel-rule { grid-column: 1 / -1; }
  .panel-rule { margin: -7px 0 0; }
  .checkpoint-section, .vehicle-section { margin-top: 0; }
  .radio-callout { margin-top: 0; align-self: start; }
  .sidebar-bottom { bottom: 12px; }
}
@media (max-width: 640px) {
  .page-shell { width: calc(100% - 20px); }
  .topbar { height: 59px; }
  .brand { gap: 8px; font-size: 10px; }
  .brand-mark { width: 27px; height: 27px; }
  .topbar-right { gap: 7px; font-size: 8px; }
  .conditions, .top-separator { display: none; }
  .main-grid { padding-top: 17px; }
  .stage-heading { min-height: 70px; align-items: flex-end; }
  h1 { font-size: 31px; }
  .stage-meta { gap: 5px; font-size: 8px; }
  .stage-meta strong { font-size: 8px; }
  .stage-meta .meta-label:nth-of-type(3), .stage-meta .meta-divider { display: none; }
  .frame-topline { height: 29px; padding: 0 9px; font-size: 7px; }
  .canvas-wrap { min-height: 240px; aspect-ratio: 4 / 3; }
  .hud-top { top: 9px; left: 8px; right: 8px; gap: 5px; }
  .hud-badge { min-width: 76px; padding: 6px 7px; }
  .hud-label { font-size: 6px; }
  .hud-badge strong { font-size: 12px; }
  .next-gate { min-width: 93px; }
  .next-gate strong { font-size: 8px; }
  .speed-badge { min-width: 68px; }
  .speed-badge strong { font-size: 20px; }
  .minimap-wrap { right: 8px; bottom: 8px; width: 128px; padding: 5px; }
  .map-caption, .map-legend { font-size: 6px; }
  .road-status { left: 8px; bottom: 8px; padding: 6px; font-size: 6px; }
  .frame-bottomline { height: 31px; gap: 7px; padding: 0 7px; font-size: 6px; }
  .frame-bottomline .bottom-hint, .frame-bottomline > span:nth-child(2) { display: none; }
  .frame-bottomline .keycap { min-width: 12px; height: 13px; font-size: 6px; }
  .overlay { padding: 10px; background: rgba(4,10,12,.6); }
  .modal-card, .end-card { width: min(420px, 100%); padding: 22px 20px 18px; }
  .modal-card h2, .end-card h2 { margin: 12px 0 10px; font-size: 49px; }
  .modal-copy { font-size: 10px; }
  .briefing-row { margin: 13px 0; padding: 9px 0; font-size: 6px; }
  .primary-button { height: 39px; font-size: 8px; }
  .modal-controls { margin-top: 10px; font-size: 6px; }
  .telemetry { grid-template-columns: 1fr; padding: 13px; }
  .radio-callout { display: none; }
  .checkpoint-section { margin-top: 2px; }
  .vehicle-section { margin-top: 0; }
  .sidebar-bottom { position: static; grid-column: 1 / -1; margin-top: 0; }
  .page-footer { font-size: 6px; }
  .page-footer span:nth-child(2) { display: none; }
  .touch-controls { position: absolute; z-index: 3; right: 8px; bottom: 62px; left: 8px; display: flex; align-items: flex-end; justify-content: space-between; pointer-events: none; }
  .touch-steer, .touch-drive { display: flex; gap: 6px; pointer-events: auto; }
  .touch-controls button { width: 46px; height: 46px; border: 1px solid rgba(201,220,219,.35); border-radius: 50%; background: rgba(13,21,23,.72); color: #e1e9e6; font-size: 16px; font-weight: 800; touch-action: none; user-select: none; }
  .touch-drive button { width: 42px; height: 42px; font-size: 7px; letter-spacing: .04em; }
  .touch-drive .touch-throttle { background: rgba(143,97,61,.82); border-color: rgba(224,169,117,.6); }
  .touch-controls button.active { transform: scale(.95); background: rgba(184,131,85,.92); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
