* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: #0a1421; overflow: hidden; }
canvas { display: block; }

:root {
  --font: 'Arial Black', 'Avenir Next Condensed', 'Helvetica Neue', Arial, sans-serif;
  --outline: 0 2px 0 #000, 2px 0 0 #000, -2px 0 0 #000, 0 -2px 0 #000,
             2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000;
}

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; font-family: var(--font); color: #fff; display: none; }
body.running #hud { display: block; }

#hud-time {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  font-size: 64px; letter-spacing: 2px; text-shadow: var(--outline);
}
#hud-time.low { color: #ff4538; animation: pulse 0.5s infinite alternate; }
@keyframes pulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.12); } }

#hud-speed { position: absolute; right: 22px; bottom: 18px; font-size: 34px; text-shadow: var(--outline); }
#hud-dist { position: absolute; left: 22px; bottom: 18px; font-size: 34px; text-shadow: var(--outline); }

#zone-banner {
  position: absolute; top: 110px; left: 50%; transform: translateX(-50%);
  font-size: 44px; letter-spacing: 6px; color: #ffd166; text-shadow: var(--outline);
  opacity: 0; transition: opacity 0.4s; white-space: nowrap;
}
#zone-banner.show { opacity: 1; }

#toast {
  position: absolute; top: 170px; left: 50%; transform: translateX(-50%);
  font-size: 36px; color: #6effa1; text-shadow: var(--outline);
  opacity: 0; transition: opacity 0.3s;
}
#toast.show { opacity: 1; }

/* ---- overlays ---- */
.overlay {
  position: fixed; inset: 0; display: none; flex-direction: column; align-items: center;
  justify-content: center; gap: 18px; font-family: var(--font); color: #fff;
  background: radial-gradient(ellipse at center, rgba(5,8,16,0.15) 0%, rgba(5,8,16,0.65) 100%);
  text-align: center;
}
.overlay.on { display: flex; }

/* title screen: text stacked at the top + bottom, the car shows free in the middle */
#title { justify-content: flex-start; padding: 6vh 0 5vh; gap: 10px; background: linear-gradient(rgba(5,8,16,0.45) 0%, rgba(5,8,16,0) 38%, rgba(5,8,16,0) 70%, rgba(5,8,16,0.55) 100%); }
#title .press { margin-top: auto; }

.logo { font-size: 92px; letter-spacing: 4px; color: #ff7a2f; text-shadow: var(--outline), 0 10px 30px rgba(255,90,30,0.5); line-height: 0.95; }
.logo span { display: block; color: #ffd166; font-size: 110px; }
.sub { font-size: 20px; letter-spacing: 5px; color: #cfe0f0; text-shadow: var(--outline); }
.press { font-size: 26px; letter-spacing: 4px; color: #fff; text-shadow: var(--outline); animation: blink 1.1s infinite alternate; margin-top: 26px; }
@keyframes blink { from { opacity: 1; } to { opacity: 0.25; } }
.keys { font-size: 15px; color: #9fb4c8; text-shadow: var(--outline); letter-spacing: 1px; }

.go-head { font-size: 64px; letter-spacing: 6px; color: #ff4538; text-shadow: var(--outline); }
.go-dist { font-size: 96px; color: #ffd166; text-shadow: var(--outline); }
.go-sub { font-size: 22px; letter-spacing: 2px; color: #cfe0f0; text-shadow: var(--outline); }

/* ---- cartoon render toggle ---- */
#toon-btn {
  position: fixed; top: 18px; right: 22px; z-index: 30; cursor: pointer;
  font-family: var(--font); font-size: 17px; letter-spacing: 2px; color: #cfe0f0;
  text-shadow: var(--outline); padding: 8px 14px; border-radius: 10px;
  background: rgba(5, 8, 16, 0.35); border: 2px solid rgba(207, 224, 240, 0.35);
  user-select: none; -webkit-user-select: none; display: flex; align-items: center; gap: 7px;
}
#toon-btn:hover { background: rgba(5, 8, 16, 0.6); }
#toon-btn.on { color: #ffd166; border-color: #ffd166; background: rgba(60, 35, 5, 0.55); }

/* ---- highscores on the game-over card ---- */
.go-entry {
  display: none; align-items: center; gap: 14px;
  font-size: 20px; letter-spacing: 2px; color: #6effa1; text-shadow: var(--outline);
}
#gameover.entry .go-entry { display: flex; }
.go-entry input {
  width: 118px; padding: 4px 8px; text-align: center; text-transform: uppercase;
  font-family: var(--font); font-size: 34px; letter-spacing: 10px; color: #ffd166;
  background: rgba(5, 8, 16, 0.55); border: 2px solid #ffd166; border-radius: 10px; outline: none;
}
.go-ok { font-size: 14px; color: #9fb4c8; }
.go-table {
  list-style: none; margin: 0; padding: 0; min-width: 320px;
  display: flex; flex-direction: column; gap: 3px;
  font-size: 17px; letter-spacing: 1px; color: #cfe0f0; text-shadow: var(--outline);
}
.go-table li { display: flex; justify-content: space-between; gap: 40px; }
.go-table li.me { color: #ffd166; }
