/* COLNE ENGAINE GP - MDT gold on near-black, with racing red */
:root{ --ink:#f4f1e8; --dim:rgba(244,241,232,.7); --faint:rgba(244,241,232,.42); --gold:#f0cd7e; --gold2:#d9a441; --red:#e8443a; --green:#5fd27a;
  --panel:rgba(10,11,9,.8); --line:rgba(240,205,126,.24);
  --disp:'Barlow Condensed', 'Inter', system-ui, sans-serif; --ui:'Inter', system-ui, sans-serif; }
*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body{ margin:0; height:100%; overflow:hidden; background:#0b0d0a; color:var(--ink); font-family:var(--ui); -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; touch-action:manipulation; overscroll-behavior:none; }
/* touch-action:none only on the game itself: iOS applies an ancestor's value to every scroller inside it */
#game, #game canvas, #hud, #touch{ touch-action:none; }
.card{ touch-action:pan-y; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; }
*::selection{ background:transparent; }
input, select{ -webkit-user-select:text; user-select:text; }
.hidden{ display:none !important; }
#game, #game canvas{ position:fixed; inset:0; width:100%; height:100%; display:block; }
#buildTag{ position:fixed; right:6px; bottom:4px; font:10px monospace; color:rgba(255,255,255,.25); z-index:9999; pointer-events:none; }
button{ font:inherit; color:inherit; }
.screen{ position:fixed; inset:0; z-index:20; display:flex; }
.muted{ color:var(--faint); }

/* ---------- buttons ---------- */
.btn{ border:1px solid rgba(255,255,255,.16); background:rgba(255,255,255,.07); border-radius:12px; padding:12px 18px; font-weight:800; cursor:pointer; font-size:15px; letter-spacing:.02em; }
.btn:hover{ background:rgba(255,255,255,.12); }
.btn.gold{ background:linear-gradient(180deg, #f6dc98, #d9a441); color:#1b1408; border-color:#f6dc98; }
.btn.gold:hover{ filter:brightness(1.06); }
.btn.ghost{ background:transparent; }
.btn.big{ font-family:var(--disp); font-style:italic; font-size:28px; letter-spacing:.06em; padding:10px 18px; }
.btn:disabled{ opacity:.5; cursor:default; }
.link{ background:none; border:0; color:var(--gold); font-weight:700; cursor:pointer; padding:6px 0; font-size:14px; }
.ibtn{ width:42px; height:42px; border-radius:12px; border:1px solid rgba(255,255,255,.14); background:rgba(10,11,9,.55); display:grid; place-items:center; cursor:pointer; pointer-events:auto; color:var(--ink); }
.ibtn svg{ width:22px; height:22px; fill:currentColor; }

/* ---------- menu (v1.6): a panel with a header, a scrolling page and a tab bar ---------- */
#menu{ pointer-events:none; justify-content:flex-end; background:linear-gradient(90deg, rgba(6,7,5,0) 30%, rgba(6,7,5,.55) 62%); }
.mPanel{ pointer-events:auto; width:min(460px, 100%); height:100%; display:flex; flex-direction:column; background:rgba(9,10,8,.84); border-left:1px solid var(--line); }
.mHead{ flex:none; display:flex; align-items:center; justify-content:space-between; gap:10px; padding:max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px 16px; }
.mdt-back{ color:var(--ink); text-decoration:none; font-weight:700; font-size:14px; padding:8px 12px; border-radius:999px; background:rgba(0,0,0,.35); border:1px solid rgba(255,255,255,.14); }
.acct{ display:inline-flex; align-items:center; gap:10px; padding:8px 14px; border-radius:999px; background:rgba(0,0,0,.35); border:1px solid rgba(255,255,255,.16); cursor:pointer; font-weight:700; font-size:14px; }
.acct .mxc{ display:inline-flex; align-items:center; gap:4px; color:var(--gold); }
/* the page itself scrolls (and only it), so nothing is ever out of reach */
.mScroll{ flex:1; min-height:0; overflow-y:auto; overflow-x:hidden; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; touch-action:pan-y; padding:4px max(16px, env(safe-area-inset-right)) 24px 16px; }
.mPage{ display:flex; flex-direction:column; gap:12px; animation:pageIn .25s ease-out; }
@keyframes pageIn{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }
.mTabs{ flex:none; display:grid; grid-template-columns:repeat(5, 1fr); border-top:1px solid var(--line); background:rgba(6,7,5,.92); padding:4px 4px max(6px, env(safe-area-inset-bottom)); }
.mTabs button{ border:0; background:none; display:flex; flex-direction:column; align-items:center; gap:2px; padding:7px 2px 5px; font-size:11px; font-weight:800; letter-spacing:.04em; color:var(--faint); cursor:pointer; border-radius:12px; }
.mTabs svg{ width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.mTabs button.on{ color:var(--gold); background:rgba(240,205,126,.1); }
.logo{ display:flex; flex-direction:column; line-height:.82; font-family:var(--disp); font-style:italic; font-weight:900; letter-spacing:.02em; margin-top:6px; }
.logo .l1{ font-size:clamp(36px, 5.4vw, 56px); color:var(--ink); text-shadow:0 4px 30px rgba(0,0,0,.6); }
.logo .l2{ font-size:clamp(58px, 8.4vw, 92px); color:var(--gold); text-shadow:0 0 34px rgba(240,205,126,.35); }
.logo .l2::after{ content:''; display:block; width:120px; height:7px; margin-top:6px; background:repeating-linear-gradient(90deg, var(--ink) 0 12px, #111 12px 24px); transform:skewX(-18deg); }
.tag{ margin:0; color:var(--dim); font-size:14.5px; line-height:1.45; }
.tag b{ color:var(--gold); }
.chips{ display:flex; gap:6px; flex-wrap:wrap; }
.chips span{ font-size:12px; font-weight:700; padding:5px 10px; border-radius:999px; background:var(--panel); border:1px solid var(--line); color:var(--dim); }
.chips b{ color:var(--gold); }
.mCard{ display:grid; gap:10px; padding:12px; border-radius:14px; background:var(--panel); border:1px solid var(--line); }
.mCardHead{ display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; }
.mCardHead b{ font-size:12px; letter-spacing:.14em; text-transform:uppercase; color:var(--gold); }
.mCardHead small{ color:var(--faint); font-size:12px; }
.mCard .row{ display:flex; align-items:center; gap:12px; }
.mCard .row > span{ width:58px; font-size:12px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; color:var(--faint); }
.pTitle{ margin:6px 0 0; font-family:var(--disp); font-style:italic; font-weight:900; font-size:36px; line-height:1; }
.pSub{ margin:-4px 0 0; font-size:13.5px; line-height:1.45; }
.mLink{ display:grid; grid-template-columns:1fr auto; align-items:center; text-align:left; gap:2px 10px; padding:12px 14px; border-radius:14px; background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.1); cursor:pointer; }
.mLink b{ font-size:15px; } .mLink small{ grid-column:1; color:var(--faint); font-size:12.5px; } .mLink i{ grid-row:1 / 3; grid-column:2; font-style:normal; font-size:26px; color:var(--gold); }
.seg{ display:flex; flex:1; border-radius:10px; overflow:hidden; border:1px solid rgba(255,255,255,.14); }
.seg button{ flex:1; border:0; background:transparent; padding:10px 6px; font-weight:800; cursor:pointer; font-size:14px; }
.seg button + button{ border-left:1px solid rgba(255,255,255,.12); }
.seg button.on{ background:var(--gold); color:#1b1408; }
.swatches{ display:flex; gap:8px; flex-wrap:wrap; }
.swatches button{ width:30px; height:30px; border-radius:50%; border:2px solid rgba(255,255,255,.25); cursor:pointer; padding:0; }
.swatches.big button{ width:42px; height:42px; }
.swatches button.on{ border-color:var(--gold); box-shadow:0 0 0 2px #000, 0 0 0 4px var(--gold); }
.rewardLine{ font-size:12.5px; color:var(--faint); text-align:center; min-height:16px; }
.rewardLine b{ color:var(--gold); }
.boardSeg{ margin-bottom:10px; }
.board{ padding:10px 12px; border-radius:14px; background:var(--panel); border:1px solid var(--line); font-size:14px; }
.board ol{ margin:0; padding-left:24px; display:grid; gap:6px; }
.board li span{ float:right; font-variant-numeric:tabular-nums; color:var(--gold); font-weight:700; }
.board li.me{ color:var(--gold); }
.board li.muted{ list-style:none; margin-left:-24px; }
.bestCard{ grid-template-columns:1fr auto; align-items:center; }
.bestCard small{ color:var(--faint); font-size:12px; letter-spacing:.12em; text-transform:uppercase; font-weight:800; }
.bestCard b{ font-family:var(--disp); font-style:italic; font-weight:900; font-size:34px; color:var(--gold); font-variant-numeric:tabular-nums; }
.howto{ margin:0; font-size:13.5px; color:var(--dim); line-height:1.55; }
.btn.sm{ padding:8px 12px; font-size:13px; justify-self:start; }
.credit{ font-size:10.5px; color:rgba(244,241,232,.3); line-height:1.4; }
.steps{ margin:0; padding:0; list-style:none; counter-reset:st; display:grid; gap:8px; }
.steps li{ counter-increment:st; display:grid; grid-template-columns:30px 1fr; gap:0 10px; align-items:center; }
.steps li::before{ content:counter(st); grid-row:1 / 3; width:28px; height:28px; border-radius:50%; display:grid; place-items:center; background:rgba(240,205,126,.16); color:var(--gold); font-weight:900; }
.steps b{ font-size:14px; } .steps span{ color:var(--faint); font-size:12.5px; }
.divider{ display:flex; align-items:center; gap:10px; color:var(--faint); font-size:12px; } .divider::before, .divider::after{ content:''; flex:1; height:1px; background:rgba(255,255,255,.12); }
/* phones: the panel is a sheet up from the bottom, the village flyover above it */
@media (max-aspect-ratio: 11/10){
  #menu{ background:linear-gradient(180deg, rgba(6,7,5,0) 10%, rgba(6,7,5,.6) 34%); }
  .mPanel{ width:100%; border-left:0; background:linear-gradient(180deg, rgba(9,10,8,0) 0, rgba(9,10,8,.72) 22vh, rgba(9,10,8,.94) 42vh); }
}

/* ---------- first-run welcome ---------- */
#onboard{ z-index:30; align-items:center; justify-content:center; padding:16px; background:radial-gradient(ellipse at 50% 30%, rgba(30,28,18,.6), rgba(4,5,3,.9)); }
.obBox{ position:relative; width:min(440px, 100%); max-height:100%; display:flex; flex-direction:column; gap:14px; padding:18px 0 16px; border-radius:22px; background:#121410; border:1px solid var(--line); box-shadow:0 30px 80px rgba(0,0,0,.6); overflow:hidden; }
.obSkip{ position:absolute; right:12px; top:10px; z-index:2; border:0; background:none; color:var(--faint); font-weight:800; font-size:14px; padding:8px; cursor:pointer; }
.obTrack{ display:flex; overflow-x:auto; overflow-y:hidden; scroll-snap-type:x mandatory; scrollbar-width:none; touch-action:pan-x; -webkit-overflow-scrolling:touch; min-height:0; }
.obTrack::-webkit-scrollbar{ display:none; }
.obCard{ flex:0 0 100%; scroll-snap-align:center; display:flex; flex-direction:column; align-items:center; text-align:center; gap:8px; padding:18px 26px 4px; overflow-y:auto; max-height:min(60vh, 460px); touch-action:pan-x pan-y; }
.obCard small{ font-size:11.5px; letter-spacing:.2em; font-weight:800; color:var(--gold); }
.obCard h2{ margin:0; font-family:var(--disp); font-style:italic; font-weight:900; font-size:clamp(30px, 8vw, 42px); line-height:1; }
.obCard p{ margin:0; color:var(--dim); font-size:14.5px; line-height:1.5; }
.obCard p.muted{ color:var(--faint); font-size:13px; }
.obCard kbd{ display:inline-block; padding:1px 7px; border-radius:6px; background:rgba(255,255,255,.12); font:800 12px var(--ui); }
.obArt{ width:96px; height:96px; border-radius:28px; display:grid; place-items:center; background:radial-gradient(circle at 35% 30%, rgba(240,205,126,.32), rgba(240,205,126,.06)); border:1px solid var(--line); margin-bottom:4px; }
.obArt svg{ width:52px; height:52px; fill:none; stroke:var(--gold); stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.obDots{ display:flex; justify-content:center; gap:7px; }
.obDots i{ width:8px; height:8px; border-radius:4px; background:rgba(255,255,255,.2); transition:width .25s, background .25s; }
.obDots i.on{ width:22px; background:var(--gold); }
.obBtns{ display:flex; gap:8px; padding:0 18px; }
.obBtns .btn{ flex:1; }
.obBtns .btn.ghost.hide{ visibility:hidden; }

/* ---------- HUD ---------- */
#hud{ position:fixed; inset:0; z-index:10; pointer-events:none; display:none; }
body[data-phase="race"] #hud, body[data-phase="countdown"] #hud, body[data-phase="done"] #hud{ display:block; }
.hudTop{ position:absolute; left:0; right:0; top:0; display:flex; align-items:flex-start; gap:12px; padding:max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
.pos{ font-family:var(--disp); font-style:italic; font-weight:900; line-height:.8; text-shadow:0 2px 12px rgba(0,0,0,.6); }
.pos b{ font-size:64px; color:var(--gold); }
.pos small{ font-size:26px; color:var(--ink); }
.mid{ flex:1; min-width:0; display:flex; flex-direction:column; align-items:center; gap:4px; }
.lap{ white-space:nowrap; font-family:var(--disp); font-style:italic; font-weight:800; font-size:26px; padding:2px 14px; border-radius:10px; background:var(--panel); }
.lap span{ color:var(--faint); font-size:18px; }
.road{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; font-size:12px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; color:#1b1408; background:var(--gold); padding:3px 10px; border-radius:6px; transition:opacity .4s; }
.times{ display:grid; gap:2px; padding:6px 10px; border-radius:12px; background:var(--panel); font-variant-numeric:tabular-nums; min-width:128px; }
.times div{ display:flex; justify-content:space-between; gap:10px; font-size:13px; }
.times span{ color:var(--faint); font-weight:700; font-size:11px; letter-spacing:.1em; align-self:center; }
.times b{ font-weight:800; }
#pauseBtn{ pointer-events:auto; }
#minimap{ position:absolute; left:max(12px, env(safe-area-inset-left)); top:96px; width:150px; height:110px; border-radius:12px; background:rgba(10,11,9,.55); }
#standings{ position:absolute; left:max(12px, env(safe-area-inset-left)); top:214px; display:grid; gap:2px; font-size:12px; font-weight:700; }
#standings div{ display:flex; gap:6px; align-items:center; padding:2px 8px 2px 4px; border-radius:6px; background:rgba(10,11,9,.5); min-width:120px; }
#standings div i{ width:8px; height:8px; border-radius:2px; }
#standings div b{ width:14px; text-align:right; color:var(--faint); }
#standings div.me{ background:rgba(240,205,126,.25); color:var(--gold); }
#standings div small{ margin-left:auto; color:var(--faint); font-variant-numeric:tabular-nums; }
.speedo{ position:absolute; right:max(16px, env(safe-area-inset-right)); bottom:max(18px, env(safe-area-inset-bottom)); display:flex; align-items:baseline; gap:6px; font-family:var(--disp); font-style:italic; font-weight:900; text-shadow:0 2px 14px rgba(0,0,0,.7); }
.speedo b{ font-size:70px; line-height:.8; font-variant-numeric:tabular-nums; min-width:2.2ch; text-align:right; }
.speedo span{ font-size:20px; color:var(--gold); }
.speedo i{ position:absolute; right:0; top:-28px; font-size:20px; font-style:italic; color:var(--faint); }
.speedo i::before{ content:'GEAR '; font-size:13px; }
#banner{ position:absolute; left:50%; top:30%; transform:translate(-50%, -50%); font-family:var(--disp); font-style:italic; font-weight:900; font-size:clamp(34px, 7vw, 64px); text-align:center; text-shadow:0 4px 24px rgba(0,0,0,.7); opacity:0; transition:opacity .3s; white-space:nowrap; }
#banner.show{ opacity:1; }
#banner small{ display:block; font-size:.4em; color:var(--gold); letter-spacing:.08em; }
#lights{ position:absolute; left:50%; top:24%; transform:translateX(-50%); display:flex; gap:10px; padding:10px 14px; border-radius:14px; background:#111; border:2px solid #333; box-shadow:0 10px 40px rgba(0,0,0,.6); }
#lights i{ width:34px; height:34px; border-radius:50%; background:#2a0e0c; box-shadow:inset 0 0 8px #000; }
#lights i.on{ background:radial-gradient(circle at 40% 35%, #ff9a8a, #e8241a 60%); box-shadow:0 0 18px #ff3b2a; }
#lights.go i{ background:radial-gradient(circle at 40% 35%, #b8ffb8, #24c24a 60%); box-shadow:0 0 18px #3bff6a; }
#wrongWay{ position:absolute; left:50%; top:42%; transform:translateX(-50%); font-family:var(--disp); font-style:italic; font-weight:900; font-size:40px; color:#fff; background:var(--red); padding:4px 18px; border-radius:10px; animation:blink .6s steps(2) infinite; }
@keyframes blink{ 50%{ opacity:.35; } }
.tools{ position:absolute; right:max(12px, env(safe-area-inset-right)); top:150px; display:grid; gap:8px; pointer-events:auto; }

/* touch controls */
#touch{ display:none; }
body.touch #touch{ display:block; }
.tbtn{ position:absolute; pointer-events:auto; border:2px solid rgba(255,255,255,.22); background:rgba(10,11,9,.45); border-radius:20px; display:grid; place-items:center; font-weight:900; letter-spacing:.08em; touch-action:none; }
.tbtn.on{ background:rgba(240,205,126,.35); border-color:var(--gold); }
.tbtn svg{ width:38px; height:38px; fill:none; stroke:currentColor; stroke-width:3; stroke-linecap:round; stroke-linejoin:round; }
.steer{ bottom:max(20px, env(safe-area-inset-bottom)); width:84px; height:84px; }
#tLeft{ left:max(14px, env(safe-area-inset-left)); }
#tRight{ left:calc(max(14px, env(safe-area-inset-left)) + 96px); }
.gas{ right:max(14px, env(safe-area-inset-right)); bottom:max(100px, calc(env(safe-area-inset-bottom) + 86px)); width:96px; height:120px; color:var(--green); }
.brake{ right:calc(max(14px, env(safe-area-inset-right)) + 108px); bottom:max(100px, calc(env(safe-area-inset-bottom) + 86px)); width:84px; height:84px; color:#ff8a80; font-size:13px; }
body.touch .speedo{ bottom:max(14px, env(safe-area-inset-bottom)); right:max(14px, env(safe-area-inset-right)); }
body.touch .speedo b{ font-size:48px; }
@media (max-width:640px){
  .pos b{ font-size:46px; } .pos small{ font-size:20px; }
  .lap{ font-size:18px; padding:2px 10px; } .lap span{ font-size:14px; } .road{ font-size:10px; padding:2px 6px; } .hudTop{ gap:8px; } .times{ min-width:0; padding:5px 8px; } .times div{ font-size:11.5px; gap:6px; }
  #minimap{ top:76px; width:120px; height:88px; }
  #standings{ top:170px; font-size:11px; }
  #standings div{ min-width:96px; }
  .tools{ top:120px; }
}
@media (max-height:480px){
  #standings{ display:none; }
  #minimap{ top:70px; }
}

/* ---------- results / pause / sign in cards ---------- */
#results, #pause, #signin{ background:rgba(4,5,3,.62); align-items:center; justify-content:center; padding:16px; }
.card{ width:min(460px, 100%); max-height:100%; overflow-y:auto; background:#121410; border:1px solid var(--line); border-radius:18px; padding:20px; display:flex; flex-direction:column; gap:12px; box-shadow:0 20px 60px rgba(0,0,0,.6); }
.card h2{ margin:0; font-family:var(--disp); font-style:italic; font-weight:900; font-size:40px; line-height:1; }
.kick{ font-size:12px; font-weight:800; letter-spacing:.16em; color:var(--gold); }
.btns{ display:flex; gap:8px; flex-wrap:wrap; }
.btns .btn{ flex:1; }
.resTable{ width:100%; border-collapse:collapse; font-size:14px; font-variant-numeric:tabular-nums; }
.resTable td{ padding:6px 4px; border-bottom:1px solid rgba(255,255,255,.07); }
.resTable td:first-child{ font-family:var(--disp); font-style:italic; font-weight:900; font-size:20px; width:30px; color:var(--faint); }
.resTable td:last-child{ text-align:right; }
.resTable td small{ color:var(--faint); }
.resTable tr.me td{ color:var(--gold); }
.resTable i{ display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:6px; }
.resMxc{ display:flex; align-items:center; justify-content:center; gap:6px; font-weight:800; color:var(--gold); min-height:20px; text-align:center; }
.set{ display:grid; gap:10px; }
.set label{ display:flex; justify-content:space-between; align-items:center; gap:12px; font-weight:700; font-size:14px; }
.set input[type=range]{ width:55%; accent-color:var(--gold); }
.set select{ background:#1d201a; color:var(--ink); border:1px solid rgba(255,255,255,.18); border-radius:8px; padding:6px; }
#signForm{ display:grid; gap:8px; }
#signForm input{ padding:12px; border-radius:10px; border:1px solid rgba(255,255,255,.16); background:#1a1d17; color:var(--ink); font-size:16px; }
.err{ color:#ff8a80; font-size:13px; min-height:16px; }

/* ---------- loading ---------- */
#loading{ position:fixed; inset:0; z-index:50; display:grid; place-items:center; background:#0b0d0a; transition:opacity .6s; }
#loading.gone{ opacity:0; pointer-events:none; }
.ld{ display:grid; gap:12px; justify-items:center; }
.ld b{ font-family:var(--disp); font-style:italic; font-weight:900; font-size:34px; color:var(--gold); letter-spacing:.04em; }
.ld .bar{ width:220px; height:5px; border-radius:3px; background:rgba(255,255,255,.1); overflow:hidden; }
.ld .bar i{ display:block; height:100%; width:0; background:var(--gold); transition:width .3s; }
.ld span{ font-size:13px; color:var(--faint); }

/* ---------- v1.5: online races ---------- */
.online{ display:grid; gap:10px; padding:14px; border-radius:14px; background:var(--panel); border:1px solid var(--line); }
.online > b{ color:var(--dim); font-size:11px; letter-spacing:.14em; text-transform:uppercase; }
.online > b small{ letter-spacing:0; text-transform:none; font-weight:600; color:var(--faint); margin-left:4px; }
.online .btns{ display:flex; gap:8px; } .online .btns .btn{ flex:1; padding:10px 12px; }
.join{ display:flex; gap:8px; }
.join input{ flex:1; min-width:0; padding:10px 12px; border-radius:12px; border:1px solid rgba(255,255,255,.16); background:rgba(0,0,0,.35); color:var(--ink); font:800 15px var(--ui); letter-spacing:.2em; text-transform:uppercase; }
.online .err{ color:var(--red); font-size:12.5px; min-height:0; }
.online .err:empty{ display:none; }
#netSheet{ z-index:26; background:rgba(4,5,3,.62); align-items:center; justify-content:center; padding:16px; }
#netCard > *{ flex-shrink:0; }
#netCard p{ margin:0; line-height:1.45; }
#netCard .btns{ display:flex; gap:8px; flex-wrap:wrap; } #netCard .btns .btn{ flex:1; }
.code{ font-family:var(--disp); font-style:italic; font-weight:900; font-size:48px; letter-spacing:.3em; text-align:center; color:var(--gold); }
.riders{ display:flex; flex-wrap:wrap; gap:6px; }
.riders span{ display:inline-flex; align-items:center; gap:6px; font-weight:800; font-size:13px; padding:6px 11px; border-radius:999px; background:rgba(255,255,255,.07); }
.riders span i{ width:10px; height:10px; border-radius:3px; }
.riders span.me{ background:rgba(240,205,126,.18); color:var(--gold); }
.riders small{ color:var(--faint); font-weight:600; }
.seg button:disabled{ cursor:default; opacity:.85; }
.spinner{ width:30px; height:30px; margin:4px auto; border-radius:50%; border:3px solid rgba(255,255,255,.12); border-top-color:var(--gold); animation:spinr .9s linear infinite; }
@keyframes spinr{ to{ transform:rotate(360deg); } }
/* v1.6 layout fixes: one column that never outgrows the card; Start race always in reach */
.online{ grid-template-columns:minmax(0, 1fr); }
.join input{ width:100%; }
.mCard .row > span{ width:auto; min-width:58px; flex:none; }
#startBtn{ position:sticky; bottom:10px; z-index:2; box-shadow:0 8px 30px rgba(0,0,0,.55); }
@media (max-height:520px){
  .logo .l1{ font-size:32px; } .logo .l2{ font-size:50px; } .logo .l2::after{ height:5px; width:90px; }
  .tag{ font-size:13px; } .mPage{ gap:9px; } .seg button{ padding:8px 6px; } .mTabs button{ padding:5px 2px 3px; } .mTabs svg{ width:21px; height:21px; }
}

/* ---------- v1.7: items, boosts, the mirror, the garage ---------- */
.itemBtn{ position:absolute; left:calc(max(12px, env(safe-area-inset-left)) + 150px); top:10px; pointer-events:auto; display:flex; flex-direction:column; align-items:center; gap:3px; background:none; border:0; padding:0; cursor:pointer; touch-action:none; }
.itemBtn .ring{ position:relative; width:62px; height:62px; border-radius:18px; display:grid; place-items:center; background:rgba(10,11,9,.62); border:2px solid rgba(240,205,126,.35); box-shadow:0 6px 20px rgba(0,0,0,.4); }
.itemBtn svg{ width:36px; height:36px; fill:none; stroke:var(--gold); stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.itemBtn.ready .ring{ border-color:var(--gold); background:radial-gradient(circle at 40% 30%, rgba(240,205,126,.35), rgba(10,11,9,.75)); animation:itemPulse 1.1s ease-in-out infinite; }
.itemBtn.rolling .ring{ animation:itemShake .12s linear infinite; }
.itemBtn.empty .ring{ opacity:.55; }
.itemBtn b{ position:absolute; right:-6px; bottom:-6px; font:900 13px var(--ui); background:var(--gold); color:#1b1408; border-radius:8px; padding:1px 5px; }
.itemBtn b:empty{ display:none; }
.itemBtn small{ font-size:11px; font-weight:800; letter-spacing:.06em; color:var(--ink); text-shadow:0 1px 6px #000; white-space:nowrap; }
.itemBtn kbd{ position:absolute; left:-8px; top:-6px; font:800 10px var(--ui); background:rgba(255,255,255,.85); color:#111; border-radius:5px; padding:1px 5px; }
.itemBtn.empty kbd{ display:none; }
body.touch .itemBtn kbd{ display:none; }
@keyframes itemPulse{ 50%{ box-shadow:0 0 0 4px rgba(240,205,126,.25), 0 6px 20px rgba(0,0,0,.4); } }
@keyframes itemShake{ 50%{ transform:rotate(-4deg) scale(1.04); } }
/* on a phone the item button sits over the steering arrows, under the left thumb */
body.touch .itemBtn{ left:max(14px, env(safe-area-inset-left)); top:auto; bottom:max(116px, calc(env(safe-area-inset-bottom) + 112px)); transform:none; }
body.touch .itemBtn .ring{ width:74px; height:74px; border-radius:22px; }
body.touch .itemBtn small{ max-width:120px; overflow:hidden; text-overflow:ellipsis; }
#toast{ position:absolute; left:50%; top:calc(30% + 56px); transform:translate(-50%, 6px); font:900 italic 22px var(--disp); letter-spacing:.06em; color:#1b1408; background:var(--gold); padding:4px 14px; border-radius:10px; opacity:0; transition:opacity .25s, transform .25s; white-space:nowrap; }
#toast.show{ opacity:1; transform:translate(-50%, 0); }
#speedLines{ position:fixed; inset:0; z-index:5; pointer-events:none; opacity:0; transition:opacity .25s;
  background:repeating-conic-gradient(from 0deg at 50% 52%, rgba(255,255,255,.0) 0deg 4deg, rgba(255,255,255,.22) 4.3deg 4.7deg, rgba(255,255,255,0) 5deg 9deg);
  -webkit-mask:radial-gradient(ellipse at 50% 52%, transparent 34%, #000 72%); mask:radial-gradient(ellipse at 50% 52%, transparent 34%, #000 72%); animation:lines .35s linear infinite; }
#speedLines.rush{ background:repeating-conic-gradient(from 0deg at 50% 52%, rgba(255,214,106,0) 0deg 3deg, rgba(255,214,106,.35) 3.3deg 3.9deg, rgba(255,214,106,0) 4.2deg 7deg); }
@keyframes lines{ to{ transform:rotate(9deg); } }
body:not([data-phase="race"]):not([data-phase="done"]):not([data-phase="countdown"]) #speedLines, body:not([data-phase="race"]):not([data-phase="done"]):not([data-phase="countdown"]) #mud{ display:none; }
#mud{ position:fixed; inset:0; z-index:6; pointer-events:none; opacity:0; transition:opacity .4s; }
#mud i{ position:absolute; border-radius:46% 54% 40% 60% / 52% 44% 56% 48%; background:radial-gradient(circle at 40% 35%, #8a6534, #4b3418 60%, #2e1f0d); box-shadow:0 0 0 6px rgba(75,52,24,.55), 0 0 40px rgba(46,31,13,.6); }
/* the rear-view mirror, top right; the camera and reset buttons sit under it */
#mirror{ position:absolute; right:max(12px, env(safe-area-inset-right)); top:92px; width:230px; height:74px; border-radius:14px; border:3px solid #1d1e20; box-shadow:0 0 0 1px rgba(255,255,255,.18), 0 8px 24px rgba(0,0,0,.45), inset 0 0 18px rgba(255,255,255,.12); pointer-events:none; }
#lookTag{ position:absolute; left:50%; top:100px; white-space:nowrap; transform:translateX(-50%); font:900 italic 20px var(--disp); letter-spacing:.14em; background:rgba(10,11,9,.7); border:1px solid var(--line); color:var(--gold); padding:3px 14px; border-radius:10px; }
.tools{ top:178px; }
#lookBtn.on{ background:rgba(240,205,126,.35); border-color:var(--gold); }
@media (max-width:640px){
  #mirror{ top:70px; width:132px; height:46px; border-width:2px; border-radius:10px; }
  .tools{ top:124px; }
  #lookTag{ top:120px; font-size:16px; }
  body:not(.touch) .itemBtn{ left:auto; right:max(12px, env(safe-area-inset-right)); top:170px; }
}
@media (max-height:480px){
  #mirror{ top:82px; width:160px; height:46px; border-width:2px; border-radius:10px; }
  .tools{ top:84px; right:calc(max(12px, env(safe-area-inset-right)) + 168px); grid-auto-flow:column; }
  #lookTag{ top:84px; left:38%; font-size:15px; }
  body.touch .itemBtn{ bottom:max(110px, calc(env(safe-area-inset-bottom) + 106px)); }
  body.touch .itemBtn .ring{ width:62px; height:62px; }
  body.touch .itemBtn small{ display:none; }
}
/* garage */
.garTop{ grid-template-columns:1fr auto; align-items:center; }
.garBal{ display:grid; gap:2px; }
.garBal span{ display:inline-flex; align-items:center; gap:6px; font-weight:800; color:var(--gold); font-size:16px; }
.garBal small{ color:var(--faint); font-size:12px; }
.garTabs{ display:flex; gap:6px; overflow-x:auto; scrollbar-width:none; touch-action:pan-x pan-y; padding-bottom:2px; }
.garTabs::-webkit-scrollbar{ display:none; }
.garTabs button{ flex:none; border:1px solid rgba(255,255,255,.14); background:rgba(255,255,255,.05); border-radius:999px; padding:8px 14px; font-weight:800; font-size:13px; cursor:pointer; color:var(--dim); }
.garTabs button.on{ background:var(--gold); color:#1b1408; border-color:var(--gold); }
.garGrid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(98px, 1fr)); gap:8px; }
.gTile{ position:relative; display:flex; flex-direction:column; align-items:center; gap:5px; padding:12px 6px 9px; border-radius:14px; background:var(--panel); border:1px solid rgba(255,255,255,.1); cursor:pointer; text-align:center; }
.gTile b{ font-size:12.5px; line-height:1.15; }
.gTile em{ font-style:normal; font-size:11.5px; font-weight:800; color:var(--faint); display:inline-flex; align-items:center; gap:3px; }
.gTile em.on{ color:#1b1408; background:var(--gold); border-radius:6px; padding:1px 7px; }
.gTile em.price{ color:var(--gold); }
.gTile.on{ border-color:var(--gold); box-shadow:inset 0 0 0 1px var(--gold); }
.gTile.locked .gSw, .gTile.locked .gIco{ opacity:.82; }
.gSw{ width:44px; height:44px; border-radius:50%; background:var(--c); border:2px solid rgba(255,255,255,.22); display:block; }
.gSw.metal{ background:radial-gradient(circle at 32% 28%, #fff8 0, transparent 30%), linear-gradient(140deg, var(--c), #000a 120%), var(--c); }
.gSw.pearl{ background:radial-gradient(circle at 30% 25%, #fff 0, transparent 35%), conic-gradient(from 40deg, var(--c), #ffd9f2, var(--c), #d9f4ff, var(--c)); }
.gSw.matte{ border-color:rgba(255,255,255,.1); }
.gSw.chrome{ background:linear-gradient(160deg, #fff, #8b9097 45%, #f4f6f8 55%, #5d6168); }
.gSw.gold{ background:linear-gradient(160deg, #fff4c8, #c88a1e 45%, #ffe08a 55%, #8a5a10); }
.gSw.rim{ background:radial-gradient(circle, #222 0 22%, var(--c) 23% 52%, #151515 53%); }
.gSw.glow{ background:radial-gradient(circle, var(--c) 0, transparent 70%); border-color:transparent; }
.gSw.none{ background:repeating-linear-gradient(45deg, #333 0 4px, #222 4px 8px); }
.gSw.rainbow{ background:conic-gradient(#ff5050, #ffcf4a, #5dff6a, #3aa8ff, #b65cff, #ff5050); }
.gIco{ width:44px; height:44px; fill:var(--gold); }
#buySheet{ z-index:28; background:rgba(4,5,3,.66); align-items:center; justify-content:center; padding:16px; }
#buyCard{ align-items:center; text-align:center; max-width:360px; }
#buyCard .btns{ width:100%; }
.buyArt{ width:96px; height:96px; border-radius:26px; display:grid; place-items:center; background:radial-gradient(circle at 35% 30%, rgba(240,205,126,.25), rgba(240,205,126,.04)); border:1px solid var(--line); }
.buyArt .gSw, .buyArt .gIco{ width:60px; height:60px; }
.buyPrice{ display:inline-flex; align-items:center; gap:6px; font-weight:800; color:var(--gold); font-size:15px; }
.buyPrice b{ font:900 italic 34px var(--disp); }
.itemList{ display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:6px 10px; }
.itemList div{ display:grid; grid-template-columns:26px 1fr; gap:0 8px; align-items:center; }
.itemList svg{ grid-row:1 / 3; width:24px; height:24px; fill:none; stroke:var(--gold); stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.itemList b{ font-size:12.5px; } .itemList small{ font-size:11px; color:var(--faint); line-height:1.25; }
.howto b{ color:var(--gold); }
/* the garage on a phone: the page starts lower, so your car shows above it */
@media (max-aspect-ratio: 11/10){ #menu.gar .mPage[data-p="garage"]{ padding-top:26vh; } }
