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

body {
  background: radial-gradient(circle at center, #0f172a 0%, #030712 100%);
  color: #f8fafc;
  font-family: 'Rajdhani', sans-serif;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  position: relative;
}

.game-wrapper {
  position: relative;
  width: 800px;
  height: 600px;
  max-width: 100vw;
  max-height: 100vh;
  box-shadow: 0 0 50px rgba(14, 165, 233, 0.25), 0 0 0 2px rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  overflow: hidden;
  background-color: #020617;
}

canvas#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #050b18;
}

/* =========================================
   HUD (Heads-Up Display)
   ========================================= */
.hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.85) 0%, rgba(2, 6, 23, 0) 100%);
}

.hud-overlay.hidden {
  display: none !important;
}

.hud-box {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.hud-label {
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: #38bdf8;
  font-weight: 700;
  margin-bottom: 3px;
}

.hud-value {
  font-family: 'Orbitron', monospace;
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
}

/* Lives / Hearts */
.lives-container {
  display: flex;
  gap: 6px;
  align-items: center;
}

.life-icon {
  width: 18px;
  height: 18px;
  fill: #ef4444;
  filter: drop-shadow(0 0 4px #ef4444);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

.life-icon.lost {
  opacity: 0.2;
  filter: grayscale(1);
  transform: scale(0.75);
}

/* Target Enemy Progress Bar */
.target-box {
  min-width: 200px;
  align-items: center;
}

.target-progress-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.target-counter {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  font-weight: 900;
  color: #facc15;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.6);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(250, 204, 21, 0.4);
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #eab308, #22c55e);
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.8);
  transition: width 0.3s ease-out;
}

.hud-btn {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #fff;
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  transform: scale(1.05);
}

/* =========================================
   SCREENS / MODALS (Start, Over, Victory)
   ========================================= */
.screen-modal {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  opacity: 1;
  transition: opacity 0.3s ease;
  padding: 16px;
}

.screen-modal.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.screen-card {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.85));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(14, 165, 233, 0.2);
  max-width: 720px;
  width: 100%;
  padding: 24px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(20px) scale(0.97);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.badge-tag {
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 8px;
  font-weight: 700;
}

.game-title {
  font-family: 'Orbitron', monospace;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #38bdf8 0%, #ffffff 60%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
  margin-bottom: 4px;
}

.game-subtitle {
  font-size: 15px;
  color: #94a3b8;
  margin-bottom: 18px;
}

.game-subtitle strong {
  color: #facc15;
}

/* =========================================
   AIRCRAFT SELECTION CARDS
   ========================================= */
.selection-section {
  width: 100%;
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  letter-spacing: 2px;
  color: #cbd5e1;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.plane-cards-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}

.plane-card {
  background: rgba(15, 23, 42, 0.7);
  border: 2px solid rgba(51, 65, 85, 0.8);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.plane-card:hover {
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-4px);
  background: rgba(30, 41, 59, 0.85);
  box-shadow: 0 8px 25px rgba(14, 165, 233, 0.2);
}

.plane-card.selected {
  border-color: #38bdf8;
  background: rgba(14, 165, 233, 0.15);
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.45), inset 0 0 15px rgba(56, 189, 248, 0.15);
  transform: translateY(-4px) scale(1.02);
}

.plane-tag {
  font-family: 'Orbitron', monospace;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 10px;
  position: absolute;
  top: 8px;
  right: 8px;
}

.tag-cyan { background: rgba(6, 182, 212, 0.2); color: #22d3ee; border: 1px solid #0891b2; }
.tag-green { background: rgba(34, 197, 94, 0.2); color: #4ade80; border: 1px solid #16a34a; }
.tag-red { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid #dc2626; }

.plane-preview-box {
  width: 90px;
  height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 6px 0;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, transparent 70%);
}

.plane-preview-canvas {
  width: 90px;
  height: 90px;
}

.plane-name {
  font-family: 'Orbitron', monospace;
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 2px;
}

.plane-desc {
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.25;
  min-height: 28px;
  margin-bottom: 8px;
}

.stats-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: #cbd5e1;
}

.stat-bar {
  width: 50%;
  height: 5px;
  background: #334155;
  border-radius: 3px;
  overflow: hidden;
}

.stat-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 3px;
}

/* =========================================
   CONTROLS GUIDE & BUTTONS
   ========================================= */
.controls-guide {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 18px;
}

.control-badge {
  font-size: 12px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
}

.control-badge strong {
  color: #38bdf8;
}

.btn-primary {
  font-family: 'Orbitron', monospace;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 14px 40px;
  color: #020617;
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.6), 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7dd3fc 0%, #0369a1 100%);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.8), 0 6px 20px rgba(0, 0, 0, 0.5);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.99);
}

/* =========================================
   VICTORY & DEFEAT SCREENS
   ========================================= */
.result-icon {
  font-size: 50px;
  margin-bottom: 8px;
  animation: pulseIcon 1.5s infinite alternate ease-in-out;
}

@keyframes pulseIcon {
  from { transform: scale(0.9); }
  to { transform: scale(1.15); }
}

.result-title {
  font-family: 'Orbitron', monospace;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.result-title.victory {
  background: linear-gradient(135deg, #4ade80, #facc15);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 25px rgba(74, 222, 128, 0.6);
}

.result-title.defeat {
  background: linear-gradient(135deg, #f87171, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 25px rgba(239, 68, 68, 0.6);
}

.result-subtitle {
  font-size: 15px;
  color: #94a3b8;
  max-width: 480px;
  margin-bottom: 20px;
}

.result-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
  width: 100%;
  justify-content: center;
}

.res-stat-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
}

.res-stat-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.res-stat-val {
  font-family: 'Orbitron', monospace;
  font-size: 20px;
  font-weight: 700;
  color: #38bdf8;
}

.btn-retry {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.6);
}

.btn-retry:hover {
  background: linear-gradient(135deg, #fca5a5 0%, #b91c1c 100%);
  box-shadow: 0 0 35px rgba(239, 68, 68, 0.8);
}

.btn-victory {
  background: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
  box-shadow: 0 0 25px rgba(74, 222, 128, 0.6);
}

.btn-victory:hover {
  background: linear-gradient(135deg, #86efac 0%, #15803d 100%);
  box-shadow: 0 0 35px rgba(74, 222, 128, 0.8);
}

/* =========================================
   TOUCH / MOBILE CONTROLS
   ========================================= */
.touch-controls {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 15;
}

.touch-controls.hidden {
  display: none !important;
}

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  gap: 4px;
}

.dpad-middle {
  display: flex;
  gap: 4px;
}

.dpad-btn {
  width: 44px;
  height: 44px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  touch-action: manipulation;
}

.fire-btn {
  pointer-events: auto;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, #ef4444 0%, #b91c1c 100%);
  border: 2px solid #fca5a5;
  color: #fff;
  font-family: 'Orbitron', monospace;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.7);
  touch-action: manipulation;
}

/* =========================================
   RESPONSIVE ADJUSTMENTS
   ========================================= */
@media (max-width: 820px) {
  .game-wrapper {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

  .plane-cards-container {
    grid-template-columns: 1fr;
    max-height: 45vh;
    overflow-y: auto;
  }

  .game-title {
    font-size: 26px;
  }
}

