/* DM Sans and Outfit are self-hosted to avoid third-party requests from player devices.
   Both families are licensed under SIL Open Font License 1.1; see fonts/licenses/. */
@font-face { font-family:'DM Sans'; font-style:normal; font-weight:400 700; font-display:swap; src:url('fonts/dm-sans-latin.woff2') format('woff2'); }
@font-face { font-family:'Outfit'; font-style:normal; font-weight:400 800; font-display:swap; src:url('fonts/outfit-latin.woff2') format('woff2'); }

:root { --ink:#193f37; --muted:#77837b; --paper:#faf9f4; --red:#ee503c; }
* { box-sizing:border-box; }
body { margin:0; background:var(--paper); color:var(--ink); font-family:'DM Sans',sans-serif; }
button, a { -webkit-tap-highlight-color:transparent; }
button { font:inherit; cursor:pointer; }
button:focus-visible, a:focus-visible { outline:3px solid #227b99; outline-offset:4px; }
header { height:76px; max-width:1440px; margin:auto; padding:0 5%; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid #e4e6dd; }
.brand { display:flex; align-items:center; color:var(--ink); font:800 24px Outfit,sans-serif; letter-spacing:-1px; text-decoration:none; }
.brand > span:last-child { font-weight:400; }
.brand-icon { display:grid; width:34px; height:34px; margin-right:10px; place-items:center; border-radius:9px; transform:rotate(-8deg); background:var(--red); color:var(--paper); font-size:31px; }
.header-right { display:flex; align-items:center; gap:28px; }
.tiny-label, .eyebrow { font-size:10px; font-weight:700; letter-spacing:1.5px; }
.icon-button { position:relative; width:39px; height:39px; border:1px solid #dddeda; border-radius:50%; background:none; color:var(--ink); font-size:23px; }
.sound-off { position:absolute; right:5px; bottom:3px; background:var(--paper); font-size:15px; }
main { max-width:1440px; margin:auto; padding:0 5%; }
.intro { display:flex; align-items:center; justify-content:space-between; padding:26px 0 24px; }
.eyebrow { display:flex; align-items:center; gap:7px; letter-spacing:1.8px; }
.eyebrow > span { width:6px; height:6px; border-radius:50%; background:var(--red); }
h1 { margin:10px 0 8px; font:600 clamp(34px,4vw,54px)/1 Outfit,sans-serif; letter-spacing:-2px; }
h1 em { color:var(--red); font-style:normal; }
.intro p { margin:0; color:var(--muted); font-size:14px; }
.world-label { display:flex; align-items:center; gap:14px; }
.world-icon { color:#94a47d; font-size:44px; }
.world-label div { display:flex; flex-direction:column; gap:5px; }
.world-label small { color:var(--muted); font-size:9px; letter-spacing:1.8px; }
.world-label strong { font:500 18px Outfit,sans-serif; }
.world-label div > span { color:var(--muted); font-size:11px; }
.game { position:relative; min-height:300px; height:clamp(300px,calc(100svh - 378px),520px); overflow:hidden; border-radius:17px; background:#c8e4de; isolation:isolate; }
canvas { display:block; width:100%; height:100%; }
.scene-top { position:absolute; top:22px; right:26px; left:26px; display:flex; align-items:center; justify-content:space-between; }
.location { display:flex; align-items:center; gap:8px; font-size:9px; font-weight:700; letter-spacing:1.5px; }
.live-dot { width:6px; height:6px; border-radius:50%; background:#407560; }
.location-number { margin-left:9px; opacity:.5; }
.score { display:flex; align-items:center; gap:9px; padding:10px 16px; border-radius:22px; background:#fff9e6; font-size:18px; }
.score > span { color:#e9a33c; }
.score small { font-size:9px; letter-spacing:1px; }
.progress-wrap { position:absolute; top:77px; right:27px; width:190px; padding:10px 12px; border-radius:10px; background:#faf9f4e8; }
.progress-label { display:flex; justify-content:space-between; margin-bottom:8px; font-size:8px; font-weight:700; letter-spacing:.9px; }
.progress, .racer-track { overflow:hidden; border-radius:9px; background:#dfe5d9; }
.progress { height:5px; }
.progress > div { width:0; height:100%; transition:width .6s; }
#progress-fill { background:var(--red); }
.team-scores { padding:7px 0; border-bottom:1px solid #b9c9b5; font-size:9px; }
.team-scores > div { display:flex; justify-content:space-between; gap:8px; margin:4px 0; }
.team-scores > div:first-child { color:#b72f29; }
.team-scores > div:last-child { color:#654392; }
#leaderboard { margin-top:10px; }
.racer-row { display:flex; flex-wrap:wrap; justify-content:space-between; gap:4px; margin-top:7px; font-size:9px; }
.racer-name { display:flex; align-items:center; gap:5px; }
.racer-name i { width:7px; height:7px; border-radius:50%; }
.racer-track { width:100%; height:3px; border-radius:4px; }
.racer-track > div { height:100%; transition:width .5s; }
#race-status { margin-top:11px; font-size:10px; font-weight:700; line-height:1.3; }
.start-copy { position:absolute; top:82px; left:42px; animation:enter .8s both; }
.small-pill { font-size:8px; font-weight:700; letter-spacing:1.2px; }
.start-copy h2 { margin:12px 0; font:600 clamp(38px,5.8vh,55px)/1.06 Outfit,sans-serif; letter-spacing:-1.8px; }
.start-copy h2 i { color:#386956; font-style:normal; }
.start-copy p { max-width:235px; color:#4f7868; font-size:13px; line-height:1.55; }
.scene-bottom { position:absolute; right:26px; bottom:19px; left:26px; display:flex; align-items:center; justify-content:space-between; color:#294e43; font-size:9px; letter-spacing:.3px; }
.scene-bottom > span:last-child { font-size:8px; letter-spacing:1.2px; }
.key { padding:2px 5px; border:1px solid #294e4366; border-radius:4px; background:#faf9f440; font-size:12px; }
.driving-hud { position:absolute; right:80px; bottom:51px; left:80px; display:flex; flex-direction:column; align-items:center; gap:4px; pointer-events:none; }
.driving-hud span { padding:5px 10px; border-radius:6px; background:#faf9f4ec; color:var(--ink); font-size:10px; text-align:center; }
#turn-hint { font-weight:700; }
.race-tools { position:absolute; top:75px; left:20px; display:flex; flex-direction:column; gap:8px; max-width:190px; }
.race-tools button { min-height:40px; padding:10px 12px; border:1px solid #196c61; border-radius:8px; background:#fff8dc; color:var(--ink); font-size:11px; font-weight:700; }
.race-tools button:disabled { opacity:.75; }
.race-tools #shortcut-enter { background:#196c61; color:white; }
.steering { position:absolute; right:20px; bottom:58px; left:20px; display:flex; justify-content:space-between; }
.steering button { width:46px; height:46px; border:1px solid #376d5555; border-radius:50%; background:#fffbe7e6; color:var(--ink); font-size:23px; }
.steering button:active { background:var(--red); color:white; }
.dashboard { display:flex; align-items:center; gap:36px; min-height:120px; padding:22px 0; border-bottom:1px solid #e1e4d9; }
.section-step { color:#8b978c; font-size:10px; font-weight:700; letter-spacing:1.2px; }
.section-step span { margin-left:9px; color:var(--ink); }
.table-buttons { display:flex; flex-wrap:wrap; gap:6px; margin-top:13px; }
.table-buttons button { min-width:35px; height:37px; padding:0 9px; border:1px solid #dfe3d9; border-radius:7px; background:none; color:var(--ink); font-size:12px; font-weight:600; transition:.2s; }
.table-buttons button.selected { border-color:var(--ink); background:var(--ink); color:white; }
.table-buttons button:hover { transform:translateY(-3px); }
.launch { display:flex; flex:1; align-items:center; justify-content:flex-end; gap:25px; }
.launch div { display:flex; flex-direction:column; gap:7px; }
.launch strong { font-size:12px; }
.launch div > span { max-width:220px; color:var(--muted); font-size:10px; line-height:1.4; }
.primary { min-width:166px; padding:17px 22px; border:0; border-radius:10px; background:var(--red); box-shadow:0 4px 0 #c73c2c; color:white; font-size:13px; font-weight:600; transition:transform .2s,background .2s; }
.primary span { margin-left:24px; font-size:18px; }
.primary:hover { background:#dc4231; transform:translateY(-2px); }
.primary:active { transform:translateY(2px); }
.quiz { display:flex; width:100%; align-items:center; gap:30px; }
.question { min-width:200px; }
.question strong { display:block; margin-top:6px; font:600 39px Outfit,sans-serif; }
.answer-area { flex:1; }
.answers { display:flex; gap:12px; }
.answers button { position:relative; flex:1; padding:10px; border:1px solid #dbe1d6; border-radius:9px; background:#fff; color:var(--ink); font:600 25px Outfit,sans-serif; transition:.2s; }
.answers button small { position:absolute; top:5px; left:7px; color:#9ba59c; font-size:9px; }
.answers button:hover:enabled { background:#edf1e5; transform:translateY(-3px); }
.answers button.correct { border-color:#528341; background:#deefd3; }
.answers button.wrong { border-color:var(--red); background:#ffdfd8; }
.answer-area p { min-height:16px; margin:9px 0 0; color:#697968; font-size:11px; }
.text-button { padding:10px; border:0; background:none; color:var(--muted); font-size:11px; }
.finish { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; background:#eff6e9ed; animation:enter .5s; }
.finish-star { color:#e5a539; font-size:67px; }
.finish h2 { margin:10px 0; font:600 52px Outfit,sans-serif; }
.finish p { margin:0 20px 23px; font-size:14px; text-align:center; }
footer { display:flex; justify-content:space-between; padding:16px 0; color:var(--muted); font-size:10px; }
footer b { margin-right:6px; color:var(--red); font-size:15px; }
footer > span:last-child { font-size:8px; letter-spacing:1.3px; }
[hidden] { display:none !important; }
@keyframes enter { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }

@media (min-width:1500px) { .game { height:520px; } }
@media (max-width:1100px) { .launch div { display:none; } .dashboard { gap:20px; } .table-buttons { gap:4px; } .table-buttons button { min-width:32px; } .question { min-width:165px; } }
@media (max-width:700px) {
  header { height:70px; padding:0 5%; } .brand { font-size:21px; } .tiny-label, .world-label { display:none; }
  .intro { padding:25px 0 22px; } .intro p { font-size:12px; } h1 { letter-spacing:-1.2px; } .eyebrow { font-size:8px; }
  .game { min-height:360px; height:410px; } .scene-top { right:20px; left:20px; } .location { font-size:6px; } .location-number { display:none; } .score { padding:8px 12px; }
  .progress-wrap { top:73px; right:15px; width:116px; padding:8px; } .progress-label { font-size:7px; } .team-scores { padding:4px 0; font-size:8px; } .team-scores > div { gap:3px; }
  #leaderboard { margin-top:6px; } .racer-row { gap:3px; margin-top:5px; font-size:8px; } #race-status { margin-top:7px; font-size:8px; }
  .start-copy { top:99px; left:20px; } .small-pill { max-width:155px; font-size:7px; line-height:1.6; } .start-copy h2 { font-size:32px; } .start-copy p { max-width:155px; font-size:10px; }
  .scene-bottom { left:20px; font-size:8px; } .scene-bottom > span:last-child, .desktop-hint { display:none; }
  .driving-hud { right:68px; bottom:52px; left:68px; } .driving-hud span { padding:4px 7px; font-size:8px; }
  .race-tools { top:65px; left:12px; max-width:145px; } .race-tools button { padding:8px; font-size:10px; }
  .dashboard { flex-wrap:wrap; padding:20px 0; } .setup { width:100%; } .table-buttons { gap:5px; } .table-buttons button { flex:1; min-width:29px; padding:0 5px; }
  .launch { justify-content:space-between; } .launch div { display:flex; } .launch div > span { max-width:155px; line-height:1.5; } .primary { min-width:142px; padding:13px 17px; }
  .quiz { flex-wrap:wrap; gap:12px; } .question { display:flex; width:100%; align-items:center; justify-content:space-between; } .question strong { margin:0; font-size:32px; }
  .answer-area { width:100%; flex:auto; } .answers { gap:8px; } .text-button { margin-left:auto; } .finish h2 { font-size:42px; } footer > span:last-child { display:none; }
}
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { animation:none !important; transition:none !important; } }
