/* ---- Turbo Lane ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0e1a;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game-container, #game-container canvas {
  position: absolute;
  inset: 0;
  display: block;
}

.hidden { display: none !important; }

/* ---- HUD ---- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.hud-top-left  { position: absolute; top: 18px; left: 22px; }
.hud-top-right { position: absolute; top: 18px; right: 22px; text-align: right; }

.hud-label {
  font-size: 12px;
  letter-spacing: 3px;
  opacity: 0.7;
  font-weight: 600;
}
.hud-label.small { margin-top: 6px; font-size: 11px; }
.hud-value {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
  font-variant-numeric: tabular-nums;
}

/* ---- Nitro bar ---- */
.hud-bottom-center {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, 60vw);
  text-align: center;
}
.nitro-label {
  font-size: 12px;
  letter-spacing: 4px;
  font-weight: 700;
  opacity: 0.85;
  margin-bottom: 5px;
  color: #b388ff;
  transition: color 0.15s, text-shadow 0.15s;
}
.nitro-label .key-hint {
  font-size: 10px;
  opacity: 0.6;
  letter-spacing: 2px;
  margin-left: 4px;
}
.nitro-label.ready  { color: #69f0ae; text-shadow: 0 0 10px rgba(105,240,174,0.7); }
.nitro-label.active { color: #40c4ff; text-shadow: 0 0 14px rgba(64,196,255,0.9); }
.nitro-label.empty  { color: #ff5252; opacity: 0.6; }

.nitro-bar-bg {
  position: relative;
  height: 14px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.6);
}
.nitro-bar-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, #6a1b9a, #b388ff, #40c4ff);
  transition: filter 0.15s;
}
.nitro-bar-fill.active {
  background: linear-gradient(90deg, #00838f, #40c4ff, #ffffff);
  animation: nitro-pulse 0.4s ease-in-out infinite alternate;
}
.nitro-bar-fill.empty { background: linear-gradient(90deg, #4a2a2a, #6d4c41); }
@keyframes nitro-pulse {
  from { filter: brightness(1); }
  to   { filter: brightness(1.6); }
}

/* on-screen nitro button (hidden on desktop, shown via media query) */
.nitro-btn {
  position: absolute;
  bottom: 80px;
  right: 24px;
  padding: 16px 22px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #081018;
  background: linear-gradient(180deg, #69f0ae, #00c853);
  border: none;
  border-radius: 50%;
  width: 78px;
  height: 78px;
  cursor: pointer;
  box-shadow: 0 4px 0 #2e7d32, 0 8px 18px rgba(0,0,0,0.5);
  display: none;
  pointer-events: auto;
  z-index: 6;
  touch-action: none;
}

/* ---- Nitro speed-line overlay ---- */
.nitro-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 35%, rgba(64,196,255,0.18) 100%),
    repeating-conic-gradient(from 0deg at 50% 50%,
      transparent 0deg, transparent 6deg,
      rgba(255,255,255,0.06) 6deg, transparent 7deg);
  opacity: 0;
  transition: opacity 0.18s ease-out;
  mix-blend-mode: screen;
}
.nitro-overlay.active {
  opacity: 1;
  animation: nitro-speedlines 0.5s linear infinite;
}
@keyframes nitro-speedlines {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 0, 0 -60px; }
}

/* ---- Overlays (menu / game over) ---- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(ellipse at center, rgba(10,12,28,0.55) 0%, rgba(10,12,28,0.92) 100%);
  backdrop-filter: blur(3px);
  text-align: center;
}

.title {
  font-size: clamp(44px, 9vw, 84px);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 4px;
  color: #ffd23f;
  text-shadow: 0 4px 0 #b8860b, 0 8px 30px rgba(0,0,0,0.7);
}
.title span { color: #4dd0ff; text-shadow: 0 4px 0 #1565c0, 0 8px 30px rgba(0,0,0,0.7); }
.title.crash { color: #ff5252; text-shadow: 0 4px 0 #8e0000, 0 8px 30px rgba(0,0,0,0.7); }

.subtitle { font-size: 16px; opacity: 0.85; letter-spacing: 1px; }

.controls-hint {
  margin: 10px 0 4px;
  font-size: 13px;
  line-height: 1.9;
  opacity: 0.65;
  letter-spacing: 1px;
}

.big-btn {
  margin-top: 8px;
  padding: 14px 48px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #081018;
  background: linear-gradient(180deg, #ffd23f, #ffb300);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 5px 0 #a97900, 0 10px 24px rgba(0,0,0,0.5);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.big-btn:hover  { transform: translateY(-2px); }
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #a97900; }

.enter-hint { font-size: 12px; letter-spacing: 3px; opacity: 0.45; }

.score-line { font-size: 26px; font-weight: 700; letter-spacing: 2px; }
.score-line span { color: #ffd23f; font-variant-numeric: tabular-nums; }
.best-line { font-size: 18px; opacity: 0.8; }
.new-best {
  font-size: 20px;
  font-weight: 800;
  color: #4dd0ff;
  letter-spacing: 2px;
  animation: pulse 0.9s ease-in-out infinite alternate;
}
@keyframes pulse {
  from { transform: scale(1);    opacity: 0.8; }
  to   { transform: scale(1.12); opacity: 1; }
}

/* show nitro button only on touch / small screens */
@media (hover: none) and (pointer: coarse), (max-width: 720px) {
  .nitro-btn { display: block; }
  .nitro-label .key-hint { display: none; }
}
