:root {
  color-scheme: dark;
  --page: #111217;
  --panel: #1a1c24;
  --line: #30323d;
  --ink: #f6f2e9;
  --muted: #b1b1c0;
  --orange: #ffa16e;
  --mint: #8de2c0;
  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --body: "Space Grotesk", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden], .symbols { display: none !important; }
body { min-height: 100dvh; margin: 0; background: radial-gradient(ellipse at 56% 10%, #27202c, var(--page) 60%); color: var(--ink); font-family: var(--body); }
button { cursor: pointer; color: inherit; font: inherit; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible { outline: 2px solid #a9eeff; outline-offset: 3px; }
svg { display: inline-block; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; pointer-events: none; }
.app { max-width: 1680px; margin-inline: auto; padding: 0 clamp(18px, 4.2vw, 68px) 24px; }
.topbar { height: 77px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand, .top-actions { display: flex; align-items: center; gap: 10px; }
.brand { font: italic 900 1.83rem/1 var(--display); letter-spacing: .025em; white-space: nowrap; }
.brand b { color: var(--orange); font-weight: inherit; }
.brand-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 8px; color: #201114; background: var(--orange); }
.brand-icon svg { width: 26px; height: 26px; }
.utility { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; min-width: 39px; border: 1px solid #3f414c; background: #1c1e27; border-radius: 7px; padding: 0 10px; font-size: .86rem; white-space: nowrap; }
.utility svg { width: 16px; height: 16px; }
.utility:hover, .utility:focus-visible { background: #30313d; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 283px; align-items: start; gap: 17px; padding-top: 20px; }
.ride, .sidebar { min-width: 0; }
.arena { position: relative; isolation: isolate; height: clamp(518px, 71vh, 730px); border: 1px solid #575160; border-radius: 12px; overflow: hidden; background: linear-gradient(#33334d, #ac6d72 46%, #343344 60%, #151520); }
#road, #cockpit, .light-vignette, .screen { position: absolute; width: 100%; height: 100%; inset: 0; }
#road { z-index: -4; }
#cockpit { z-index: -1; pointer-events: none; }
.light-vignette { z-index: 0; pointer-events: none; box-shadow: inset 0 0 105px #100c18a0; }
.rider { position: absolute; z-index: -2; left: 50%; bottom: 4%; transform: translate(-50%, var(--rider-lift, 0%)); width: min(42%, 420px); height: min(56%, 370px); pointer-events: none; }
.rider video, .rider canvas { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; }
.rider video { transform: scaleX(-1); object-fit: cover; border-radius: 43% 43% 30% 30%; mask-image: radial-gradient(ellipse 52% 55% at 50% 52%, #000 65%, #000c 79%, transparent 100%); }
.rider canvas, .rider.cutout video { display: none; }
.rider.cutout canvas { display: block; }
.arena[data-screen="setup"] .rider { left: 71%; bottom: 15%; height: 65%; }
.screen { pointer-events: none; }
.screen button { pointer-events: auto; }
.menu-screen { display: flex; align-items: center; background: linear-gradient(90deg, #120f1bf7 1%, #171321df 20%, #18132286 47%, #16121a00 75%); }
.menu-copy { width: 100%; padding: 26px 0 42px clamp(25px, 5.8vw, 91px); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: #ffc09d; font-weight: 700; font-size: .8rem; letter-spacing: .17em; }
.eyebrow svg { width: 17px; height: 17px; }
h1, h2, p { margin: 0; }
h1 { margin: 13px 0 16px; font: italic 900 clamp(6.5rem, 10.8vw, 12.5rem)/.76 var(--display); letter-spacing: -.025em; text-shadow: 0 10px 45px #1a1223aa; }
h1 em { color: var(--orange); font-style: inherit; }
.menu-copy > p { max-width: 350px; font-size: 1.05rem; line-height: 1.4; color: #eee2e5; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 22px; }
.button { min-height: 48px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 7px; padding: 0 14px; font-weight: 700; font-size: .9rem; letter-spacing: -.01em; transition: background .15s, border-color .15s, transform .15s; }
.button:hover { transform: translateY(-1px); }
.button:active, .button.held { transform: translateY(1px); }
.button svg { width: 18px; height: 18px; }
.primary { background: var(--orange); color: #211219; box-shadow: 0 8px 30px #f99d7425; }
.primary:hover { background: #ffba93; }
.secondary { background: #1b1725e6; border-color: #797080; }
.secondary:hover, .secondary.held { background: #3e3449; border-color: #a79bac; }
.error { display: inline-block; max-width: min(435px, 96%) !important; background: #46262beF; border: 1px solid #ae6b68; color: #ffdbcd !important; font-size: .86rem !important; border-radius: 6px; margin: 13px 0 0; padding: 8px 11px; }
.centered { display: grid; place-items: center; padding: 19px; }
#setup { justify-items: start; background: linear-gradient(90deg, #120e1bf4 0, #191324bc 36%, #211a2921 70%); }
.setup-copy { margin-left: clamp(4px, 4vw, 66px); max-width: min(50%, 440px); }
.screen h2 { font: italic 900 clamp(3rem, 6vw, 6rem)/.86 var(--display); margin-top: 9px; text-wrap: balance; text-shadow: 0 7px 25px #180e20; }
.screen h2 + p, .modal p { color: #e2dce8; margin-top: 14px; line-height: 1.45; }
.setup-progress, .race-progress { overflow: hidden; height: 5px; background: #c0acbe40; border-radius: 5px; margin: 18px 0; }
.setup-progress i, .race-progress i { display: block; width: 100%; height: 100%; transform: scaleX(var(--progress, 0)); transform-origin: left; background: var(--orange); }
.race-hud { position: absolute; z-index: 2; display: grid; grid-template-columns: minmax(86px, .72fr) minmax(90px, 2.7fr) minmax(79px, .7fr) auto; align-items: start; gap: 8px; inset: 16px 16px auto; }
.hud-box { padding: 8px 11px; min-height: 57px; background: #171424e9; border: 1px solid #83788c93; border-radius: 8px; }
.hud-label { color: #d1c4d1; font-size: .66rem; font-weight: 700; letter-spacing: .11em; }
.speed-box div { display: flex; gap: 5px; align-items: baseline; color: var(--orange); }
.speed-box strong, .timer-box strong { font: 800 2rem/.9 var(--display); font-variant-numeric: tabular-nums; }
.speed-box div > span { font-size: .65rem; font-weight: 700; }
.progress-box { align-self: stretch; display: flex; flex-direction: column; justify-content: space-between; }
.progress-box > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
#checkpoint-count { color: var(--orange); font-size: .76rem; font-weight: 700; white-space: nowrap; }
.race-progress { position: relative; margin: 5px 0 3px; height: 6px; }
.race-progress b { position: absolute; bottom: 0; height: 100%; width: 2px; background: #efe4e0a0; }
.race-progress b:nth-child(2) { left: 25%; }
.race-progress b:nth-child(3) { left: 50%; }
.race-progress b:nth-child(4) { left: 75%; }
.timer-box strong { display: block; white-space: nowrap; margin-top: 3px; }
.hud-pause { min-height: 57px; background: #171424db; }
.number-screen { display: grid; place-items: center; padding-bottom: 5%; }
.number-screen strong { color: #ffe6d5; font: italic 900 clamp(7rem, 21vw, 16rem)/1 var(--display); text-shadow: 0 0 30px #ff8520b0, 0 5px 24px #2a162d; }
.race-call { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); font: italic 900 clamp(1.6rem, 4vw, 3.9rem)/.95 var(--display); letter-spacing: .05em; white-space: nowrap; color: #ffe7b5; text-shadow: 0 3px 15px #190f27, 0 3px 3px #190f27; }
.race-call.warning { color: #ffac9f; }
.brake-pill { position: absolute; right: 16px; bottom: 19px; display: flex; align-items: center; gap: 6px; background: #301a2aea; border: 1px solid #fa9e8a8a; color: #ffb5a5; border-radius: 6px; padding: 7px; font-weight: 700; font-size: .72rem; letter-spacing: .1em; }
.brake-pill svg { width: 15px; height: 15px; }
.brake-pill > span { background: #ffffff3a; height: 4px; width: 38px; border-radius: 3px; }
.brake-pill i { display: block; height: 100%; background: #ff8e6e; transform: scaleX(var(--brake, 0)); transform-origin: left; }
.modal-screen { background: #15122190; backdrop-filter: blur(4px); }
.modal { width: min(470px, 100%); background: #211b2cf5; border: 1px solid #7d677d; border-radius: 12px; padding: clamp(18px, 4vw, 37px); text-align: center; box-shadow: 0 18px 60px #10091990; }
.modal .hero-actions { justify-content: center; }
.finish-time { display: block; color: var(--orange); font: 800 4.4rem/1 var(--display); margin-top: 12px; }
.arena.impact { animation: impact .36s ease-out; }
@keyframes impact { 25% { border-color: #ff8776; } 30% { box-shadow: 0 0 38px #ff674c80; } }
.sidebar { display: grid; gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 15px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.panel-heading h2 { display: flex; align-items: center; gap: 8px; font-size: 1rem; white-space: nowrap; }
.panel-heading h2 svg { width: 17px; height: 17px; color: var(--orange); }
.panel p { color: var(--muted); line-height: 1.45; font-size: .87rem; }
.camera-panel > p, .route-panel > p { margin-top: 10px; }
.camera-status { display: flex; align-items: center; gap: 5px; background: #2c2e38; color: #c7c6d0; padding: 4px 6px; border-radius: 4px; font-size: .66rem; letter-spacing: .08em; }
.camera-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.camera-status.ready { background: #244136; color: var(--mint); }
.camera-status.active { background: #413128; color: #ffbc94; }
.steer-meter { display: grid; grid-template-columns: auto 1fr auto; gap: 7px; align-items: center; margin: 13px 0 1px; font-size: .69rem; font-weight: 700; color: var(--muted); }
.steer-meter > div { position: relative; height: 4px; border-radius: 4px; background: repeating-linear-gradient(90deg, #464753 0 calc(25% - 1px), #7d7885 calc(25% - 1px) 25%); }
.steer-meter i { position: absolute; top: -3px; left: calc(50% + var(--steer, 0) * 49.5%); width: 9px; height: 10px; border-radius: 2px; background: var(--orange); transform: translateX(-50%); }
.camera-actions { display: flex; gap: 6px; margin-top: 12px; }
.camera-actions button { min-height: 32px; padding: 0 7px; font-size: .77rem; }
.controls-panel .panel-heading { margin-bottom: 2px; }
.control { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 7px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.control:last-child { border-bottom: 0; padding-bottom: 2px; }
.control-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; background: #3b2c32; color: var(--orange); }
.control-icon svg { width: 19px; height: 19px; }
.control strong { font-size: .88rem; }
.control p { font-size: .78rem; margin-top: 2px; }
kbd, .auto { padding: 3px 5px; border-radius: 4px; font: 700 .68rem/1.2 var(--body); white-space: nowrap; }
kbd { border: 1px solid #535363; border-bottom-width: 2px; background: #292a34; }
.auto { color: #a0dabb; background: #263b35; }
.best { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 11px; padding-top: 9px; font-size: .81rem; color: var(--muted); }
.best strong { color: var(--orange); font-size: .94rem; }
.ride-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .79rem; margin-top: 12px; padding: 0 1px; }
.ride-footer > span:first-child { display: inline-flex; gap: 5px; align-items: center; }
.ride-footer svg { width: 15px; height: 15px; }
#footer-mode { font-size: .67rem; font-weight: 700; letter-spacing: .09em; white-space: nowrap; }
.touch-pad { display: none; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) 249px; gap: 12px; }
  .panel { padding: 13px; }
  .menu-copy { padding-left: 32px; }
}
@media (max-width: 780px) {
  .app { padding-inline: 13px; }
  .topbar { height: 64px; }
  .layout { grid-template-columns: 1fr; gap: 13px; padding-top: 12px; }
  .arena { height: clamp(465px, 68dvh, 590px); }
  .sidebar { grid-template-columns: 1fr 1fr; gap: 9px; }
  .route-panel { grid-column: 1 / -1; }
  .arena[data-screen="setup"] .rider { left: 74%; bottom: 14%; }
  .rider { width: 52%; }
  h1 { font-size: clamp(5.7rem, 14vw, 9rem); }
}
@media (max-width: 470px) {
  .brand { font-size: 1.5rem; }
  .brand-icon { width: 34px; height: 34px; }
  .top-actions { gap: 6px; }
  .top-actions button span { display: none; }
  .menu-copy { padding: 24px 15px 35px 21px; }
  .menu-copy > p { max-width: 210px; }
  .menu-screen { background: linear-gradient(90deg, #120f1bf0, #17132168 74%, #17132133); }
  .menu-screen .hero-actions { display: grid; justify-content: start; }
  .arena { height: clamp(380px, 65dvh, 520px); }
  .sidebar { grid-template-columns: 1fr; }
  .race-hud { gap: 5px; inset: 8px 8px auto; grid-template-columns: 62px minmax(62px, 1fr) 64px 35px; }
  .hud-box { padding: 6px 5px; min-height: 49px; }
  .hud-label { font-size: .54rem; }
  .speed-box strong, .timer-box strong { font-size: 1.65rem; }
  .speed-box div > span { font-size: .58rem; }
  .hud-pause { min-width: 0; min-height: 49px; padding: 0; }
  #checkpoint-count { font-size: .61rem; }
  .rider { width: 61%; }
  .arena[data-screen="setup"] .rider { left: 73%; }
  .setup-copy { max-width: 55%; }
  .screen h2 { font-size: clamp(2.45rem, 9vw, 4.3rem); }
  .ride-footer { font-size: .71rem; }
  #footer-mode { display: none; }
}
@media (pointer: coarse), (hover: none) {
  .touch-pad:not([hidden]) { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 8px; }
  .touch-pad button { touch-action: none; min-height: 49px; }
}
@media (max-height: 530px) and (orientation: landscape) {
  .arena { height: max(300px, 78dvh); }
  .topbar { height: 50px; }
  .layout { padding-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

.course-trigger { display: inline-flex; align-items: center; gap: 8px; min-height: 37px; max-width: 100%; padding: 0 9px; border: 1px solid #e9b49a61; border-radius: 6px; background: #1c1724ba; color: #ffe0cb; text-align: left; font-size: .78rem; }
.course-trigger svg { width: 15px; height: 15px; color: var(--orange); }
.course-trigger > span { font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.course-trigger small { padding-left: 7px; border-left: 1px solid #e9b49a50; color: #ded4e0; font-size: .72rem; white-space: nowrap; }
.course-trigger:hover { background: #493345e8; border-color: var(--orange); }
#course-picker { width: min(690px, calc(100% - 22px)); max-height: calc(100dvh - 26px); color: var(--ink); background: #1a1923; padding: clamp(12px, 3vw, 25px); border: 1px solid #837081; border-radius: 12px; box-shadow: 0 16px 90px #110b19cd; }
#course-picker::backdrop { background: #17121dc7; backdrop-filter: blur(4px); }
.course-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.course-picker-head h2 { color: var(--ink); font: italic 900 clamp(2.35rem, 7vw, 3.9rem)/1 var(--display); }
.course-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.course-option { --swatch-top: #574a72; --swatch-bottom: #e1987e; min-height: 91px; position: relative; display: grid; align-content: start; gap: 5px; padding: 11px 11px 11px 14px; text-align: left; color: var(--ink); background: linear-gradient(125deg, #2d2738, #252433); border: 1px solid #514757; border-radius: 7px; overflow: hidden; }
.course-option::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 4px; background: linear-gradient(var(--swatch-top), var(--swatch-bottom)); }
.course-option[data-course="neon-harbor"] { --swatch-top: #503473; --swatch-bottom: #82efff; }
.course-option[data-course="redstone-canyon"] { --swatch-top: #9a4b37; --swatch-bottom: #ffbd78; }
.course-option[data-course="glacier-run"] { --swatch-top: #5586bb; --swatch-bottom: #caf7ff; }
.course-option[data-course="palm-coast"] { --swatch-top: #2488aa; --swatch-bottom: #8dffd5; }
.course-option[data-course="jungle-switchbacks"] { --swatch-top: #1d6551; --swatch-bottom: #d2db76; }
.course-option[data-course="ember-ridge"] { --swatch-top: #5b3a5c; --swatch-bottom: #ee6b4f; }
.course-option:hover, .course-option[aria-pressed="true"] { background: #3c3141; border-color: var(--orange); }
.course-option strong { font-size: .99rem; }
.course-option p { font-size: .79rem; color: #c4becb; line-height: 1.35; }
.course-meta { font-size: .7rem; color: #ffc2a2; }
.trick-hud { position: absolute; left: 16px; bottom: 19px; display: flex; align-items: center; gap: 8px; background: #1f1727ed; border: 1px solid #efad8680; color: #ffbd99; border-radius: 6px; padding: 8px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; }
#pump-meter { display: flex; gap: 3px; }
#pump-meter i { width: 10px; height: 6px; border-radius: 1px; background: #ffdbca3a; }
#pump-meter i.filled { background: var(--orange); box-shadow: 0 0 6px #ffa16e76; }
.arena.glow-air { box-shadow: 0 0 24px #ffa16e33; }
@media (max-width: 510px) {
  .course-option { min-height: 95px; padding-inline: 10px 6px; }
  .course-option strong { font-size: .87rem; }
  .course-option p { font-size: .72rem; }
  .course-meta { font-size: .67rem; }
  .trick-hud { left: 8px; bottom: 10px; font-size: .64rem; }
  .brake-pill { right: 8px; bottom: 10px; }
}
@media (pointer: coarse), (hover: none) {
  .touch-pad:not([hidden]) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .touch-pad button { grid-column: span 2; padding: 0 4px; }
  .touch-pad .stunt-touch { grid-column: span 2; }
}

.setup-tip { color: #dfcedc; font-size: .82rem; margin-top: 8px; }
