/* =========================================================
   BoomArena — Game Screen
   ========================================================= */

.game-page {
  padding: 0;
  min-height: 100vh;
  background: #050510;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Game Top HUD ── */
.game-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  background: rgba(6, 6, 22, 0.82);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid rgba(0, 229, 255, 0.18);
  box-shadow: 0 4px 32px rgba(0,0,0,0.7), inset 0 1px 0 rgba(0,229,255,0.10);
  position: relative;
  z-index: 100;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.hud-back-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.hud-back-btn:hover {
  color: var(--neon-blue);
}

.hud-health {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.health-bar {
  width: 120px;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.health-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff88, #00e5ff);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.health-text {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: #00ff88;
}

.hud-center {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.hud-score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hud-score-label {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

.hud-score-value {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--neon-cyan);
}

.hud-timer {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0.3rem 1rem;
  border: 1px solid rgba(0,229,255,0.2);
  border-radius: 6px;
}

/* Target counter — TARGETS: alive/total */
.hud-objective {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 12px;
  border: 1px solid rgba(255,45,149,0.2);
  background: rgba(255,45,149,0.05);
}
.hud-obj-label {
  font-family: var(--font-display);
  font-size: 0.4rem;
  letter-spacing: 0.25em;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
}
.hud-obj-count {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: #ff2d95;
  letter-spacing: 0.06em;
  transition: color 0.4s ease;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.hud-powerups {
  display: flex;
  gap: 0.5rem;
}

.hud-powerup {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  position: relative;
}

.hud-powerup.active {
  border-color: var(--neon-blue);
  background: rgba(0, 229, 255, 0.1);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.hud-powerup-count {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neon-purple);
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.hud-pause-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: var(--transition-fast);
  cursor: pointer;
}

.hud-pause-btn:hover {
  border-color: var(--neon-blue);
  color: var(--neon-blue);
}

/* ── Game Canvas Area ── */
.game-canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* CRT scanline overlay over the canvas */
.game-canvas-container::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  /* thin scanlines */
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.055) 3px,
    rgba(0, 0, 0, 0.055) 4px
  );
  /* panel vignette */
  mask-image: radial-gradient(ellipse 90% 85% at 50% 50%, transparent 55%, black 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 85% at 50% 50%, transparent 55%, black 100%);
}

/* Chromatic aberration flicker on the canvas (subtle) */
#game-canvas {
  display: block;
  image-rendering: pixelated;
  /* Will be sized by JS */
}

/* ── Game Bottom HUD ── */
.game-hud-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.5rem;
  background: rgba(6, 6, 22, 0.82);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border-top: 1px solid rgba(0, 229, 255, 0.18);
  box-shadow: 0 -4px 32px rgba(0,0,0,0.7), inset 0 -1px 0 rgba(0,229,255,0.08);
  position: relative;
  z-index: 100;
}

.hud-minimap {
  width: 100px;
  height: 100px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0,0,0,0.5);
}

#minimap-canvas {
  width: 100%;
  height: 100%;
}

.hud-bomb-meter {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bomb-meter-label {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.bomb-meter-bar {
  width: 100px;
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 5px;
  overflow: hidden;
}

.bomb-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-orange), var(--neon-pink));
  border-radius: 5px;
  transition: width 0.3s ease;
}

.hud-controls-hint {
  display: flex;
  gap: 1rem;
}

.control-hint {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.control-key {
  padding: 0.15rem 0.5rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
}

/* ── Pause Overlay ── */
.game-pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 5, 16, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.game-pause-overlay.active {
  display: flex;
}

.pause-menu {
  text-align: center;
  max-width: 400px;
  width: 90%;
  margin: auto;
}

.pause-menu h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2rem;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pause-menu-btns {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pause-btn {
  padding: 0.9rem 2rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 8px;
  transition: var(--transition-fast);
}

.pause-btn-resume {
  background: var(--gradient-button);
  color: var(--bg-primary);
}

.pause-btn-resume:hover {
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.3);
  transform: translateY(-2px);
}

.pause-btn-quit {
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-secondary);
}

.pause-btn-quit:hover {
  border-color: var(--neon-pink);
  color: var(--neon-pink);
}

/* ── Game Over ── */
.game-over-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 5, 16, 0.95);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  display: none;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.game-over-overlay.active {
  display: flex;
}

.game-over-content {
  text-align: center;
  max-width: 500px;
  width: 92%;
  padding: 2rem;
  margin: auto;
}

.game-over-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.game-over-title.win {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-over-title.lose {
  color: var(--neon-pink);
}

.game-over-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(80px, 100%), 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.game-over-stat h4 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--neon-cyan);
}

