/* ==========================================================================
   GAMEPLAY & TACTICAL HUD STYLES
   Space Shooter - Tactical Cockpit Command, Side Panels, Gauges & Controls
   ========================================================================== */

.hud-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(8px, 1.8vw, 16px);
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════════
   TOP & BOTTOM BARS
   ═══════════════════════════════════════════════════════════════════ */

.hud-top-bar,
.hud-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 8px;
  z-index: 15;
}

.hud-info-card {
  position: relative;
  background:
    linear-gradient(to right, var(--cyan) 8px, transparent 8px) 0 0,
    linear-gradient(to bottom, var(--cyan) 8px, transparent 8px) 0 0,
    linear-gradient(to left, var(--cyan) 8px, transparent 8px) 100% 0,
    linear-gradient(to bottom, var(--cyan) 8px, transparent 8px) 100% 0,
    linear-gradient(to right, var(--cyan) 8px, transparent 8px) 0 100%,
    linear-gradient(to top, var(--cyan) 8px, transparent 8px) 0 100%,
    linear-gradient(to left, var(--cyan) 8px, transparent 8px) 100% 100%,
    linear-gradient(to top, var(--cyan) 8px, transparent 8px) 100% 100%,
    var(--bg-panel);
  background-size:
    8px 2px, 2px 8px,
    8px 2px, 2px 8px,
    8px 2px, 2px 8px,
    8px 2px, 2px 8px,
    100% 100%;
  background-repeat: no-repeat;
  border: 1px solid rgba(45, 212, 220, 0.18);
  border-radius: 0;
  padding: 5px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hud-bar-pair {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  width: 100%;
}

.hud-mini-track {
  width: 100%;
  height: 3px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 1px;
  overflow: hidden;
}

.hud-mini-fill {
  height: 100%;
  transition: width 0.15s ease-out;
}

.hud-mini-fill.cyan {
  background: linear-gradient(90deg, #00b4d8, #00f0ff);
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.6);
}

.hud-mini-fill.green {
  background: linear-gradient(90deg, #10b981, #2dd4dc);
  box-shadow: 0 0 6px rgba(45, 212, 220, 0.6);
}

.hud-label {
  font-family: var(--font-hud-mono, 'Share Tech Mono', monospace);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.hud-value {
  font-family: var(--font-hud-heading, 'Rajdhani', sans-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.score-card .hud-value {
  font-size: 1.15rem;
}

.hud-score-target {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-family: var(--font-hud-mono, monospace);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-align: right;
  white-space: nowrap;
}

.hud-wave-detail {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-family: var(--font-hud-mono, monospace);
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.hud-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

#btn-toggle-panels {
  min-width: 72px;
  letter-spacing: 0.06em;
  font-family: var(--font-hud-mono, monospace);
  font-size: 0.70rem;
  padding: 4px 8px;
  transition: all 0.2s ease;
}

#btn-toggle-panels.btn-primary {
  border-color: var(--cyan);
  color: var(--cyan-bright);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
}

/* ═══════════════════════════════════════════════════════════════════
   TACTICAL SIDE PANELS (LEFT & RIGHT)
   ═══════════════════════════════════════════════════════════════════ */

.hud-mid-tactical-layout {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  width: 100%;
  flex: 1;
  pointer-events: none;
  margin: 6px 0;
}

.hud-sidebar-left,
.hud-sidebar-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: clamp(180px, 20vw, 240px);
  pointer-events: auto;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.35s;
  will-change: opacity, transform;
}

.hud-theater-card {
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.35s;
  will-change: opacity, transform;
}

.hud-bottom-bar > .hud-info-card:first-child {
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.35s;
  will-change: opacity, transform;
}

/* ═══════════════════════════════════════════════════════════════════
   DYNAMIC HUD AUTO-HIDE IN COMBAT / MOVEMENT
   Hides bulky side panels and non-essential cards when player is moving,
   smoothly unhiding when stationary for 2s or on level completion.
   ═══════════════════════════════════════════════════════════════════ */
.hud-layer.hud-moving-hidden .hud-sidebar-left {
  opacity: 0;
  transform: translateX(-32px);
  pointer-events: none;
  visibility: hidden;
}

.hud-layer.hud-moving-hidden .hud-sidebar-right {
  opacity: 0;
  transform: translateX(32px);
  pointer-events: none;
  visibility: hidden;
}

.hud-layer.hud-moving-hidden .hud-theater-card {
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
  visibility: hidden;
}

.hud-layer.hud-moving-hidden .hud-bottom-bar > .hud-info-card:first-child {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  visibility: hidden;
}

.hud-sidebar-right {
  align-items: flex-end;
}

.hud-data-panel {
  background: rgba(8, 12, 20, 0.72);
  border: 1px solid rgba(45, 212, 220, 0.18);
  border-left: 2px solid var(--cyan);
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 100%;
  box-sizing: border-box;
}

.hud-sidebar-right .hud-data-panel {
  border-left: 1px solid rgba(45, 212, 220, 0.18);
  border-right: 2px solid var(--cyan);
}

.hud-panel-title {
  font-family: var(--font-hud-mono, monospace);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--cyan-bright);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.hud-panel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
}

.hud-panel-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.hud-panel-dot.amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.hud-panel-dot.pulse {
  animation: radarDotPulse 1.2s infinite alternate;
}

@keyframes radarDotPulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 1.0; }
}

