:root {
  --bg-deep: #090418;
  --neon-pink: #ff2e97;
  --neon-cyan: #2cf6ff;
  --neon-gold: #ffd166;
  --panel-bg: rgba(12, 7, 28, 0.78);
  --panel-border: rgba(44, 246, 255, 0.35);
  --text-main: #f6f2ff;
  --text-dim: #b4a7d6;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

#road-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud-top {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
  z-index: 10;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hud-right {
  justify-content: flex-end;
}

.hud-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 6px 12px;
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  min-width: 82px;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.35);
}

.speed-card {
  min-width: 74px;
  text-align: right;
}

.hud-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  font-weight: 700;
}

.hud-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-main);
}

.accent-cyan {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(44, 246, 255, 0.5);
}

.accent-gold {
  color: var(--neon-gold);
}

.shield-bars {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  height: 12px;
  align-items: center;
}

.shield-pip {
  width: 18px;
  height: 8px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.shield-pip.active {
  background: var(--neon-pink);
  box-shadow: 0 0 10px rgba(255, 46, 151, 0.75);
}

.hud-btn {
  pointer-events: auto;
  background: var(--panel-bg);
  color: var(--text-main);
  border: 1px solid rgba(255, 46, 151, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.hud-btn:hover {
  border-color: var(--neon-cyan);
  background: rgba(26, 12, 56, 0.92);
}

.hud-btn:active {
  transform: scale(0.96);
}

.nitro-wrap {
  position: absolute;
  top: 76px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-bg);
  border: 1px solid rgba(44, 246, 255, 0.3);
  border-radius: 8px;
  padding: 5px 10px;
  z-index: 10;
  pointer-events: none;
}

.nitro-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--neon-cyan);
}

.nitro-track {
  width: 128px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.nitro-fill {
  height: 100%;
  width: 50%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-cyan));
  box-shadow: 0 0 10px rgba(44, 246, 255, 0.7);
  transition: width 0.06s linear;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 3, 20, 0.62);
  backdrop-filter: blur(5px);
  z-index: 20;
  transition: opacity 0.2s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 7, 34, 0.92);
  border: 1px solid rgba(255, 46, 151, 0.55);
  border-radius: 18px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 0 40px rgba(255, 46, 151, 0.22), 0 16px 40px rgba(0, 0, 0, 0.6);
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: var(--neon-cyan);
  margin-bottom: 10px;
}

.title {
  font-size: clamp(32px, 6vw, 44px);
  line-height: 1.02;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff5c0 0%, #ff8a5b 48%, #ff2e97 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 46, 151, 0.45));
  margin-bottom: 12px;
}

.subtitle {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.stats-grid.hidden {
  display: none;
}

.stat-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(44, 246, 255, 0.25);
  border-radius: 10px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-k {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  font-weight: 700;
}

.stat-v {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 800;
  color: var(--neon-gold);
}

.primary-btn {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, #ff2e97, #ff6b4a);
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.14em;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(255, 46, 151, 0.5);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.primary-btn:hover {
  filter: brightness(1.1);
}

.primary-btn:active {
  transform: scale(0.98);
}

.controls-hint {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  font-size: 12px;
  color: var(--text-dim);
}

.controls-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--neon-cyan);
  background: rgba(44, 246, 255, 0.12);
  border: 1px solid rgba(44, 246, 255, 0.35);
  border-radius: 5px;
}

.touch-controls {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 18px;
  display: none;
  justify-content: space-between;
  align-items: center;
  z-index: 15;
  pointer-events: none;
}

.touch-left,
.touch-right {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.touch-btn {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  border: 1px solid rgba(44, 246, 255, 0.45);
  background: rgba(15, 7, 34, 0.7);
  color: var(--text-main);
  font-size: 28px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.touch-btn.pressed {
  background: rgba(44, 246, 255, 0.3);
  border-color: var(--neon-cyan);
  transform: scale(0.95);
}

.touch-nitro {
  font-size: 13px;
  letter-spacing: 0.08em;
  border-color: rgba(255, 46, 151, 0.65);
  color: var(--neon-pink);
}

.touch-brake {
  font-size: 13px;
  letter-spacing: 0.08em;
  border-color: rgba(255, 209, 102, 0.55);
  color: var(--neon-gold);
}

@media (hover: none) and (pointer: coarse), (max-width: 760px) {
  .touch-controls {
    display: flex;
  }

  .hud-card {
    padding: 5px 8px;
    min-width: 64px;
  }

  .hud-value {
    font-size: 16px;
  }

  .hud-btn {
    padding: 8px 9px;
    font-size: 10px;
  }

  .nitro-wrap {
    top: 66px;
  }

  .nitro-track {
    width: 96px;
  }
}
