/* Grand Prix des Sons: the road on top (--road-h), the panel below. */
:root {
  --bg: #0f1222;
  --card: #1b2040;
  --card-2: #252b52;
  --text: #f6f4ff;
  --muted: #a8aed0;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #ff4d5e;
  --gold: #ffd23f;
  --good: #3ccf8e;
  --bad: #ff6b6b;
  --road-h: 38vh;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

#road { position: fixed; left: 0; top: 0; display: block; }
.panel { position: fixed; left: 0; right: 0; top: var(--road-h); bottom: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 14px max(18px, env(safe-area-inset-bottom)); border-top: 3px solid #000; background: var(--bg); }
.panel > * { max-width: 560px; margin-left: auto; margin-right: auto; }

.hl { color: var(--gold); font-weight: 900; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; }
u { text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.label { margin: 14px 0 8px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
h1 { margin: 4px 0 8px; font-size: 28px; font-style: italic; font-weight: 900; letter-spacing: -0.02em; }

.btn { display: block; width: 100%; padding: 15px 16px; margin: 10px 0 0; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); font-size: 17px; font-weight: 750; text-align: center; color: inherit; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.btn.big { padding: 18px 16px; font-size: 20px; font-style: italic; font-weight: 900; }
.mini { min-width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 13px; background: var(--card-2); font-size: 17px; vertical-align: middle; }
.garage-btn { display: block; margin: 14px auto 0; padding: 9px 16px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--muted); font-size: 15px; font-weight: 700; }

/* ---------- the HUD over the road ---------- */
.hud { position: fixed; left: 0; right: 0; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: max(8px, env(safe-area-inset-top)) 10px 0; pointer-events: none; }
.hud-place { font-size: 30px; font-weight: 950; font-style: italic; color: #fff; text-shadow: 0 3px 0 #b91c1c, 0 0 10px rgba(0, 0, 0, 0.6); }
.hud-pill { padding: 5px 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.55); font-size: 13px; font-weight: 800; }
.hud-pill.gold { color: var(--gold); }
.hud-count { position: fixed; left: 0; right: 0; top: calc(var(--road-h) * 0.25); text-align: center; font-size: 90px; font-weight: 950; font-style: italic; color: var(--gold); text-shadow: 0 5px 0 #b45309; animation: count 0.5s ease-out; }
.hud-wait { position: fixed; left: 50%; top: calc(max(8px, env(safe-area-inset-top)) + 48px); transform: translateX(-50%); padding: 5px 12px; border-radius: 99px; background: rgba(0, 0, 0, 0.65); font-size: 13px; font-weight: 700; white-space: nowrap; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.55; } }
@keyframes count { from { transform: scale(1.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- start, new rule, results ---------- */
.kicker { margin: 2px 0 0; color: var(--gold); font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.how { padding: 12px 14px; border-radius: 16px; background: rgba(255, 210, 63, 0.1); border: 1px dashed rgba(255, 210, 63, 0.45); font-size: 15px; line-height: 1.5; }
.intro .btn { position: sticky; bottom: 0; }
.new { margin: 0 0 6px; color: var(--gold); font-size: 14px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.sprint { margin-top: 20px; font-size: 20px; font-weight: 900; }
.results h1 { text-align: center; }
.trophy { margin: 0; font-size: 64px; line-height: 1.1; text-align: center; overflow: hidden; animation: count 0.6s ease-out; }
.recap { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.recap li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 19px; font-weight: 800; }
.recap .mini { min-width: 34px; height: 34px; font-size: 14px; }
.recap small { flex-basis: 100%; font-size: 13px; font-weight: 500; }

/* ---------- sound cards and rule cards ---------- */
.scard { margin: 10px 0; padding: 12px; border-radius: 16px; background: var(--card-2); border: 1px solid var(--line); }
.scard-top { display: flex; align-items: center; gap: 12px; }
.scard-emoji { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: rgba(255, 255, 255, 0.08); font-size: 30px; }
.scard-main { flex: 1; min-width: 0; }
.scard-main p { margin: 0; }
.scard-name { font-size: 24px; font-weight: 900; color: var(--gold); line-height: 1.1; }
.scard-like { font-size: 15px; line-height: 1.35; }
.hear-btn { flex: none; padding: 9px 12px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 800; }
.scard-tip { margin: 10px 0 0; font-size: 14px; line-height: 1.45; }
.scard-spell { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.scard-spell b { color: var(--text); }
.rcard h3 { margin: 0 0 6px; font-size: 20px; font-weight: 900; line-height: 1.2; }
.rcard-text { margin: 8px 0; font-size: 15px; line-height: 1.5; }
.words { margin: 0; padding: 0; list-style: none; }
.words li { display: flex; gap: 6px; margin-top: 6px; }
.word { flex: 1; min-width: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--card); text-align: left; }
.word:active { transform: scale(0.98); }
.word .fr { font-size: 19px; font-weight: 750; }
.word .en { color: var(--muted); font-size: 13px; text-align: right; }

/* ---------- the question ---------- */
.q-ask { margin: 2px 0 6px; font-size: 18px; font-weight: 850; }
.q-word { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin: 6px 0 2px; font-size: clamp(34px, 11vw, 46px); font-weight: 900; text-align: center; }
.q-en { margin: 0 0 8px; color: var(--muted); font-size: 14px; text-align: center; }
.q-listen { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 6px 0 10px; }
.play-big { width: 76px; height: 76px; border: 0; border-radius: 50%; background: var(--accent); font-size: 34px; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35); }
.play-big:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.opts { display: grid; gap: 8px; margin: 10px 0 8px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opts.three { grid-template-columns: 1fr 1fr 1fr; }
.opts.read.three { grid-template-columns: 1fr; }
.opt { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 62px; padding: 10px 8px;
  border: 2px solid var(--line); border-radius: 16px; background: var(--card-2); text-align: left; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }
.opts.read .opt { justify-content: flex-start; padding: 10px 12px; }
.opt:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.opt.lane-0 { border-color: #2563eb; box-shadow: 0 3px 0 #1e3a8a; }
.opt.lane-1 { border-color: #d97706; box-shadow: 0 3px 0 #92400e; }
.opt.lane-2 { border-color: #db2777; box-shadow: 0 3px 0 #9d174d; }
.opt-word { font-size: 22px; font-weight: 850; text-align: center; }
.opt-word.small { font-size: 16px; }
.chip-emoji { flex: none; font-size: 28px; }
.chip-text { display: flex; flex-direction: column; min-width: 0; }
.chip-text b { font-size: 20px; line-height: 1.1; }
.chip-text small { color: var(--muted); font-size: 13px; line-height: 1.3; }
.opt.right { background: var(--good); color: #062b1b; }
.opt.right small { color: #0b3b25; }
.opt.wrong { background: #3a1620; border-color: var(--bad); opacity: 0.7; }
.opt.dim { opacity: 0.45; }
.opt .x { position: absolute; top: 4px; right: 8px; color: var(--bad); font-weight: 900; }
.hint-btn { display: block; margin: 2px auto 4px; padding: 8px 14px; border: 1px dashed rgba(255, 210, 63, 0.5); border-radius: 99px; background: none; color: var(--gold); font-size: 14px; font-weight: 700; }
.fb { margin: 8px 0 4px; padding: 12px; border-radius: 16px; font-size: 15px; line-height: 1.45; }
.fb p { margin: 0 0 6px; }
.fb.good { background: rgba(60, 207, 142, 0.14); border: 1px solid rgba(60, 207, 142, 0.5); }
.fb.bad { background: rgba(255, 107, 107, 0.1); border: 1px solid rgba(255, 107, 107, 0.5); }
.fb.hint { background: rgba(255, 210, 63, 0.08); border: 1px solid rgba(255, 210, 63, 0.4); }
.fb-title { font-weight: 850; }
.fb-again { margin: 8px 0 0 !important; font-weight: 800; color: var(--gold); text-align: center; }

/* ---------- garage ---------- */
.garage-top { display: flex; justify-content: space-between; align-items: center; }
.coins { padding: 6px 11px; border-radius: 99px; background: var(--card); color: var(--gold); font-size: 15px; font-weight: 800; }
.garage-kart { display: grid; place-items: center; height: 130px; margin: 6px 0; border-radius: 20px; background: repeating-linear-gradient(90deg, #2a2d40 0 30px, #30344a 30px 60px); }
.garage-kart img { width: 130px; }
.pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pick { position: relative; display: grid; place-items: center; height: 62px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); font-size: 30px; }
.pick.on { border-color: var(--gold); background: rgba(255, 210, 63, 0.12); }
.pick[data-action="locked"] { opacity: 0.5; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); }
.lock { position: absolute; bottom: 2px; left: 0; right: 0; font-size: 11px; font-weight: 700; color: var(--muted); }

.pop { animation: pop 0.25s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(0.98); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