.hud-sys-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-hud-mono, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  padding: 1px 0;
}

.hud-sys-label {
  color: var(--text-secondary);
}

.hud-sys-value {
  font-weight: 700;
  color: var(--text-primary);
}

.hud-coords-stream {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.hud-telemetry-num {
  color: var(--cyan-bright);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════
   RADAR MODE TOGGLE PILL BUTTON
   ═══════════════════════════════════════════════════════════════════ */

.hud-radar-toggle-btn {
  width: 100%;
  background: rgba(10, 16, 26, 0.85);
  border: 1px solid var(--cyan);
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-hud-mono, monospace);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.hud-radar-toggle-btn:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: #ffffff;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.35);
}

.hud-radar-toggle-btn.active {
  border-color: var(--cyan);
  color: var(--cyan-bright);
}

.hud-radar-toggle-btn.passive {
  border-color: var(--amber);
  color: var(--amber);
  background: rgba(30, 20, 5, 0.85);
  box-shadow: 0 0 10px rgba(255, 183, 3, 0.2);
}

.radar-mode-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.radar-rf-badge {
  font-size: 0.62rem;
  color: var(--cyan-bright);
}

/* ═══════════════════════════════════════════════════════════════════
   WEAPON ARSENAL & CYCLE SELECTOR
   ═══════════════════════════════════════════════════════════════════ */

.hud-weapon-bay-panel {
  border-right: 2px solid var(--amber) !important;
}

.hud-panel-hint {
  font-size: 0.55rem;
  color: var(--text-secondary);
  margin-left: auto;
  letter-spacing: 0.05em;
}

.hud-active-weapon-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 20, 30, 0.75);
  border: 1px solid rgba(255, 183, 3, 0.25);
  padding: 4px 6px;
  margin: 2px 0 4px;
}

.hud-weapon-icon-badge {
  font-size: 1.25rem;
  color: var(--amber);
  text-shadow: 0 0 8px rgba(255, 183, 3, 0.6);
  min-width: 24px;
  text-align: center;
}

.hud-weapon-details {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.hud-weapon-name {
  font-family: var(--font-hud-heading, 'Rajdhani', sans-serif);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--amber);
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.hud-weapon-meta {
  font-family: var(--font-hud-mono, monospace);
  font-size: 0.58rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.hud-weapon-slots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  margin-bottom: 4px;
}

.weapon-slot-chip:nth-child(5) {
  grid-column: span 2;
  justify-content: center;
}

.weapon-slot-chip {
  background: rgba(10, 14, 22, 0.85);
  border: 1px solid rgba(45, 212, 220, 0.2);
  color: var(--text-secondary);
  padding: 3px 4px;
  font-family: var(--font-hud-mono, monospace);
  font-size: 0.60rem;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
  -webkit-user-select: none;
}

.weapon-slot-chip:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--cyan);
  color: var(--text-primary);
}

.weapon-slot-chip.active {
  background: rgba(255, 183, 3, 0.18);
  border-color: var(--amber);
  color: var(--amber);
  box-shadow: 0 0 10px rgba(255, 183, 3, 0.35);
  font-weight: 700;
}

