/* ============================================
   Luxon & Willis' Fuel Nightmare
   Mobile-first portrait-friendly styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Press+Start+2P&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a1a;
  font-family: 'Orbitron', monospace;
  touch-action: manipulation;
}

#game-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ---------- Canvas ---------- */
#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* ---------- HUD Overlay ---------- */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

#hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#score-display {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: #00ffcc;
  text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}

#mute-btn {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 18px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  padding: 0;
  line-height: 1;
}

#mute-btn:hover {
  background: rgba(0, 255, 204, 0.15);
  border-color: rgba(0, 255, 204, 0.4);
}

#fuel-bar-container {
  width: 100%;
  height: 18px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9px;
  overflow: hidden;
  position: relative;
}

#fuel-bar {
  height: 100%;
  background: linear-gradient(90deg, #ff4444, #ffaa00, #00ff88);
  border-radius: 9px;
  transition: width 0.15s ease;
  position: relative;
}

#fuel-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent);
  border-radius: 9px 9px 0 0;
}

#fuel-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  white-space: nowrap;
}

/* ---------- Alert Level Controls ---------- */
#alert-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.alert-btn {
  width: 56px;
  height: 56px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  font-family: 'Orbitron', monospace;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.alert-btn .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-bottom: 2px;
}

.alert-btn[data-level="green"] { background: rgba(0, 180, 0, 0.3); }
.alert-btn[data-level="green"] .dot { background: #00cc00; box-shadow: 0 0 8px #00cc00; }

.alert-btn[data-level="yellow"] { background: rgba(200, 200, 0, 0.3); }
.alert-btn[data-level="yellow"] .dot { background: #cccc00; box-shadow: 0 0 8px #cccc00; }

.alert-btn[data-level="orange"] { background: rgba(220, 130, 0, 0.3); }
.alert-btn[data-level="orange"] .dot { background: #dd8800; box-shadow: 0 0 8px #dd8800; }

.alert-btn[data-level="red"] { background: rgba(200, 0, 0, 0.3); }
.alert-btn[data-level="red"] .dot { background: #dd0000; box-shadow: 0 0 8px #dd0000; }

.alert-btn.active {
  border-color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(255,255,255,0.3);
}

.alert-btn:active {
  transform: scale(0.95);
}

/* ---------- Start / Game Over Screens ---------- */
.overlay-screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 20, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 24px;
  text-align: center;
  opacity: 1;
  transition: opacity 0.4s ease;
}

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

.overlay-screen h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  line-height: 1.6;
  color: #ff6600;
  text-shadow: 0 0 20px rgba(255, 102, 0, 0.6);
  margin-bottom: 16px;
}

.overlay-screen h1 span {
  color: #00ffcc;
}

.overlay-screen .subtitle {
  font-size: 11px;
  color: #aaa;
  margin-bottom: 32px;
  line-height: 1.5;
}

.overlay-screen .final-score {
  font-family: 'Press Start 2P', monospace;
  font-size: 28px;
  color: #ffcc00;
  text-shadow: 0 0 20px rgba(255, 204, 0, 0.5);
  margin-bottom: 8px;
}

.overlay-screen .final-label {
  font-size: 11px;
  color: #888;
  margin-bottom: 24px;
}

.overlay-screen .post-mortem {
  font-family: 'Orbitron', monospace;
  font-size: 12px;
  font-style: italic;
  color: #ff9966;
  text-shadow: 0 0 10px rgba(255, 153, 102, 0.3);
  line-height: 1.6;
  max-width: 340px;
  margin: 0 auto 28px;
  padding: 12px 16px;
  border-left: 3px solid #ff6600;
  background: rgba(255, 102, 0, 0.06);
  border-radius: 0 8px 8px 0;
  text-align: left;
}

.play-btn {
  padding: 16px 40px;
  border: 2px solid #00ffcc;
  border-radius: 12px;
  background: rgba(0, 255, 204, 0.1);
  color: #00ffcc;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.play-btn:hover, .play-btn:active {
  background: rgba(0, 255, 204, 0.25);
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.3);
  transform: scale(1.05);
}

.instructions {
  margin-top: 24px;
  font-size: 10px;
  color: #666;
  line-height: 1.8;
}

.instructions strong {
  color: #00ffcc;
}

/* ---------- Tanker Alert Toast ---------- */
#tanker-toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 15;
  padding: 8px 20px;
  border-radius: 8px;
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

#tanker-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#tanker-toast.delivery {
  background: rgba(0, 200, 100, 0.85);
  border: 1px solid #00ff88;
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

#tanker-toast.diverted {
  background: rgba(200, 50, 50, 0.85);
  border: 1px solid #ff4444;
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
}

/* ---------- Responsive: Mobile ---------- */
@media (min-width: 500px) and (max-width: 767px) {
  #game-wrapper {
    max-width: 420px;
    margin: 0 auto;
    border-left: 1px solid rgba(255,255,255,0.05);
    border-right: 1px solid rgba(255,255,255,0.05);
  }
}

@media (min-height: 800px) and (max-width: 767px) {
  .overlay-screen h1 {
    font-size: 22px;
  }
  #score-display {
    font-size: 16px;
  }
}

/* ---------- Responsive: Desktop ---------- */
@media (min-width: 768px) {
  #game-wrapper {
    max-width: 100%;
    margin: 0;
  }

  #hud {
    padding: 14px 24px;
    gap: 6px;
  }

  #score-display {
    font-size: 18px;
  }

  #fuel-bar-container {
    height: 24px;
    border-radius: 12px;
  }

  #fuel-bar {
    border-radius: 12px;
  }

  #fuel-text {
    font-size: 12px;
  }

  #alert-controls {
    bottom: 24px;
    gap: 12px;
  }

  .alert-btn {
    width: 72px;
    height: 64px;
    font-size: 10px;
    border-radius: 14px;
  }

  .alert-btn .dot {
    width: 14px;
    height: 14px;
  }

  .overlay-screen {
    padding: 40px;
  }

  .overlay-screen h1 {
    font-size: 28px;
    margin-bottom: 20px;
  }

  .overlay-screen .subtitle {
    font-size: 13px;
    margin-bottom: 40px;
  }

  .overlay-screen .final-score {
    font-size: 36px;
  }

  .overlay-screen .final-label {
    font-size: 13px;
  }

  .overlay-screen .post-mortem {
    font-size: 14px;
    max-width: 520px;
  }

  .play-btn {
    padding: 18px 52px;
    font-size: 16px;
    border-radius: 14px;
  }

  .instructions {
    font-size: 12px;
  }

  #tanker-toast {
    top: 80px;
    font-size: 13px;
    padding: 10px 24px;
  }

  .alert-btn::after {
    content: attr(data-hotkey);
    display: block;
    font-size: 8px;
    opacity: 0.5;
    margin-top: 2px;
    font-family: 'Orbitron', monospace;
  }
}
