:root {
  --bg: #0f1020;
  --bg2: #1a1b35;
  --ink: #fff;
  --muted: #b9bbe0;
  --track: #2b2c4a;
  --accent: #ffc933;
  --asphalt: #34354f;
  --idc: #2279bc;
  --idc2: #316cf8;
  --font: 'Fredoka', 'Baloo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --brand: 'Space Grotesk', 'Fredoka', system-ui, sans-serif;
}
.brand { font-family: var(--brand); letter-spacing: -0.01em; }
/* dial overall boldness down a notch (Fredoka/Space Grotesk both load 600) */
h1, h2, h3 { font-weight: 600; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, #2a2c55 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, #0a0a15 100%);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.5px; }
button { font-family: inherit; cursor: pointer; border: none; }

.center { text-align: center; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Exec head badge ---------- */
.head {
  --size: 64px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3, transparent 60%), var(--c);
  border: 3px solid #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,.3), 0 6px 14px rgba(0,0,0,.4);
  display: grid; place-items: center;
  overflow: hidden;
  position: relative;
}
.head img { width: 100%; height: 100%; object-fit: cover; }
.head .initials {
  font-weight: 600;
  font-size: calc(var(--size) * 0.4);
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,.45);
}

/* ---------- Go-kart ---------- */
.kart { position: relative; width: 140px; }
.kart-bob {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  animation: bob 0.55s ease-in-out infinite;
  transform-origin: 70% bottom;   /* pivot near rear axle for a wheelie feel */
}
.kart.revving .kart-bob { animation: revbob 0.18s ease-in-out infinite; will-change: transform; }
@keyframes bob   { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-3px) rotate(1deg); } }
@keyframes revbob{ 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(2deg); } }

/* head as the driver — big, seated into the cockpit, with a poppy white ring */
.kart .head {
  --size: 64px;
  margin-bottom: calc(var(--size) * -0.34);
  z-index: 2;
  border: 4px solid #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,.15), 0 6px 10px rgba(0,0,0,.45), inset 0 -6px 10px rgba(0,0,0,.18);
}
.kart .head img { transform: scale(1.06) translateY(-1px); }
.kart-body { width: 100%; height: auto; filter: drop-shadow(0 6px 6px rgba(0,0,0,.4)); }
.kart-plate {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: #fff; color: #111; font-size: 10px; font-weight: 600;
  padding: 1px 5px; border-radius: 3px; letter-spacing: 0.5px;
  border: 1px solid #0003; white-space: nowrap; z-index: 3;
}

/* wheels: lazy idle turn, fast blur on rev */
.kart .spokes { transform-box: fill-box; transform-origin: center; animation: spin 2.4s linear infinite; }
.kart.revving .spokes { animation: spin 0.12s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* exhaust puffs */
.kart-exhaust {
  position: absolute; left: -4px; bottom: 18px; width: 16px; height: 16px;
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #ffffff66 70%, transparent);
  opacity: 0; pointer-events: none; z-index: 0;
}
.kart.revving .kart-exhaust { animation: puff 0.45s ease-out infinite; }
@keyframes puff {
  0% { opacity: .75; transform: translate(0,0) scale(.4); }
  60% { opacity: .5; }
  100% { opacity: 0; transform: translate(-30px,-14px) scale(1.8); }
}

/* speed lines */
.speedlines { position: absolute; left: -10px; top: 40%; width: 40px; height: 30px; opacity: 0; pointer-events: none; z-index: 0; }
.kart.revving .speedlines { opacity: 1; }
.speedlines i { position: absolute; left: 0; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--c)); }
.speedlines i:nth-child(1) { top: 2px;  width: 22px; animation: streak .3s linear infinite 0s; }
.speedlines i:nth-child(2) { top: 12px; width: 30px; animation: streak .3s linear infinite .1s; }
.speedlines i:nth-child(3) { top: 22px; width: 18px; animation: streak .3s linear infinite .05s; }
@keyframes streak { 0% { transform: translateX(10px); opacity: 0; } 40% { opacity: .9; } 100% { transform: translateX(-26px); opacity: 0; } }