.slot-num {
  font-weight: 700;
  color: var(--cyan-bright);
  font-size: 0.55rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 1px 3px;
  border-radius: 1px;
}

.weapon-slot-chip.active .slot-num {
  color: #000000;
  background: var(--amber);
}

.slot-icon {
  font-size: 0.7rem;
}

.slot-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-weapon-cycle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 1px;
}

.hud-cycle-btn {
  background: rgba(10, 14, 22, 0.85);
  border: 1px solid rgba(45, 212, 220, 0.25);
  color: var(--cyan-bright);
  font-family: var(--font-hud-mono, monospace);
  font-size: 0.62rem;
  padding: 2px 6px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.hud-cycle-btn:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

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

.hud-cycle-label {
  font-family: var(--font-hud-mono, monospace);
  font-size: 0.55rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════════════
   ORDNANCE METERS (AMMO, HEAT, MISSILES)
   ═══════════════════════════════════════════════════════════════════ */

.hud-meter-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 3px;
}

.hud-meter-header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-hud-mono, monospace);
  font-size: 0.64rem;
  color: var(--text-secondary);
}

.hud-meter-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(45, 212, 220, 0.2);
  border-radius: 1px;
  overflow: hidden;
}

.hud-meter-fill {
  height: 100%;
  transition: width 0.1s linear, background 0.2s ease;
}

.hud-meter-fill.cyan {
  background: linear-gradient(90deg, #0077b6, #00f0ff);
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.6);
}

