/**
 * page_06_battle_stage2.css - Fully Responsive Battle Stage 2 Styles
 * Scales dynamically using CSS Container Query Units relative to #game-wrapper
 */

/* ==========================================================================
   1. MAIN LAYOUT & WRAPPERS
   ========================================================================== */

/* Main stage 2 wrapper container; relative positioning at z-index: 10 with 2cqmin padding */
.battle-stage2-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2cqmin;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  z-index: 10;
}

/* Hides the battle stage 2 wrapper container */
.battle-stage2-container.hidden {
  display: none !important;
}

/* Inner card frame; scaled with 0.35cqmin border, 1.8cqmin radius, 2.2cqmin padding, 1.5cqmin gap, and 1cqmin 3cqmin / 1.5cqmin shadows */
.battle-stage2-card {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  background-color: rgba(18, 10, 6, 0.95);
  border: 0.35cqmin solid var(--border-gold, #c89d38);
  border-radius: 1.8cqmin;
  padding: 2.2cqmin;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5cqmin;
  box-shadow: 0 1cqmin 3cqmin rgba(0, 0, 0, 0.9), 0 0 1.5cqmin rgba(200, 157, 56, 0.2);
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

/* ==========================================================================
   2. HUD HEADERS & TITLE LABELS
   ========================================================================== */

/* Header panel container; scaled with 0.8cqmin gap, 0.25cqmin border, 1.5cqmin radius, and 1.2cqmin 1.8cqmin padding */
.hud-header {
  display: flex;
  flex-direction: column;
  gap: 0.8cqmin;
  background: rgba(13, 8, 4, 0.6);
  border: 0.25cqmin solid rgba(200, 157, 56, 0.4);
  border-radius: 1.5cqmin;
  padding: 1.2cqmin 1.8cqmin;
  flex-shrink: 0;
}

/* Top and bottom layout rows within HUD header */
.hud-top-row,
.hud-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Base style for combatant name titles; scaled with 3.2cqmin font size */
.player-name-title {
  font-family: 'Cinzel', serif;
  font-size: 3.2cqmin;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Red color accent for enemy combatant title */
.enemy-title {
  color: #e74c3c;
}

/* Green color accent for user combatant title */
.user-title {
  color: #0055ff;
}

/* Red color override for enemy HUD label and health text */
.enemy-hud .enemy-label,
.enemy-hud .life-text {
  color: #e74c3c !important;
}

/* Green color override for user HUD label and health text */
.user-hud .user-label,
.user-hud .life-text {
  color: #0055ff !important;
}

/* ==========================================================================
   3. HEALTH BARS & DAMAGE ZONES
   ========================================================================== */

/* Flexbox wrapper for combatant heart icons; scaled with 0.8cqmin gap */
.hearts-container {
  display: flex;
  gap: 0.8cqmin;
}

/* Red heart icons for enemy status; scaled with 3.2cqmin font size */
.enemy-hearts .heart-icon {
  color: #e74c3c;
  font-size: 3.2cqmin;
}

/* Green heart icons for user status; scaled with 3.2cqmin font size */
.user-hearts .heart-icon {
  color: #0055ff;
  font-size: 3.2cqmin;
}

/* Damage zone layout container; scaled with 0.6cqmin gap */
.damage-zone-container {
  display: flex;
  flex-direction: column;
  gap: 0.6cqmin;
}

/* Row wrapper for damage zone title labels and percentage text; scaled to 2.5cqmin font size */
.damage-zone-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 2.5cqmin;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Color accent for enemy damage zone label */
.enemy-label {
  color: #e74c3c;
}

/* Color accent for user damage zone label */
.user-label {
  color: #0055ff;
}

/* Monospace text display for numeric health readout; scaled to 2.7cqmin font size */
.life-text {
  font-family: monospace;
  font-size: 2.7cqmin;
}

/* Outer track for health bar; scaled with 1.8cqmin height, 0.2cqmin border, 1cqmin radius, and 0.2cqmin padding */
.life-bar-track {
  width: 100%;
  height: 1.8cqmin;
  background-color: #120a06;
  border: 0.2cqmin solid rgba(200, 157, 56, 0.3);
  border-radius: 1cqmin;
  overflow: hidden;
  padding: 0.2cqmin;
  box-sizing: border-box;
}

/* Dynamic health bar fill element; scaled with 0.8cqmin radius and 0.3s ease-out width transition */
.life-bar-fill {
  height: 100%;
  border-radius: 0.8cqmin;
  transition: width 0.3s ease-out;
}

/* Red gradient fill for enemy health bar */
.enemy-fill {
  background: linear-gradient(90deg, #c0392b, #e74c3c);
}

/* Green gradient fill for user health bar */
.user-fill {
  background: linear-gradient(90deg, #0055ff, #0055ff);
}

/* ==========================================================================
   4. ARENA CANVAS & LAYERS
   ========================================================================== */

/* Main arena frame container; relative positioning, scaled with 0.35cqmin border, 1.5cqmin radius, and 3cqmin inset box-shadow */
.arena-container {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  aspect-ratio: 8 / 10;
  background-color: #080d1a;
  border: 0.35cqmin solid var(--border-gold, #c89d38);
  border-radius: 1.5cqmin;
  overflow: hidden;
  box-shadow: inset 0 0 3cqmin rgba(0, 0, 0, 0.8);
  align-self: center;
}

/* Base absolute overlay styling for stacked canvas layers */
.arena-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Static background canvas layer; positioned at z-index: 1 */
.static-layer {
  z-index: 1;
}

/* Dynamic active canvas layer; positioned at z-index: 2 with pointer-events disabled */
.dynamic-layer {
  z-index: 2;
  pointer-events: none;
}

/* ==========================================================================
   5. CONTROLS & ACTION BUTTONS
   ========================================================================== */

/* Control panel footer; 2-column grid layout scaled with 1.8cqmin gap and 0.5cqmin top margin */
.battle-stage2-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.8cqmin;
  margin-top: 0.5cqmin;
  flex-shrink: 0;
}

/* Interactive battle action buttons; scaled with 0.25cqmin border, 1.5cqmin radius, 1.8cqmin padding, 3.2cqmin font size, and 0.8cqmin 2cqmin shadow */
.stage2-btn {
  background: linear-gradient(180deg, #f3d078 0%, #c89d38 100%);
  color: #1a0f0a;
  border: 0.25cqmin solid #f3d078;
  border-radius: 1.5cqmin;
  padding: 1.8cqmin 0;
  font-family: 'Cinzel', serif;
  font-size: 3.2cqmin;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 0.8cqmin 2cqmin rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease, filter 0.2s ease;
}

/* Hover effect boosting button brightness */
.stage2-btn:hover {
  filter: brightness(1.1);
}

/* Active click state depressing button by 1px */
.stage2-btn:active {
  transform: translateY(1px);
}

/* ==========================================================================
   6. COUNTDOWN & OVERLAY SYSTEM
   ========================================================================== */

/* Pre-battle countdown overlay; absolute positioning at z-index: 500 with backdrop-filter blur (0.6cqmin) and opacity transitions */
.battle-stage2-overlay {
  position: absolute;
  inset: 0;
  z-index: 500;
  background-color: rgba(4, 2, 1, 0.85);
  backdrop-filter: blur(0.6cqmin);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  user-select: none;
  opacity: 1;
  transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

/* Hidden state for countdown overlay */
.battle-stage2-overlay.hidden {
  opacity: 0;
  pointer-events: none !important;
  visibility: hidden;
}

/* Large countdown timer display; scaled to 20cqmin font size with text shadow glow effects (5cqmin, 10cqmin) */
.countdown-display {
  font-family: 'Cinzel', serif;
  font-size: 20cqmin;
  font-weight: 900;
  color: #f3d078;
  text-shadow: 0 0 5cqmin rgba(243, 208, 120, 0.8), 0 0 10cqmin rgba(200, 157, 56, 0.4);
  letter-spacing: 0.05em;
  animation: countdownPulse 0.9s ease-out infinite;
}

/* Label text below countdown display; scaled to 3.2cqmin font size with 1.8cqmin top margin */
.countdown-label {
  font-family: 'Cinzel', serif;
  font-size: 3.2cqmin;
  font-weight: 700;
  color: #a88238;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  margin-top: 1.8cqmin;
}

/* Utility class to disable user interaction and text selection */
.controls-disabled {
  pointer-events: none !important;
  user-select: none !important;
}

/* Pulse animation keyframes modulating scale and opacity for countdown text */
@keyframes countdownPulse {
  0% {
    transform: scale(1.25);
    opacity: 0.3;
  }
  30% {
    transform: scale(1);
    opacity: 1;
  }
  80% {
    transform: scale(0.98);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.8;
  }
}

/* ==========================================================================
   7. SPECIAL EFFECTS & TRANSITION OVERLAYS
   ========================================================================== */

/* Screen transition overlay; fixed fullscreen positioning at top layer z-index: 9999 with 3s fade opacity transition */
.battle-stage2-fade-overlay {
  position: fixed;
  inset: 0;
  background-color: #000000;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 3s ease-in-out;
}

/* Active transition state enabling visibility and interactions */
.battle-stage2-fade-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Red radial damage vignette effect; absolute positioning at z-index: 600 with 9cqmin inset shadow */
.blood-damage-overlay {
  position: absolute;
  inset: 0;
  z-index: 600;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255, 0, 0, 0) 30%, rgba(180, 0, 0, 0.45) 70%, rgba(130, 0, 0, 0.8) 100%);
  box-shadow: inset 0 0 9cqmin rgba(220, 20, 20, 0.85);
  opacity: 0;
  transition: opacity 0.08s ease-in-out;
}

/* Active state making blood damage overlay visible */
.blood-damage-overlay.active {
  opacity: 1;
}