/* leader treatment: gold glow + crown + sparkle */
.kart.leader .head {
  border-color: #ffe27a;
  box-shadow: 0 0 0 2px #b8860b, 0 0 18px 4px rgba(255,210,63,.65), 0 6px 10px rgba(0,0,0,.45);
}
.kart.leader .kart-body { filter: drop-shadow(0 0 10px rgba(255,210,63,.7)); }
.kart.leader .kart-bob::before {
  content: "👑"; position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  font-size: 24px; z-index: 4; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5));
  animation: crownfloat 1.2s ease-in-out infinite;
}
@keyframes crownfloat { 0%,100% { transform: translateX(-50%) translateY(0) rotate(-4deg); } 50% { transform: translateX(-50%) translateY(-3px) rotate(4deg); } }
.kart.leader .head::after {
  content: "✨"; position: absolute; top: -4px; right: -4px; font-size: 14px; z-index: 4;
  animation: sparkle 1.4s ease-in-out infinite;
}
@keyframes sparkle { 0%,100% { opacity: 0; transform: scale(.5) rotate(0deg); } 50% { opacity: 1; transform: scale(1.1) rotate(20deg); } }

/* ---------- Buttons ---------- */
.btn {
  background: var(--accent); color: #1a1400; font-weight: 600; font-size: 18px;
  padding: 14px 22px; border-radius: 14px;
  box-shadow: 0 5px 0 #b88c00; transition: transform .05s, box-shadow .05s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b88c00; }
.btn.secondary { background: #2c2e57; color: #fff; box-shadow: 0 5px 0 #15162c; }
.btn.danger { background: #ff5765; color: #fff; box-shadow: 0 5px 0 #a31726; }
.btn:disabled { opacity: .5; filter: grayscale(.4); cursor: not-allowed; }

.status-pill {
  display: inline-block; padding: 7px 16px; border-radius: 999px; font-weight: 600;
  font-size: 15px; background: #2c2e57;
}
.status-pill.live { background: #0a9d5a; }
.status-pill.done { background: #ff5765; }

/* ======================================================================
   PLAYER PAGE — tap ANY exec to rev them ("spread the wealth")
   ====================================================================== */
#player { display: flex; flex-direction: column; height: 100dvh; padding: 10px 12px env(safe-area-inset-bottom); }
.player-head { text-align: center; padding: 6px 4px 8px; flex: 0 0 auto; }
.player-head .ph-title { font-size: clamp(20px, 6vw, 28px); font-weight: 600; }
.player-head .ph-title .vroom { color: var(--accent); }
.player-head .status-pill { margin-top: 6px; }

.tap-grid {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  grid-auto-rows: 1fr; padding: 4px 0;
}
.tap-card {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--bg2), #14152b);
  border: 2px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-radius: 18px; padding: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: #fff; transition: transform .06s; touch-action: manipulation; user-select: none;
}
.tap-card::before { /* color wash that flares on tap */
  content: ""; position: absolute; inset: 0; background: var(--c); opacity: 0; transition: opacity .25s;
}
.tap-card.bump { animation: cardbump .14s ease-out; }
.tap-card.bump::before { opacity: .28; transition: none; }
@keyframes cardbump { 0% { transform: scale(1); } 45% { transform: scale(.95); } 100% { transform: scale(1); } }
.tap-card .head { --size: clamp(56px, 16vw, 92px); position: relative; z-index: 1; }
.tap-card .tc-name { font-weight: 600; font-size: clamp(14px, 4vw, 18px); position: relative; z-index: 1; }
.tap-card .tc-you { font-size: 12px; color: var(--accent); font-weight: 600; min-height: 16px; position: relative; z-index: 1; }
#player.locked .tap-card { opacity: .5; filter: grayscale(.5); }

.player-foot { flex: 0 0 auto; text-align: center; padding: 8px 4px; font-size: 15px; }
.player-foot b { color: var(--accent); font-size: 20px; }

/* ======================================================================
   BIG SCREEN — locked to the viewport, lanes divide the height
   ====================================================================== */
.bs.wrap {
  width: 100%; max-width: none; height: 100dvh;
  padding: clamp(8px, 1.2vh, 16px) clamp(16px, 2vw, 32px);
  display: flex; flex-direction: column; gap: clamp(6px, 1vh, 14px);
}
.bs-top { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: clamp(12px, 2vw, 28px); }
.brand { display: flex; align-items: center; gap: clamp(10px, 1.4vw, 20px); min-width: 0; }
.idc-logo { height: clamp(30px, 4.4vh, 52px); width: auto; display: block; }
.bs-title { font-size: clamp(22px, 3.2vh, 40px); white-space: nowrap; }
.bs-title .vroom { color: var(--accent); }
#subtitle { font-size: clamp(12px, 1.6vh, 16px); }

.timer { font-size: clamp(44px, 8vh, 76px); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; text-shadow: 0 4px 0 #0006; }
.timer.warn { color: #ff5765; animation: tick 1s steps(1) infinite; }
@keyframes tick { 50% { opacity: .55; } }

.join-box { display: flex; align-items: center; gap: 12px; }
.join-box .qr { background: #fff; padding: 8px; border-radius: 12px; width: clamp(96px, 12vh, 132px); height: clamp(96px, 12vh, 132px); display: grid; place-items: center; }
.join-box .qr img, .join-box .qr canvas { width: 100%; height: 100%; }
.join-box .txt { text-align: left; }
.join-box .url { font-size: clamp(16px, 2.2vh, 24px); font-weight: 600; color: var(--accent); }
.join-box .label { font-size: clamp(11px, 1.5vh, 14px); color: var(--muted); }
.join-box .goal { font-size: clamp(12px, 1.6vh, 16px); margin-top: 4px; }
.join-box .goal b { color: #fff; }

/* Track fills all remaining height; lanes split it evenly (robust to 6–8 racers) */
.track {
  flex: 1 1 auto; min-height: 0; margin: 0;
  display: flex; flex-direction: column;
  border-radius: 18px; overflow: hidden; position: relative;
  background: repeating-linear-gradient(180deg, var(--asphalt) 0 2px, transparent 2px 4px), var(--track);
  border: 3px solid #ffffff14;
}
.track::after { /* soft finish-zone shading */
  content: ""; position: absolute; top: 0; bottom: 0; right: 0;
  width: clamp(70px, 7vw, 130px); background: linear-gradient(90deg, transparent, #ffffff10);
  pointer-events: none; z-index: 0;
}
.lane {
  flex: 1 1 0; min-height: 0; position: relative;
  display: flex; align-items: center;
  border-bottom: 2px dashed #ffffff18;
  padding-left: clamp(120px, 12vw, 200px);
  box-shadow: inset 4px 0 0 var(--lane, transparent);
}
.lane:nth-child(even of .lane) { background: #ffffff06; }
.lane:last-child { border-bottom: none; }
.lane.leader { background: linear-gradient(90deg, #ffd23f1f, transparent 55%); }
.lane-label {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 10px; width: clamp(110px, 11vw, 190px); z-index: 2;
}
.lane-label .head { --size: clamp(34px, 4.6vh, 54px); }
.lane-label .nm { font-size: clamp(14px, 1.9vh, 22px); font-weight: 600; line-height: 1.1; }
.lane-label .ct { font-size: clamp(13px, 1.7vh, 20px); color: var(--accent); font-weight: 600; }
.lane-runner { position: absolute; left: clamp(120px, 12vw, 200px); top: 50%; transform: translate(0, -50%); will-change: transform; z-index: 1; }
.lane-runner .kart { width: clamp(92px, 12vh, 150px); }
.lane-runner .kart .head { --size: clamp(40px, 5.6vh, 64px); }
.lane-runner .kart-plate { display: none; }

/* Finish line */
.finish {
  position: absolute; top: 0; bottom: 0; right: clamp(28px, 3vw, 56px); width: clamp(16px, 1.4vw, 26px);
  background: repeating-conic-gradient(#fff 0 25%, #111 0 50%) 0 0 / 12px 12px;
  opacity: .95; z-index: 1; box-shadow: 0 0 24px #fff4, inset 0 0 0 2px #fff6;
}
.finish-flag { position: absolute; right: clamp(20px, 2.6vw, 48px); top: -2px; font-size: clamp(26px, 3.4vh, 46px); z-index: 2; }

/* Leaderboard + ticker */
.bs-bottom { flex: 0 0 auto; display: flex; gap: 16px; align-items: stretch; max-height: clamp(86px, 15vh, 150px); }
.leaderboard { flex: 1; background: #14152b88; border-radius: 14px; padding: 8px 14px; overflow: hidden; }
.leaderboard h3 { font-size: clamp(12px, 1.6vh, 16px); color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 1px; }
.lb-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 24px; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 2px 0; font-size: clamp(15px, 2vh, 21px); }
.lb-row .pos { width: 24px; font-weight: 600; color: var(--accent); }
.lb-row .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.lb-row .nm { flex: 1; font-weight: 600; }
.lb-row .ct { font-weight: 600; font-variant-numeric: tabular-nums; }

.ticker { background: #000; border-radius: 12px; padding: 10px 16px; overflow: hidden; display: flex; align-items: center; flex: 0 0 clamp(260px, 26vw, 420px); }
.ticker .live-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff5765; margin-right: 10px; animation: tick 1s steps(1) infinite; flex: 0 0 auto; }
.ticker .msg { font-size: clamp(16px, 2.4vh, 26px); font-weight: 600; }

/* Idle / winner overlays */
.overlay { position: fixed; inset: 0; background: rgba(8,8,18,.86); backdrop-filter: blur(4px); display: grid; place-items: center; text-align: center; z-index: 50; }
.overlay h2 { font-size: clamp(40px, 8vw, 96px); }
.overlay .head { --size: clamp(120px, 22vh, 180px); margin: 16px auto; animation: bob .5s ease-in-out infinite; }
.overlay .trophy { font-size: clamp(56px, 9vh, 80px); }
.overlay .sub { color: var(--muted); font-size: clamp(16px, 2.4vh, 24px); margin-top: 8px; }

/* ======================================================================
   ADMIN
   ====================================================================== */
.admin { max-width: 520px; margin: 40px auto; padding: 24px; background: var(--bg2); border-radius: 18px; }
.admin h1 { margin-bottom: 16px; }
.admin label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
.admin input {
  width: 100%; padding: 12px; border-radius: 10px; border: 2px solid #ffffff22;
  background: #0e0f1f; color: #fff; font-size: 16px; font-family: inherit;
}
.admin .two { display: flex; gap: 12px; }
.admin .two > div { flex: 1; }
.admin .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.admin .row .btn { flex: 1; min-width: 120px; }
.admin .state { margin-top: 18px; padding: 12px; border-radius: 10px; background: #0e0f1f; font-size: 14px; }
.admin .state b { color: var(--accent); }

@media (max-width: 760px) {
  .bs-top { flex-wrap: wrap; }
  .bs-bottom { flex-direction: column; max-height: none; }
  .ticker { flex-basis: auto; }
  .lb-grid { grid-template-columns: 1fr; }
}

/* ======================================================================
   EXEC DASH (single-player game)
   ====================================================================== */
.game-body { overflow: hidden; }
#stage { position: fixed; inset: 0; overflow: hidden; }
#game { width: 100%; height: 100%; display: block; touch-action: none; }
.icon-btn { position: absolute; z-index: 40; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right));
  width: 50px; height: 50px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #1b2138, #0a0b16); border: 1.5px solid #ffffff2e; color: #e7ebf6;
  display: grid; place-items: center; opacity: .92; box-shadow: 0 3px 12px #00000055, inset 0 1px 0 #ffffff14; transition: opacity .15s, transform .3s, color .15s, box-shadow .15s; }
.icon-btn svg { width: 28px; height: 28px; }
.icon-btn:hover { opacity: 1; color: #fff; transform: rotate(45deg); box-shadow: 0 4px 16px #00000066, inset 0 1px 0 #ffffff20; } .icon-btn:active { transform: scale(.92); }

/* corner "Home/Back" link inside an overlay */
.corner-link { position: absolute; z-index: 5; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left));
  background: #ffffff14; border: 1px solid #ffffff24; color: #e7e8ff; font-size: 13px; font-weight: 600; padding: 7px 13px; border-radius: 999px; }
.corner-link:hover { background: #ffffff22; }

/* ---- Modals: settings + credits ---- */
.modal { position: absolute; inset: 0; z-index: 45; display: grid; place-items: center; padding: 18px;
  background: rgba(6,6,18,.72); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.modal-card { width: min(420px, 92vw); background: linear-gradient(180deg, var(--bg2), #14152b); border: 1px solid #ffffff1f;
  border-radius: 18px; padding: 22px 22px 18px; box-shadow: 0 20px 50px #0009; }
.modal-title { font-size: 22px; margin-bottom: 14px; text-align: center; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 2px; font-size: 15px; color: #e7e8ff; }
.set-row + .set-row { border-top: 1px solid #ffffff12; }
.set-row input[type=range] { flex: 1; max-width: 200px; accent-color: var(--accent); }
.pill-toggle { background: #2c2e57; color: #fff; border-radius: 999px; padding: 6px 16px; font-weight: 600; font-size: 13px; min-width: 56px; }
.pill-toggle.on { background: var(--idc); }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.credits-list { display: flex; flex-direction: column; gap: 9px; margin: 4px 0 14px; }
.cr-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; font-size: 14px; }
.cr-role { color: var(--muted); } .cr-row b { color: #fff; }
.credits-foot { text-align: center; font-size: 11.5px; color: var(--muted); margin-bottom: 16px; }
#credits .btn, #settings .modal-actions .btn { margin: 0 auto; display: block; }
#credits #creditsBack { margin: 0 auto; }

/* HUD */
#hud { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 10px 14px; pointer-events: none; }
.hud-card { background: #0c0d1cc7; border: 1px solid #ffffff1f; border-radius: 12px; padding: 6px 14px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.hud-card .h-label { font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.hud-card b { color: var(--accent); font-size: 22px; font-variant-numeric: tabular-nums; }
.hud-card.mid { font-weight: 600; }
.hud-card.mid #hTime, .hud-card.mid #hReports { font-variant-numeric: tabular-nums; }
.hud-card.combo { font-weight: 600; color: #fff; background: linear-gradient(90deg, #ff6a00, #ffb43f); border-color: #ffd27a; }
.hud-card.combo.gain { animation: comboGain .35s ease-out; }
@keyframes comboGain { 0% { transform: scale(1.4); filter: brightness(1.7); } 100% { transform: scale(1); } }
.hud-card:first-child { background: #0c0d1cdd; border-color: #ffc93340; }
#hScore { font-size: 30px; text-shadow: 0 0 12px #ffc93366; }
/* absolutely CENTERED in the HUD so nothing on the left (score/timer/combo growth) ever shifts it → the Q labels stay put */
.hud-prog { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: clamp(260px, 36vw, 460px); height: 14px; background: linear-gradient(180deg, #0a0b15, #14151f); border: 1px solid #ffffff2b; border-radius: 999px; box-shadow: inset 0 1px 2px #00000066, 0 2px 8px #00000040; }
.hud-prog > div { position: relative; height: 100%; width: 0; background: linear-gradient(90deg, var(--champ, #ffd23f), #ffe98a); border-radius: 999px; box-shadow: 0 0 9px var(--champ, #ffd23f); transition: width .12s linear; }
.hud-prog > div::after { content: ''; position: absolute; right: -2px; top: 50%; transform: translateY(-50%); width: 9px; height: 9px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px 2px var(--champ, #ffd23f); }   /* glowing position pin at the leading edge */
.hud-prog > .goal-tag { position: absolute; right: 0; top: -20px; font-size: 12.5px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.hud-prog > .goal-tag::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 5px; vertical-align: -1px; border-radius: 2px; background-image: conic-gradient(#ececf2 25%, #181820 0 50%, #ececf2 0 75%, #181820 0); background-size: 5px 5px; box-shadow: 0 0 0 1px #ffffff33; }   /* tiny checkered finish flag */

/* Overlays (menu / end / rotate) */
.overlay-game {
  position: absolute; inset: 0; z-index: 10; overflow-y: auto;
  background: radial-gradient(900px 500px at 50% -10%, #2a2c55cc, transparent 60%), rgba(8,8,18,.93);
  backdrop-filter: blur(3px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 18px; gap: 10px;
}
.overlay-game .idc-logo { height: 34px; width: auto; }

/* ---- Splash / landing — full-bleed hero illustration with UI laid out around the art ---- */
.splash { position: absolute; inset: 0; z-index: 20; overflow: hidden; background: #0a0a15; }
.splash-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 46%; }
.splash-scrim { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(7,7,22,.74) 0%, rgba(7,7,22,.14) 26%, rgba(7,7,22,0) 50%, rgba(7,7,22,.5) 80%, rgba(7,7,22,.93) 100%); }
.splash-content { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; align-items: center; text-align: center;
  padding: clamp(12px,3vh,30px) 16px calc(clamp(14px,3.2vh,30px) + env(safe-area-inset-bottom)); }
.splash-top { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.splash-top .idc-logo { height: clamp(26px,3.6vh,40px); width: auto; }
.splash-title { font-size: clamp(28px,6.4vw,58px); margin: 2px 0 0; color: #fff; line-height: 1; text-shadow: 0 2px 16px #000b, 0 0 34px #3a74ff66; }
.splash-title .vroom { color: var(--accent); }
.splash-tag { font-size: clamp(12px,2.6vw,17px); color: #e9ecff; margin: 0; text-shadow: 0 1px 8px #000c; }
.splash-bottom { display: flex; flex-direction: column; align-items: center; gap: 11px; }
.splash-foot { font-size: clamp(10px,2.2vw,13px); color: #c7cde8; text-shadow: 0 1px 6px #000; }
.splash-foot b { color: #fff; font-weight: 600; }
/* cycling exec badge — frosted so it reads over the art (sits just under the title text) */
.splash-exec { display: flex; align-items: center; gap: 14px; padding: 9px 24px 9px 10px; margin-top: 8px; border-radius: 999px;
  background: rgba(10,12,28,.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border: 1px solid #ffffff2e;
  opacity: 0; transform: translateY(5px); transition: opacity .3s ease, transform .3s ease; min-height: 68px; }
.splash-exec.show { opacity: 1; transform: none; }
.splash-exec .head { --size: 52px; border-width: 2px; }
.se-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.12; text-align: left; }
.se-lead { font-size: 12.5px; color: #b9c0e0; text-transform: uppercase; letter-spacing: .9px; }
.se-meta b { font-size: 20px; color: #fff; }
.se-title { font-size: 13px; color: #c0c6e4; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overlay-game h1 { font-size: clamp(26px, 6vw, 44px); }
.overlay-game h1 .vroom { color: var(--accent); }
.howto { font-size: clamp(12px, 2.6vw, 15px); color: #e7e8ff; background: #ffffff10; padding: 8px 14px; border-radius: 999px; }
.pick-label { margin-top: 6px; font-weight: 600; color: var(--muted); }
/* width tuned so exactly 4 cards fit per row → 4 on top, 3 centered below (7 execs) */
.pick-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 512px; }
.pick-exec {
  background: linear-gradient(180deg, var(--bg2), #14152b); border: 2px solid color-mix(in srgb, var(--c) 55%, transparent);
  border-radius: 16px; padding: 10px 8px 8px; width: 120px; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 5px; transition: transform .06s;
}
.pick-exec:active { transform: scale(.95); }
.pick-exec .head { --size: 62px; }
.pick-exec .pe-name { font-weight: 600; font-size: 15px; }
.pick-exec .pe-sl { font-size: 10.5px; color: var(--muted); font-style: italic; line-height: 1.15; min-height: 30px; }
.pick-exec.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 0 18px #ffc93366; transform: translateY(-2px); }

/* Menu steps + car/color selection */
.menu-step { margin-top: 8px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 8px; }
.menu-step .step-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--idc); color: #fff; font-size: 13px; }
.car-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.car-opt { background: #14152b; border: 2px solid #ffffff1f; border-radius: 14px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.car-opt canvas { width: 120px; height: 75px; }
.car-opt .co-name { font-size: 12px; font-weight: 600; color: var(--muted); }
.car-opt.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.car-opt.sel .co-name { color: #fff; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #ffffff33; cursor: pointer; }
.swatch.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.big-start { font-size: 20px; padding: 14px 30px; margin-top: 6px; }
.big-start:disabled { opacity: .55; }

/* Goal banner — make the Quanta objective clear from the start (also opens How-to-play) */
.goal-banner {
  font-size: clamp(13px, 2.8vw, 17px); font-weight: 600; color: #fff; font-family: inherit; line-height: 1.3;
  background: linear-gradient(90deg, var(--idc), var(--idc2)); border: 2px solid #ffffff33;
  padding: 9px 18px; border-radius: 999px; box-shadow: 0 4px 16px #316cf855; max-width: 92vw; cursor: pointer;
  margin-bottom: 14px;   /* clean gap before "Pick your driver" */
}
.goal-banner:hover { border-color: #ffffff66; }
.goal-banner b { color: #ffe27a; }
.gb-how { color: #ffe27a; font-weight: 700; white-space: nowrap; text-decoration: underline; text-underline-offset: 2px; }

/* How-to-play modal */
.howto-list { list-style: none; padding: 0; margin: 6px 0 16px; display: flex; flex-direction: column; gap: 11px; text-align: left; max-width: 440px; }
.howto-list li { font-size: 14px; line-height: 1.45; color: #cdd2e6; padding-left: 20px; position: relative; }
.howto-list li::before { content: '▸'; position: absolute; left: 2px; color: var(--accent); font-weight: 700; }
.howto-list b { color: #fff; }

/* Vehicle presets (revealed after driver pick) */
#carSection { display: flex; flex-direction: column; align-items: center; gap: 10px; animation: revealUp .28s ease-out; }
@keyframes revealUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.preset-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; justify-content: center; max-width: 560px; }
.preset { background: #14152b; border: 2px solid #ffffff1f; border-radius: 14px; padding: 6px 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform .06s; }
.preset:active { transform: scale(.95); }
.preset canvas { width: 110px; height: 68px; }
.preset .co-name { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.preset.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.preset.sel .co-name { color: #fff; }
.car-head { display: flex; align-items: center; gap: 12px; }
.car-head #chosenDriver { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.car-head #chosenDriver .head { --size: 34px; }
.link-btn { background: #2c2e57; color: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 13px; }
.link-btn:active { transform: scale(.96); }

/* HUD goal tag at the end of the progress bar */
.goal-tag { position: absolute; right: 0; top: -22px; font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.prog-tick { position: absolute; top: -2px; width: 3px; height: 16px; background: #ff5765; border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 4px #ff576599; }
.prog-div { position: absolute; top: 2px; bottom: 2px; width: 1.5px; background: rgba(255,255,255,.22); transform: translateX(-50%); border-radius: 2px; pointer-events: none; }
.prog-q { position: absolute; top: 17px; transform: translateX(-50%); font-size: 9px; font-weight: 600; letter-spacing: .6px; color: rgba(255,255,255,.55); pointer-events: none; }   /* BELOW the bar, centered in each quarter */

/* End card — compact 2-column so it fits landscape without scrolling */
#endcard { gap: 10px; }
#endcard:not(.hidden) { animation: revealUp .3s ease-out; }
.end-card { display: flex; gap: clamp(18px, 4vw, 44px); align-items: flex-start; justify-content: center; width: 100%; max-width: 760px; }
.end-left, .end-right { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; max-width: 360px; }
.end-left { align-items: center; gap: 5px; }
.end-right { gap: 7px; }
#endHead .head { --size: 70px; }
.end-score { font-size: 17px; margin-top: 2px; }
.end-score b { color: var(--accent); font-size: 40px; display: block; line-height: 1; text-shadow: 0 0 18px #ffc93355; }
.end-best { font-size: 13px; font-weight: 600; color: #ff9d3c; text-align: center; }
.end-best b { color: #ffb054; }
.end-break { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.stat { display: flex; flex-direction: column; align-items: center; background: #ffffff10; border: 1px solid #ffffff14; border-radius: 10px; padding: 5px 11px; min-width: 56px; }
.stat b { color: #fff; font-size: 16px; line-height: 1.05; }
.stat span { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.stat.bad b { color: #ff8d8d; }
.end-lbl { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; text-align: center; margin: 2px 0 0; }
.submit-row { display: flex; gap: 8px; }
.submit-row input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 2px solid #ffffff26; background: #0e0f1f; color: #fff; font: inherit; font-size: 16px; }
.end-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: center; margin-top: 2px; }
.end-actions .btn { font-size: 15px; padding: 11px 18px; }
.board { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 2px; }
.bd-row { display: flex; align-items: center; gap: 10px; background: #ffffff0d; border-radius: 8px; padding: 6px 12px; font-size: 15px; }
.bd-row:nth-child(1) { background: #ffd23f22; }
.bd-pos { width: 22px; font-weight: 600; color: var(--accent); }
.bd-name { flex: 1; font-weight: 600; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-exec { font-size: 12px; font-weight: 600; }
.bd-score { font-weight: 600; font-variant-numeric: tabular-nums; }
.rotate-inner { font-size: 24px; font-weight: 600; line-height: 1.6; }

/* ---------- Projector leaderboard ---------- */
.board-screen { width: 100%; height: 100dvh; padding: clamp(10px, 1.5vh, 22px) clamp(16px, 2.5vw, 40px); display: flex; flex-direction: column; gap: clamp(8px, 1.4vh, 18px); }
.bigboard { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: clamp(4px, 0.8vh, 10px); }
.bb-row { flex: 1 1 0; min-height: 0; display: flex; align-items: center; gap: clamp(10px, 1.5vw, 22px); background: #14152b99; border-radius: 14px; padding: 0 clamp(14px, 1.8vw, 28px); }
.bb-row.first { background: linear-gradient(90deg, #ffd23f2e, #14152b99 60%); box-shadow: inset 4px 0 0 var(--accent); }
.bb-pos { width: clamp(40px, 4vw, 64px); font-size: clamp(22px, 3.4vh, 44px); font-weight: 600; color: var(--accent); text-align: center; }
.bb-head .head { --size: clamp(38px, 6vh, 64px); }
.bb-name { flex: 1; font-size: clamp(18px, 3vh, 38px); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-exec { font-size: clamp(13px, 1.8vh, 22px); font-weight: 600; width: clamp(80px, 8vw, 140px); }
.bb-time { font-size: clamp(15px, 2.2vh, 28px); color: var(--muted); font-variant-numeric: tabular-nums; width: clamp(70px, 7vw, 120px); text-align: right; }
.bb-score { font-size: clamp(22px, 3.4vh, 46px); font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; width: clamp(90px, 9vw, 160px); text-align: right; }
.bb-empty { flex: 1; display: grid; place-items: center; font-size: clamp(24px, 5vh, 56px); font-weight: 600; color: var(--muted); animation: bobup 1.4s ease-in-out infinite; }
@keyframes bobup { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ======================================================================
   Review-pass polish (HUD, menu, end card, projector)
   ====================================================================== */
/* HUD: scrim so cards read over bright sky/neon; reserve the combo slot (no jump) */
#hud { background: linear-gradient(180deg, rgba(8,8,18,.55), transparent); padding-bottom: 14px; }
#hMult { visibility: hidden; min-width: 96px; justify-content: center; }
#hMult.show { visibility: visible; }

/* Menu: start button flows in-content (NOT sticky — sticky overlapped the car grid on mobile) */
.big-start { z-index: 3; margin-top: 4px; }
.preset, .car-opt { background: radial-gradient(62% 46% at 50% 76%, #ffffff16, transparent 70%), #14152b; }

/* honor notches/safe areas so the HUD isn't hidden under a camera cutout */
#hud { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }

/* Landscape-phone (short viewport): tighten so it doesn't overflow/scroll + shrink the HUD
   so it doesn't eat the small screen (the canvas itself now scales via the virtual viewport) */
@media (max-height: 480px) {
  .overlay-game { justify-content: flex-start; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); gap: 5px; }
  .overlay-game h1 { font-size: clamp(18px, 5vw, 26px); margin: 0; }
  .overlay-game .idc-logo { height: 24px; }
  .howto { display: none; }                                   /* save a row on short screens */
  .goal-banner { padding: 5px 12px; font-size: 12px; }
  .menu-step { font-size: 13px; }
  .car-head { margin: 0; }
  .pick-row { max-width: 460px; gap: 7px; }
  .pick-exec { width: 100px; padding: 6px 5px 5px; gap: 2px; }
  .pick-exec .head { --size: 46px; }
  .pick-exec .pe-name { font-size: 13px; }
  .pick-exec .pe-sl { display: none; }
  .preset-row { gap: 6px; max-width: 400px; }
  .preset { padding: 4px 4px 2px; }
  .preset canvas { width: 80px; height: 48px; }
  .co-name { font-size: 10.5px; }
  .goal-banner { font-size: 11px; }
  .car-head { font-size: 12px; }
  .big-start { font-size: 16px; padding: 9px 22px; margin-top: 2px; }
  /* compact HUD */
  #hud { padding: 6px 10px; gap: 6px; padding-bottom: 10px; }
  .hud-card { padding: 4px 10px; font-size: 12.5px; border-radius: 10px; }
  .hud-card b { font-size: 16px; }
  #hScore { font-size: 21px; }
  .hud-card .h-label { font-size: 9px; }
  #hMult { min-width: 66px; }
  .hud-prog { height: 9px; }
  .hud-prog > .goal-tag { font-size: 11px; top: -5px; }
  .splash-art { aspect-ratio: 16 / 5; }
  .splash-note { display: none; }
}

/* End card: score-tier reaction; highlight the player's own leaderboard row */
.end-tier { font-weight: 600; font-size: 20px; color: var(--accent); animation: comboGain .4s ease-out; }
.bd-row.you { box-shadow: inset 0 0 0 2px var(--accent); }
.bd-row.you .bd-name::after { content: ' (you)'; color: var(--accent); font-weight: 600; }

/* Projector: shimmer on the #1 row + flash a row that just changed, so it feels live */
.bb-row { position: relative; overflow: hidden; transition: background .4s; }
.bb-row.first::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, transparent 42%, #ffffff22 50%, transparent 58%); transform: translateX(-100%); animation: shimmer 3.6s linear infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.bb-row.justin { animation: rowflash 1.4s ease-out; }
@keyframes rowflash { 0% { background: #ffd23f55; } 100% { background: #14152b99; } }