.game-over-stat p {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.game-over-btns {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

/* ── Mobile Touch Controls ── */
.mobile-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  z-index: 200;
}

.mobile-dpad {
  display: grid;
  grid-template-columns: 60px 60px 60px;
  grid-template-rows: 60px 60px 60px;
  gap: 4px;
  position: absolute;
  left: 1.5rem;
  bottom: 1.5rem;
}

.dpad-btn {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--neon-blue);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.dpad-btn:active {
  background: rgba(0, 229, 255, 0.3);
}

.dpad-up    { grid-column: 2; grid-row: 1; }
.dpad-left  { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down  { grid-column: 2; grid-row: 3; }

.mobile-bomb-btn {
  position: absolute;
  right: 2rem;
  bottom: 3rem;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-orange), var(--neon-pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 0 30px rgba(255, 107, 53, 0.3);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.mobile-bomb-btn:active {
  transform: scale(0.9);
}

@media (max-width: 768px) {
  .mobile-controls {
    display: block;
  }

  .hud-controls-hint {
    display: none;
  }

  .game-hud-bottom {
    display: none;
  }

  .game-canvas-container {
    padding: 4px;
  }

  .game-hud-top {
    padding: 0.4rem 0.8rem;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .hud-left {
    gap: 0.8rem;
  }

  .health-bar {
    width: 80px;
  }

  #game-canvas {
    border-radius: 8px;
  }
}

@media (max-width: 480px) {
  .hud-center {
    gap: 0.6rem;
  }

  .hud-timer {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
  }

  .hud-powerups {
    display: none;
  }

  .hud-score-label {
    display: none;
  }

  .hud-back-btn span {
    display: none;
  }

  .game-hud-top {
    padding: 0.3rem 0.5rem;
  }

  .game-over-content {
    padding: 1.5rem;
  }

  .game-over-title {
    font-size: 2rem;
  }

  .game-over-stats {
    gap: 1rem;
    margin: 1rem 0;
  }

  .lc-title {
    font-size: 1.5rem;
  }

  .lc-stats {
    gap: 1rem;
    margin-bottom: 1.2rem;
  }

  .lc-val {
    font-size: 1.2rem;
  }

  .level-intro-level {
    font-size: 2.5rem;
  }
}

/* ═══════════════════════════════════════
   ██ Level Info HUD
   ═══════════════════════════════════════ */
.hud-level-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hud-level-value {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--neon-cyan);
  background: rgba(0,229,255,0.08);
  padding: 0.15rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(0,229,255,0.15);
}

.hud-chapter-name {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--neon-cyan);
  opacity: 0.7;
}

.hud-double-score {
  display: none;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 900;
  color: #ffe066;
  padding: 0.15rem 0.6rem;
  border-radius: 6px;
  background: rgba(255,224,102,0.12);
  border: 1px solid rgba(255,224,102,0.25);
  animation: pulseGold 1s infinite;
}

.hud-double-score.active {
  display: inline-block;
}

@keyframes pulseGold {
  0%, 100% { box-shadow: 0 0 8px rgba(255,224,102,0.2); }
  50% { box-shadow: 0 0 16px rgba(255,224,102,0.5); }
}

.hud-timer.danger {
  color: #ff2d95 !important;
  border-color: rgba(255,45,149,0.4) !important;
  animation: timerPulse 0.6s infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ═══════════════════════════════════════
   ██ Level Intro Overlay
   ═══════════════════════════════════════ */
.level-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 16, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.level-intro-overlay.active {
  display: flex;
  animation: fadeIn 0.4s ease;
}

.level-intro-content {
  text-align: center;
  animation: levelIntroPop 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes levelIntroPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.level-intro-chapter {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--chapter-color, var(--neon-cyan));
  margin-bottom: 0.5rem;
}

.level-intro-level {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--chapter-color, var(--neon-cyan)), #fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.level-intro-boss {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: #ff2d95;
  margin-bottom: 0.8rem;
  animation: bossGlow 0.8s infinite alternate;
}

@keyframes bossGlow {
  0% { text-shadow: 0 0 10px rgba(255,45,149,0.3); }
  100% { text-shadow: 0 0 25px rgba(255,45,149,0.7); }
}

.level-intro-subtitle {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.level-intro-narrative {
  max-width: 500px;
  margin: 0 auto;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  opacity: 0;
  animation: narrativeFadeIn 0.8s ease 0.5s forwards;
}

@keyframes narrativeFadeIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   ██ Level Complete Overlay
   ═══════════════════════════════════════ */
.level-complete-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 16, 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.level-complete-overlay.active {
  display: flex;
  animation: fadeIn 0.4s ease;
}

.level-complete-content {
  text-align: center;
  max-width: 500px;
  width: 92%;
  padding: 2rem;
  margin: auto;
  animation: levelIntroPop 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.lc-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
}

.lc-stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.lc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.lc-val {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--neon-cyan);
}

.lc-label {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.lc-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.lc-next {
  min-width: 180px;
}

.reward-confirmed {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: #00ffd5;
  margin-top: 0.5rem;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/*  Continue / Revive Button  */
.go-continue-wrap {
  margin: 1rem 0 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.go-continue-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 2rem;
  background: linear-gradient(135deg, #7a4800, #cc7a00);
  border: 2px solid #ffb300;
  color: #fff8e0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 0 18px rgba(255, 180, 0, 0.35);
  transition: all 0.2s;
}
.go-continue-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #a06000, #ffa000);
  box-shadow: 0 0 28px rgba(255, 180, 0, 0.55);
  transform: translateY(-1px);
}
.go-continue-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.6);
}
.go-continue-cost {
  font-size: 1.1rem;
}
.go-continue-balance {
  font-size: 0.78rem;
  color: #ff9966;
  text-align: center;
  margin: 0;
}