.hud-meter-fill.green {
  background: linear-gradient(90deg, #059669, #10b981);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.hud-meter-fill.amber {
  background: linear-gradient(90deg, #d97706, #ffb703);
  box-shadow: 0 0 8px rgba(255, 183, 3, 0.6);
}

.hud-meter-fill.red {
  background: linear-gradient(90deg, #dc2626, #ff003c);
  box-shadow: 0 0 10px rgba(255, 0, 60, 0.8);
}

.hud-overheat-alert {
  font-family: var(--font-hud-mono, monospace);
  font-size: 0.65rem;
  font-weight: 700;
  color: #ff003c;
  background: rgba(255, 0, 60, 0.15);
  border: 1px solid #ff003c;
  padding: 2px 4px;
  text-align: center;
  margin-top: 2px;
  animation: alertBlink 0.4s infinite alternate;
}

@keyframes alertBlink {
  0% { opacity: 0.4; }
  100% { opacity: 1.0; }
}

.hud-missile-pips {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.missile-pip {
  flex: 1;
  height: 6px;
  background: rgba(255, 183, 3, 0.15);
  border: 1px solid rgba(255, 183, 3, 0.35);
  border-radius: 1px;
}

.missile-pip.armed {
  background: var(--amber);
  box-shadow: 0 0 6px rgba(255, 183, 3, 0.6);
}

/* ═══════════════════════════════════════════════════════════════════
   ON-SCREEN TOUCH CONTROLS (MOBILE RIGHT-SIDE COMBAT CLUSTER)
   ═══════════════════════════════════════════════════════════════════ */

.hud-touch-controls {
  position: absolute;
  bottom: 64px;
  right: 14px;
  left: auto;
  width: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  z-index: 25;
  box-sizing: border-box;
}

.hud-touch-right-actions {
  display: grid;
  grid-template-columns: 54px 68px;
  grid-template-rows: 52px 68px;
  gap: 10px 12px;
  align-items: center;
  justify-items: center;
  pointer-events: auto;
}

.touch-action-btn {
  width: 52px;
  height: 52px;
  min-width: 46px;
  min-height: 46px;
  border-radius: 50%;
  background: rgba(8, 12, 20, 0.88);
  border: 1.5px solid var(--cyan);
  color: var(--cyan-bright);
  font-family: var(--font-heading, sans-serif);
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 0 14px rgba(45, 212, 220, 0.22);
  transition: transform 0.08s ease, background 0.1s ease, border-color 0.1s ease;
  user-select: none;
  -webkit-user-select: none;
}

.touch-action-btn:active,
.touch-action-btn.active {
  transform: scale(0.92);
  background: rgba(45, 212, 220, 0.35);
  border-color: #ffffff;
  box-shadow: 0 0 24px rgba(45, 212, 220, 0.6);
}

.touch-action-btn.boost-btn {
  border-color: var(--cyan);
  color: var(--cyan-bright);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

.touch-action-btn.boost-btn:active,
.touch-action-btn.boost-btn.active {
  background: rgba(0, 240, 255, 0.4);
  border-color: #ffffff;
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.7);
}

.touch-action-btn.weapon-btn {
  border-color: var(--amber);
  color: var(--amber);
  font-size: 0.60rem;
  box-shadow: 0 0 16px rgba(255, 183, 3, 0.25);
}

.touch-action-btn.weapon-btn:active,
.touch-action-btn.weapon-btn.active {
  background: rgba(255, 183, 3, 0.35);
  border-color: #ffffff;
  box-shadow: 0 0 24px rgba(255, 183, 3, 0.6);
}

.touch-action-btn.radar-btn {
  border-color: var(--cyan);
  font-size: 0.60rem;
}

.touch-action-btn.fire-btn {
  width: 68px;
  height: 68px;
  min-width: 64px;
  min-height: 64px;
  border: 2px solid var(--amber);
  color: var(--amber);
  font-size: 0.75rem;
  box-shadow: 0 0 20px rgba(232, 153, 26, 0.38);
}

.touch-action-btn.fire-btn:active,
.touch-action-btn.fire-btn.active {
  transform: scale(0.94);
  background: rgba(232, 153, 26, 0.42);
  border-color: #ffffff;
  box-shadow: 0 0 28px rgba(232, 153, 26, 0.85);
}

.touch-action-icon {
  font-size: 1.15rem;
  line-height: 1;
}

/* Hide touch action buttons on desktop mouse hover devices unless in touch mode */
@media (hover: hover) and (pointer: fine) {
  body:not([data-control-scheme="touch"]) .hud-touch-controls {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE LAYOUT (TABLET & MOBILE)
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .hud-sidebar-left,
  .hud-sidebar-right {
    width: 190px;
  }
}

@media (max-width: 768px) {
  .hud-layer {
    padding: 6px;
  }

  .hud-top-bar,
  .hud-bottom-bar {
    gap: 4px;
  }

  .hud-info-card {
    padding: 4px 6px;
  }

  .hud-label {
    font-size: 0.58rem;
  }

  .hud-value {
    font-size: 0.85rem;
  }

  .score-card .hud-value {
    font-size: 0.92rem;
  }

  .hud-theater-card {
    display: none; /* Conserve top space on mobile */
  }

  /* Compact side panels on mobile */
  .hud-sidebar-left {
    display: none; /* Canvas HUD renders pitch/heading/coordinates */
  }

  .hud-sidebar-right {
    width: 145px;
    gap: 4px;
  }

  .hud-sidebar-right .hud-data-panel {
    padding: 4px 6px;
  }

  .hud-touch-controls {
    bottom: 56px;
    right: 8px;
  }

  .hud-touch-right-actions {
    grid-template-columns: 50px 62px;
    grid-template-rows: 48px 62px;
    gap: 8px 10px;
  }

  .touch-action-btn {
    width: 48px;
    height: 48px;
  }

  .touch-action-btn.fire-btn {
    width: 62px;
    height: 62px;
  }
}

@media (max-width: 480px) {
  .hud-fps-card {
    display: none;
  }

  #btn-toggle-panels {
    min-width: unset;
    padding: 3px 5px;
    font-size: 0.62rem;
  }

  .hud-sidebar-right {
    width: 130px;
  }

  .hud-flight-telemetry {
    font-size: 0.65rem;
  }

  .hud-score-target {
    font-size: 0.48rem;
  }

  .hud-touch-controls {
    bottom: 50px;
    right: 6px;
  }

  .hud-touch-right-actions {
    grid-template-columns: 46px 58px;
    grid-template-rows: 44px 58px;
    gap: 6px 8px;
  }

  .touch-action-btn {
    width: 44px;
    height: 44px;
    font-size: 0.58rem;
  }

  .touch-action-btn.fire-btn {
    width: 58px;
    height: 58px;
    font-size: 0.68rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   LIVE HUD STAR INDICATOR & TACTICAL WAVE ALERT NOTIFIERS
   ═══════════════════════════════════════════════════════════════════ */

.hud-stars-indicator {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  margin-left: 6px;
  font-family: var(--font-heading, sans-serif);
  font-size: 0.95rem;
  letter-spacing: 2px;
}

.hud-stars-indicator .star-slot {
  color: rgba(255, 255, 255, 0.2);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hud-stars-indicator .star-slot.active {
  color: var(--amber, #ffb703);
  text-shadow: 0 0 10px rgba(255, 183, 3, 0.85);
  transform: scale(1.15);
}

/* Center-screen Tactical Wave Alert Banner (HTML Layer) */
.hud-wave-alert-box {
  position: absolute;
  top: 24%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 620px;
  padding: 16px 24px;
  background: rgba(5, 10, 18, 0.92);
  border: 1px solid var(--cyan-bright, #00f0ff);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.35), inset 0 0 25px rgba(0, 240, 255, 0.1);
  text-align: center;
  pointer-events: none;
  z-index: 50;
  animation: waveBannerPop 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hud-wave-alert-box.final-wave {
  border-color: var(--danger-red, #ff003c);
  box-shadow: 0 0 40px rgba(255, 0, 60, 0.45), inset 0 0 25px rgba(255, 0, 60, 0.15);
}

.hud-wave-alert-box.hvt-alert {
  border-color: #ff003c;
  background: rgba(20, 3, 7, 0.96);
  box-shadow: 0 0 55px rgba(255, 0, 60, 0.65), inset 0 0 35px rgba(255, 0, 60, 0.25);
  animation: hvtAlertStrobe 0.4s infinite alternate;
}

@keyframes hvtAlertStrobe {
  0% { border-color: #ff003c; box-shadow: 0 0 35px rgba(255, 0, 60, 0.45); }
  100% { border-color: #ffb703; box-shadow: 0 0 65px rgba(255, 0, 60, 0.85); }
}

.hud-layer.hvt-red-alert {
  animation: hudRedAlertPulse 0.5s infinite alternate;
}

@keyframes hudRedAlertPulse {
  0% { filter: drop-shadow(0 0 5px rgba(255, 0, 60, 0.3)); }
  100% { filter: drop-shadow(0 0 15px rgba(255, 0, 60, 0.75)); }
}

.hud-wave-alert-box.victory-wave {
  border-color: #10b981;
  box-shadow: 0 0 40px rgba(16, 185, 129, 0.45), inset 0 0 25px rgba(16, 185, 129, 0.15);
}

@keyframes waveBannerPop {
  0% { opacity: 0; transform: translate(-50%, -60%) scale(0.9); }
  60% { transform: translate(-50%, -50%) scale(1.02); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
}

.wave-alert-title {
  font-family: var(--font-heading, 'Orbitron', sans-serif);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--cyan-bright, #00f0ff);
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.8);
  margin-bottom: 4px;
}

.hud-wave-alert-box.final-wave .wave-alert-title {
  color: var(--danger-red, #ff003c);
  text-shadow: 0 0 16px rgba(255, 0, 60, 0.85);
}

.hud-wave-alert-box.hvt-alert .wave-alert-title {
  color: var(--danger-red, #ff003c);
  text-shadow: 0 0 20px rgba(255, 0, 60, 0.95);
}

.hud-wave-alert-box.victory-wave .wave-alert-title {
  color: #10b981;
  text-shadow: 0 0 16px rgba(16, 185, 129, 0.85);
}

.wave-alert-sub {
  font-family: var(--font-mono, 'Share Tech Mono', monospace);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-bright, #ffffff);
}

/* ═══════════════════════════════════════════════════════════════════
   MISSION COMPLETION CHOICE MODAL (PROCEED VS UNLIMITED SURVIVAL)
   ═══════════════════════════════════════════════════════════════════ */

.hud-completion-choice-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 580px;
  padding: 24px 28px;
  background: rgba(8, 14, 24, 0.96);
  border: 1px solid #10b981;
  box-shadow: 0 0 45px rgba(16, 185, 129, 0.35), inset 0 0 25px rgba(16, 185, 129, 0.1);
  text-align: center;
  z-index: 60;
  pointer-events: auto;
  animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalSlideUp {
  0% { opacity: 0; transform: translate(-50%, -42%) scale(0.95); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
}

.completion-modal-title {
  font-family: var(--font-heading, 'Orbitron', sans-serif);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #10b981;
  text-shadow: 0 0 16px rgba(16, 185, 129, 0.7);
  margin-bottom: 6px;
}

.completion-modal-desc {
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: 20px;
  line-height: 1.4;
  letter-spacing: 1px;
}

.completion-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.completion-modal-actions .console-btn {
  flex: 1 1 200px;
  padding: 10px 14px;
}

.pulse-green {
  animation: pulseGreenGlow 1.6s infinite alternate;
}

@keyframes pulseGreenGlow {
  0% {
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
    border-color: #10b981;
  }
  100% {
    box-shadow: 0 0 22px rgba(16, 185, 129, 0.9), inset 0 0 10px rgba(16, 185, 129, 0.4);
    border-color: #34d399;
  }
}

/* V2 mobile game HUD: overlay drawers, compact topbar, thumb-zone touch cluster */
.hud-top-bar { flex-wrap: wrap; }
.hud-layer button { touch-action: manipulation; }
@media (max-width: 768px) {
  .hud-layer {
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-left: calc(6px + env(safe-area-inset-left));
    padding-right: calc(6px + env(safe-area-inset-right));
  }
  .hud-top-bar { gap: 6px; }
  .hud-info-card { padding: 4px 8px; }
  /* Side panels become floating drawers so they never squeeze the playfield */
  .hud-mid-tactical-layout {
    position: absolute;
    top: 76px;
    left: 6px;
    right: 6px;
    bottom: 150px;
    margin: 0;
    pointer-events: none;
    z-index: 30;
    align-items: flex-start;
  }
  .hud-sidebar-left, .hud-sidebar-right {
    position: absolute;
    top: 0;
    display: flex;
    width: min(72vw, 240px);
    max-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(5, 8, 13, 0.88);
    border: 1px solid rgba(45, 212, 220, 0.25);
    padding: 6px;
    pointer-events: auto;
  }
  .hud-sidebar-left { left: 0; }
  .hud-sidebar-right { right: 0; }
  .hud-layer.hud-moving-hidden .hud-sidebar-left,
  .hud-layer.hud-moving-hidden .hud-sidebar-right { opacity: 0; visibility: hidden; transform: translateY(6px); pointer-events: none; }
  .hud-bottom-bar { flex-wrap: wrap; gap: 6px; }
  .hud-wave-alert-box { width: calc(100% - 24px); padding: 12px 14px; }
  .wave-alert-title { font-size: 1rem; }
  .wave-alert-sub { font-size: 0.62rem; }
}
@media (max-width: 480px) {
  /* Single compact top row: vitals + score + wave + pause */
  .hud-top-bar { flex-wrap: nowrap; gap: 4px; }
  .hud-top-bar .hud-info-card { padding: 3px 6px; min-width: 0; flex: 1 1 auto; }
  .hud-top-bar .hud-value { font-size: 0.8rem; }
  .hud-top-bar .hud-label { font-size: 0.52rem; }
  .hud-score-target, .hud-wave-detail { display: none; }
  .hud-stars-indicator { font-size: 0.7rem; letter-spacing: 1px; margin-left: 2px; }
  #hud-toggle-label { display: none; }
  #btn-toggle-panels { min-width: 44px; }
  /* Slim bottom bar: actions only */
  .hud-flight-telemetry { display: none; }
  .hud-bottom-bar { flex-wrap: nowrap; justify-content: flex-end; padding-bottom: env(safe-area-inset-bottom); }
  .hud-bottom-bar .console-btn { min-height: 44px; }
  /* Thumb-zone combat cluster above the bottom bar */
  .hud-touch-controls {
    bottom: calc(108px + env(safe-area-inset-bottom));
    right: calc(10px + env(safe-area-inset-right));
  }
  .hud-touch-right-actions {
    grid-template-columns: 52px 76px;
    grid-template-rows: 52px 76px;
    gap: 10px;
  }
  .touch-action-btn { width: 52px; height: 52px; font-size: 0.58rem; }
  .touch-action-btn.fire-btn { width: 76px; height: 76px; font-size: 0.72rem; }
  .hud-completion-choice-modal { width: calc(100% - 24px); padding: 18px; }
}
@media (pointer: coarse) {
  .touch-action-btn { min-width: 56px; min-height: 56px; }
  .weapon-slot-chip { min-height: 44px; min-width: 44px; }
  #btn-pause, #btn-toggle-panels { min-height: 44px; }
}
#game-canvas { touch-action: none; }
