:root {
  color-scheme: dark;
  --bg: #0d0814;
  --panel: #14101e;
  --panel-soft: #1b1528;
  --line: rgba(195, 151, 255, .14);
  --muted: #938ba4;
  --text: #f3effa;
  --violet: #bd69ff;
  --violet-light: #e4bcff;
  --pink: #ff75cc;
  --cyan: #80e7ff;
  --condensed: 'Barlow Condensed', Impact, sans-serif;
  --sans: 'Manrope', 'Segoe UI', sans-serif;
}
.selection-panel, .online-panel { display:flex; flex-wrap:wrap; gap:16px; align-items:center; background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:18px; margin-bottom:16px; }
.selection-panel label { flex:1; min-width:180px; display:flex; flex-direction:column; gap:8px; color:var(--muted); font:700 12px var(--sans); }
.selection-panel select { width:100%; padding:11px; background:#20172c; color:var(--text); border:1px solid var(--line); border-radius:7px; font:600 13px var(--sans); }
.selection-panel p { width:100%; margin:0; color:var(--muted); font-size:11px; }
.selection-panel button, .online-panel button, .online-panel a { padding:11px 14px; border:1px solid var(--line); border-radius:7px; color:var(--text); background:#281838; cursor:pointer; font:700 11px var(--sans); text-decoration:none; }
.online-panel span { flex:1; min-width:240px; font-size:12px; color:var(--muted); }
.online-panel ol { width:100%; display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:8px; list-style:none; padding:0; margin:0; font-size:12px; }
.online-panel li { border-top:1px solid var(--line); padding-top:10px; }
.online-panel [hidden] { display:none; }
button:disabled { opacity:.5; cursor:default; }
select:focus-visible, button:focus-visible, a:focus-visible { outline:2px solid var(--cyan); outline-offset:3px; }

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(ellipse at 8% 18%, rgba(102, 37, 168, .13), transparent 35%),
    radial-gradient(ellipse at 94% 72%, rgba(75, 29, 135, .12), transparent 36%),
    linear-gradient(180deg, #100a19 0%, #0c0812 64%, #100a18 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

button, a { font: inherit; }
button { color: inherit; }
.ambient { position: fixed; pointer-events: none; z-index: -1; border-radius: 50%; filter: blur(90px); opacity: .12; }
.ambient-one { width: 300px; height: 300px; background: #a431ff; top: 250px; left: -180px; }
.ambient-two { width: 350px; height: 350px; background: #6e48ff; right: -200px; bottom: 60px; }
.shell { max-width: 1510px; width: calc(100% - 76px); margin: 0 auto; }
.topbar { min-height: 78px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { display: grid; place-items: center; position: relative; width: 38px; height: 38px; border: 1px solid rgba(214, 168, 255, .45); background: linear-gradient(145deg, #4d2184, #1e1030); border-radius: 11px; font: 800 23px var(--condensed); box-shadow: 0 0 22px rgba(175, 75, 255, .24); }
.brand-mark span { position: absolute; color: var(--cyan); font: 10px var(--sans); right: 3px; top: 2px; }
.brand-copy { display: flex; flex-direction: column; letter-spacing: .14em; line-height: 1.04; }
.brand-copy strong { font-size: 13px; font-weight: 800; }
.brand-copy small { color: #b18bd6; font-size: 9px; font-weight: 800; letter-spacing: .3em; margin-top: 3px; }
.topbar-center { color: #aaa0b7; font: 700 10px var(--condensed); letter-spacing: .18em; display: flex; align-items: center; gap: 9px; }
.topbar-divider { color: #534767; }
.live-dot { width: 7px; height: 7px; flex: 0 0 auto; display: inline-block; border-radius: 50%; background: #86f0bd; box-shadow: 0 0 12px #5bffae; }
.discord-link { border: 1px solid rgba(193, 148, 255, .21); border-radius: 6px; color: #d8c4ed; text-decoration: none; padding: 10px 13px; font-size: 9px; font-weight: 800; letter-spacing: .1em; transition: .18s ease; }
.discord-link:hover { color: white; border-color: var(--violet); box-shadow: 0 0 20px rgba(166, 73, 252, .2); }
.discord-link span { color: #a58cff; margin-right: 5px; }.discord-link b { color: var(--violet-light); margin-left: 8px; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; min-height: 263px; padding: 43px 2px 32px; }
.eyebrow { display: flex; align-items: center; gap: 11px; margin: 0 0 13px; color: #c694fa; font: 700 10px var(--condensed); letter-spacing: .2em; }
.eyebrow i { width: 30px; height: 1px; background: linear-gradient(90deg, var(--violet), transparent); }
h1 { position: relative; margin: 0; color: #f9f5ff; font: 900 clamp(52px, 6.4vw, 88px)/.76 var(--condensed); letter-spacing: -.015em; text-shadow: 0 10px 40px rgba(146, 71, 205, .1); }
h1 span { color: var(--violet-light); }
.title-star { position: absolute; color: var(--pink); font: 24px var(--sans); top: 5px; right: -31px; text-shadow: 0 0 18px rgba(255, 117, 204, .7); }
.hero-description { margin: 17px 0 20px; color: #aaa1b6; font-size: 12px; line-height: 1.7; }
.hero-actions { display: flex; align-items: center; gap: 19px; }
.primary-button { border: 0; background: linear-gradient(105deg, #a84cf5, #7335c8); box-shadow: 0 6px 24px rgba(153, 61, 232, .21), inset 0 1px 0 rgba(255,255,255,.2); height: 43px; min-width: 195px; padding: 0 14px; border-radius: 5px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font: 800 11px var(--condensed); letter-spacing: .14em; transition: .18s ease; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 9px 29px rgba(153, 61, 232, .38); }
.primary-button .button-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.18); font: 9px var(--sans); }
.primary-button b { color: #efdcff; font-size: 14px; }
.control-hint { display: flex; align-items: center; gap: 4px; }
.key { width: 20px; height: 21px; display: grid; place-items: center; border: 1px solid #41334f; border-bottom-width: 2px; border-radius: 4px; color: #c9b7d7; background: rgba(255,255,255,.025); font: 700 9px var(--sans); }
.control-hint small { margin-left: 6px; color: #71687c; font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.hero-aside { align-self: flex-end; display: grid; grid-template-columns: 1fr; min-width: 185px; padding: 3px 0 3px 22px; border-left: 1px solid rgba(202, 160, 255, .22); margin-bottom: 2px; }
.aside-label { color: #70647e; font: 700 9px var(--condensed); letter-spacing: .18em; }
.hero-aside strong { margin-top: 4px; color: #eae0f3; font: 700 18px/1.02 var(--condensed); letter-spacing: .07em; }
.aside-line { height: 1px; width: 100%; background: linear-gradient(90deg, #54386e, transparent); margin: 12px 0; }
.hero-aside .weather { font-size: 13px; }.weather span { color: #f7d78b; font-size: 19px; vertical-align: -2px; margin-right: 4px; }
.aside-coordinate { margin-top: 13px; color: #635a6e; font: 600 8px var(--condensed); letter-spacing: .12em; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 274px; gap: 15px; align-items: stretch; }
.track-frame { min-width: 0; border: 1px solid rgba(199, 157, 255, .2); background: rgba(17, 12, 27, .82); box-shadow: 0 20px 60px rgba(0,0,0,.28), 0 0 60px rgba(101, 42, 152, .08); border-radius: 8px; overflow: hidden; }
.track-topline { height: 37px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(203, 170, 242, .1); color: #83788f; font: 700 9px var(--condensed); letter-spacing: .14em; }
.track-topline > span:first-child { display: flex; align-items: center; gap: 8px; color: #b1a2c0; }
.track-topline .live-dot { width: 6px; height: 6px; background: var(--pink); box-shadow: 0 0 9px var(--pink); }
#raceState { color: var(--cyan); }.canvas-wrap { position: relative; width: 100%; aspect-ratio: 10 / 7; overflow: hidden; background: #0c0d16; }
canvas { display: block; width: 100%; height: 100%; }
.game-hud { position: absolute; z-index: 2; top: 13px; left: 14px; right: 14px; display: grid; grid-template-columns: 1fr 1.2fr 1fr; pointer-events: none; }
.hud-block { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-shadow: 0 2px 10px #090710; }
.hud-block span { color: #9d93aa; font: 700 8px var(--condensed); letter-spacing: .16em; }
.hud-block strong { color: #f5ebff; font: 700 18px var(--condensed); letter-spacing: .03em; }
.timer-block { align-items: center; }.timer-block strong { color: #f6d9ff; font-size: 24px; font-variant-numeric: tabular-nums; text-shadow: 0 0 16px rgba(209,137,255,.34); }
.speed-block { align-items: flex-end; }.speed-block strong { color: var(--cyan); font-size: 19px; font-variant-numeric: tabular-nums; }.speed-block small { color: #8baab2; font-size: 8px; letter-spacing: .1em; }
.start-overlay { position: absolute; z-index: 3; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: radial-gradient(ellipse, rgba(15, 9, 23, .53), rgba(8, 8, 14, .84)); transition: opacity .28s ease, visibility .28s ease; }
.start-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.overlay-emblem { display: grid; place-items: center; width: 44px; height: 44px; color: #e7c2ff; background: rgba(169, 78, 255, .14); border: 1px solid rgba(203, 151, 255, .42); border-radius: 50%; box-shadow: 0 0 33px rgba(158, 76, 235, .25); font-size: 20px; }
.start-overlay .eyebrow { margin: 15px 0 9px; font-size: 9px; }
.start-overlay h2 { margin: 0; color: #fff; font: 900 clamp(28px, 4vw, 46px)/.87 var(--condensed); letter-spacing: .025em; }
.start-overlay h2 span { color: #d5a4ff; }
.start-overlay > p:not(.eyebrow) { margin: 12px 0 17px; color: #b4a8bd; font-size: 10px; line-height: 1.65; }
.overlay-button { display: inline-flex; align-items: center; gap: 10px; border: 1px solid rgba(226, 196, 255, .32); border-radius: 4px; padding: 10px 17px; color: #f3e8ff; background: rgba(130, 58, 191, .45); box-shadow: 0 4px 20px rgba(144, 50, 213, .22); cursor: pointer; font: 800 10px var(--condensed); letter-spacing: .15em; transition: .18s; }
.overlay-button:hover { background: rgba(160, 70, 232, .68); transform: translateY(-1px); }
.overlay-button span { font-size: 9px; }
.canvas-corner { position: absolute; z-index: 2; bottom: 10px; color: rgba(176, 157, 192, .47); font: 700 8px var(--condensed); letter-spacing: .15em; pointer-events: none; }.canvas-corner span { color: rgba(177, 105, 255, .7); }.corner-left { left: 13px; }.corner-right { right: 13px; }
.finish-toast { position: absolute; z-index: 4; top: 58px; right: 14px; min-width: 190px; display: flex; gap: 10px; align-items: center; padding: 11px 10px; border: 1px solid rgba(206, 166, 255, .4); border-radius: 6px; background: rgba(30, 19, 43, .94); box-shadow: 0 8px 30px rgba(0,0,0,.4); opacity: 0; transform: translateY(-7px); pointer-events: none; transition: .22s ease; }.finish-toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast-spark { color: #f6d17d; font-size: 20px; text-shadow: 0 0 15px #e9a1ff; }.finish-toast div { display: flex; flex-direction: column; gap: 3px; }.finish-toast strong { color: #eedcff; font: 800 10px var(--condensed); letter-spacing: .1em; }.finish-toast small { color: #fff; font: 700 15px var(--condensed); font-variant-numeric: tabular-nums; }.finish-toast button { margin-left: auto; align-self: flex-start; border: 0; background: transparent; color: #9889a5; font-size: 18px; cursor: pointer; }
.mobile-controls { display: none; }

.race-sidebar { display: flex; flex-direction: column; gap: 11px; }
.record-card, .leaderboard-card, .garage-card { padding: 14px 14px 13px; border-radius: 7px; border: 1px solid rgba(198, 155, 255, .14); background: linear-gradient(145deg, rgba(25, 18, 38, .94), rgba(17, 13, 24, .96)); box-shadow: inset 0 1px 0 rgba(255,255,255,.018); }
.card-heading { display: flex; align-items: center; gap: 7px; }.card-heading > span:first-child { color: #ad69de; font: 800 9px var(--condensed); }.card-heading h2 { margin: 0; color: #d8ccdf; white-space: nowrap; font: 800 11px var(--condensed); letter-spacing: .1em; }.heading-line { height: 1px; flex: 1; background: linear-gradient(90deg, rgba(179, 109, 238, .36), transparent); }
.record-time { margin: 18px 0 6px; color: #ead7ff; font: 700 38px/.9 var(--condensed); letter-spacing: .025em; font-variant-numeric: tabular-nums; text-shadow: 0 0 20px rgba(197, 114, 255, .25); }
.record-meta { display: flex; justify-content: space-between; gap: 8px; color: #71687d; font: 700 8px var(--condensed); letter-spacing: .08em; }.record-meta span:first-child { display: flex; gap: 6px; align-items: center; }.record-dot { width: 5px; height: 5px; display: inline-block; background: #8af1bd; border-radius: 50%; box-shadow: 0 0 8px #73ffbc; }
.record-divider { margin: 13px 0 9px; height: 1px; background: rgba(208, 185, 231, .09); }
.personal-best { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }.personal-best span { color: #80758d; font: 700 8px var(--condensed); letter-spacing: .08em; }.personal-best strong { color: #c6b3dc; font: 700 13px var(--condensed); font-variant-numeric: tabular-nums; }.personal-best:first-of-type strong { color: #a6e9f9; }
.ghost-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(208, 185, 231, .09); }.ghost-row > div { display: flex; flex-direction: column; gap: 3px; }.ghost-row > div > span { color: #9b82ad; font: 800 8px var(--condensed); letter-spacing: .09em; }.ghost-row small { color: #6f6878; font-size: 7px; }.ghost-row button { border: 1px solid rgba(150, 118, 178, .3); border-radius: 4px; padding: 6px 7px; color: #c7a8e2; background: rgba(156, 80, 216, .12); cursor: pointer; font: 800 8px var(--condensed); letter-spacing: .08em; }.ghost-row button:hover:not(:disabled) { border-color: var(--violet); color: white; }.ghost-row button:disabled { opacity: .45; cursor: not-allowed; }
.leaderboard-card { flex: 1; min-height: 175px; }.leaderboard-note { margin: 13px 0 6px; color: #756a81; font: 700 8px var(--condensed); letter-spacing: .11em; }
.leaderboard-list { display: flex; flex-direction: column; list-style: none; margin: 0; padding: 0; }.leaderboard-list li { display: grid; grid-template-columns: 20px 1fr auto; gap: 6px; align-items: center; min-height: 27px; border-top: 1px solid rgba(210, 180, 233, .07); color: #c7bdcf; font: 600 9px var(--sans); }.leaderboard-list li > span:first-child { color: #a88abf; font: 700 10px var(--condensed); }.leaderboard-list li:first-child > span:first-child { color: #f2c76f; }.leaderboard-list li > span:last-child { color: #e3d0f0; font: 700 12px var(--condensed); font-variant-numeric: tabular-nums; }.leaderboard-list .empty-score { grid-template-columns: 20px 1fr auto; color: #766c7f; font-size: 8px; }.leaderboard-list .empty-score > span:last-child { color: #766c7f; }
.local-note { display: flex; gap: 6px; align-items: center; color: #6f6878; margin-top: 12px; font-size: 8px; }.local-note span { color: #9a76ba; }
.garage-card .card-heading { margin-bottom: 11px; }.instruction-row { display: flex; align-items: center; gap: 9px; margin-top: 6px; color: #a69baa; font-size: 9px; }.keycap { display: inline-grid; place-items: center; width: 22px; height: 19px; border: 1px solid #44364f; border-bottom-width: 2px; border-radius: 4px; color: #ddc6f0; background: rgba(255,255,255,.025); font: 800 9px var(--condensed); }.keycap.wide { width: 48px; font-size: 8px; }
.drift-tip { margin: 12px 0 0; padding-top: 9px; border-top: 1px solid rgba(210,180,233,.08); color: #827888; font-size: 8px; line-height: 1.55; }.drift-tip b { color: #d5a1ff; margin-right: 4px; font-size: 8px; letter-spacing: .08em; }
.footer { display: flex; justify-content: space-between; align-items: center; min-height: 51px; color: #665b70; font: 700 8px var(--condensed); letter-spacing: .12em; }.footer b { color: #df78cc; font-size: 10px; }

@media (min-width: 1550px) { .shell { width: calc(100% - 110px); } }
@media (max-width: 1080px) { .shell { width: calc(100% - 40px); }.game-layout { grid-template-columns: minmax(0, 1fr) 245px; gap: 11px; }.race-sidebar { gap: 9px; }.record-card, .leaderboard-card, .garage-card { padding: 12px; } }
@media (max-width: 780px) { .shell { width: calc(100% - 28px); }.topbar { min-height: 66px; }.topbar-center { display: none; }.hero { min-height: 0; padding: 34px 1px 25px; }.hero-aside { min-width: 145px; padding-left: 14px; }.hero-aside strong { font-size: 15px; }.aside-coordinate { font-size: 7px; }.game-layout { grid-template-columns: 1fr; }.race-sidebar { display: grid; grid-template-columns: 1fr 1fr; }.record-card { grid-row: span 2; }.leaderboard-card { min-height: auto; }.garage-card { grid-column: 2; }.record-time { font-size: 35px; }.footer { flex-wrap: wrap; gap: 8px; padding: 14px 0; }.footer span:nth-child(2) { order: 1; width: 100%; text-align: center; } }
@media (max-width: 540px) { .shell { width: calc(100% - 20px); }.brand-mark { width: 34px; height: 34px; }.brand-copy strong { font-size: 12px; }.discord-link { padding: 9px 10px; font-size: 8px; }.hero { padding-top: 27px; align-items: flex-end; }.hero-copy { min-width: 0; }.hero .eyebrow { gap: 7px; font-size: 8px; }.hero .eyebrow i { width: 17px; }.hero h1 { font-size: clamp(51px, 15vw, 72px); }.hero-description { font-size: 10px; margin: 14px 0; }.hero-actions { gap: 10px; flex-wrap: wrap; }.primary-button { min-width: 178px; height: 40px; font-size: 10px; }.control-hint small { font-size: 7px; }.hero-aside { min-width: 93px; padding-left: 9px; margin-left: 10px; }.hero-aside .aside-label { font-size: 7px; }.hero-aside strong { font-size: 12px; }.hero-aside .weather { font-size: 9px; }.weather span { font-size: 15px; }.aside-coordinate { display: none; }.aside-line { margin: 8px 0; }.game-hud { top: 9px; left: 9px; right: 9px; }.hud-block span { font-size: 7px; }.hud-block strong { font-size: 14px; }.timer-block strong { font-size: 19px; }.speed-block strong { font-size: 15px; }.start-overlay h2 { font-size: 34px; }.overlay-emblem { width: 36px; height: 36px; }.start-overlay .eyebrow { margin: 10px 0 6px; }.start-overlay > p:not(.eyebrow) { margin: 8px 0 12px; font-size: 9px; }.overlay-button { padding: 9px 13px; }.mobile-controls { position: absolute; z-index: 5; display: flex; justify-content: space-between; align-items: flex-end; left: 10px; right: 10px; bottom: 24px; pointer-events: none; }.steering-controls, .drive-controls { display: flex; align-items: flex-end; gap: 6px; pointer-events: auto; }.mobile-controls button { touch-action: none; user-select: none; -webkit-user-select: none; border: 1px solid rgba(222, 183, 255, .32); color: #e8d6f8; background: rgba(27, 16, 39, .73); backdrop-filter: blur(8px); cursor: pointer; }.steering-controls button { width: 47px; height: 43px; border-radius: 13px; font-size: 22px; }.drive-controls button { height: 43px; border-radius: 13px; font: 800 9px var(--condensed); letter-spacing: .07em; }.drive-controls .brake-control { width: 57px; color: #ffc3ec; }.drive-controls .gas-control { width: 51px; color: #baf6ff; }.gas-control span { display: block; font-size: 9px; }.mobile-controls button.active, .mobile-controls button:active { background: rgba(147, 65, 215, .73); border-color: rgba(226, 190, 255, .74); }.canvas-corner { bottom: 8px; font-size: 7px; }.race-sidebar { grid-template-columns: 1fr; }.record-card { grid-row: auto; }.garage-card { grid-column: auto; }.record-card, .leaderboard-card, .garage-card { padding: 14px; }.record-time { font-size: 41px; }.leaderboard-card { min-height: 150px; }.finish-toast { right: 8px; top: 48px; min-width: 170px; }.footer { font-size: 7px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
