:root {
   --bg: #05060f;
   --panel: rgba(10, 16, 34, 0.72);
   --neon: #39ff14;
   --neon-soft: rgba(57, 255, 20, 0.35);
   --accent: #4dd0ff;
   --danger: #ff3b5c;
   --text: #dfe7ff;
   --muted: #8ea0c9;
   --font: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

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

html,
body {
   width: 100%;
   height: 100%;
   overflow: hidden;
   background: var(--bg);
   color: var(--text);
   font-family: var(--font);
}

#game-container {
   position: relative;
   width: 100vw;
   height: 100vh;
}

#game-canvas {
   position: absolute;
   inset: 0;
   width: 100%;
   height: 100%;
   display: block;
   background: radial-gradient(ellipse at 50% 30%, #0b1030 0%, #05060f 70%);
}

/* ---------- HUD ---------- */
#hud {
   position: absolute;
   inset: 0;
   pointer-events: none;
   display: flex;
   justify-content: space-between;
   align-items: flex-start;
   padding: 18px 22px;
   z-index: 5;
}

.hud-panel {
   display: flex;
   flex-direction: column;
   gap: 10px;
   background: var(--panel);
   border: 1px solid rgba(77, 208, 255, 0.25);
   border-radius: 12px;
   padding: 14px 16px;
   min-width: 210px;
   backdrop-filter: blur(6px);
   box-shadow: 0 0 24px rgba(0, 0, 0, 0.5);
}

.hud-row {
   display: flex;
   align-items: center;
   gap: 10px;
   font-size: 14px;
   letter-spacing: 0.5px;
}

.hud-label {
   color: var(--muted);
   font-weight: 600;
   width: 46px;
   flex: 0 0 auto;
}

.hud-value {
   color: var(--text);
   font-variant-numeric: tabular-nums;
   font-weight: 600;
   min-width: 42px;
   text-align: right;
}

.fuel-track {
   flex: 1 1 auto;
   height: 12px;
   background: rgba(255, 255, 255, 0.08);
   border-radius: 6px;
   overflow: hidden;
   border: 1px solid rgba(255, 255, 255, 0.12);
}

.fuel-fill {
   height: 100%;
   width: 100%;
   background: linear-gradient(90deg, var(--neon) 0%, #a6ff5e 100%);
   box-shadow: 0 0 12px var(--neon-soft);
   transition: width 0.12s linear;
}

.fuel-fill.low {
   background: linear-gradient(90deg, var(--danger) 0%, #ff8a5e 100%);
   box-shadow: 0 0 12px rgba(255, 59, 92, 0.4);
}

/* ---------- Overlays ---------- */
.overlay {
   position: absolute;
   inset: 0;
   z-index: 10;
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   gap: 18px;
   text-align: center;
   background: rgba(4, 6, 16, 0.78);
   backdrop-filter: blur(4px);
   padding: 24px;
}

.overlay.hidden {
   display: none;
}

.title {
   font-size: clamp(34px, 7vw, 64px);
   letter-spacing: 6px;
   font-weight: 800;
   color: var(--neon);
   text-shadow:
      0 0 18px var(--neon-soft),
      0 0 40px rgba(57, 255, 20, 0.2);
}

.subtitle {
   color: var(--muted);
   font-size: clamp(14px, 2.4vw, 18px);
   max-width: 520px;
}

.high-score-line {
   color: var(--muted);
   font-size: 16px;
   letter-spacing: 2px;
   font-weight: 600;
}

.high-score-line span {
   color: var(--neon);
   font-weight: 800;
   font-variant-numeric: tabular-nums;
   text-shadow: 0 0 12px var(--neon-soft);
}

.new-record {
   width: 100%;
   color: var(--neon);
   font-weight: 800;
   letter-spacing: 3px;
   font-size: 18px;
   text-shadow: 0 0 14px var(--neon-soft);
   animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
   0%,
   100% {
      opacity: 1;
   }
   50% {
      opacity: 0.55;
   }
}

.controls {
   list-style: none;
   display: flex;
   flex-direction: column;
   gap: 8px;
   color: var(--text);
   font-size: 15px;
}

.controls b {
   color: var(--accent);
   display: inline-block;
   min-width: 90px;
   text-align: left;
}

.btn {
   pointer-events: auto;
   cursor: pointer;
   font-family: var(--font);
   font-size: 18px;
   font-weight: 700;
   letter-spacing: 3px;
   color: #04120a;
   background: var(--neon);
   border: none;
   border-radius: 10px;
   padding: 14px 40px;
   box-shadow: 0 0 22px var(--neon-soft);
   transition:
      transform 0.12s ease,
      box-shadow 0.12s ease,
      background 0.12s ease;
}

.btn:hover {
   transform: translateY(-2px);
   box-shadow: 0 0 34px var(--neon-soft);
}

.btn:active {
   transform: translateY(0);
}

/* ---------- Game over modal ---------- */
#game-over-modal {
   background: rgba(4, 6, 16, 0.82);
}

.modal-card {
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 18px;
   background: var(--panel);
   border: 1px solid rgba(77, 208, 255, 0.25);
   border-radius: 16px;
   padding: 40px 56px;
   box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

#game-over-title.success {
   color: var(--neon);
   text-shadow: 0 0 18px var(--neon-soft);
}

#game-over-title.crash {
   color: var(--danger);
   text-shadow: 0 0 18px rgba(255, 59, 92, 0.4);
}

.final-stats {
   display: flex;
   gap: 28px;
   flex-wrap: wrap;
   justify-content: center;
   color: var(--muted);
   font-size: 15px;
}

.final-stats span {
   color: var(--text);
   font-weight: 700;
   font-variant-numeric: tabular-nums;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
   #hud {
      padding: 10px;
   }
   .hud-panel {
      min-width: 0;
      flex: 1 1 45%;
      padding: 10px 12px;
      gap: 6px;
   }
   .hud-row {
      font-size: 12px;
   }
   .hud-label {
      width: 34px;
   }
   .modal-card {
      padding: 28px 24px;
   }
}
