@font-face { font-family: 'Inter'; src: url(fonts/Inter-normal.woff2) format('woff2'); font-weight: 100 900; font-display: block; }
@font-face { font-family: 'Anton'; src: url(fonts/Anton-normal.woff2) format('woff2'); font-display: block; }
@font-face { font-family: 'Cormorant'; src: url(fonts/Cormorant-normal.woff2) format('woff2'); font-weight: 300 700; font-display: block; }
@font-face { font-family: 'Cormorant'; src: url(fonts/Cormorant-italic.woff2) format('woff2'); font-weight: 300 700; font-style: italic; font-display: block; }

:root {
  --navy: #0A1424; --navy2: #13233B; --ice: #9CC7F0; --red: #E5322D; --green: #1FA463;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; background: #000; overflow: hidden; }
body { font-family: 'Inter', system-ui, sans-serif; color: #fff; -webkit-font-smoothing: antialiased; user-select: none; }
body.playing { cursor: none; }
#stage { position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; transform-origin: 0 0; overflow: hidden; background: var(--navy); }
.num { font-variant-numeric: tabular-nums; }

/* runs and fixed scenes: only the active one is visible */
.run, .scene { position: absolute; inset: 0; overflow: hidden; visibility: hidden; z-index: 0; }
.run.on, .scene.on { visibility: visible; }

/* ---------- HUD: race clock (keep scenes clear of x > 1340, y < 170) ---------- */
#hud { position: absolute; top: 48px; right: 56px; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; opacity: 0; transition: opacity .4s; pointer-events: none; }
#hud.on { opacity: 1; }
.hud-main { display: flex; height: 72px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.hud-bib { background: var(--red); color: #fff; font-weight: 800; font-size: 26px; display: flex; align-items: center; padding: 0 20px; }
.hud-name { background: #fff; color: var(--navy); font-weight: 700; font-size: 24px; display: flex; align-items: center; padding: 0 22px; letter-spacing: -.01em; }
.hud-time { background: var(--navy2); color: #fff; font-weight: 700; font-size: 40px; display: flex; align-items: center; justify-content: flex-end; width: 210px; padding: 0 22px; transition: background .3s; }
.hud-rank { background: #fff; color: var(--navy); font-weight: 800; font-size: 34px; width: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; transition: width .5s cubic-bezier(.16,1,.3,1); }
#hud.finish .hud-time { background: var(--green); }
#hud.finish .hud-rank { width: 72px; }
.hud-split { height: 44px; background: rgba(10,20,36,.92); color: var(--ice); font-weight: 600; font-size: 22px; display: flex; align-items: center; gap: 18px; padding: 0 18px; opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .35s cubic-bezier(.16,1,.3,1); }
.hud-split b { color: #fff; font-weight: 700; }
.hud-split.on { opacity: 1; transform: none; }

/* ---------- menu ---------- */
#menu { background: var(--navy); }
.menu-mtn { position: absolute; inset: 0; width: 100%; height: 100%; }
.menu-mtn .m1 { fill: #13233B; }
.menu-mtn .m2 { fill: #182B47; }
#menu .brand { position: absolute; left: 140px; top: 130px; }
#menu .brand .v { font-weight: 800; font-size: 220px; letter-spacing: -.06em; line-height: .85; }
#menu .brand .t { font-size: 36px; color: var(--ice); font-weight: 500; margin-top: 22px; letter-spacing: -.01em; }
#menu .cards { position: absolute; left: 140px; right: 140px; bottom: 140px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; }
#menu .card { background: rgba(10,20,36,.86); border-top: 2px solid rgba(255,255,255,.14); padding: 40px 40px 44px; cursor: pointer; transition: transform .4s cubic-bezier(.16,1,.3,1), background .3s; }
#menu .card:hover { transform: translateY(-6px); background: #13233B; }
#menu .card .k { font-weight: 800; font-size: 76px; color: var(--red); line-height: 1; }
#menu .card .n { font-weight: 700; font-size: 40px; margin-top: 22px; letter-spacing: -.02em; }
#menu .card .d { font-size: 26px; color: var(--ice); margin-top: 10px; }

/* ---------- start gate ---------- */
#gate { background: var(--navy); }
.gate-label { position: absolute; left: 140px; top: 290px; }
.gate-label .c { font-size: 34px; color: var(--ice); font-weight: 600; }
.gate-label .h { font-size: 128px; font-weight: 800; letter-spacing: -.05em; line-height: 1; margin-top: 18px; }
.lamps { position: absolute; left: 140px; top: 650px; display: flex; gap: 44px; }
.lamp { width: 96px; height: 96px; border-radius: 50%; background: #1B2A41; border: 3px solid #2A3D5B; transition: background .08s; }
.lamp.r { background: var(--red); border-color: #FF6B66; }
.lamp.g { background: #22C55E; border-color: #7CF0A6; }
.hint { position: absolute; left: 140px; bottom: 90px; font-size: 22px; color: rgba(255,255,255,.3); }

#help { position: absolute; left: 40px; bottom: 40px; z-index: 60; background: rgba(0,0,0,.85); color: #fff; font-size: 24px; line-height: 1.6; padding: 24px 30px; border-radius: 14px; display: none; }
#help.on { display: block; }
#help b { color: var(--ice); }
.still #hud, .still .hud-split, .still .hud-rank, .still .hud-time { transition: none !important; }
