/*
 * ============================================================================
 * STYLE.CSS - MORTAL CHESS / King's Trial
 * Gothic Dark Theme - "Mortal Kombat meets Diablo I meets Chess"
 * ============================================================================
 *
 * TABLE OF CONTENTS
 * =================
 *
 * 1.  CSS VARIABLES .......................... Custom properties for theming
 *     - Z-Index Scale
 *     - Animation Durations
 *     - Theme Colors (backgrounds, text)
 *     - Brand Colors (gold, red)
 *     - Power-up Colors
 *     - Combo Colors
 *     - Spacing Scale
 *     - Typography
 *     - Border Radius
 *     - Tier Colors
 *     - Effect Colors
 *     - Common Gradients
 *
 * 2.  RESET & BASE ........................... Global resets, body styles
 *
 * 3.  LAYOUT ................................. Main structure
 *     - Game Container
 *     - Main Area
 *     - Bottom Bar
 *
 * 4.  HP BAR ................................. Health bar and related effects
 *     - HP Container & Bar
 *     - HP Fill & Danger State
 *     - Health/Shield/Second Wind Floaters
 *
 * 5.  SCORE & COMBO DISPLAY .................. Scoring system UI
 *     - Score Display
 *     - Score Popup
 *     - Combo Multiplier
 *     - Combo Section
 *
 * 6.  CHESS BOARD ............................ Board and piece styling
 *     - Board Container & Wrapper
 *     - Gothic Border
 *     - Boss Mode
 *     - Move Annotation
 *     - Square Colors
 *     - Highlights
 *
 * 7.  STAGE INFO ............................. Stage/position display
 *
 * 8.  POWER-UPS .............................. All power-up related styles
 *     - Inventory Items
 *     - Power-up Selection Overlay
 *     - Power-up Cards
 *     - Power-up Indicators (Shield, Timeout, etc.)
 *     - Lightning Targeting & Effects
 *     - Best Move Hints
 *
 * 9.  OVERLAYS ............................... Modal screens
 *     - Base Overlay
 *     - Menu Overlay (MORTAL CHESS title)
 *     - Loading Overlay
 *     - Death Overlay
 *     - Round/Stage Clear Overlays
 *     - Pause Menu
 *     - Shop Overlay
 *     - Leaderboard & Name Entry
 *
 * 10. GOLD DISPLAY ........................... Gold/currency UI
 *
 * 11. PIECE UPGRADES ......................... Upgrade system visuals
 *     - Tier Glow Effects
 *     - Upgrade Floaters & Popups
 *     - Upgrades Display Panel
 *
 * 12. SPEED COMBO SYSTEM ..................... Speed-based multiplier UI
 *     - Speed Multiplier Indicator
 *     - Speed Combo Indicator
 *     - Lightning Effects
 *
 * 13. VISUAL EFFECTS ......................... Damage & atmosphere
 *     - Damage Flash
 *     - Vignette
 *     - Screen Shake
 *     - Desaturation
 *     - Ember Particles
 *     - Blood Effects
 *     - Combo Decay
 *
 * 14. COMBO STREAK EFFECTS ................... Board glow effects by combo
 *     - Fire (combo 2-3)
 *     - Lightning (combo 4-5)
 *     - Golden (combo 6-7)
 *     - Godlike (combo 8)
 *     - Screen Edge Glow
 *
 * 15. MOVE EFFECTS ........................... Move trail and capture visuals
 *     - Move Trails
 *     - Capture Explosions
 *     - Excellent Move Bursts
 *
 * 16. ANNOUNCEMENTS .......................... Stage/boss announcements
 *
 * 17. ANIMATIONS (@keyframes) ................ All animation definitions
 *     (Note: Keyframes are kept near their usage for context)
 *
 * 18. RESPONSIVE BREAKPOINTS ................. Media queries
 *     - Tablet (768px)
 *     - Small Tablet (600px)
 *     - Small Phones (480px)
 *     - Very Small Phones (375px)
 *     - Landscape Mode
 *     - Touch Devices
 *
 * 19. ACCESSIBILITY .......................... Reduced motion, focus styles
 *
 * 20. CHESSBOARD.JS OVERRIDES ................ Library-specific fixes
 *
 * ============================================================================
 */

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

/* ===== CSS VARIABLES ===== */
:root {
  /* Z-Index Scale */
  --z-base: 1;
  --z-board-overlay: 10;
  --z-indicators: 30;
  --z-damage-flash: 50;
  --z-vignette: 55;
  --z-overlay: 100;
  --z-modal: 150;
  --z-announcement: 200;
  --z-tooltip: 300;

  /* Animation Durations */
  --anim-fast: 150ms;
  --anim-normal: 300ms;
  --anim-slow: 500ms;
  --anim-combo-break: 800ms;
  --anim-floater: 1500ms;
  --anim-announcement: 2000ms;

  /* Theme Colors */
  --color-bg-dark: #050505;
  --color-bg-card: #0a0805;
  --color-bg-overlay: rgba(20, 5, 5, 0.98);
  --color-text: #E8E4D9;
  --color-text-muted: #888888;
  --color-text-dim: #666666;

  /* Brand Colors */
  --color-gold: #FFD700;
  --color-gold-dark: #CC8800;
  --color-gold-glow: rgba(255, 215, 0, 0.5);
  --color-red-dark: #8B0000;
  --color-red-bright: #CC0000;
  --color-red-glow: rgba(139, 0, 0, 0.5);

  /* Power-up Colors */
  --color-shield: #00ccff;
  --color-timeout: #ff00ff;
  --color-lightning: #ffff00;
  --color-adrenaline: #ff4444;
  --color-ironskin: #ffaa00;
  --color-doublemove: #00ccff;
  --color-comboanchor: #00aacc;
  --color-criticalstrike: #ff8800;
  --color-bloodlust: #cc0000;

  /* Combo Colors */
  --combo-1: #888888;
  --combo-2: #00ff00;
  --combo-3: #00ff00;
  --combo-4: #ffff00;
  --combo-5: #ffaa00;
  --combo-6: #ff6600;
  --combo-7: #ff00ff;
  --combo-8: #00ffff;

  /* Spacing Scale */
  --space-xs: 5px;
  --space-sm: 10px;
  --space-md: 15px;
  --space-lg: 20px;
  --space-xl: 30px;

  /* Typography */
  --font-display: 'MedievalSharp', cursive;
  --font-body: 'Cinzel', serif;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 20px;
  --text-xl: 28px;
  --text-2xl: 48px;
  --text-3xl: 56px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 15px;

  /* Unified Button System */
  --btn-pad-y: 16px;
  --btn-pad-x: 45px;
  --btn-font-size: 18px;
  --btn-min-width: 180px;
  --btn-hover-scale: 1.05;
  --btn-active-scale: 0.95;
  --btn-hover-glow: 0 0 20px rgba(255, 215, 0, 0.3);

  /* Tier Colors (Piece Upgrades) */
  --tier-1: #00FF00;
  --tier-2: #00BFFF;
  --tier-3: #FFD700;

  /* Combo Effect Colors */
  --combo-fire: rgba(255, 100, 0, 0.3);
  --combo-lightning: rgba(0, 200, 255, 0.4);
  --combo-golden: rgba(255, 215, 0, 0.5);

  /* Common Gradients */
  --gradient-card: linear-gradient(180deg, #1a1a2a 0%, #0a0a15 100%);
  --gradient-btn-primary: linear-gradient(180deg, #CC0000 0%, #8B0000 100%);
  --gradient-btn-gold: linear-gradient(180deg, #CC8800 0%, #996600 100%);
  --gradient-btn-secondary: linear-gradient(180deg, #333 0%, #222 100%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--color-bg-dark);
  background-image:
    radial-gradient(ellipse at center, rgba(30, 0, 0, 0.3) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  background-blend-mode: overlay;
  color: var(--color-text);
  font-family: var(--font-body), 'Georgia', serif;
  overflow: hidden;
  min-height: 100vh;
}

#game-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* ===== HP BAR - Gothic Frame (Legacy - kept for fallback) ===== */
/* Note: Main HP bars are now in #dual-hp-container */

@keyframes hp-crack {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2) saturate(1.3); }
}

/* Health bonus floater */
.health-floater {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 28px;
  font-weight: bold;
  color: #00ff00;
  text-shadow: 0 0 15px #00ff00, 0 0 30px #00ff00;
  animation: health-float 1s ease-out forwards;
  pointer-events: none;
  z-index: 10;
  font-family: 'Cinzel', serif;
}

@keyframes health-float {
  0% {
    opacity: 1;
    transform: translateY(-50%) translateX(0) scale(1);
  }
  50% {
    transform: translateY(-50%) translateX(15px) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translateY(-50%) translateX(40px) scale(0.8);
  }
}

/* HP Restored floater (shows when HP resets between stages) */
.hp-restored-floater {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  font-weight: bold;
  color: #00ff88;
  text-shadow: 0 0 15px #00ff88, 0 0 30px #00ff88, 0 0 45px #00ff44;
  animation: hp-restored-float 1.5s ease-out forwards;
  pointer-events: none;
  z-index: 10;
  font-family: 'MedievalSharp', cursive;
  letter-spacing: 2px;
}

@keyframes hp-restored-float {
  0% {
    opacity: 0;
    transform: translateY(-50%) translateX(-20px) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translateY(-50%) translateX(0) scale(1.1);
  }
  70% {
    opacity: 1;
    transform: translateY(-50%) translateX(10px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-50%) translateX(30px) scale(0.9);
  }
}

/* Shield block floater */
.shield-block-floater {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: bold;
  color: #00ccff;
  text-shadow: 0 0 20px #00ccff, 0 0 40px #00ccff;
  animation: shield-block-pop 1s ease-out forwards;
  pointer-events: none;
  z-index: 100;
  font-family: 'MedievalSharp', cursive;
}

@keyframes shield-block-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  50% { transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8) translateY(-30px); }
}

/* Second wind floater */
.second-wind-floater {
  position: absolute;
  left: 50%;
  top: -30px;
  transform: translateX(-50%);
  font-size: 32px;
  font-weight: bold;
  color: #FFD700;
  text-shadow: 0 0 20px #FFD700, 0 0 40px #FF4500;
  animation: second-wind-rise 1.5s ease-out forwards;
  pointer-events: none;
  z-index: 100;
  font-family: 'MedievalSharp', cursive;
  white-space: nowrap;
}

@keyframes second-wind-rise {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.5); }
  20% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.2); }
  80% { opacity: 1; transform: translateX(-50%) translateY(-20px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(0.8); }
}

/* ===== MK-STYLE HEALTH BARS ===== */
#mk-health-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 80%, transparent 100%);
  z-index: var(--z-indicators);
  gap: 10px;
}

/* Fighter Sections */
.mk-fighter-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mk-fighter-section.mk-player {
  flex-direction: row; /* Portrait | Bar */
}

.mk-fighter-section.mk-enemy {
  flex-direction: row; /* Bar | Portrait */
}

/* Portraits */
.mk-portrait {
  width: 50px;
  height: 60px;
  border: 2px solid #8B7355;
  background: #1a1a1a;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.mk-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.mk-portrait img[src]:not([src=""]) {
  display: block;
}

.mk-portrait-fallback {
  font-size: 32px;
  color: gold;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* When image loads, hide fallback */
.mk-portrait img:not([style*="display: none"]) + .mk-portrait-fallback {
  display: none;
}

/* Bar Wrapper */
.mk-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Names */
.mk-name {
  font-family: 'MedievalSharp', serif;
  font-size: 14px;
  color: #d4af37;
  text-transform: uppercase;
  text-shadow: 1px 1px 2px #000;
  letter-spacing: 1px;
}

.mk-player .mk-name {
  text-align: left;
}

.mk-enemy .mk-name {
  text-align: right;
}

/* Health Bars */
.mk-health-bar {
  width: 280px;
  height: 24px;
  background: #1a1a1a;
  border: 2px solid #444;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
}

.mk-health-fill {
  height: 100%;
  width: 100%;
  transition: none; /* CHUNKY - no smooth transition */
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
}

.mk-health-drain {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: rgba(255, 255, 255, 0.6);
  z-index: 1;
  transition: width 0.4s ease-out; /* Drain animates slower */
}

/* RTL for enemy (fills from right) */
.mk-bar-rtl .mk-health-fill,
.mk-bar-rtl .mk-health-drain {
  left: auto;
  right: 0;
}

/* ===== HP COLOR GRADIENT CLASSES ===== */

/* HP > 60% - Green (safe) */
.mk-health-fill.hp-high {
  background: linear-gradient(90deg, #2d8f2d, #44cc44, #2d8f2d);
  box-shadow: 0 0 10px rgba(68, 204, 68, 0.4);
}

/* HP 30-60% - Yellow (caution) */
.mk-health-fill.hp-medium {
  background: linear-gradient(90deg, #b8a000, #e6c700, #b8a000);
  box-shadow: 0 0 10px rgba(230, 199, 0, 0.4);
}

/* HP 15-30% - Orange (danger) */
.mk-health-fill.hp-low {
  background: linear-gradient(90deg, #cc6600, #ff8800, #cc6600);
  box-shadow: 0 0 12px rgba(255, 136, 0, 0.5);
}

/* HP < 15% - Red flashing (critical) */
.mk-health-fill.hp-critical {
  background: linear-gradient(90deg, #aa0000, #ff0000, #aa0000);
  animation: mk-critical-flash 0.3s infinite;
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.6);
}

@keyframes mk-critical-flash {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

/* VS Emblem */
.mk-vs-emblem {
  font-family: 'MedievalSharp', serif;
  font-size: 24px;
  font-weight: bold;
  color: #ff4444;
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.8);
  padding: 0 15px;
}

/* Gold display repositioned for MK layout */
#mk-health-container #gold-display {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'MedievalSharp', serif;
  font-size: 18px;
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#mk-health-container #gold-icon {
  font-size: 20px;
}

/* ===== MK HEALTH BAR RESPONSIVE ===== */
@media (max-width: 768px) {
  #mk-health-container {
    padding: 8px 10px;
    gap: 5px;
  }

  .mk-health-bar {
    width: 180px;
    height: 20px;
  }

  .mk-portrait {
    width: 40px;
    height: 50px;
  }

  .mk-portrait-fallback {
    font-size: 24px;
  }

  .mk-name {
    font-size: 12px;
  }

  .mk-vs-emblem {
    font-size: 18px;
    padding: 0 8px;
  }

  #mk-health-container #gold-display {
    position: static;
    transform: none;
    font-size: 14px;
    margin-left: 10px;
  }
}

@media (max-width: 480px) {
  .mk-health-bar {
    width: 120px;
    height: 18px;
  }

  .mk-portrait {
    width: 35px;
    height: 42px;
  }

  .mk-portrait-fallback {
    font-size: 20px;
  }

  .mk-name {
    font-size: 12px;
  }

  .mk-vs-emblem {
    font-size: 14px;
    padding: 0 5px;
  }
}

/* Enemy HP Section (Top) */
#enemy-hp-section {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row-reverse; /* Name on right, bar fills from right */
}

#enemy-name {
  font-size: 14px;
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  color: #ff4444;
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
  min-width: 90px;
  text-align: left;
  letter-spacing: 1px;
}

#enemy-hp-bar {
  flex: 1;
  height: 24px;
  background: linear-gradient(180deg, #1a0a0a 0%, #0a0505 100%);
  border: 2px solid #5a1a1a;
  overflow: hidden;
  position: relative;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.8),
    0 0 8px rgba(255, 0, 0, 0.2);
}

#enemy-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #ff3333 0%, #cc0000 50%, #880000 100%);
  transition: width 0.15s ease-out;
  position: relative;
  box-shadow: 0 0 12px rgba(255, 0, 0, 0.4);
  /* Fills from RIGHT to LEFT (transform origin on right) */
  transform-origin: right center;
}

/* Enemy HP fills from right - we use a wrapper trick */
#enemy-hp-bar {
  direction: rtl; /* Makes the fill go from right to left */
}

#enemy-hp-fill {
  direction: ltr; /* Reset text direction if needed */
}

#enemy-hp-text {
  font-size: 14px;
  font-weight: bold;
  min-width: 70px;
  text-align: right;
  font-family: 'Cinzel', serif;
  color: #ff6666;
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
}

/* Enemy HP Danger State (<35%) */
#enemy-hp-fill.danger {
  background: linear-gradient(180deg, #ff6666 0%, #ff3333 50%, #cc0000 100%);
  animation: enemy-hp-pulse 0.8s infinite;
}

/* Enemy HP Critical State (<20%) - FINISH HIM mode */
#enemy-hp-fill.critical {
  background: linear-gradient(180deg, #ff9999 0%, #ff4444 50%, #cc0000 100%);
  animation: enemy-hp-critical 0.3s infinite;
}

@keyframes enemy-hp-pulse {
  0%, 100% { filter: brightness(1); box-shadow: 0 0 12px rgba(255, 0, 0, 0.4); }
  50% { filter: brightness(1.2); box-shadow: 0 0 20px rgba(255, 0, 0, 0.6); }
}

@keyframes enemy-hp-critical {
  0%, 100% { filter: brightness(1); box-shadow: 0 0 15px rgba(255, 0, 0, 0.6); }
  50% { filter: brightness(1.4); box-shadow: 0 0 30px rgba(255, 100, 100, 0.8); }
}

/* VS Indicator */
#vs-indicator {
  font-size: 16px;
  font-weight: 900;
  font-family: 'MedievalSharp', cursive;
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.8);
  padding: 2px 15px;
  letter-spacing: 3px;
}

/* Player HP Section (Bottom) */
#player-hp-section {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

#player-name {
  font-size: 14px;
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  color: #44ff44;
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
  min-width: 90px;
  text-align: right;
  letter-spacing: 1px;
}

/* Update existing HP bar to be green-tinted for player */
#player-hp-section #hp-bar {
  flex: 1;
  height: 24px;
  background: linear-gradient(180deg, #0a1a0a 0%, #050a05 100%);
  border: 2px solid #1a5a1a;
  overflow: hidden;
  position: relative;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.8),
    0 0 8px rgba(0, 255, 0, 0.2);
}

#player-hp-section #hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #44CC44 0%, #228B22 50%, #006400 100%);
  transition: width 0.1s linear;
  position: relative;
  box-shadow: 0 0 12px rgba(0, 255, 0, 0.3);
}

#player-hp-section #hp-fill.danger {
  background: linear-gradient(180deg, #FF6600 0%, #CC4400 50%, #883300 100%);
  animation: hp-pulse 0.5s infinite, hp-crack 0.3s infinite;
  box-shadow: 0 0 15px rgba(255, 100, 0, 0.4);
}

#player-hp-section #hp-text {
  font-size: 14px;
  font-weight: bold;
  min-width: 70px;
  text-align: left;
  font-family: 'Cinzel', serif;
  color: #66ff66;
  text-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
}

/* Enemy damage floater */
.enemy-damage-floater {
  position: absolute;
  font-size: 32px;
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  color: #ff4444;
  text-shadow: 0 0 15px #ff0000, 0 0 30px #ff0000;
  animation: enemy-damage-float 1.2s ease-out forwards;
  pointer-events: none;
  z-index: 50;
}

@keyframes enemy-damage-float {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  30% {
    transform: translateY(-15px) scale(1.3);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(0.8);
  }
}

/* Enemy heal floater */
.enemy-heal-floater {
  position: absolute;
  font-size: 24px;
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  color: #44ff44;
  text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00;
  animation: enemy-heal-float 1s ease-out forwards;
  pointer-events: none;
  z-index: 50;
}

@keyframes enemy-heal-float {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-10px) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateY(-25px) scale(0.9);
  }
}

/* K.O. Victory Announcement */
.ko-announcement {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 120px;
  font-weight: 900;
  font-family: 'MedievalSharp', cursive;
  color: #ff0000;
  text-shadow:
    0 0 50px #ff0000,
    0 0 100px #ff0000,
    0 0 150px #ff4400,
    0 4px 8px rgba(0, 0, 0, 0.8);
  animation: ko-pop 2s ease-out forwards;
  z-index: var(--z-announcement);
  letter-spacing: 10px;
}

@keyframes ko-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.4);
  }
  40% {
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.2);
  }
}

/* FINISH HIM Announcement (Enemy HP < 20%) */
.announcement.finish-him-enemy {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 48px;
  font-weight: 900;
  font-family: 'MedievalSharp', cursive;
  color: #ff0000;
  text-shadow:
    0 0 30px #ff0000,
    0 0 60px #ff0000,
    0 2px 4px rgba(0, 0, 0, 0.8);
  animation: finish-him-pulse 0.5s infinite alternate, finish-him-entrance 0.5s ease-out;
  z-index: var(--z-announcement);
  letter-spacing: 5px;
}

@keyframes finish-him-entrance {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.5);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}

@keyframes finish-him-pulse {
  0% {
    filter: brightness(1);
    text-shadow: 0 0 30px #ff0000, 0 0 60px #ff0000;
  }
  100% {
    filter: brightness(1.3);
    text-shadow: 0 0 50px #ff4400, 0 0 100px #ff0000;
  }
}

/* ===== MAIN AREA ===== */
#main-area {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  flex: 1;
  padding: 10px;
  padding-top: 90px; /* Space for fixed health bar */
  max-width: 900px;
  margin: 0 auto;
}

/* Board wrapper now contains powerups - centered in layout */
#board-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  touch-action: none;  /* Prevent scroll while interacting with board */
}

/* Stage container - appears to the RIGHT of the board */
#stage-container {
  width: 150px;
  text-align: center;
  flex-shrink: 0;
}

/* Resign button */
#resign-button {
  margin-top: 20px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--color-danger, #ff4444);
  color: var(--color-danger, #ff4444);
  font-family: var(--font-display, 'Courier New', monospace);
  font-size: 0.7rem;
  letter-spacing: 1px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, background 0.2s;
}

#resign-button:hover {
  opacity: 1;
  background: rgba(255, 68, 68, 0.15);
}

#resign-button.hidden {
  display: none;
}

/* Powerups container - directly under board */
#powerups-container {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 5px;
}

/* ===== SCORE & COMBO DISPLAY ===== */
/* Score now integrated into stage-container */
#score-section {
  margin-top: 15px;
  text-align: center;
  position: relative; /* For score-popup positioning */
}

/* Score display - prominent, scales with combo */
#score-display {
  font-size: var(--text-2xl);
  font-weight: 900;
  font-family: var(--font-display);
  color: var(--color-gold);
  text-shadow: 0 0 20px var(--color-gold-glow), 0 2px 4px rgba(0, 0, 0, 0.8);
  line-height: 1;
  transition: transform 0.3s ease-out, color 0.3s, text-shadow 0.3s;
  transform-origin: center;
}

/* Combo-based score colors */
#score-display[data-combo="2"] {
  color: #90EE90;
  text-shadow: 0 0 20px rgba(144, 238, 144, 0.6), 0 2px 4px rgba(0, 0, 0, 0.8);
}
#score-display[data-combo="3"] {
  color: #00BFFF;
  text-shadow: 0 0 25px rgba(0, 191, 255, 0.7), 0 2px 4px rgba(0, 0, 0, 0.8);
}
#score-display[data-combo="4"] {
  color: #9370DB;
  text-shadow: 0 0 25px rgba(147, 112, 219, 0.7), 0 2px 4px rgba(0, 0, 0, 0.8);
}
#score-display[data-combo="5"] {
  color: #FF69B4;
  text-shadow: 0 0 30px rgba(255, 105, 180, 0.8), 0 2px 4px rgba(0, 0, 0, 0.8);
}
#score-display[data-combo="6"] {
  color: #FF4500;
  text-shadow: 0 0 30px rgba(255, 69, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.8);
}
#score-display[data-combo="7"] {
  color: #FF0000;
  text-shadow: 0 0 35px rgba(255, 0, 0, 0.9), 0 0 60px rgba(255, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.8);
}
#score-display[data-combo="8"] {
  color: #FFFFFF;
  text-shadow: 0 0 40px rgba(255, 255, 255, 1), 0 0 80px rgba(255, 215, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.8);
  animation: godlike-score 0.5s infinite alternate;
}

@keyframes godlike-score {
  0% { text-shadow: 0 0 40px rgba(255, 255, 255, 1), 0 0 80px rgba(255, 215, 0, 0.8); }
  100% { text-shadow: 0 0 60px rgba(255, 255, 255, 1), 0 0 100px rgba(255, 100, 0, 1); }
}

#score-display.pulse {
  animation: score-pulse 0.3s ease-out;
}

@keyframes score-pulse {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}

#score-label {
  font-size: var(--text-xs);
  font-family: var(--font-body);
  color: var(--color-text-muted);
  letter-spacing: 3px;
  margin-bottom: var(--space-sm);
}

/* Score popup for points earned */
#score-popup {
  position: absolute;
  top: 0;
  right: -10px;
  font-size: 24px;
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  color: #00FF00;
  text-shadow: 0 0 10px #00FF00;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
}

/* Combo-based popup colors and sizes */
#score-popup[data-combo="2"] { font-size: 26px; color: #90EE90; text-shadow: 0 0 12px #90EE90; }
#score-popup[data-combo="3"] { font-size: 28px; color: #00BFFF; text-shadow: 0 0 14px #00BFFF; }
#score-popup[data-combo="4"] { font-size: 30px; color: #9370DB; text-shadow: 0 0 16px #9370DB; }
#score-popup[data-combo="5"] { font-size: 32px; color: #FF69B4; text-shadow: 0 0 18px #FF69B4; }
#score-popup[data-combo="6"] { font-size: 34px; color: #FF4500; text-shadow: 0 0 20px #FF4500; }
#score-popup[data-combo="7"] { font-size: 36px; color: #FF0000; text-shadow: 0 0 25px #FF0000; }
#score-popup[data-combo="8"] { font-size: 40px; color: #FFFFFF; text-shadow: 0 0 30px #FFFFFF, 0 0 50px #FFD700; }

#score-popup.show {
  animation: score-popup-rise 1.1s ease-out forwards;
}

@keyframes score-popup-rise {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateY(-20px) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(0.8);
  }
}

/* ===== SCORE BREAKDOWN (Balatro-style) ===== */
.score-breakdown {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, rgba(20, 15, 30, 0.97) 0%, rgba(10, 5, 15, 0.98) 100%);
  border: 3px solid #8B7355;
  border-radius: 12px;
  padding: 20px 30px;
  min-width: 280px;
  z-index: var(--z-modal);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(139, 115, 85, 0.3), inset 0 0 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  animation: breakdown-appear 0.3s ease-out forwards;
  pointer-events: none;
}

@keyframes breakdown-appear {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.score-breakdown.fade-out {
  animation: breakdown-disappear 0.3s ease-in forwards;
}

@keyframes breakdown-disappear {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

.breakdown-header {
  font-family: 'MedievalSharp', cursive;
  font-size: 16px;
  color: #d4af37;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(139, 115, 85, 0.5);
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.breakdown-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breakdown-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateX(30px);
}

.breakdown-line.show {
  animation: breakdown-line-slide 0.25s ease-out forwards;
}

@keyframes breakdown-line-slide {
  0% {
    opacity: 0;
    transform: translateX(30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.breakdown-line .label {
  color: #aaa;
  font-size: 14px;
}

.breakdown-line .value {
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  font-size: 18px;
  min-width: 80px;
  text-align: right;
}

/* Base points - white */
.breakdown-line.base .value {
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Combo multiplier - cyan */
.breakdown-line.combo .label {
  color: #00FFFF;
}
.breakdown-line.combo .value {
  color: #00FFFF;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
}

/* Piece multiplier - gold */
.breakdown-line.piece .label {
  color: #FFD700;
}
.breakdown-line.piece .value {
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

/* Eval multiplier - green */
.breakdown-line.eval .label {
  color: #00FF00;
}
.breakdown-line.eval .value {
  color: #00FF00;
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.6);
}

/* Speed multiplier - magenta */
.breakdown-line.speed .label {
  color: #FF00FF;
}
.breakdown-line.speed .value {
  color: #FF00FF;
  text-shadow: 0 0 10px rgba(255, 0, 255, 0.6);
}

/* Final total line */
.breakdown-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 12px 15px;
  background: linear-gradient(90deg, rgba(139, 115, 85, 0.2) 0%, rgba(212, 175, 55, 0.3) 50%, rgba(139, 115, 85, 0.2) 100%);
  border: 2px solid #8B7355;
  border-radius: 8px;
  opacity: 0;
  transform: scale(0.9);
}

.breakdown-total.show {
  animation: breakdown-total-reveal 0.4s ease-out forwards;
}

@keyframes breakdown-total-reveal {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.breakdown-total.pulse {
  animation: breakdown-total-pulse 0.6s ease-out;
}

@keyframes breakdown-total-pulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 50px rgba(255, 100, 0, 0.5);
  }
}

.breakdown-total .label {
  font-family: 'MedievalSharp', cursive;
  font-size: 18px;
  color: #d4af37;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.breakdown-total .value {
  font-family: 'MedievalSharp', cursive;
  font-size: 28px;
  font-weight: bold;
  color: #FFD700;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 100, 0, 0.5);
}

/* Rolling counter animation class */
.rolling-counter {
  display: inline-block;
  transition: none;
}

/* Big score "wow" effects */
.score-breakdown.wow {
  border-color: #FFD700;
  box-shadow: 0 0 60px rgba(255, 215, 0, 0.6), 0 0 100px rgba(255, 100, 0, 0.4), inset 0 0 40px rgba(255, 215, 0, 0.1);
}

.score-breakdown.wow .breakdown-header {
  color: #FFD700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  animation: wow-header-glow 0.5s infinite alternate;
}

@keyframes wow-header-glow {
  0% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
  100% { text-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 50px rgba(255, 100, 0, 0.8); }
}

/* Particle burst container for wow moments */
.breakdown-particles {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.breakdown-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFD700;
  box-shadow: 0 0 10px #FFD700;
  animation: particle-burst 0.8s ease-out forwards;
}

@keyframes particle-burst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0);
  }
}

/* Combo section */
#combo-section {
  border-top: 1px solid rgba(255, 215, 0, 0.2);
  padding-top: 10px;
  margin-top: 5px;
}

#combo-multiplier {
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  font-family: 'MedievalSharp', cursive;
  color: #888;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  transition: color 0.3s, text-shadow 0.3s;
}

/* Combo tier colors */
#combo-multiplier[data-tier="2"] {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#combo-multiplier[data-tier="3"] {
  color: #00ff00;
  text-shadow: 0 0 15px #00ff00;
}

#combo-multiplier[data-tier="4"] {
  color: #FF8C00;
  text-shadow: 0 0 20px #FF8C00;
}

#combo-multiplier[data-tier="5"] {
  color: #FF4500;
  text-shadow: 0 0 25px #FF4500, 0 0 50px #FF0000;
  animation: combo-fire 0.5s infinite;
}

#combo-multiplier[data-tier="6"] {
  color: #00FFFF;
  text-shadow: 0 0 30px #00FFFF, 0 0 60px #0088FF;
  animation: combo-surgical 0.4s infinite;
}

#combo-multiplier[data-tier="7"] {
  color: #FF00FF;
  text-shadow: 0 0 35px #FF00FF, 0 0 70px #8800FF;
  animation: combo-fire 0.3s infinite;
}

#combo-multiplier[data-tier="8"] {
  color: #FFD700;
  text-shadow: 0 0 50px #FFD700, 0 0 100px #FF4500, 0 0 150px #FF0000;
  animation: combo-godlike 0.2s infinite;
}

@keyframes combo-surgical {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.4) hue-rotate(10deg); }
}

@keyframes combo-fire {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

@keyframes combo-godlike {
  0%, 100% {
    filter: brightness(1) hue-rotate(0deg);
    transform: scale(1);
  }
  50% {
    filter: brightness(1.5) hue-rotate(10deg);
    transform: scale(1.05);
  }
}

#combo-multiplier.pulse {
  animation: combo-pulse 0.25s ease-out;
}

#combo-name {
  font-size: 20px;
  color: #FFD700;
  min-height: 28px;
  margin-top: 8px;
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  text-shadow: 0 0 10px currentColor;
  letter-spacing: 2px;
}

/* ===== CHESS BOARD ===== */
#board-container {
  /* Responsive board sizing - larger default, constrained by viewport */
  width: min(500px, 50vh, 50vw);
  height: min(500px, 50vh, 50vw);
  aspect-ratio: 1;
  touch-action: none;  /* Prevent scroll/zoom while dragging pieces */
  -webkit-user-select: none;
  user-select: none;
}

/* Gothic board border */
#board-container::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border: 4px solid #3a1a1a;
  border-image: linear-gradient(135deg, #5a2a2a, #1a0a0a, #5a2a2a) 1;
  pointer-events: none;
  z-index: 1;
}

/* Boss stage glow */
#board-container.boss-mode::after {
  content: '';
  position: absolute;
  top: -20px;
  left: -20px;
  right: -20px;
  bottom: -20px;
  box-shadow: 0 0 60px rgba(255, 0, 0, 0.6), inset 0 0 60px rgba(255, 0, 0, 0.3);
  pointer-events: none;
  animation: boss-glow 2s infinite;
  z-index: 0;
}

@keyframes boss-glow {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ===== MOVE ANNOTATION ===== */
#move-annotation {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 140px;
  font-weight: 900;
  pointer-events: none;
  z-index: 30;
  font-family: 'MedievalSharp', cursive;
  text-shadow: 0 0 20px currentColor, 0 4px 8px rgba(0,0,0,0.8);
  opacity: 0;
}

#move-annotation.hidden {
  display: none;
}

#move-annotation.show {
  animation: annotation-pop 2s ease-out forwards;
}

#move-annotation.brilliant {
  color: #00ffff;
  text-shadow: 0 0 40px #00ffff, 0 0 80px #00ffff, 0 4px 8px rgba(0,0,0,0.8);
}

#move-annotation.good {
  color: #00ff00;
  text-shadow: 0 0 30px #00ff00, 0 0 60px #00ff00, 0 4px 8px rgba(0,0,0,0.8);
}

#move-annotation.free {
  color: #00ddff;
  font-size: 3rem;
  text-shadow: 0 0 30px #00ddff, 0 0 60px #00ddff, 0 4px 8px rgba(0,0,0,0.8);
}

#move-annotation.inaccuracy {
  color: #ffaa00;
  text-shadow: 0 0 25px #ffaa00, 0 4px 8px rgba(0,0,0,0.8);
}

#move-annotation.mistake {
  color: #ff6600;
  text-shadow: 0 0 30px #ff6600, 0 4px 8px rgba(0,0,0,0.8);
}

#move-annotation.blunder {
  color: #ff0000;
  text-shadow: 0 0 50px #ff0000, 0 0 100px #ff0000, 0 4px 8px rgba(0,0,0,0.8);
  animation: annotation-pop-blunder 2s ease-out forwards;
}

@keyframes annotation-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.3);
  }
  20% {
    transform: translate(-50%, -50%) scale(1);
  }
  85% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8) translateY(-30px);
  }
}

@keyframes annotation-pop-blunder {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  8% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.5) rotate(-5deg);
  }
  15% {
    transform: translate(-50%, -50%) scale(1.2) rotate(3deg);
  }
  22% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8) translateY(-30px);
  }
}

/* Override chessboard.js colors for dark gothic theme */
.board-b72b1 {
  border: 3px solid #3a1a1a;
}

/* Dark squares - deep blood wood */
.square-55d63.black-3c85d {
  background-color: #1a2a1a !important;
}

/* Light squares - aged bone */
.square-55d63.white-1e1d7 {
  background-color: #4a5a4a !important;
}

/* Highlight squares */
.highlight-white {
  box-shadow: inset 0 0 5px 5px rgba(255, 204, 0, 0.6);
}

.highlight-black {
  box-shadow: inset 0 0 5px 5px rgba(255, 204, 0, 0.6);
}

/* ===== STAGE INFO ===== */
#stage-number {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 15px;
  font-family: 'MedievalSharp', cursive;
  color: #E8E4D9;
  text-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
  letter-spacing: 1px;
}

#stage-number.boss {
  color: #FF0000;
  text-shadow: 0 0 20px #FF0000, 0 0 40px #8B0000;
  animation: boss-text-pulse 1s infinite;
}

@keyframes boss-text-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

#position-info {
  font-size: 16px;
  color: #888;
  margin-bottom: 8px;
  font-family: 'Cinzel', serif;
}

/* Hidden - KO-based victory system, no move counter needed */
#moves-remaining {
  display: none;
}

/* Inventory items - compact clickable power-up buttons */
.inventory-item {
  background: linear-gradient(180deg, rgba(40, 30, 50, 0.9) 0%, rgba(20, 15, 30, 0.95) 100%);
  border: 2px solid #555;
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 40px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  user-select: none;
  position: relative;
  font-size: 18px;
  animation: inventory-pulse 2s ease-in-out infinite;
}

.inventory-item .inventory-icon {
  font-size: 20px;
}

.inventory-item .inventory-name {
  display: none; /* Hide name to keep compact */
}

.inventory-item::before {
  content: 'CLICK!';
  position: absolute;
  top: -8px;
  right: -8px;
  background: #FF4500;
  color: white;
  font-size: 9px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 8px;
  font-family: 'Cinzel', serif;
  animation: click-bounce 1s ease-in-out infinite;
}

@keyframes click-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes inventory-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 255, 255, 0.1); }
  50% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.2); }
}

.inventory-item:hover {
  transform: translateY(-5px) scale(1.05);
  animation: none;
}

.inventory-item:active {
  transform: translateY(-2px) scale(1.02);
}

.inventory-item[data-powerup="shield"] {
  border-color: #00ccff;
  box-shadow: 0 0 15px rgba(0, 204, 255, 0.3);
}

.inventory-item[data-powerup="shield"]:hover {
  border-color: #00ffff;
  box-shadow: 0 8px 30px rgba(0, 204, 255, 0.5);
  background: linear-gradient(180deg, rgba(0, 80, 100, 0.9) 0%, rgba(0, 40, 60, 0.95) 100%);
}

.inventory-item[data-powerup="shield"]::before {
  background: #00ccff;
}

.inventory-item[data-powerup="timeout"] {
  border-color: #ff00ff;
  box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
}

.inventory-item[data-powerup="timeout"]:hover {
  border-color: #ff66ff;
  box-shadow: 0 8px 30px rgba(255, 0, 255, 0.5);
  background: linear-gradient(180deg, rgba(80, 0, 80, 0.9) 0%, rgba(40, 0, 40, 0.95) 100%);
}

.inventory-item[data-powerup="timeout"]::before {
  background: #ff00ff;
}

.inventory-icon {
  font-size: 32px;
}

.inventory-name {
  font-size: 14px;
  font-weight: bold;
  color: #E8E4D9;
  font-family: 'MedievalSharp', cursive;
  letter-spacing: 1px;
}

/* ===== OVERLAYS ===== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, rgba(20, 5, 5, 0.98) 0%, rgba(5, 0, 0, 0.99) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-overlay);
  opacity: 1;
  visibility: visible;
  transition: opacity var(--anim-normal) ease, visibility var(--anim-normal) ease;
}

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

.overlay h1 {
  font-size: 56px;
  margin-bottom: 15px;
  letter-spacing: 4px;
  font-family: 'MedievalSharp', cursive;
  color: #CC0000;
  text-shadow: 0 0 30px #8B0000, 0 4px 8px rgba(0, 0, 0, 0.8);
}

/* MORTAL CHESS Title */
.game-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
  animation: title-pulse 3s ease-in-out infinite;
}

.title-mortal {
  font-family: 'MedievalSharp', cursive;
  font-size: 72px;
  font-weight: bold;
  letter-spacing: 12px;
  color: #FFD700;
  text-shadow:
    0 0 10px #FF6600,
    0 0 20px #FF4400,
    0 0 40px #CC0000,
    0 0 80px #880000,
    4px 4px 0 #000;
  animation: mortal-flicker 0.1s infinite;
}

.title-chess {
  font-family: 'Cinzel', serif;
  font-size: 96px;
  font-weight: 900;
  letter-spacing: 20px;
  color: #FFFFFF;
  text-shadow:
    0 0 20px #CC0000,
    0 0 40px #880000,
    0 0 60px #660000,
    0 0 100px #440000,
    6px 6px 0 #000;
  margin-top: -10px;
}

@keyframes title-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes mortal-flicker {
  0%, 90%, 100% { opacity: 1; }
  92%, 98% { opacity: 0.9; }
}

.overlay .tagline {
  font-size: 20px;
  color: #666;
  margin-bottom: 30px;
  font-family: 'Cinzel', serif;
  font-style: italic;
}

.overlay p {
  font-size: 22px;
  margin-bottom: var(--space-sm);
  font-family: var(--font-body);
  color: var(--color-text);
}

.overlay button {
  margin-top: var(--space-xl);
  padding: var(--btn-pad-y) 60px;
  font-size: 24px;
  background: var(--gradient-btn-primary);
  color: var(--color-text);
  border: 3px solid #5a2a2a;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: bold;
  letter-spacing: 3px;
  transition: all 0.2s;
  min-width: var(--btn-min-width);
  box-shadow: 0 0 20px var(--color-red-glow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.overlay button:hover {
  background: linear-gradient(180deg, #FF0000 0%, #CC0000 100%);
  transform: scale(var(--btn-hover-scale));
  box-shadow: 0 0 40px rgba(255, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.overlay button:active {
  transform: scale(var(--btn-active-scale));
}

/* Loading overlay */
#loading-overlay {
  z-index: 150;
}

#loading-status {
  color: #666;
  font-family: 'Cinzel', serif;
}

/* Death overlay - dramatic */
#death-overlay h1 {
  font-size: 64px;
  color: #8B0000;
  animation: death-title 1s ease-out;
}

@keyframes death-title {
  0% {
    opacity: 0;
    transform: scale(2) translateY(-50px);
    filter: blur(10px);
  }
  50% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

/* Round clear overlay */
#round-clear-overlay {
  background: radial-gradient(ellipse at center, rgba(0, 50, 0, 0.95) 0%, rgba(0, 20, 0, 0.98) 100%);
}

#round-clear-overlay h1 {
  color: #00ff00;
  text-shadow: 0 0 40px #00ff00, 0 0 80px #008800;
  animation: round-clear-text 0.5s ease-out;
}

/* Stage clear overlay */
#stage-clear-overlay {
  background: radial-gradient(ellipse at center, rgba(50, 30, 0, 0.95) 0%, rgba(20, 10, 0, 0.98) 100%);
}

#stage-clear-overlay h1 {
  color: #FFD700;
  text-shadow: 0 0 40px #FFD700, 0 0 80px #FF8C00;
}

/* ===== VISUAL EFFECTS ===== */
#damage-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-color: transparent;
  z-index: 50;
}

#damage-flash.flash-light {
  animation: flash-light 0.15s ease-out;
}

#damage-flash.flash-medium {
  animation: flash-medium 0.2s ease-out;
}

#damage-flash.flash-heavy {
  animation: flash-heavy 0.4s ease-out;
}

#vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.7);
}

#vignette.danger {
  animation: vignette-danger 0.8s infinite;
}

/* Low HP screen darkening */
#vignette.critical {
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.5) 100%);
  animation: vignette-critical 0.5s infinite;
}

@keyframes vignette-critical {
  0%, 100% {
    box-shadow: inset 0 0 150px rgba(139, 0, 0, 0.7);
  }
  50% {
    box-shadow: inset 0 0 200px rgba(255, 0, 0, 0.8);
  }
}

/* Screen shake */
#game-container.shake-light {
  animation: shake-light 0.2s ease-out;
}

#game-container.shake-medium {
  animation: shake-medium 0.25s ease-out;
}

#game-container.shake-heavy {
  animation: shake-heavy 0.4s ease-out;
}

/* Desaturation on combo break */
body.desaturate {
  filter: saturate(0.1) brightness(0.6);
  transition: filter 0.1s;
}

/* Ember particles container */
.ember-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 45;
  overflow: hidden;
}

.ember {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #FF4500;
  border-radius: 50%;
  box-shadow: 0 0 6px #FF4500, 0 0 12px #FF0000;
  animation: ember-rise 2s ease-out forwards;
}

@keyframes ember-rise {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-200px) scale(0);
  }
}

/* Blood splatter effect */
.blood-splatter {
  position: fixed;
  pointer-events: none;
  z-index: 48;
}

.blood-splatter.splatter-light {
  width: 60px;
  height: 60px;
  background: radial-gradient(ellipse 70% 50%, rgba(139, 0, 0, 0.6) 0%, rgba(100, 0, 0, 0.3) 40%, transparent 70%);
  animation: splatter-light 0.6s ease-out forwards;
}

.blood-splatter.splatter-medium {
  width: 100px;
  height: 100px;
  background: radial-gradient(ellipse 60% 80%, rgba(180, 0, 0, 0.7) 0%, rgba(139, 0, 0, 0.4) 30%, transparent 70%);
  animation: splatter-medium 0.8s ease-out forwards;
}

.blood-splatter.splatter-heavy {
  width: 150px;
  height: 150px;
  background:
    radial-gradient(ellipse 50% 70% at 50% 50%, rgba(200, 0, 0, 0.9) 0%, rgba(139, 0, 0, 0.5) 40%, transparent 70%),
    radial-gradient(ellipse 80% 40% at 30% 60%, rgba(139, 0, 0, 0.6) 0%, transparent 60%),
    radial-gradient(ellipse 40% 80% at 70% 40%, rgba(100, 0, 0, 0.5) 0%, transparent 60%);
  animation: splatter-heavy 1s ease-out forwards;
}

@keyframes splatter-light {
  0% {
    opacity: 0;
    transform: rotate(var(--rotation, 0deg)) scale(0.3);
  }
  20% {
    opacity: 1;
    transform: rotate(var(--rotation, 0deg)) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--rotation, 0deg)) scale(0.8);
  }
}

@keyframes splatter-medium {
  0% {
    opacity: 0;
    transform: rotate(var(--rotation, 0deg)) scale(0.3);
  }
  15% {
    opacity: 1;
    transform: rotate(var(--rotation, 0deg)) scale(1.2);
  }
  40% {
    transform: rotate(var(--rotation, 0deg)) scale(1);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--rotation, 0deg)) scale(0.9);
  }
}

@keyframes splatter-heavy {
  0% {
    opacity: 0;
    transform: rotate(var(--rotation, 0deg)) scale(0.2);
  }
  10% {
    opacity: 1;
    transform: rotate(var(--rotation, 0deg)) scale(1.4);
  }
  30% {
    transform: rotate(var(--rotation, 0deg)) scale(1.1);
  }
  60% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--rotation, 0deg)) scale(1);
  }
}

/* Blood drip trails */
.blood-drip {
  position: fixed;
  width: 8px;
  background: linear-gradient(180deg, rgba(139, 0, 0, 0.8) 0%, rgba(80, 0, 0, 0.4) 70%, transparent 100%);
  border-radius: 0 0 4px 4px;
  pointer-events: none;
  z-index: 47;
  animation: drip-fall 1.5s ease-in forwards;
}

@keyframes drip-fall {
  0% {
    height: 0;
    opacity: 1;
  }
  50% {
    height: 80px;
    opacity: 0.8;
  }
  100% {
    height: 120px;
    opacity: 0;
    transform: translateY(50px);
  }
}

/* ===== ANIMATIONS ===== */
@keyframes combo-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

@keyframes hp-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes flash-light {
  0% { background-color: rgba(255, 100, 100, 0.35); }
  100% { background-color: transparent; }
}

@keyframes flash-medium {
  0% { background-color: rgba(255, 50, 50, 0.55); }
  100% { background-color: transparent; }
}

@keyframes flash-heavy {
  0% { background-color: rgba(255, 0, 0, 0.8); }
  30% { background-color: rgba(139, 0, 0, 0.6); }
  60% { background-color: rgba(255, 0, 0, 0.4); }
  100% { background-color: transparent; }
}

@keyframes shake-light {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

@keyframes shake-medium {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-8px) rotate(-0.5deg); }
  30% { transform: translateX(8px) rotate(0.5deg); }
  50% { transform: translateX(-6px); }
  70% { transform: translateX(6px); }
  90% { transform: translateX(-3px); }
}

@keyframes shake-heavy {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-12px, -3px) rotate(-1.5deg); }
  20% { transform: translate(12px, 3px) rotate(1.5deg); }
  30% { transform: translate(-10px, -2px) rotate(-1deg); }
  40% { transform: translate(10px, 2px) rotate(1deg); }
  50% { transform: translate(-8px, 0); }
  60% { transform: translate(8px, 0); }
  70% { transform: translate(-5px, 0); }
  80% { transform: translate(5px, 0); }
  90% { transform: translate(-3px, 0); }
}

@keyframes vignette-danger {
  0%, 100% {
    box-shadow: inset 0 0 120px rgba(255, 0, 0, 0.5);
  }
  50% {
    box-shadow: inset 0 0 180px rgba(255, 0, 0, 0.7);
  }
}

@keyframes round-clear-text {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== POWER-UP SELECTION ===== */
#powerup-overlay {
  background: radial-gradient(ellipse at center, rgba(15, 8, 8, 0.98) 0%, rgba(5, 2, 2, 0.99) 100%);
}

#powerup-overlay h1 {
  color: #FFD700;
  text-shadow: 0 0 30px #FF8C00;
}

.powerup-hint {
  margin-top: 25px;
  font-size: 14px;
  color: #666;
  font-family: 'Cinzel', serif;
}

#powerup-choices {
  display: flex;
  gap: 25px;
  margin-top: 30px;
  max-width: 650px;
  justify-content: center;
  flex-wrap: wrap;
}

.powerup-card {
  background: linear-gradient(180deg, #1a1a2a 0%, #0a0a15 100%);
  border: 3px solid #333;
  border-radius: 15px;
  padding: 25px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-width: 140px;
  max-width: 180px;
  min-height: 200px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.powerup-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s;
}

.powerup-card:hover::before {
  left: 100%;
}

.powerup-card:hover {
  transform: translateY(-12px) scale(1.05);
}

.powerup-card:active {
  transform: translateY(-6px) scale(1.02);
}

.powerup-card[data-powerup="health"] {
  border-color: #2a4a2a;
}

.powerup-card[data-powerup="health"]:hover {
  border-color: #00ff00;
  box-shadow: 0 10px 40px rgba(0, 255, 0, 0.4), inset 0 0 30px rgba(0, 255, 0, 0.1);
}

.powerup-card[data-powerup="shield"] {
  border-color: #2a3a4a;
}

.powerup-card[data-powerup="shield"]:hover {
  border-color: #00ccff;
  box-shadow: 0 10px 40px rgba(0, 204, 255, 0.4), inset 0 0 30px rgba(0, 204, 255, 0.1);
}

.powerup-card[data-powerup="timeout"] {
  border-color: #3a2a4a;
}

.powerup-card[data-powerup="timeout"]:hover {
  border-color: #ff00ff;
  box-shadow: 0 10px 40px rgba(255, 0, 255, 0.4), inset 0 0 30px rgba(255, 0, 255, 0.1);
}

.powerup-card[data-powerup="adrenaline"] {
  border-color: #4a2a2a;
}

.powerup-card[data-powerup="adrenaline"]:hover {
  border-color: #ff4444;
  box-shadow: 0 10px 40px rgba(255, 68, 68, 0.4), inset 0 0 30px rgba(255, 68, 68, 0.1);
}

.powerup-card[data-powerup="ironSkin"] {
  border-color: #4a3a1a;
}

.powerup-card[data-powerup="ironSkin"]:hover {
  border-color: #ffaa00;
  box-shadow: 0 10px 40px rgba(255, 170, 0, 0.4), inset 0 0 30px rgba(255, 170, 0, 0.1);
}

.powerup-icon {
  font-size: 64px;
  margin-bottom: 15px;
}

.powerup-name {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 10px;
  font-family: 'MedievalSharp', cursive;
  color: #E8E4D9;
}

.powerup-desc {
  font-size: 14px;
  color: #888;
  font-family: 'Cinzel', serif;
}

/* ===== POWER-UP INDICATORS ===== */

/* Shared base class for all power-up indicators */
.power-indicator,
#shield-indicator,
#timeout-indicator,
#adrenaline-indicator,
#ironskin-indicator,
#lightning-indicator,
#doublemove-indicator,
#comboanchor-indicator,
#criticalstrike-indicator,
#bloodlust-indicator {
  --indicator-color: var(--color-text-muted);
  position: fixed;
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  font-size: var(--text-base);
  display: none;
  z-index: var(--z-indicators);
  font-family: var(--font-body);
  border: 2px solid var(--indicator-color);
  color: var(--indicator-color);
  text-shadow: 0 0 10px var(--indicator-color);
}

/* Unified pulse animation using CSS custom properties */
@keyframes indicator-pulse {
  0%, 100% { box-shadow: 0 0 15px color-mix(in srgb, var(--indicator-color) 50%, transparent); }
  50% { box-shadow: 0 0 30px color-mix(in srgb, var(--indicator-color) 80%, transparent); }
}

/* Individual indicators - position and color only */
/* Desktop: Stack vertically on right side, below health bar */
#shield-indicator {
  --indicator-color: var(--color-shield);
  top: 90px;
  right: 15px;
  background: linear-gradient(180deg, rgba(0, 50, 80, 0.3) 0%, rgba(0, 30, 50, 0.4) 100%);
}

#shield-indicator.active {
  display: block;
  animation: indicator-pulse 1.5s infinite;
}

#timeout-indicator {
  --indicator-color: var(--color-timeout);
  top: 90px;
  left: 15px;
  background: linear-gradient(180deg, rgba(50, 0, 50, 0.3) 0%, rgba(30, 0, 30, 0.4) 100%);
}

#timeout-indicator.active {
  display: block;
  animation: indicator-pulse 1s infinite;
}

#adrenaline-indicator {
  --indicator-color: var(--color-adrenaline);
  top: 140px;
  left: 15px;
  background: linear-gradient(180deg, rgba(80, 0, 0, 0.3) 0%, rgba(50, 0, 0, 0.4) 100%);
}

#adrenaline-indicator.active {
  display: block;
  animation: indicator-pulse 1s infinite;
}

#ironskin-indicator {
  --indicator-color: var(--color-ironskin);
  top: 140px;
  right: 15px;
  background: linear-gradient(180deg, rgba(80, 60, 0, 0.3) 0%, rgba(50, 40, 0, 0.4) 100%);
}

#ironskin-indicator.active {
  display: block;
  animation: indicator-pulse 1.2s infinite;
}

#lightning-indicator {
  --indicator-color: var(--color-lightning);
  top: 190px;
  right: 15px;
  background: linear-gradient(180deg, rgba(80, 80, 0, 0.3) 0%, rgba(50, 50, 0, 0.4) 100%);
}

#lightning-indicator.active {
  display: block;
  animation: indicator-pulse 0.8s infinite;
}

/* Lightning Targeting Mode */
.lightning-targeting {
  cursor: crosshair !important;
}

.lightning-targeting .piece-417db {
  cursor: crosshair !important;
}

.lightning-targeting-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 0, 0.05);
  pointer-events: none;
  z-index: 100;
}

/* Double Move Indicator */
#doublemove-indicator {
  --indicator-color: var(--color-doublemove);
  top: 240px;
  right: 15px;
  background: linear-gradient(180deg, rgba(0, 100, 150, 0.3) 0%, rgba(0, 60, 100, 0.4) 100%);
}

#doublemove-indicator.active {
  display: block;
  animation: indicator-pulse-scale 0.6s infinite;
}

/* Variant with scale for doublemove and criticalstrike */
@keyframes indicator-pulse-scale {
  0%, 100% {
    box-shadow: 0 0 15px color-mix(in srgb, var(--indicator-color) 50%, transparent);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 30px color-mix(in srgb, var(--indicator-color) 90%, transparent);
    transform: scale(1.05);
  }
}

/* Combo Anchor Indicator */
#comboanchor-indicator {
  --indicator-color: var(--color-comboanchor);
  top: 190px;
  left: 15px;
  background: linear-gradient(180deg, rgba(0, 80, 100, 0.3) 0%, rgba(0, 50, 70, 0.4) 100%);
}

#comboanchor-indicator.active {
  display: block;
  animation: indicator-pulse 1.5s infinite;
}

/* Critical Strike Indicator */
#criticalstrike-indicator {
  --indicator-color: var(--color-criticalstrike);
  top: 240px;
  left: 15px;
  background: linear-gradient(180deg, rgba(150, 80, 0, 0.3) 0%, rgba(100, 50, 0, 0.4) 100%);
}

#criticalstrike-indicator.active {
  display: block;
  animation: indicator-pulse-scale 0.8s infinite;
}

/* Bloodlust Indicator */
#bloodlust-indicator {
  --indicator-color: var(--color-bloodlust);
  top: 290px;
  right: 15px;
  background: linear-gradient(180deg, rgba(100, 0, 0, 0.3) 0%, rgba(70, 0, 0, 0.4) 100%);
}

#bloodlust-indicator.active {
  display: block;
  animation: bloodlust-pulse 1s infinite;
}

/* Bloodlust has unique background animation, keep it */
@keyframes bloodlust-pulse {
  0%, 100% {
    box-shadow: 0 0 15px rgba(204, 0, 0, 0.5);
    background: linear-gradient(180deg, rgba(100, 0, 0, 0.3) 0%, rgba(70, 0, 0, 0.4) 100%);
  }
  50% {
    box-shadow: 0 0 25px rgba(204, 0, 0, 0.8);
    background: linear-gradient(180deg, rgba(130, 0, 0, 0.4) 0%, rgba(90, 0, 0, 0.5) 100%);
  }
}

/* Combo Anchor Used Floater */
.combo-anchor-floater {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: bold;
  color: #00aacc;
  text-shadow: 0 0 20px #00aacc, 0 0 40px #006688;
  animation: anchor-used 1s ease-out forwards;
  z-index: 1000;
}

@keyframes anchor-used {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  30% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -80%) scale(1);
    opacity: 0;
  }
}

/* Bloodlust Heal Floater */
.bloodlust-floater {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: bold;
  color: #cc0000;
  text-shadow: 0 0 15px #cc0000, 0 0 30px #880000;
  animation: bloodlust-heal 1s ease-out forwards;
  z-index: 1000;
}

@keyframes bloodlust-heal {
  0% {
    transform: translateX(-50%) translateY(0) scale(0.8);
    opacity: 0;
  }
  20% {
    transform: translateX(-50%) translateY(0) scale(1.1);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) translateY(-50px) scale(1);
    opacity: 0;
  }
}

/* Best Move Hint Highlights */
.hint-highlight {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 50;
  border-radius: 4px;
}

.hint-from {
  background: rgba(0, 200, 255, 0.4);
  border: 3px solid #00c8ff;
  animation: hint-pulse 1s infinite;
}

.hint-to {
  background: rgba(0, 255, 100, 0.4);
  border: 3px solid #00ff64;
  animation: hint-pulse 1s infinite;
}

@keyframes hint-pulse {
  0%, 100% {
    opacity: 0.8;
    box-shadow: 0 0 10px rgba(0, 200, 255, 0.5);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 25px rgba(0, 200, 255, 0.9);
  }
}

/* ===== THREAT HINT (See Threat ability) ===== */
.threat-highlight {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 50;
  border-radius: 2px;
}

.threat-from {
  background: rgba(255, 100, 0, 0.4);
  border: 3px solid #ff6400;
  animation: threat-pulse 0.8s infinite;
}

.threat-to {
  background: rgba(255, 50, 50, 0.4);
  border: 3px solid #ff3232;
  animation: threat-pulse 0.8s infinite;
}

@keyframes threat-pulse {
  0%, 100% {
    opacity: 0.7;
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.5);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 25px rgba(255, 100, 0, 0.9);
  }
}

.threat-warning {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 40px;
  font-weight: 900;
  font-family: 'MedievalSharp', cursive;
  color: #ff3232;
  text-shadow: 0 0 15px #ff0000, 0 0 30px #ff6600;
  pointer-events: none;
  z-index: 51;
  animation: threat-warning-pulse 0.5s infinite alternate;
}

@keyframes threat-warning-pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 1;
  }
}

/* Inventory item style for threatView */
.inventory-item[data-powerup="threatView"] {
  border-color: #ff6400;
  box-shadow: 0 0 15px rgba(255, 100, 0, 0.3);
}

.inventory-item[data-powerup="threatView"]:hover {
  border-color: #ff8844;
  box-shadow: 0 8px 30px rgba(255, 100, 0, 0.5);
  background: linear-gradient(180deg, rgba(100, 40, 0, 0.9) 0%, rgba(60, 20, 0, 0.95) 100%);
}

.inventory-item[data-powerup="threatView"]::before {
  background: #ff6400;
}

.lightning-targeting-overlay .targeting-text {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  font-family: 'MedievalSharp', cursive;
  color: #ffff00;
  text-shadow: 0 0 20px #ffff00, 0 0 40px #ffaa00;
  animation: targeting-flash 0.5s infinite;
}

@keyframes targeting-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Lightning Bolt Effect */
.lightning-bolt {
  position: absolute;
  width: 8px;
  height: 300px;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 100, 1) 20%,
    rgba(255, 255, 0, 1) 50%,
    rgba(255, 200, 0, 0.8) 80%,
    transparent 100%);
  transform: translateX(-50%);
  z-index: 150;
  animation: lightning-strike 0.4s ease-out forwards;
  box-shadow:
    0 0 20px #ffffff,
    0 0 40px #ffff00,
    0 0 60px #ffaa00,
    0 0 80px #ff6600;
  filter: blur(1px);
}

.lightning-bolt::before,
.lightning-bolt::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 100px;
  background: linear-gradient(180deg, #ffffff, #ffff00, transparent);
  box-shadow: 0 0 15px #ffff00, 0 0 30px #ffaa00;
}

.lightning-bolt::before {
  top: 25%;
  left: -20px;
  transform: rotate(-35deg);
}

.lightning-bolt::after {
  top: 45%;
  right: -20px;
  transform: rotate(35deg);
}

@keyframes lightning-strike {
  0% {
    opacity: 1;
    transform: translateX(-50%) scaleY(0);
    transform-origin: top;
  }
  20% {
    transform: translateX(-50%) scaleY(1);
    opacity: 1;
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scaleY(1);
  }
}

/* Lightning Flash */
.lightning-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  pointer-events: none;
  z-index: 140;
  animation: flash-out 0.15s ease-out forwards;
}

@keyframes flash-out {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Lightning Impact on Square */
.lightning-impact {
  position: absolute;
  background: radial-gradient(circle, rgba(255, 255, 0, 0.9) 0%, rgba(255, 200, 0, 0.6) 40%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 145;
  animation: impact-expand 0.6s ease-out forwards;
  box-shadow: 0 0 30px #ffff00, 0 0 60px #ffaa00, 0 0 90px #ff6600;
}

@keyframes impact-expand {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.8;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Invalid Target Message */
.invalid-target-floater {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-family: 'Cinzel', serif;
  font-weight: bold;
  color: #ff4444;
  text-shadow: 0 0 10px #ff0000, 0 0 20px #aa0000;
  background: rgba(0, 0, 0, 0.8);
  padding: 10px 20px;
  border: 2px solid #ff4444;
  border-radius: 8px;
  z-index: 200;
  animation: invalid-shake 0.5s ease-out, fade-out 1.5s ease-out forwards;
  white-space: nowrap;
}

@keyframes invalid-shake {
  0%, 100% { transform: translate(-50%, -50%) translateX(0); }
  20% { transform: translate(-50%, -50%) translateX(-10px); }
  40% { transform: translate(-50%, -50%) translateX(10px); }
  60% { transform: translate(-50%, -50%) translateX(-5px); }
  80% { transform: translate(-50%, -50%) translateX(5px); }
}

@keyframes fade-out {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== DRAMATIC ANNOUNCEMENTS ===== */
.announcement {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 80px;
  font-family: 'MedievalSharp', cursive;
  font-weight: bold;
  text-align: center;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}

.announcement.stage-start {
  color: #CC0000;
  text-shadow: 0 0 40px #8B0000, 0 0 80px #660000;
  animation: announcement-in 2s ease-out forwards;
}

.announcement.boss-start {
  color: #FF0000;
  text-shadow: 0 0 60px #FF0000, 0 0 120px #8B0000;
  animation: boss-announcement 2.5s ease-out forwards;
}

.announcement.finish-him {
  color: #FF0000;
  text-shadow: 0 0 50px #FF0000, 0 0 100px #FF4500;
  animation: finish-him 1.5s ease-out infinite;
}

@keyframes announcement-in {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(3);
    filter: blur(20px);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: blur(0);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
}

@keyframes boss-announcement {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
    filter: blur(30px);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.3);
    filter: blur(0);
  }
  40% {
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

@keyframes finish-him {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    text-shadow: 0 0 50px #FF0000, 0 0 100px #FF4500;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    text-shadow: 0 0 80px #FF0000, 0 0 150px #FF4500;
  }
}

/* ===== PAUSE MENU ===== */
#pause-overlay {
  background: radial-gradient(ellipse at center, rgba(15, 8, 8, 0.98) 0%, rgba(5, 2, 2, 0.99) 100%);
}

#pause-overlay h1 {
  color: #888;
  text-shadow: 0 0 20px rgba(136, 136, 136, 0.5);
}

.pause-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 30px;
}

.pause-btn {
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font-size);
  background: linear-gradient(180deg, #333 0%, #222 100%);
  color: #E8E4D9;
  border: 2px solid #555;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-weight: bold;
  letter-spacing: 2px;
  transition: all 0.2s;
  min-width: var(--btn-min-width);
  border-radius: var(--radius-md);
}

.pause-btn:hover {
  background: linear-gradient(180deg, #444 0%, #333 100%);
  border-color: #777;
  transform: scale(var(--btn-hover-scale));
  box-shadow: var(--btn-hover-glow);
}

.pause-btn:active {
  transform: scale(var(--btn-active-scale));
}

#sound-toggle {
  background: linear-gradient(180deg, #2a4a2a 0%, #1a3a1a 100%);
  border-color: #4a6a4a;
}

#sound-toggle:hover {
  background: linear-gradient(180deg, #3a5a3a 0%, #2a4a2a 100%);
  border-color: #5a7a5a;
}

.pause-hint {
  margin-top: 25px;
  font-size: 14px;
  color: #666;
  font-family: 'Cinzel', serif;
}

/* ===== HIGH SCORE DISPLAY ===== */
#new-record-badge {
  font-size: 28px;
  color: #FFD700;
  text-shadow: 0 0 20px #FFD700, 0 0 40px #FF8C00;
  animation: record-pulse 0.8s infinite;
  margin-bottom: 20px;
  font-family: 'MedievalSharp', cursive;
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.2) 0%, rgba(139, 69, 0, 0.3) 100%);
  border: 2px solid var(--color-gold);
  border-radius: var(--radius-md);
  padding: 8px 24px;
  letter-spacing: 2px;
}

#new-record-badge.hidden {
  display: none;
}

@keyframes record-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
  }
}

#highscore-comparison {
  margin-top: 15px;
  padding: 15px 25px;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
}

#highscore-comparison.hidden {
  display: none;
}

.highscore-label {
  font-size: 14px;
  color: #888;
  margin-bottom: 5px;
}

#highscore-comparison p {
  font-size: 16px;
  margin: 5px 0;
}

.death-hint, .stage-clear-hint {
  margin-top: 15px;
  font-size: 14px;
  color: #666;
  font-family: 'Cinzel', serif;
}

.death-buttons {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.death-buttons button {
  margin-top: 0;
}

/* ===== COMBO DECAY INDICATOR ===== */
.combo-decay-flash {
  animation: combo-decay 0.5s ease-out;
}

@keyframes combo-decay {
  0% { filter: brightness(1); }
  25% { filter: brightness(0.5) sepia(1); }
  50% { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}

/* ===== GOLD DISPLAY ===== */
#gold-display {
  display: flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, rgba(80, 60, 0, 0.4) 0%, rgba(40, 30, 0, 0.5) 100%);
  border: 2px solid #FFD700;
  border-radius: 8px;
  padding: 8px 15px;
  margin-left: 20px;
  font-family: 'MedievalSharp', cursive;
}

#gold-icon {
  font-size: 20px;
}

#gold-amount {
  font-size: 22px;
  font-weight: bold;
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  min-width: 50px;
}

.gold-popup {
  position: absolute;
  right: 0;
  top: -5px;
  font-size: 18px;
  font-weight: bold;
  color: #FFD700;
  text-shadow: 0 0 10px #FFD700;
  animation: gold-float 1s ease-out forwards;
  pointer-events: none;
  white-space: nowrap;
}

@keyframes gold-float {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  50% { transform: translateY(-15px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-30px) scale(0.8); }
}

/* ===== SHOP OVERLAY ===== */
#shop-overlay {
  background: radial-gradient(ellipse at center, rgba(15, 8, 8, 0.98) 0%, rgba(5, 2, 2, 0.99) 100%);
}

#shop-overlay h1 {
  color: #FFD700;
  text-shadow: 0 0 40px #FF8C00, 0 0 80px #CC6600;
  font-size: 48px;
  margin-bottom: 10px;
}

#shop-gold-display {
  font-size: 32px;
  font-family: 'MedievalSharp', cursive;
  color: #FFD700;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.shop-gold-icon {
  font-size: 36px;
}

#shop-gold-amount {
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
  transition: transform 0.2s, color 0.2s;
}

#shop-gold-amount.flash {
  animation: gold-flash 0.3s ease-out;
}

@keyframes gold-flash {
  0% { transform: scale(1); color: #FFD700; }
  50% { transform: scale(1.3); color: #FFFFFF; }
  100% { transform: scale(1); color: #FFD700; }
}

/* Shop Items Grid */
#shop-items {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 30px;
}

.shop-slot {
  width: 160px;
  min-height: 200px;
  background: linear-gradient(180deg, #1a1510 0%, #0a0805 100%);
  border: 3px solid #4a3a20;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-slot:hover:not(.sold):not(.cant-afford) {
  transform: translateY(-10px) scale(1.05);
  border-color: #FFD700;
  box-shadow: 0 10px 40px rgba(255, 215, 0, 0.4);
}

.shop-slot.sold {
  opacity: 0.5;
  cursor: default;
  border-style: dashed;
}

.shop-slot.cant-afford {
  opacity: 0.6;
  cursor: not-allowed;
}

.shop-slot.cant-afford:hover {
  transform: none;
  box-shadow: none;
}

.sold-text {
  font-size: 24px;
  font-family: 'MedievalSharp', cursive;
  color: #666;
  text-shadow: 0 0 10px rgba(100, 100, 100, 0.3);
}

/* Shop Item Card */
.shop-item {
  padding: 20px 15px;
  text-align: center;
  width: 100%;
}

.shop-item-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.shop-item-name {
  font-size: 18px;
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  color: #E8E4D9;
  margin-bottom: 8px;
}

.shop-item-desc {
  font-size: 12px;
  color: #888;
  font-family: 'Cinzel', serif;
  margin-bottom: 15px;
  min-height: 30px;
}

.shop-item-price {
  font-size: 20px;
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.shop-item-price.expensive {
  color: #FF4444;
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

/* Piece Upgrade Tiers */
.shop-item.pieceUpgrade {
  position: relative;
}

.shop-item.pieceUpgrade .shop-item-icon {
  filter: drop-shadow(0 0 5px currentColor);
}

.shop-item.tier-1 .shop-item-icon {
  color: var(--tier-1);
  text-shadow: 0 0 15px var(--tier-1);
}

.shop-item.tier-2 .shop-item-icon {
  color: var(--tier-2);
  text-shadow: 0 0 20px var(--tier-2);
}

.shop-item.tier-3 .shop-item-icon {
  color: var(--tier-3);
  text-shadow: 0 0 25px var(--tier-3), 0 0 50px #FF8C00;
  animation: tier3-glow 1s infinite;
}

@keyframes tier3-glow {
  0%, 100% { filter: drop-shadow(0 0 15px var(--tier-3)); }
  50% { filter: drop-shadow(0 0 25px var(--tier-3)) drop-shadow(0 0 35px #FF8C00); }
}

/* Shop Actions */
#shop-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 20px;
}

.shop-btn {
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font-size);
  font-family: 'MedievalSharp', cursive;
  font-weight: bold;
  letter-spacing: 2px;
  border: 3px solid;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  min-width: var(--btn-min-width);
}

.shop-btn:not(.primary) {
  background: linear-gradient(180deg, #333 0%, #222 100%);
  color: #E8E4D9;
  border-color: #555;
}

.shop-btn:not(.primary):hover:not(:disabled) {
  background: linear-gradient(180deg, #444 0%, #333 100%);
  border-color: #777;
  transform: scale(var(--btn-hover-scale));
  box-shadow: var(--btn-hover-glow);
}

.shop-btn:not(.primary):active:not(:disabled) {
  transform: scale(var(--btn-active-scale));
}

.shop-btn.primary {
  background: linear-gradient(180deg, #CC8800 0%, #996600 100%);
  color: #FFF;
  border-color: #FFD700;
}

.shop-btn.primary:hover {
  background: linear-gradient(180deg, #FFAA00 0%, #CC8800 100%);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
  transform: scale(var(--btn-hover-scale));
}

.shop-btn.primary:active {
  transform: scale(var(--btn-active-scale));
}

.shop-btn:disabled, .shop-btn.cant-afford {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.shop-hint {
  font-size: 14px;
  color: #666;
  font-family: 'Cinzel', serif;
}

/* ===== HERO SELECTION OVERLAY ===== */
#hero-select-overlay {
  background: radial-gradient(ellipse at center, rgba(10, 15, 20, 0.98) 0%, rgba(5, 5, 10, 0.99) 100%);
}

.hero-select-title {
  font-size: 48px;
  font-family: 'MedievalSharp', cursive;
  color: #FFD700;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.8);
  margin-bottom: 30px;
  letter-spacing: 4px;
  animation: hero-title-glow 2s ease-in-out infinite;
}

@keyframes hero-title-glow {
  0%, 100% { text-shadow: 0 0 30px rgba(255, 215, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.8); }
  50% { text-shadow: 0 0 50px rgba(255, 215, 0, 0.8), 0 4px 8px rgba(0, 0, 0, 0.8); }
}

#hero-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 1100px;
  padding: 0 20px;
}

.hero-card {
  background: linear-gradient(180deg, rgba(30, 30, 40, 0.95) 0%, rgba(15, 15, 25, 0.98) 100%);
  border: 3px solid #444;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-width: 220px;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, var(--hero-color, #666) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.hero-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--hero-color, #888);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 30px var(--hero-glow, rgba(100, 100, 100, 0.3));
}

.hero-card:hover::before {
  opacity: 0.15;
}

.hero-card:active {
  transform: translateY(-4px) scale(1.01);
}

/* Hero-specific colors */
.hero-card[data-hero="schlechter"] {
  --hero-color: #4a90d9;
  --hero-glow: rgba(74, 144, 217, 0.4);
}

.hero-card[data-hero="nimzowitsch"] {
  --hero-color: #9b59b6;
  --hero-glow: rgba(155, 89, 182, 0.4);
}

.hero-card[data-hero="tal"] {
  --hero-color: #e74c3c;
  --hero-glow: rgba(231, 76, 60, 0.4);
}

.hero-card[data-hero="fischer"] {
  --hero-color: #f1c40f;
  --hero-glow: rgba(241, 196, 15, 0.4);
}

.hero-icon {
  font-size: 48px;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 10px var(--hero-color, #888));
}

/* Hero portrait for selection screen */
.hero-portrait {
  width: 80px;
  height: 100px;
  border: 3px solid var(--hero-color, #666);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: 0 0 15px var(--hero-color, rgba(100, 100, 100, 0.5));
  position: relative;
  background: #1a1a1a;
}

.hero-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-icon-fallback {
  display: none;
  font-size: 48px;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 10px var(--hero-color, #888));
}

/* Hero card info wrapper - for mobile horizontal layout */
.hero-card-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
}

.hero-name {
  font-size: 18px;
  font-family: 'MedievalSharp', cursive;
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
  margin-bottom: 2px;
}

.hero-title-text {
  font-size: 12px;
  font-family: 'Cinzel', serif;
  color: var(--hero-color, #888);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.hero-archetype {
  font-size: 10px;
  font-family: 'Cinzel', serif;
  color: #888;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 10px;
  border-radius: 10px;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.hero-era {
  font-size: 11px;
  color: #666;
  margin-bottom: 15px;
  font-style: italic;
}

.hero-passives {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero-passive {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  padding: 8px 10px;
  text-align: left;
}

.hero-passive-name {
  font-size: 11px;
  font-family: 'MedievalSharp', cursive;
  color: var(--hero-color, #aaa);
  text-shadow: 0 0 5px var(--hero-color, #888);
  margin-bottom: 2px;
}

.hero-passive-desc {
  font-size: 10px;
  color: #aaa;
  line-height: 1.3;
}

.hero-select-hint {
  margin-top: 25px;
  font-size: 14px;
  color: #666;
  font-family: 'Cinzel', serif;
  letter-spacing: 1px;
}

/* Hero indicator during gameplay - HIDDEN (portrait in health bar replaces this) */
#hero-indicator {
  display: none !important;
}

@keyframes hero-indicator-pulse {
  0%, 100% { box-shadow: 0 0 15px var(--hero-glow, rgba(100, 100, 100, 0.2)); }
  50% { box-shadow: 0 0 25px var(--hero-glow, rgba(100, 100, 100, 0.4)); }
}

#hero-indicator-icon {
  font-size: 24px;
}

#hero-indicator-name {
  font-size: 14px;
  font-family: 'MedievalSharp', cursive;
  color: var(--hero-color, #888);
  text-shadow: 0 0 5px var(--hero-color, #888);
}

/* Blood harvest floater for Tal captures */
.blood-harvest-floater {
  position: absolute;
  font-size: 28px;
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  color: #ff4444;
  text-shadow: 0 0 15px #ff0000, 0 0 30px #aa0000;
  animation: blood-harvest-float 1.2s ease-out forwards;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
}

@keyframes blood-harvest-float {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  30% {
    transform: translateY(-15px) scale(1.3);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(0.8);
  }
}

/* Fischer triple damage effect */
.fischer-triple-damage {
  position: absolute;
  font-size: 36px;
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  color: #f1c40f;
  text-shadow: 0 0 20px #f1c40f, 0 0 40px #f39c12;
  animation: fischer-triple-pop 1.5s ease-out forwards;
  pointer-events: none;
  z-index: 50;
}

@keyframes fischer-triple-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.4);
  }
  50% {
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8) translateY(-30px);
  }
}

/* Hero selection responsive */
@media (max-width: 1000px) {
  #hero-cards {
    grid-template-columns: repeat(2, 1fr);
    max-width: 500px;
  }
}

@media (max-width: 520px) {
  #hero-cards {
    grid-template-columns: 1fr;
    max-width: 280px;
  }

  .hero-card {
    min-width: unset;
    padding: 15px;
  }

  .hero-select-title {
    font-size: 32px;
  }
}

/* ===== PLAYER INTRO OVERLAY ===== */
#player-intro-overlay {
  background: radial-gradient(ellipse at center, rgba(15, 10, 5, 0.98) 0%, rgba(5, 3, 0, 0.99) 100%);
}

#player-intro-overlay.boss-intro {
  background: radial-gradient(ellipse at center, rgba(40, 5, 5, 0.98) 0%, rgba(15, 0, 0, 0.99) 100%);
}

#player-intro-overlay.boss-intro::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 0 150px rgba(255, 0, 0, 0.3);
  pointer-events: none;
  animation: boss-intro-pulse 2s infinite;
}

@keyframes boss-intro-pulse {
  0%, 100% { box-shadow: inset 0 0 150px rgba(255, 0, 0, 0.3); }
  50% { box-shadow: inset 0 0 200px rgba(255, 0, 0, 0.5); }
}

.player-intro-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: player-intro-fade-in 0.8s ease-out;
}

@keyframes player-intro-fade-in {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Portrait Frame */
.player-portrait-frame {
  width: 180px;
  height: 220px;
  border: 4px solid #5a3a1a;
  border-image: linear-gradient(135deg, #8a6a3a, #2a1a0a, #8a6a3a) 1;
  background: #0a0805;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
  box-shadow:
    0 0 20px rgba(139, 69, 0, 0.3),
    inset 0 0 30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.boss-intro .player-portrait-frame {
  border-color: #8B0000;
  border-image: linear-gradient(135deg, #CC0000, #2a0505, #CC0000) 1;
  box-shadow:
    0 0 30px rgba(255, 0, 0, 0.4),
    inset 0 0 30px rgba(0, 0, 0, 0.8);
}

#player-portrait {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  filter: sepia(0.3) contrast(1.1) brightness(0.9);
}

.portrait-fallback {
  font-size: 100px;
  color: #8a6a3a;
  text-shadow: 0 0 30px rgba(139, 69, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(30, 20, 10, 0.5) 0%, rgba(10, 5, 0, 0.8) 100%);
}

.boss-intro .portrait-fallback {
  color: #CC4444;
  text-shadow: 0 0 40px rgba(255, 0, 0, 0.7);
  background: linear-gradient(180deg, rgba(40, 10, 10, 0.5) 0%, rgba(20, 0, 0, 0.8) 100%);
}

/* Player Era */
.player-era {
  font-size: 16px;
  font-family: 'Cinzel', serif;
  color: #888;
  letter-spacing: 3px;
  margin-bottom: 10px;
}

/* Player Name */
#player-intro-overlay .player-name {
  font-size: 42px;
  font-family: 'MedievalSharp', cursive;
  font-weight: bold;
  color: #FFD700;
  text-shadow:
    0 0 20px rgba(255, 215, 0, 0.6),
    0 0 40px rgba(255, 165, 0, 0.4),
    0 3px 6px rgba(0, 0, 0, 0.8);
  margin-bottom: 8px;
  letter-spacing: 2px;
  animation: name-glow 3s ease-in-out infinite;
}

@keyframes name-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 165, 0, 0.4); }
  50% { text-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 165, 0, 0.6); }
}

#player-intro-overlay .player-name.boss {
  color: #FF4444;
  text-shadow:
    0 0 30px rgba(255, 0, 0, 0.7),
    0 0 60px rgba(255, 0, 0, 0.5),
    0 3px 6px rgba(0, 0, 0, 0.8);
  animation: boss-name-pulse 1.5s ease-in-out infinite;
}

@keyframes boss-name-pulse {
  0%, 100% { text-shadow: 0 0 30px rgba(255, 0, 0, 0.7), 0 0 60px rgba(255, 0, 0, 0.5); }
  50% { text-shadow: 0 0 50px rgba(255, 0, 0, 0.9), 0 0 100px rgba(255, 50, 0, 0.7); }
}

/* Player Title */
.player-title {
  font-size: 22px;
  font-family: 'Cinzel', serif;
  font-style: italic;
  color: #CC4444;
  text-shadow: 0 0 10px rgba(204, 68, 68, 0.5);
  margin-bottom: 20px;
}

.boss-intro .player-title {
  color: #FF6666;
  text-shadow: 0 0 15px rgba(255, 0, 0, 0.6);
}

/* Player Quote */
.player-quote {
  font-size: 18px;
  font-family: 'Cinzel', serif;
  font-style: italic;
  color: #AAA;
  max-width: 500px;
  line-height: 1.5;
  margin-bottom: 25px;
}

/* Position Context (historical game info) */
.position-context {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-style: italic;
  color: #a08060;
  text-align: center;
  margin-top: 15px;
  margin-bottom: 20px;
  padding: 8px 20px;
  border-top: 1px solid rgba(160, 128, 96, 0.3);
  letter-spacing: 1px;
}

.position-context.hidden {
  display: none;
}

/* Stage Badge */
.stage-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px 30px;
  background: linear-gradient(180deg, rgba(30, 20, 10, 0.8) 0%, rgba(10, 5, 0, 0.9) 100%);
  border: 2px solid #5a3a1a;
  border-radius: 10px;
}

.boss-intro .stage-badge {
  border-color: #8B0000;
  background: linear-gradient(180deg, rgba(40, 10, 10, 0.8) 0%, rgba(20, 0, 0, 0.9) 100%);
}

.stage-label {
  font-size: 14px;
  font-family: 'Cinzel', serif;
  color: #888;
  letter-spacing: 4px;
}

.stage-num {
  font-size: 48px;
  font-family: 'MedievalSharp', cursive;
  font-weight: bold;
  color: #FFD700;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
  line-height: 1;
}

.boss-intro .stage-num {
  color: #FF4444;
  text-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
}

/* Challenge Button */
.fight-btn {
  margin-top: 30px;
  padding: 18px 80px;
  font-size: 28px;
  font-family: 'MedievalSharp', cursive;
  font-weight: bold;
  letter-spacing: 5px;
  color: #FFF;
  background: linear-gradient(180deg, #CC8800 0%, #996600 100%);
  border: 3px solid #FFD700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  min-width: var(--btn-min-width);
  box-shadow:
    0 0 20px rgba(255, 215, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: challenge-pulse 2s infinite;
}

@keyframes challenge-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.4); }
  50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.6); }
}

.fight-btn:hover {
  background: linear-gradient(180deg, #FFAA00 0%, #CC8800 100%);
  transform: scale(var(--btn-hover-scale));
  box-shadow: 0 0 50px rgba(255, 215, 0, 0.7);
}

.fight-btn:active {
  transform: scale(var(--btn-active-scale));
}

.boss-intro .fight-btn {
  background: linear-gradient(180deg, #CC0000 0%, #880000 100%);
  border-color: #FF4444;
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
}

.boss-intro .fight-btn:hover {
  background: linear-gradient(180deg, #FF2222 0%, #CC0000 100%);
  box-shadow: 0 0 60px rgba(255, 0, 0, 0.7);
}

/* Enemy name boss styling (in HP bar) */
#enemy-name.boss-name {
  color: #ff6666;
  text-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
  animation: boss-enemy-name 1s infinite;
}

@keyframes boss-enemy-name {
  0%, 100% { text-shadow: 0 0 15px rgba(255, 0, 0, 0.7); }
  50% { text-shadow: 0 0 25px rgba(255, 50, 50, 0.9); }
}

/* ===== PIECE UPGRADE EFFECTS ===== */
/* Visual glow effects for upgraded pieces on the board */
.piece-tier-1 {
  filter: drop-shadow(0 0 5px var(--tier-1)) drop-shadow(0 0 10px var(--tier-1));
}

.piece-tier-2 {
  filter: drop-shadow(0 0 8px var(--tier-2)) drop-shadow(0 0 16px var(--tier-2));
}

.piece-tier-3 {
  filter: drop-shadow(0 0 12px var(--tier-3)) drop-shadow(0 0 24px #FF8C00);
  animation: legendary-piece-glow 1s infinite;
}

@keyframes legendary-piece-glow {
  0%, 100% { filter: drop-shadow(0 0 12px var(--tier-3)) drop-shadow(0 0 24px #FF8C00); }
  50% { filter: drop-shadow(0 0 18px var(--tier-3)) drop-shadow(0 0 36px #FF8C00); }
}

/* Piece Upgrade Floater */
.piece-upgrade-floater {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 300;
  animation: upgrade-pop 2s ease-out forwards;
  pointer-events: none;
}

.piece-upgrade-floater .upgrade-text {
  font-size: 36px;
  font-family: 'MedievalSharp', cursive;
  font-weight: bold;
  margin-bottom: 10px;
}

.piece-upgrade-floater .upgrade-multiplier {
  font-size: 28px;
  font-family: 'Cinzel', serif;
}

.piece-upgrade-floater.tier-1 .upgrade-text {
  color: var(--tier-1);
  text-shadow: 0 0 20px var(--tier-1), 0 0 40px var(--tier-1);
}

.piece-upgrade-floater.tier-2 .upgrade-text {
  color: var(--tier-2);
  text-shadow: 0 0 25px var(--tier-2), 0 0 50px var(--tier-2);
}

.piece-upgrade-floater.tier-3 .upgrade-text {
  color: var(--tier-3);
  text-shadow: 0 0 30px var(--tier-3), 0 0 60px #FF8C00;
}

.piece-upgrade-floater .upgrade-multiplier {
  color: #FFF;
  text-shadow: 0 0 10px currentColor;
}

@keyframes upgrade-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  40% {
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9) translateY(-30px);
  }
}

/* Piece Multiplier Popup (shown when moving upgraded piece) */
.piece-multiplier-popup {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  font-weight: bold;
  font-family: 'MedievalSharp', cursive;
  color: #FFD700;
  text-shadow: 0 0 15px #FFD700, 0 0 30px #FF8C00;
  animation: mult-popup 1s ease-out forwards;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
}

.piece-multiplier-popup .mult {
  color: #00FF00;
  text-shadow: 0 0 10px #00FF00;
}

@keyframes mult-popup {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  30% {
    transform: translateX(-50%) translateY(-20px) scale(1.3);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-50px) scale(0.8);
  }
}

/* ===== PIECE UPGRADES DISPLAY ===== */
#upgrades-display {
  margin-top: 20px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(20, 15, 30, 0.8) 0%, rgba(10, 5, 20, 0.9) 100%);
  border: 2px solid #444;
  border-radius: 10px;
  text-align: center;
}

#upgrades-display.hidden {
  display: none;
}

#upgrades-display.multi-active {
  border-color: #FFD700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4), inset 0 0 15px rgba(255, 215, 0, 0.1);
  animation: multi-mult-pulse 1.5s infinite;
}

#upgrades-display.synergy-active {
  border-color: #FF00FF;
  box-shadow: 0 0 30px rgba(255, 0, 255, 0.5), 0 0 60px rgba(255, 215, 0, 0.3), inset 0 0 20px rgba(255, 0, 255, 0.15);
  animation: synergy-pulse 1s infinite;
}

@keyframes multi-mult-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.4), inset 0 0 15px rgba(255, 215, 0, 0.1); }
  50% { box-shadow: 0 0 35px rgba(255, 215, 0, 0.6), inset 0 0 25px rgba(255, 215, 0, 0.2); }
}

@keyframes synergy-pulse {
  0%, 100% {
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.5), 0 0 60px rgba(255, 215, 0, 0.3);
    filter: hue-rotate(0deg);
  }
  50% {
    box-shadow: 0 0 50px rgba(255, 0, 255, 0.7), 0 0 80px rgba(255, 215, 0, 0.5);
    filter: hue-rotate(15deg);
  }
}

#upgrades-label {
  font-size: 11px;
  font-family: 'Cinzel', serif;
  color: #888;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

#upgrades-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.upgrade-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: 'MedievalSharp', cursive;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid;
}

.upgrade-badge.tier-1 {
  border-color: var(--tier-1);
  color: var(--tier-1);
  text-shadow: 0 0 5px var(--tier-1);
}

.upgrade-badge.tier-2 {
  border-color: var(--tier-2);
  color: var(--tier-2);
  text-shadow: 0 0 8px var(--tier-2);
}

.upgrade-badge.tier-3 {
  border-color: var(--tier-3);
  color: var(--tier-3);
  text-shadow: 0 0 10px var(--tier-3);
  animation: tier3-badge-glow 1s infinite;
}

@keyframes tier3-badge-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
  50% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.8); }
}

.upgrade-badge .piece-icon {
  font-size: 16px;
}

.upgrade-badge .mult-value {
  font-weight: bold;
}

#total-mult-power {
  font-size: 16px;
  font-family: 'MedievalSharp', cursive;
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#total-mult-power.power-high {
  font-size: 18px;
  color: #FF00FF;
  text-shadow: 0 0 15px #FF00FF, 0 0 30px #FFD700;
  animation: power-high-pulse 0.8s infinite;
}

@keyframes power-high-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Enhanced multiplier popup when multiple upgrades active */
.piece-multiplier-popup.multi-bonus {
  font-size: 34px;
  animation: mult-popup 1.2s ease-out forwards, multi-bonus-glow 0.4s infinite;
}

@keyframes multi-bonus-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

.piece-multiplier-popup .synergy-text {
  display: block;
  font-size: 16px;
  color: #FF00FF;
  text-shadow: 0 0 15px #FF00FF, 0 0 30px #FF00FF;
  animation: synergy-flash 0.3s infinite;
  margin-top: 5px;
}

@keyframes synergy-flash {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

/* Speed bonus styling */
.piece-multiplier-popup.speed-bonus {
  color: #00FFFF;
  text-shadow: 0 0 20px #00FFFF, 0 0 40px #0088FF;
  animation: mult-popup 1.2s ease-out forwards, speed-pulse 0.2s infinite;
}

.piece-multiplier-popup.speed-bonus .mult {
  color: #00FFFF;
}

.piece-multiplier-popup.speed-bonus .synergy-text {
  color: #00FFFF;
  text-shadow: 0 0 15px #00FFFF, 0 0 30px #0088FF;
}

@keyframes speed-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

/* ===== SPEED MULTIPLIER INDICATOR ===== */
.speed-mult-indicator {
  position: fixed;
  top: 120px;
  right: 20px;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 10px 20px;
  text-align: center;
  z-index: 100;
  opacity: 0;
  transform: translateX(100px) scale(0.5);
  transition: all 0.3s ease-out;
}

.speed-mult-indicator.active {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.speed-mult-indicator.fade-out {
  opacity: 0;
  transform: translateX(100px) scale(0.5);
}

.speed-mult-indicator.pulse {
  animation: speed-indicator-pulse 0.4s ease-out;
}

@keyframes speed-indicator-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.speed-mult-value {
  font-family: 'MedievalSharp', cursive;
  font-size: 24px;
  font-weight: bold;
  color: #00FFFF;
  text-shadow: 0 0 10px #00FFFF, 0 0 20px #0088FF;
}

.speed-mult-threshold {
  font-size: 14px;
  color: #88DDFF;
  margin-top: 2px;
}

/* Speed mult tiers - text colors intensify */
.speed-mult-indicator.mult-2 .speed-mult-value {
  color: #00CCFF;
}

.speed-mult-indicator.mult-3 .speed-mult-value {
  color: #00FFAA;
  text-shadow: 0 0 10px #00FFAA, 0 0 20px #00FF88;
}

.speed-mult-indicator.mult-4 .speed-mult-value {
  color: #FFFF00;
  text-shadow: 0 0 10px #FFFF00, 0 0 20px #FFAA00;
}

.speed-mult-indicator.mult-5 .speed-mult-value {
  color: #FF00FF;
  text-shadow: 0 0 15px #FF00FF, 0 0 30px #FF00AA;
  animation: speed-text-5 0.2s infinite;
}

@keyframes speed-text-5 {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ===== SPEED COMBO INDICATOR ===== */
/* Speed combo display with tier-based visual intensification */

.speed-combo-indicator {
  position: fixed;
  top: 180px;
  right: 20px;
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 12px 24px;
  text-align: center;
  z-index: 100;
  opacity: 0;
  transform: translateX(100px) scale(0.5);
  transition: all 0.3s ease-out;
  pointer-events: none; /* Don't block touch/click on board */
}

.speed-combo-indicator.active {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.speed-combo-indicator.fade-out {
  opacity: 0;
  transform: translateX(100px) scale(0.5);
}

.speed-combo-indicator.pulse {
  animation: speed-combo-pulse 0.5s ease-out;
}

@keyframes speed-combo-pulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.speed-combo-label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: bold;
  color: #FFFF88;
  text-shadow: 0 0 5px #FF8800;
  letter-spacing: 2px;
}

.speed-combo-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: bold;
  color: var(--color-gold);
  text-shadow: 0 0 10px var(--color-gold), 0 0 20px #FF8800, 0 0 30px #FF4400;
}

/* Speed combo tiers - text colors and effects intensify */
.speed-combo-indicator.mult-2 .speed-combo-value {
  color: var(--color-gold);
}

.speed-combo-indicator.mult-4 .speed-combo-value {
  color: #FF8800;
  text-shadow: 0 0 15px #FF8800, 0 0 25px #FF4400;
}

.speed-combo-indicator.mult-8 .speed-combo-value {
  color: #FF4400;
  text-shadow: 0 0 15px #FF4400, 0 0 30px #FF0000;
  animation: speed-combo-text-8 0.15s infinite;
}

@keyframes speed-combo-text-8 {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.speed-combo-indicator.mult-16 .speed-combo-value {
  color: #FF0000;
  text-shadow: 0 0 20px #FF0000, 0 0 40px #FF4400, 0 0 60px #FFFF00;
  animation: speed-combo-text-16 0.1s infinite;
}

.speed-combo-indicator.mult-16 .speed-combo-label {
  animation: speed-combo-label-16 0.2s infinite;
}

@keyframes speed-combo-text-16 {
  0%, 100% { transform: scale(1); color: #FF0000; }
  50% { transform: scale(1.1); color: #FFFF00; }
}

@keyframes speed-combo-label-16 {
  0%, 100% { color: #FFFF88; }
  50% { color: #FFFFFF; }
}

/* Speed combo lightning effects */
.speed-combo-indicator.has-lightning {
  overflow: visible;
}

.speed-combo-spark {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #00DDFF;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 8px #00DDFF, 0 0 15px #00AAFF, 0 0 25px #0088FF;
  animation: spark-flash 0.3s ease-out forwards;
}

@keyframes spark-flash {
  0% {
    opacity: 1;
    transform: translate(var(--dx), var(--dy)) scale(1);
  }
  50% {
    opacity: 0.8;
    transform: translate(calc(var(--dx) * 1.5), calc(var(--dy) * 1.5)) scale(1.5);
  }
  100% {
    opacity: 0;
    transform: translate(calc(var(--dx) * 2), calc(var(--dy) * 2)) scale(0);
  }
}

.speed-combo-lightning-bolt {
  position: absolute;
  width: 3px;
  height: 30px;
  background: linear-gradient(to bottom, transparent, #00DDFF, #FFFFFF, #00DDFF, transparent);
  pointer-events: none;
  transform-origin: top center;
  animation: speed-combo-lightning-strike 0.15s ease-out forwards;
  box-shadow: 0 0 10px #00DDFF, 0 0 20px #0088FF;
}

@keyframes speed-combo-lightning-strike {
  0% {
    opacity: 1;
    transform: rotate(var(--angle)) scaleY(0);
  }
  30% {
    opacity: 1;
    transform: rotate(var(--angle)) scaleY(1);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) scaleY(1);
  }
}

/* ===== RECOVERY INDICATOR (Blunder Cooldown) ===== */
.recovery-indicator {
  position: fixed;
  top: 180px;
  right: 20px;
  background: rgba(139, 0, 0, 0.8);
  border: 2px solid #FF4444;
  border-radius: 8px;
  padding: 8px 16px;
  text-align: center;
  z-index: 100;
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.3s ease-out;
  pointer-events: none;
}

.recovery-indicator.active {
  opacity: 1;
  transform: translateX(0);
  animation: recovery-pulse 1.5s infinite;
}

@keyframes recovery-pulse {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 0, 0, 0.3); }
  50% { box-shadow: 0 0 15px rgba(255, 0, 0, 0.6); }
}

.recovery-label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: bold;
  color: #FF6666;
  text-shadow: 0 0 5px #FF0000;
  letter-spacing: 1px;
}

.recovery-count {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: bold;
  color: #FFFFFF;
}

/* Score breakdown precision types */
.breakdown-line.precision.lightning {
  color: #00DDFF !important;
}

.breakdown-line.precision.lightning .label {
  color: #00DDFF;
  text-shadow: 0 0 10px #00DDFF;
}

.breakdown-line.precision.recovering {
  color: #FF6666 !important;
}

.breakdown-line.precision.recovering .label {
  color: #FF6666;
  text-shadow: 0 0 5px #FF0000;
}

.breakdown-header.lightning {
  color: #00DDFF !important;
  text-shadow: 0 0 10px #00DDFF, 0 0 20px #0088FF !important;
  animation: lightning-header 0.5s ease-out;
}

@keyframes lightning-header {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; transform: scale(1.05); }
}

/* Finisher line in breakdown */
.breakdown-line.finisher {
  color: #FFD700 !important;
}

.breakdown-line.finisher .label {
  color: #FFD700;
  text-shadow: 0 0 10px #FFA500;
  animation: finisher-glow 0.5s ease-out infinite alternate;
}

@keyframes finisher-glow {
  0% { text-shadow: 0 0 5px #FFA500; }
  100% { text-shadow: 0 0 15px #FFD700, 0 0 25px #FFA500; }
}

/* ===== LEADERBOARD & NAME ENTRY (Arcade Style) ===== */

/* Arcade button style */
.arcade-btn {
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: 20px;
  font-family: 'MedievalSharp', cursive;
  font-weight: bold;
  letter-spacing: 3px;
  background: linear-gradient(180deg, #CC8800 0%, #996600 100%);
  color: #FFF;
  border: 3px solid #FFD700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  min-width: var(--btn-min-width);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
  box-shadow: 0 4px 0 #664400, 0 6px 10px rgba(0, 0, 0, 0.5);
}

.arcade-btn:hover {
  background: linear-gradient(180deg, #FFAA00 0%, #CC8800 100%);
  transform: translateY(-2px) scale(var(--btn-hover-scale));
  box-shadow: 0 6px 0 #664400, 0 8px 15px rgba(0, 0, 0, 0.5), var(--btn-hover-glow);
}

.arcade-btn:active {
  transform: translateY(2px) scale(var(--btn-active-scale));
  box-shadow: 0 2px 0 #664400, 0 3px 5px rgba(0, 0, 0, 0.5);
}

.menu-btn.secondary {
  margin-top: 15px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font-size);
  background: linear-gradient(180deg, #444 0%, #222 100%);
  border-color: #666;
  border-radius: var(--radius-md);
  min-width: var(--btn-min-width);
  box-shadow: 0 4px 0 #111, 0 6px 10px rgba(0, 0, 0, 0.5);
}

.menu-btn.secondary:hover {
  background: linear-gradient(180deg, #555 0%, #333 100%);
  border-color: #888;
  transform: scale(var(--btn-hover-scale));
  box-shadow: 0 4px 0 #111, 0 6px 10px rgba(0, 0, 0, 0.5), var(--btn-hover-glow);
}

.menu-btn.secondary:active {
  transform: scale(var(--btn-active-scale));
}

/* Name Entry Overlay */
#name-entry-overlay {
  background: radial-gradient(ellipse at center, rgba(0, 30, 60, 0.98) 0%, rgba(0, 10, 30, 0.99) 100%);
}

#name-entry-overlay h1 {
  color: #FFD700;
  text-shadow: 0 0 30px #FFD700, 0 0 60px #FF8C00;
  animation: high-score-flash 0.5s infinite;
  font-size: 64px;
}

@keyframes high-score-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

#name-entry-score {
  font-size: 48px;
  font-family: 'MedievalSharp', cursive;
  color: #FFF;
  margin: 10px 0;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

#name-entry-rank {
  font-size: 24px;
  font-family: 'Cinzel', serif;
  color: #00FFFF;
  margin-bottom: 30px;
}

.name-entry-prompt {
  font-size: 20px;
  color: #888;
  letter-spacing: 3px;
  margin-bottom: 20px;
}

#name-entry-input {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

.name-char {
  width: 70px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  font-family: 'MedievalSharp', cursive;
  font-weight: bold;
  color: #FFD700;
  background: linear-gradient(180deg, #1a1a2a 0%, #0a0a15 100%);
  border: 4px solid #444;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
  user-select: none;
}

.name-char:hover {
  border-color: #FFD700;
  transform: scale(1.05);
}

.name-char.selected {
  border-color: #00FFFF;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), inset 0 0 20px rgba(0, 255, 255, 0.1);
  animation: char-selected 0.5s infinite;
}

@keyframes char-selected {
  0%, 100% { border-color: #00FFFF; }
  50% { border-color: #FFD700; }
}

.control-hint {
  font-size: 14px;
  color: #666;
  margin-bottom: 25px;
}

#name-entry-submit {
  margin-top: 10px;
}

/* Leaderboard Overlay */
#leaderboard-overlay {
  background: radial-gradient(ellipse at center, rgba(10, 10, 20, 0.98) 0%, rgba(0, 0, 10, 0.99) 100%);
}

#leaderboard-overlay h1 {
  color: #FFD700;
  text-shadow: 0 0 30px #FFD700;
  margin-bottom: 20px;
}

#leaderboard-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.leaderboard-tab {
  padding: 12px 30px;
  font-size: 16px;
  font-family: 'Cinzel', serif;
  font-weight: bold;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #222 0%, #111 100%);
  color: #666;
  border: 2px solid #333;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.leaderboard-tab:hover {
  color: #888;
  border-color: #444;
}

.leaderboard-tab.active {
  background: linear-gradient(180deg, #CC8800 0%, #996600 100%);
  color: #FFF;
  border-color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#leaderboard-content {
  width: 100%;
  max-width: 500px;
  margin-bottom: 25px;
}

.leaderboard-list {
  display: none;
}

.leaderboard-list.active {
  display: block;
}

.leaderboard-header {
  display: flex;
  padding: 10px 15px;
  font-size: 14px;
  font-family: 'Cinzel', serif;
  color: #666;
  letter-spacing: 2px;
  border-bottom: 2px solid #333;
  margin-bottom: 5px;
}

.lb-rank { width: 50px; text-align: center; }
.lb-name { width: 100px; text-align: center; }
.lb-stage { width: 60px; text-align: center; }
.lb-score { flex: 1; text-align: right; }

.leaderboard-entry {
  display: flex;
  padding: 12px 15px;
  font-size: 18px;
  font-family: 'MedievalSharp', cursive;
  color: #E8E4D9;
  background: linear-gradient(180deg, rgba(30, 30, 40, 0.6) 0%, rgba(20, 20, 30, 0.6) 100%);
  border-radius: 5px;
  margin-bottom: 4px;
  transition: all 0.2s;
}

.leaderboard-entry:hover {
  background: linear-gradient(180deg, rgba(40, 40, 50, 0.8) 0%, rgba(30, 30, 40, 0.8) 100%);
}

.leaderboard-entry.rank-1 {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.2) 0%, rgba(200, 150, 0, 0.15) 100%);
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.leaderboard-entry.rank-1 .entry-rank {
  color: #FFD700;
  text-shadow: 0 0 10px #FFD700;
}

.leaderboard-entry.rank-2 {
  background: linear-gradient(180deg, rgba(192, 192, 192, 0.15) 0%, rgba(150, 150, 150, 0.1) 100%);
  border: 1px solid rgba(192, 192, 192, 0.2);
}

.leaderboard-entry.rank-2 .entry-rank {
  color: #C0C0C0;
}

.leaderboard-entry.rank-3 {
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.15) 0%, rgba(150, 100, 50, 0.1) 100%);
  border: 1px solid rgba(205, 127, 50, 0.2);
}

.leaderboard-entry.rank-3 .entry-rank {
  color: #CD7F32;
}

.leaderboard-entry.highlight {
  animation: new-entry-glow 1s infinite;
  border: 2px solid #00FFFF;
}

@keyframes new-entry-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 255, 0.5); }
  50% { box-shadow: 0 0 25px rgba(0, 255, 255, 0.8); }
}

.entry-rank { width: 50px; text-align: center; font-weight: bold; }
.entry-name { width: 100px; text-align: center; letter-spacing: 3px; }
.entry-stage { width: 60px; text-align: center; color: #888; }
.entry-score { flex: 1; text-align: right; color: #FFD700; }

.leaderboard-empty {
  text-align: center;
  padding: 40px;
  color: #666;
  font-family: 'Cinzel', serif;
  font-style: italic;
}

#leaderboard-close {
  background: linear-gradient(180deg, #444 0%, #222 100%);
  border-color: #666;
}

#leaderboard-close:hover {
  background: linear-gradient(180deg, #555 0%, #333 100%);
}

/* ===== RESPONSIVE ===== */

/* Large Desktop (>1024px) - Larger board */
@media (min-width: 1025px) {
  #board-container {
    width: min(560px, 60vh);
    height: min(560px, 60vh);
  }

  #main-area {
    gap: 25px;
  }

  #stage-container {
    width: 160px;
  }
}

/* Large Tablet (768-1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
  #board-container {
    width: min(450px, 55vh);
    height: min(450px, 55vh);
  }

  #main-area {
    gap: 20px;
  }

  #stage-container {
    width: 140px;
  }
}

/* Tablet (768px) */
@media (max-width: 768px) {
  /* Prevent zoom on input focus (iOS) */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Dual HP Bar responsive */
  #dual-hp-container {
    padding: 10px 15px 8px;
    gap: 3px;
  }

  #enemy-hp-bar, #player-hp-section #hp-bar {
    height: 20px;
  }

  #enemy-name, #player-name {
    font-size: 12px;
    min-width: 70px;
  }

  #enemy-hp-text, #player-hp-section #hp-text {
    font-size: 12px;
    min-width: 55px;
  }

  #vs-indicator {
    font-size: 12px;
    padding: 1px 10px;
  }

  .ko-announcement {
    font-size: 80px;
  }

  .announcement.finish-him-enemy {
    font-size: 32px;
    top: 10%;
  }

  #board-container {
    width: 380px;
    height: 380px;
  }

  #move-annotation {
    font-size: 100px;
  }

  #stage-container {
    width: 130px;
  }

  #combo-multiplier {
    font-size: 48px;
  }

  .overlay h1 {
    font-size: 40px;
  }

  .announcement {
    font-size: 50px;
  }
}

/* Small tablet (600px) */
@media (max-width: 600px) {
  #main-area {
    flex-direction: column;
    gap: 15px;
    align-items: center;
    padding-top: 80px; /* Space for fixed health bar */
  }

  #stage-container {
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    order: -1; /* Move stage info above board on mobile */
  }

  #board-wrapper {
    order: 0;
  }

  #board-container {
    width: min(380px, calc(100vw - 20px));
    height: min(380px, calc(100vw - 20px));
  }

  #move-annotation {
    font-size: 70px;
  }

  .announcement {
    font-size: 36px;
  }

  #powerup-choices {
    max-width: 100%;
    gap: 15px;
  }

  .powerup-card {
    min-width: 110px;
    max-width: 150px;
    min-height: 180px;
    padding: 18px 12px;
  }

  .powerup-icon {
    font-size: 44px;
  }

  /* Shop responsive */
  #shop-items {
    flex-wrap: wrap;
    gap: 10px;
  }

  .shop-slot {
    width: 140px;
    min-height: 180px;
  }

  .shop-item-icon {
    font-size: 36px;
  }

  .shop-item-name {
    font-size: 14px;
  }

  #shop-actions {
    flex-direction: column;
    gap: 10px;
  }

  .shop-btn {
    padding: 12px 30px;
    font-size: 16px;
  }

  /* Player Intro responsive */
  .player-portrait-frame {
    width: 140px;
    height: 170px;
    margin-bottom: 15px;
  }

  .portrait-fallback {
    font-size: 70px;
  }

  .player-era {
    font-size: 14px;
  }

  #player-intro-overlay .player-name {
    font-size: 28px;
  }

  .player-title {
    font-size: 18px;
    margin-bottom: 15px;
  }

  .player-quote {
    font-size: 14px;
    max-width: 90%;
    margin-bottom: 20px;
  }

  .position-context {
    font-size: 12px;
    margin-top: 10px;
    margin-bottom: 15px;
  }

  .stage-badge {
    padding: 10px 20px;
  }

  .stage-num {
    font-size: 36px;
  }

  .fight-btn {
    padding: 15px 50px;
    font-size: 22px;
  }

  /* Leaderboard responsive */
  #name-entry-input {
    gap: 10px;
  }

  .name-char {
    width: 55px;
    height: 70px;
    font-size: 40px;
  }

  #leaderboard-content {
    max-width: 95%;
  }

  .leaderboard-entry {
    font-size: 14px;
    padding: 10px;
  }

  .lb-rank, .entry-rank { width: 35px; }
  .lb-name, .entry-name { width: 70px; }
  .lb-stage, .entry-stage { width: 40px; }

  /* Leaderboard buttons responsive */
  .leaderboard-buttons {
    flex-wrap: wrap;
    gap: 10px;
  }

  .leaderboard-buttons .arcade-btn {
    padding: 12px 25px;
    font-size: 16px;
  }
}

/* Small phones (480px) */
@media (max-width: 480px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  #game-container {
    min-height: 100vh;
    height: auto;
    padding-bottom: 20px;
  }

  /* Dual HP Bar - Compact for mobile */
  #dual-hp-container {
    width: 98%;
    padding: 8px 10px 5px;
    gap: 2px;
  }

  #enemy-hp-section, #player-hp-section {
    gap: 5px;
  }

  #enemy-hp-bar, #player-hp-section #hp-bar {
    height: 18px;
  }

  #enemy-name, #player-name {
    font-size: 10px;
    min-width: 50px;
    letter-spacing: 0;
  }

  #enemy-hp-text, #player-hp-section #hp-text {
    font-size: 10px;
    min-width: 45px;
  }

  #vs-indicator {
    font-size: 10px;
    padding: 0 8px;
    letter-spacing: 2px;
  }

  .ko-announcement {
    font-size: 60px;
    letter-spacing: 5px;
  }

  .announcement.finish-him-enemy {
    font-size: 24px;
    top: 8%;
    letter-spacing: 2px;
  }

  .enemy-damage-floater {
    font-size: 24px;
  }

  .enemy-heal-floater {
    font-size: 18px;
  }

  /* Main Area - Stack vertically */
  #main-area {
    flex-direction: column;
    gap: 10px;
    padding: 5px;
    padding-top: 70px; /* Space for fixed health bar */
    width: 100%;
  }

  /* Board - Fill available width with max limit */
  #board-container {
    width: calc(100vw - 20px) !important;
    height: calc(100vw - 20px) !important;
    max-width: 350px !important;
    max-height: 350px !important;
  }

  #board-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  /* Powerups under board on mobile */
  #powerups-container {
    gap: 6px;
    padding: 4px;
  }

  .inventory-item {
    padding: 5px 8px;
    font-size: 16px;
    min-width: 36px;
  }

  .inventory-item .inventory-icon {
    font-size: 18px;
  }

  /* Stage container - Horizontal on mobile */
  #stage-container {
    width: 100%;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 8px;
    gap: 10px;
    order: -1; /* Above board */
  }

  #combo-section {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  #combo-multiplier {
    font-size: 24px;
  }

  #combo-name {
    font-size: 10px;
  }

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

  #score-label {
    font-size: 9px;
  }

  #score-section {
    margin-top: 0;
  }

  #stage-number {
    font-size: 14px;
  }

  #position-info, #moves-remaining {
    font-size: 11px;
  }

  /* Move annotation - smaller on mobile */
  #move-annotation {
    font-size: 60px !important;
  }

  /* Overlays - Full screen on mobile */
  .overlay {
    padding: 20px;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .overlay h1 {
    font-size: 28px;
  }

  .overlay p {
    font-size: 14px;
  }

  /* Menu screen */
  .game-title {
    flex-direction: column;
    gap: 5px;
  }

  .title-mortal, .title-chess {
    font-size: 36px;
  }

  .tagline {
    font-size: 14px;
  }

  #start-button, .menu-btn {
    padding: 15px 40px;
    font-size: 18px;
    width: 100%;
    max-width: 250px;
    min-width: unset;
  }

  /* Death screen */
  .death-buttons {
    flex-direction: column;
    gap: 10px;
  }

  /* Powerup selection - Scrollable grid */
  #powerup-choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 55vh;
    overflow-y: auto;
    padding: 10px;
    max-width: 100%;
    justify-content: center;
  }

  .powerup-card {
    min-width: unset;
    max-width: unset;
    width: 100%;
    min-height: 150px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }

  .powerup-icon {
    font-size: 36px;
    margin-bottom: 8px;
  }

  .powerup-name {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .powerup-desc {
    font-size: 10px;
  }

  .powerup-hint {
    font-size: 10px;
    padding: 0 10px;
  }

  /* Shop - Mobile optimized layout */
  #shop-overlay {
    padding: 15px 10px;
    justify-content: flex-start;
    overflow-y: auto;
  }

  #shop-overlay h1 {
    font-size: 22px;
    margin-bottom: 5px;
  }

  #shop-gold-display {
    font-size: 24px;
    margin-bottom: 15px;
  }

  .shop-gold-icon {
    font-size: 28px;
  }

  #shop-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 400px;
    padding: 5px;
    margin-bottom: 15px;
    flex-shrink: 0;
  }

  .shop-slot {
    width: 100%;
    min-height: 140px;
    padding: 12px 8px;
    border-radius: 10px;
    border-width: 2px;
  }

  .shop-item {
    padding: 5px;
  }

  .shop-item-icon {
    font-size: 32px;
    margin-bottom: 5px;
  }

  .shop-item-name {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .shop-item-desc {
    font-size: 9px;
    min-height: 24px;
    margin-bottom: 8px;
    line-height: 1.2;
  }

  .shop-item-price {
    font-size: 16px;
  }

  #shop-actions {
    flex-direction: row;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    padding: 0 5px;
  }

  .shop-btn {
    padding: 12px 15px;
    font-size: 14px;
    flex: 1;
    min-width: 0;
    border-radius: 8px;
  }

  .shop-btn.primary {
    flex: 1.2;
  }

  .shop-hint {
    font-size: 11px;
    margin-top: 10px;
    padding: 0 10px;
    text-align: center;
  }

  /* Sold items on mobile */
  .shop-slot.sold .sold-text {
    font-size: 14px;
  }

  /* Bottom bar removed - powerups now under board */

  /* Power-up indicators - Compact row below health bar */
  #shield-indicator, #timeout-indicator, #adrenaline-indicator,
  #ironskin-indicator, #lightning-indicator, #doublemove-indicator,
  #comboanchor-indicator, #criticalstrike-indicator, #bloodlust-indicator {
    position: fixed;
    top: 55px;
    left: auto;
    right: auto;
    bottom: auto;
    font-size: 9px;
    padding: 4px 8px;
    border-radius: 4px;
    border-width: 1px;
    z-index: 50;
  }

  /* Position indicators in a row with better spacing */
  #shield-indicator { left: 5px; right: auto; transform: none; }
  #timeout-indicator { left: 5px; top: 80px; right: auto; transform: none; }
  #adrenaline-indicator { left: 90px; right: auto; transform: none; }
  #ironskin-indicator { left: 90px; top: 80px; right: auto; transform: none; }
  #lightning-indicator { right: 90px; left: auto; transform: none; }
  #doublemove-indicator { right: 5px; left: auto; transform: none; }
  #comboanchor-indicator { right: 5px; top: 80px; left: auto; transform: none; }
  #criticalstrike-indicator { left: 175px; right: auto; transform: none; }
  #bloodlust-indicator { right: 175px; left: auto; transform: none; }

  /* Leaderboard - Full width */
  #leaderboard-content {
    max-width: 100%;
    width: 100%;
  }

  .leaderboard-entry {
    font-size: 12px;
    padding: 8px 5px;
  }

  .lb-rank, .entry-rank { width: 30px; font-size: 11px; }
  .lb-name, .entry-name { width: 60px; font-size: 11px; }
  .lb-stage, .entry-stage { width: 35px; font-size: 11px; }
  .lb-score, .entry-score { font-size: 11px; }

  /* Name entry - Smaller */
  .name-char {
    width: 45px;
    height: 60px;
    font-size: 32px;
  }

  /* Pause menu */
  .pause-options {
    flex-direction: column;
    gap: 10px;
  }

  .pause-btn {
    width: 100%;
    max-width: 250px;
  }

  /* Announcements */
  .announcement {
    font-size: 28px !important;
    padding: 0 10px;
  }

  /* Speed combo indicator - Mobile positioning */
  .speed-combo-indicator {
    top: auto;
    bottom: 80px;
    right: 10px;
    left: auto;
    padding: 6px 12px;
    font-size: 12px;
    max-width: 100px;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
  }

  .speed-combo-label {
    font-size: 10px;
    letter-spacing: 1px;
  }

  .speed-combo-value {
    font-size: 20px;
  }

  /* Damage effects */
  #damage-flash {
    pointer-events: none;
  }

  /* Upgrades display */
  #upgrades-display {
    font-size: 10px;
  }

  #upgrades-list {
    gap: 3px;
  }

  .upgrade-item {
    font-size: 14px;
  }
}

/* Very small phones (iPhone SE, etc) */
@media (max-width: 375px) {
  #board-container {
    width: calc(100vw - 16px) !important;
    height: calc(100vw - 16px) !important;
    max-width: 300px !important;
    max-height: 300px !important;
  }

  .title-mortal, .title-chess {
    font-size: 28px;
  }

  #powerup-choices {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-height: 50vh;
  }

  .powerup-card {
    padding: 10px 5px;
    min-height: 130px;
  }

  .powerup-icon {
    font-size: 28px;
  }

  .powerup-name {
    font-size: 11px;
  }

  .powerup-desc {
    font-size: 9px;
  }

  /* Even smaller indicators */
  #shield-indicator, #timeout-indicator, #adrenaline-indicator,
  #ironskin-indicator, #lightning-indicator, #doublemove-indicator,
  #comboanchor-indicator, #criticalstrike-indicator, #bloodlust-indicator {
    font-size: 8px;
    padding: 2px 5px;
  }

  /* Inventory on tiny phones - still touch-friendly */
  .inventory-item {
    padding: 4px 6px;
    font-size: 14px;
    min-width: 32px;
  }

  .inventory-item .inventory-icon {
    font-size: 16px;
  }

  #powerups-container {
    gap: 4px;
  }

  /* Shop for tiny phones */
  #shop-overlay h1 {
    font-size: 20px;
  }

  #shop-gold-display {
    font-size: 20px;
    margin-bottom: 10px;
  }

  #shop-items {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .shop-slot {
    min-height: 120px;
    padding: 6px;
  }

  .shop-item-icon {
    font-size: 26px;
  }

  .shop-item-name {
    font-size: 10px;
  }

  .shop-item-desc {
    font-size: 8px;
    min-height: 20px;
  }

  .shop-item-price {
    font-size: 14px;
  }

  .shop-btn {
    padding: 10px 12px;
    font-size: 12px;
    width: 100%;
    max-width: 250px;
    min-width: unset;
  }

  #move-annotation {
    font-size: 48px !important;
  }

  #combo-multiplier {
    font-size: 24px;
  }
}

/* ===== MODERN PHONE BREAKPOINTS (390px, 360px, 320px) ===== */

/* Modern iPhones (390px) - iPhone 12/13/14 */
@media (max-width: 390px) {
  /* === MK Health Bars === */
  #mk-health-container {
    padding: 6px 8px;
    gap: 4px;
  }

  .mk-health-bar {
    width: 110px;
    height: 16px;
  }

  .mk-portrait {
    width: 32px;
    height: 40px;
  }

  .mk-portrait-fallback {
    font-size: 18px;
  }

  .mk-name {
    font-size: 9px;
    letter-spacing: 0;
  }

  .mk-vs-emblem {
    font-size: 12px;
    padding: 0 4px;
  }

  #mk-health-container #gold-display {
    font-size: 12px;
    gap: 3px;
  }

  #mk-health-container #gold-icon {
    font-size: 14px;
  }

  /* === Board Sizing === */
  #board-container {
    width: calc(100vw - 16px) !important;
    height: calc(100vw - 16px) !important;
    max-width: 340px !important;
    max-height: 340px !important;
  }

  #main-area {
    padding-top: 60px;
  }

  /* === Hero Selection - Scrollable on Mobile === */
  #hero-select-overlay {
    overflow-y: auto;
    padding: 20px 10px;
    justify-content: flex-start;
  }

  #hero-cards {
    max-width: 340px;
    gap: 12px;
    padding: 0 12px;
    margin-bottom: 20px;
  }

  .hero-card {
    min-width: unset;
    padding: 16px;
    flex-direction: row;
    align-items: flex-start;
    text-align: left;
    gap: 12px;
  }

  .hero-portrait {
    width: 70px;
    height: 85px;
    flex-shrink: 0;
    margin-bottom: 0;
  }

  .hero-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-name {
    font-size: 16px;
  }

  .hero-title-text {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .hero-archetype {
    font-size: 9px;
    margin-bottom: 8px;
    padding: 2px 8px;
  }

  .hero-era {
    font-size: 10px;
    margin-bottom: 8px;
  }

  .hero-passives {
    gap: 6px;
  }

  .hero-passive {
    padding: 6px 8px;
  }

  .hero-passive-name {
    font-size: 10px;
  }

  .hero-passive-desc {
    font-size: 9px;
  }

  .hero-select-title {
    font-size: 28px;
  }

  .hero-select-hint {
    font-size: 12px;
    margin-top: 15px;
  }

  /* === Stage Info & Combo Display === */
  #combo-multiplier {
    font-size: 22px;
  }

  #combo-name {
    font-size: 9px;
  }

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

  #score-label {
    font-size: 8px;
  }

  #stage-number {
    font-size: 13px;
  }

  #position-info, #moves-remaining {
    font-size: 10px;
  }

  /* === Shop & Powerup Overlays === */
  .shop-slot {
    min-height: 115px;
    padding: 8px 6px;
  }

  .shop-item-icon {
    font-size: 24px;
    margin-bottom: 4px;
  }

  .shop-item-name {
    font-size: 10px;
  }

  .shop-item-desc {
    font-size: 8px;
    min-height: 18px;
  }

  .shop-item-price {
    font-size: 13px;
  }

  .powerup-card {
    min-height: 140px;
    padding: 12px 8px;
  }

  .powerup-icon {
    font-size: 32px;
    margin-bottom: 6px;
  }

  .powerup-name {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .powerup-desc {
    font-size: 9px;
  }

  /* === Player Intro Screen === */
  .player-portrait-frame {
    width: 120px;
    height: 150px;
    margin-bottom: 12px;
  }

  .portrait-fallback {
    font-size: 60px;
  }

  #player-intro-overlay .player-name {
    font-size: 24px;
  }

  .player-title {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .player-quote {
    font-size: 12px;
    max-width: 85%;
    margin-bottom: 15px;
  }

  .position-context {
    font-size: 11px;
    margin-top: 8px;
    margin-bottom: 12px;
  }

  .player-era {
    font-size: 12px;
  }

  .stage-badge {
    padding: 8px 16px;
  }

  .stage-num {
    font-size: 32px;
  }

  .stage-label {
    font-size: 12px;
  }

  .fight-btn {
    padding: 12px 40px;
    font-size: 20px;
    letter-spacing: 3px;
  }

  /* === Announcements === */
  .announcement {
    font-size: 24px !important;
  }

  .ko-announcement {
    font-size: 48px;
  }

  .announcement.finish-him-enemy {
    font-size: 20px;
  }

  /* === Move Annotation === */
  #move-annotation {
    font-size: 44px !important;
  }

  /* === Menu Screen === */
  .title-mortal, .title-chess {
    font-size: 26px;
  }

  .tagline {
    font-size: 12px;
  }

  #start-button, .menu-btn {
    padding: 12px 30px;
    font-size: 16px;
    width: 100%;
    max-width: 250px;
    min-width: unset;
  }

  /* === Leaderboard === */
  .name-char {
    width: 40px;
    height: 52px;
    font-size: 28px;
  }

  .leaderboard-entry {
    font-size: 11px;
    padding: 6px 4px;
  }
}

/* Common Android phones (360px) - Galaxy S series */
@media (max-width: 360px) {
  /* === MK Health Bars - Stacked Layout === */
  #mk-health-container {
    flex-direction: column;
    padding: 4px 6px;
    gap: 2px;
  }

  .mk-fighter-section {
    width: 100%;
    justify-content: center;
  }

  .mk-fighter-section.mk-player {
    order: 2;
  }

  .mk-fighter-section.mk-enemy {
    order: 1;
    flex-direction: row-reverse;
  }

  .mk-vs-emblem {
    display: none;
  }

  .mk-health-bar {
    width: 140px;
    height: 14px;
  }

  .mk-portrait {
    width: 28px;
    height: 35px;
  }

  .mk-portrait-fallback {
    font-size: 16px;
  }

  .mk-name {
    font-size: 8px;
  }

  #mk-health-container #gold-display {
    position: absolute;
    right: 6px;
    top: 4px;
    font-size: 11px;
  }

  /* === Board Sizing === */
  #board-container {
    width: calc(100vw - 12px) !important;
    height: calc(100vw - 12px) !important;
    max-width: 310px !important;
    max-height: 310px !important;
  }

  #main-area {
    padding-top: 55px;
  }

  /* === Hero Selection === */
  .hero-select-title {
    font-size: 22px;
    margin-bottom: 15px;
  }

  #hero-cards {
    max-width: 320px;
    gap: 10px;
    padding: 0 10px;
  }

  .hero-card {
    padding: 12px;
    gap: 10px;
  }

  .hero-portrait {
    width: 60px;
    height: 75px;
  }

  .hero-name {
    font-size: 14px;
  }

  .hero-title-text {
    font-size: 9px;
  }

  .hero-archetype {
    font-size: 8px;
    padding: 2px 6px;
  }

  .hero-era {
    font-size: 9px;
    margin-bottom: 6px;
  }

  .hero-passives {
    gap: 4px;
  }

  .hero-passive {
    padding: 4px 6px;
  }

  .hero-passive-name {
    font-size: 9px;
  }

  .hero-passive-desc {
    font-size: 8px;
    line-height: 1.2;
  }

  .hero-select-title {
    font-size: 24px;
  }

  .hero-select-hint {
    font-size: 11px;
  }

  /* === Stage Info & Combo Display === */
  #combo-multiplier {
    font-size: 20px;
  }

  #combo-name {
    font-size: 8px;
  }

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

  #score-label {
    font-size: 8px;
  }

  #stage-number {
    font-size: 12px;
  }

  #position-info, #moves-remaining {
    font-size: 9px;
  }

  /* === Shop & Powerup Overlays === */
  #shop-items {
    gap: 6px;
  }

  .shop-slot {
    min-height: 105px;
    padding: 6px 4px;
  }

  .shop-item-icon {
    font-size: 22px;
    margin-bottom: 3px;
  }

  .shop-item-name {
    font-size: 9px;
  }

  .shop-item-desc {
    font-size: 7px;
    min-height: 16px;
  }

  .shop-item-price {
    font-size: 12px;
  }

  .shop-btn {
    padding: 8px 10px;
    font-size: 11px;
  }

  #powerup-choices {
    gap: 6px;
  }

  .powerup-card {
    min-height: 125px;
    padding: 10px 6px;
  }

  .powerup-icon {
    font-size: 28px;
    margin-bottom: 5px;
  }

  .powerup-name {
    font-size: 11px;
    margin-bottom: 3px;
  }

  .powerup-desc {
    font-size: 8px;
  }

  /* === Player Intro Screen === */
  .player-portrait-frame {
    width: 100px;
    height: 125px;
    margin-bottom: 10px;
  }

  .portrait-fallback {
    font-size: 50px;
  }

  #player-intro-overlay .player-name {
    font-size: 20px;
  }

  .player-title {
    font-size: 14px;
    margin-bottom: 10px;
  }

  .player-quote {
    font-size: 11px;
    margin-bottom: 12px;
  }

  .position-context {
    font-size: 10px;
    margin-top: 6px;
    margin-bottom: 10px;
  }

  .player-era {
    font-size: 11px;
  }

  .stage-badge {
    padding: 6px 12px;
  }

  .stage-num {
    font-size: 28px;
  }

  .stage-label {
    font-size: 11px;
  }

  .fight-btn {
    padding: 10px 35px;
    font-size: 18px;
    letter-spacing: 2px;
  }

  /* === Announcements === */
  .announcement {
    font-size: 22px !important;
  }

  .ko-announcement {
    font-size: 42px;
  }

  .announcement.finish-him-enemy {
    font-size: 18px;
  }

  /* === Move Annotation === */
  #move-annotation {
    font-size: 40px !important;
  }

  /* === Menu Screen === */
  .title-mortal, .title-chess {
    font-size: 24px;
  }

  .tagline {
    font-size: 11px;
  }

  #start-button, .menu-btn {
    padding: 10px 25px;
    font-size: 14px;
    min-width: 160px;
  }

  /* === Leaderboard === */
  .name-char {
    width: 36px;
    height: 48px;
    font-size: 26px;
  }

  .leaderboard-entry {
    font-size: 10px;
    padding: 5px 3px;
  }

  /* === Inventory/Powerups === */
  .inventory-item {
    padding: 3px 5px;
    font-size: 13px;
    min-width: 30px;
  }

  .inventory-item .inventory-icon {
    font-size: 15px;
  }

  #powerups-container {
    gap: 3px;
  }

  /* === Power-up Indicators === */
  #shield-indicator, #timeout-indicator, #adrenaline-indicator,
  #ironskin-indicator, #lightning-indicator, #doublemove-indicator,
  #comboanchor-indicator, #criticalstrike-indicator, #bloodlust-indicator {
    font-size: 7px;
    padding: 2px 4px;
  }
}

/* Legacy phones (320px) - iPhone SE 1st gen, older devices */
@media (max-width: 320px) {
  /* === MK Health Bars - Minimal Layout === */
  #mk-health-container {
    padding: 3px 4px;
  }

  .mk-health-bar {
    width: 120px;
    height: 12px;
  }

  .mk-portrait {
    width: 24px;
    height: 30px;
  }

  .mk-portrait-fallback {
    font-size: 14px;
  }

  .mk-name {
    display: none; /* Hide names on tiny screens */
  }

  #mk-health-container #gold-display {
    font-size: 10px;
    right: 4px;
    top: 2px;
  }

  /* === Board Sizing === */
  #board-container {
    width: calc(100vw - 10px) !important;
    height: calc(100vw - 10px) !important;
    max-width: 280px !important;
    max-height: 280px !important;
  }

  #main-area {
    padding-top: 50px;
    gap: 6px;
  }

  /* === Hero Selection === */
  #hero-select-overlay {
    padding: 15px 8px;
  }

  .hero-select-title {
    font-size: 18px;
    margin-bottom: 12px;
    letter-spacing: 2px;
  }

  #hero-cards {
    max-width: 290px;
    gap: 8px;
    padding: 0 8px;
  }

  .hero-card {
    padding: 10px;
    gap: 8px;
  }

  .hero-portrait {
    width: 50px;
    height: 62px;
  }

  .hero-name {
    font-size: 13px;
  }

  .hero-title-text {
    font-size: 8px;
  }

  .hero-archetype {
    font-size: 7px;
    padding: 1px 5px;
    margin-bottom: 4px;
  }

  .hero-era {
    font-size: 8px;
    margin-bottom: 4px;
  }

  .hero-passives {
    gap: 3px;
  }

  .hero-passive {
    padding: 3px 5px;
  }

  .hero-passive-name {
    font-size: 8px;
  }

  .hero-passive-desc {
    font-size: 7px;
    line-height: 1.1;
  }

  .hero-select-title {
    font-size: 20px;
  }

  .hero-select-hint {
    font-size: 10px;
  }

  /* === Stage Info & Combo Display === */
  #combo-multiplier {
    font-size: 18px;
  }

  #combo-name {
    font-size: 7px;
  }

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

  #score-label {
    font-size: 7px;
  }

  #stage-number {
    font-size: 11px;
  }

  #position-info, #moves-remaining {
    font-size: 8px;
  }

  /* === Shop & Powerup Overlays === */
  #shop-overlay h1 {
    font-size: 18px;
  }

  #shop-gold-display {
    font-size: 18px;
    margin-bottom: 8px;
  }

  #shop-items {
    gap: 4px;
  }

  .shop-slot {
    min-height: 90px;
    padding: 4px;
  }

  .shop-item-icon {
    font-size: 20px;
    margin-bottom: 2px;
  }

  .shop-item-name {
    font-size: 8px;
  }

  .shop-item-desc {
    font-size: 6px;
    min-height: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .shop-item-price {
    font-size: 11px;
  }

  .shop-btn {
    padding: 6px 8px;
    font-size: 10px;
  }

  #powerup-choices {
    gap: 4px;
    max-height: 45vh;
  }

  .powerup-card {
    min-height: 110px;
    padding: 8px 4px;
  }

  .powerup-icon {
    font-size: 24px;
    margin-bottom: 4px;
  }

  .powerup-name {
    font-size: 10px;
    margin-bottom: 2px;
  }

  .powerup-desc {
    font-size: 7px;
  }

  /* === Player Intro Screen === */
  .player-portrait-frame {
    width: 85px;
    height: 105px;
    margin-bottom: 8px;
    border-width: 2px;
  }

  .portrait-fallback {
    font-size: 42px;
  }

  #player-intro-overlay .player-name {
    font-size: 18px;
  }

  .player-title {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .player-quote {
    font-size: 10px;
    margin-bottom: 10px;
  }

  .position-context {
    font-size: 9px;
    margin-top: 5px;
    margin-bottom: 8px;
  }

  .player-era {
    font-size: 10px;
  }

  .stage-badge {
    padding: 5px 10px;
  }

  .stage-num {
    font-size: 24px;
  }

  .stage-label {
    font-size: 10px;
  }

  .fight-btn {
    margin-top: 15px;
    padding: 8px 30px;
    font-size: 16px;
    letter-spacing: 2px;
  }

  /* === Announcements === */
  .announcement {
    font-size: 18px !important;
  }

  .ko-announcement {
    font-size: 36px;
    letter-spacing: 3px;
  }

  .announcement.finish-him-enemy {
    font-size: 16px;
  }

  /* === Move Annotation === */
  #move-annotation {
    font-size: 36px !important;
  }

  /* === Menu Screen === */
  .title-mortal, .title-chess {
    font-size: 20px;
  }

  .tagline {
    font-size: 10px;
  }

  #start-button, .menu-btn {
    padding: 8px 20px;
    font-size: 13px;
    width: 100%;
    max-width: 200px;
    min-width: unset;
  }

  /* === Leaderboard === */
  .name-char {
    width: 32px;
    height: 42px;
    font-size: 22px;
  }

  .leaderboard-entry {
    font-size: 9px;
    padding: 4px 2px;
  }

  .lb-rank, .entry-rank { width: 25px; }
  .lb-name, .entry-name { width: 50px; }
  .lb-stage, .entry-stage { width: 30px; }
  .lb-score, .entry-score { font-size: 9px; }

  /* === Inventory/Powerups === */
  .inventory-item {
    padding: 2px 4px;
    font-size: 12px;
    min-width: 28px;
  }

  .inventory-item .inventory-icon {
    font-size: 14px;
  }

  #powerups-container {
    gap: 2px;
  }

  /* === Power-up Indicators === */
  #shield-indicator, #timeout-indicator, #adrenaline-indicator,
  #ironskin-indicator, #lightning-indicator, #doublemove-indicator,
  #comboanchor-indicator, #criticalstrike-indicator, #bloodlust-indicator {
    font-size: 6px;
    padding: 1px 3px;
    top: 45px;
  }

  /* === Overlays === */
  .overlay {
    padding: 15px 10px;
  }

  .overlay h1 {
    font-size: 22px;
  }

  .overlay p {
    font-size: 12px;
  }

  /* === Upgrades Display === */
  #upgrades-display {
    font-size: 8px;
  }

  #upgrades-list {
    gap: 2px;
  }

  .upgrade-item {
    font-size: 12px;
  }
}

/* ===== ENHANCED LANDSCAPE MODE (Very Short Screens) ===== */
@media (max-height: 420px) and (orientation: landscape) {
  /* Optimized for phones in landscape */
  #mk-health-container {
    padding: 4px 10px;
    gap: 8px;
  }

  .mk-health-bar {
    width: 150px;
    height: 14px;
  }

  .mk-portrait {
    width: 28px;
    height: 35px;
  }

  .mk-vs-emblem {
    font-size: 14px;
    padding: 0 6px;
  }

  #board-container {
    width: min(calc(100vh - 60px), 240px) !important;
    height: min(calc(100vh - 60px), 240px) !important;
    max-width: 240px !important;
    max-height: 240px !important;
  }

  #main-area {
    padding-top: 50px;
    gap: 8px;
  }

  /* Hero cards in landscape - horizontal scroll */
  #hero-selection-overlay {
    padding: 10px;
  }

  #hero-cards {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 10px;
    max-width: 100%;
    padding: 5px 10px;
  }

  .hero-card {
    min-width: 140px;
    flex-shrink: 0;
    padding: 10px;
    flex-direction: column;
    text-align: center;
  }

  .hero-portrait {
    width: 50px;
    height: 62px;
    margin-bottom: 6px;
  }

  .hero-select-title {
    font-size: 20px;
    margin-bottom: 10px;
  }

  .hero-passives {
    display: none; /* Hide passives in landscape to save space */
  }

  /* Player intro in landscape */
  .player-portrait-frame {
    width: 80px;
    height: 100px;
    margin-bottom: 8px;
  }

  #player-intro-overlay .player-name {
    font-size: 18px;
  }

  .player-title {
    font-size: 12px;
  }

  .player-quote {
    display: none; /* Hide quote in landscape */
  }

  .position-context {
    display: none; /* Hide position context in landscape */
  }

  .fight-btn {
    padding: 8px 30px;
    font-size: 16px;
  }

  /* Stage container in landscape */
  #stage-container {
    flex-direction: column;
    gap: 4px;
    padding: 4px;
  }

  #combo-multiplier {
    font-size: 20px;
  }

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

/* ===== TOUCH TARGET ACCESSIBILITY ===== */
@media (hover: none) and (pointer: coarse) {
  /* Ensure minimum 44px touch targets for WCAG compliance */
  button,
  .powerup-card,
  .shop-slot,
  .leaderboard-tab,
  .hero-card,
  .inventory-item,
  .menu-btn,
  .shop-btn,
  .fight-btn,
  .pause-btn,
  .name-char {
    min-height: 44px;
    min-width: 44px;
  }

  /* Active state feedback instead of hover */
  .hero-card:hover {
    transform: none;
    box-shadow: none;
  }

  .hero-card:active {
    transform: scale(0.97);
    opacity: 0.9;
    transition: transform 0.1s ease;
  }

  .inventory-item:hover {
    transform: none;
  }

  .inventory-item:active {
    transform: scale(0.95);
    opacity: 0.85;
  }

  .menu-btn:hover,
  .shop-btn:hover,
  .fight-btn:hover,
  .pause-btn:hover {
    transform: none;
  }

  .menu-btn:active,
  .shop-btn:active,
  .fight-btn:active,
  .pause-btn:active {
    transform: scale(0.97);
    opacity: 0.9;
  }

  /* Prevent accidental text selection on touch */
  .hero-card,
  .powerup-card,
  .shop-slot,
  .inventory-item {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }

  /* Name character touch highlight */
  .name-char {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(139, 0, 0, 0.3);
  }

  /* Chessboard touch improvements */
  .chessboard-63f37 .piece-417db {
    cursor: grab;
    touch-action: none;
  }

  .chessboard-63f37 .square-55d63 {
    touch-action: none;
  }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  #game-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    padding: 10px;
  }

  #hp-container {
    width: 100%;
    padding: 5px 10px;
  }

  #hp-bar {
    height: 20px;
  }

  #main-area {
    flex-direction: row;
    gap: 10px;
  }

  #board-container {
    width: calc(100vh - 80px) !important;
    height: calc(100vh - 80px) !important;
    max-width: 280px !important;
    max-height: 280px !important;
  }

  #stage-container {
    width: auto;
    flex-direction: column;
    padding: 5px;
  }

  #board-wrapper {
    flex-direction: column;
    gap: 5px;
  }

  #powerups-container {
    gap: 4px;
  }

  .inventory-item {
    padding: 4px 6px;
    font-size: 14px;
  }

  .overlay {
    padding: 10px;
  }

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

  #powerup-choices {
    grid-template-columns: repeat(3, 1fr);
    max-height: 70vh;
  }

  .powerup-card {
    padding: 8px 5px;
  }

  .powerup-icon {
    font-size: 24px;
  }

  /* Shop in landscape */
  #shop-overlay {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    gap: 10px;
  }

  #shop-overlay h1 {
    width: 100%;
    font-size: 18px;
    margin-bottom: 0;
  }

  #shop-gold-display {
    width: 100%;
    font-size: 20px;
    margin-bottom: 5px;
  }

  #shop-items {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 50vh;
  }

  .shop-slot {
    min-height: 100px;
    padding: 6px;
  }

  .shop-item-icon {
    font-size: 22px;
    margin-bottom: 3px;
  }

  .shop-item-name {
    font-size: 9px;
  }

  .shop-item-desc {
    display: none;  /* Hide description in landscape to save space */
  }

  .shop-item-price {
    font-size: 12px;
  }

  #shop-actions {
    width: 100%;
  }

  .shop-btn {
    padding: 8px 15px;
    font-size: 12px;
  }

  .shop-hint {
    display: none;  /* Hide hint in landscape */
  }
}


/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== CHESSBOARD.JS OVERRIDES FOR MOBILE ===== */
.chessboard-63f37 {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.chessboard-63f37 .piece-417db {
  touch-action: none;
  -webkit-touch-callout: none;
}

/* Ensure dragged piece is visible above everything */
.chessboard-63f37 .piece-417db.dragging {
  z-index: 9999 !important;
}

/* ===== COMBO STREAK VISUAL EFFECTS ===== */

/* Fire effect for combo 2-3 */
#board-container.combo-fire {
  box-shadow:
    0 0 20px rgba(255, 100, 0, 0.3),
    0 0 40px rgba(255, 50, 0, 0.2),
    inset 0 0 30px rgba(255, 100, 0, 0.1);
}

/* Lightning effect for combo 4-5 */
#board-container.combo-lightning {
  box-shadow:
    0 0 25px rgba(0, 200, 255, 0.4),
    0 0 50px rgba(0, 150, 255, 0.3),
    inset 0 0 40px rgba(0, 200, 255, 0.15);
  animation: combo-lightning-pulse 0.5s infinite;
}

@keyframes combo-lightning-pulse {
  0%, 100% {
    box-shadow:
      0 0 25px rgba(0, 200, 255, 0.4),
      0 0 50px rgba(0, 150, 255, 0.3),
      inset 0 0 40px rgba(0, 200, 255, 0.15);
  }
  50% {
    box-shadow:
      0 0 35px rgba(0, 220, 255, 0.5),
      0 0 70px rgba(0, 180, 255, 0.4),
      inset 0 0 50px rgba(0, 220, 255, 0.2);
  }
}

/* Golden effect for combo 6-7 */
#board-container.combo-golden {
  box-shadow:
    0 0 30px rgba(255, 215, 0, 0.5),
    0 0 60px rgba(255, 180, 0, 0.4),
    0 0 100px rgba(255, 150, 0, 0.2),
    inset 0 0 50px rgba(255, 215, 0, 0.2);
  animation: combo-golden-pulse 0.8s infinite;
}

@keyframes combo-golden-pulse {
  0%, 100% {
    box-shadow:
      0 0 30px rgba(255, 215, 0, 0.5),
      0 0 60px rgba(255, 180, 0, 0.4),
      0 0 100px rgba(255, 150, 0, 0.2),
      inset 0 0 50px rgba(255, 215, 0, 0.2);
  }
  50% {
    box-shadow:
      0 0 50px rgba(255, 215, 0, 0.7),
      0 0 90px rgba(255, 180, 0, 0.5),
      0 0 130px rgba(255, 150, 0, 0.3),
      inset 0 0 70px rgba(255, 215, 0, 0.3);
  }
}

/* GODLIKE effect for combo 8 */
#board-container.combo-godlike {
  box-shadow:
    0 0 40px rgba(255, 215, 0, 0.6),
    0 0 80px rgba(255, 100, 0, 0.5),
    0 0 120px rgba(255, 0, 100, 0.3),
    0 0 200px rgba(255, 215, 0, 0.2),
    inset 0 0 60px rgba(255, 215, 0, 0.3);
  animation: combo-godlike-pulse 0.3s infinite;
}

@keyframes combo-godlike-pulse {
  0%, 100% {
    box-shadow:
      0 0 40px rgba(255, 215, 0, 0.6),
      0 0 80px rgba(255, 100, 0, 0.5),
      0 0 120px rgba(255, 0, 100, 0.3),
      0 0 200px rgba(255, 215, 0, 0.2),
      inset 0 0 60px rgba(255, 215, 0, 0.3);
  }
  50% {
    box-shadow:
      0 0 60px rgba(255, 215, 0, 0.8),
      0 0 100px rgba(255, 100, 0, 0.6),
      0 0 160px rgba(255, 0, 100, 0.4),
      0 0 250px rgba(255, 215, 0, 0.3),
      inset 0 0 80px rgba(255, 215, 0, 0.4);
  }
}

/* Combo particles */
.combo-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 100;
  animation: combo-particle-float 1.5s ease-out forwards;
}

.golden-particle {
  background: radial-gradient(circle, #FFD700 0%, #FF8C00 100%);
  box-shadow: 0 0 10px #FFD700, 0 0 20px #FF8C00;
}

.godlike-particle {
  background: radial-gradient(circle, #FFFFFF 0%, #FFD700 50%, #FF4400 100%);
  box-shadow: 0 0 15px #FFD700, 0 0 30px #FF4400, 0 0 50px #FF0000;
  width: 12px;
  height: 12px;
}

@keyframes combo-particle-float {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.5) translateY(-50px);
  }
}

/* Screen edge glow for high combos */
.screen-edge-glow {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

.screen-edge-glow.active {
  opacity: 1;
}

/* SOVEREIGN glow (combo 7) - golden edges */
.screen-edge-glow.sovereign {
  box-shadow:
    inset 0 0 100px rgba(255, 215, 0, 0.2),
    inset 0 0 200px rgba(255, 180, 0, 0.1);
  animation: sovereign-glow-pulse 2s infinite ease-in-out;
}

@keyframes sovereign-glow-pulse {
  0%, 100% {
    box-shadow:
      inset 0 0 100px rgba(255, 215, 0, 0.2),
      inset 0 0 200px rgba(255, 180, 0, 0.1);
  }
  50% {
    box-shadow:
      inset 0 0 150px rgba(255, 215, 0, 0.3),
      inset 0 0 300px rgba(255, 180, 0, 0.15);
  }
}

/* GODLIKE glow (combo 8) - intense golden with fire */
.screen-edge-glow.godlike {
  box-shadow:
    inset 0 0 150px rgba(255, 215, 0, 0.4),
    inset 0 0 300px rgba(255, 100, 0, 0.2),
    inset 0 0 400px rgba(255, 0, 50, 0.1);
  animation: godlike-glow-pulse 0.5s infinite ease-in-out;
}

@keyframes godlike-glow-pulse {
  0%, 100% {
    box-shadow:
      inset 0 0 150px rgba(255, 215, 0, 0.4),
      inset 0 0 300px rgba(255, 100, 0, 0.2),
      inset 0 0 400px rgba(255, 0, 50, 0.1);
  }
  50% {
    box-shadow:
      inset 0 0 200px rgba(255, 215, 0, 0.5),
      inset 0 0 350px rgba(255, 100, 0, 0.3),
      inset 0 0 500px rgba(255, 0, 50, 0.15);
  }
}

/* ===== MOVE TRAIL EFFECTS ===== */
.move-trail {
  position: absolute;
  height: 4px;
  border-radius: 2px;
  transform-origin: left center;
  pointer-events: none;
  z-index: 50;
  animation: trail-fade 0.6s ease-out forwards;
}

.trail-normal {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2));
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.trail-excellent {
  background: linear-gradient(90deg, rgba(255, 215, 0, 1), rgba(255, 215, 0, 0.3));
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 150, 0, 0.4);
  height: 6px;
}

.trail-good {
  background: linear-gradient(90deg, rgba(100, 255, 100, 0.9), rgba(100, 255, 100, 0.2));
  box-shadow: 0 0 10px rgba(100, 255, 100, 0.6);
}

.trail-bad {
  background: linear-gradient(90deg, rgba(255, 100, 100, 0.9), rgba(255, 100, 100, 0.2));
  box-shadow: 0 0 10px rgba(255, 100, 100, 0.6);
}

.trail-blunder {
  background: linear-gradient(90deg, rgba(255, 0, 0, 1), rgba(255, 0, 0, 0.3));
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.8), 0 0 30px rgba(200, 0, 0, 0.4);
  height: 6px;
}

@keyframes trail-fade {
  0% {
    opacity: 1;
    transform: scaleX(1) rotate(var(--angle, 0deg));
  }
  100% {
    opacity: 0;
    transform: scaleX(0.5) rotate(var(--angle, 0deg));
  }
}

/* ===== CAPTURE EFFECTS ===== */
.capture-explosion {
  position: absolute;
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 100, 0.9) 0%, rgba(255, 100, 0, 0.6) 40%, transparent 70%);
  pointer-events: none;
  z-index: 60;
  animation: capture-explode 0.4s ease-out forwards;
}

.blunder-explosion {
  width: 80px;
  height: 80px;
  margin-left: -40px;
  margin-top: -40px;
  background: radial-gradient(circle, rgba(255, 100, 100, 1) 0%, rgba(200, 0, 0, 0.8) 40%, transparent 70%);
}

@keyframes capture-explode {
  0% {
    transform: scale(0.3);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.capture-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  margin-top: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, #FF6B6B 0%, #8B0000 100%);
  box-shadow: 0 0 6px #FF0000;
  pointer-events: none;
  z-index: 61;
  animation: capture-particle-fly 0.5s ease-out forwards;
}

@keyframes capture-particle-fly {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.3);
    opacity: 0;
  }
}

/* ===== EXCELLENT MOVE EFFECTS ===== */
.excellent-burst {
  position: absolute;
  width: 80px;
  height: 80px;
  margin-left: -40px;
  margin-top: -40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.9) 0%, rgba(255, 180, 0, 0.5) 30%, transparent 60%);
  pointer-events: none;
  z-index: 60;
  animation: excellent-burst-expand 0.6s ease-out forwards;
}

@keyframes excellent-burst-expand {
  0% {
    transform: scale(0.2);
    opacity: 1;
  }
  50% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.excellent-sparkle {
  position: absolute;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  pointer-events: none;
  z-index: 62;
  animation: excellent-sparkle-fly 0.8s ease-out forwards;
}

.excellent-sparkle::before {
  content: '✦';
  font-size: 14px;
  color: #FFD700;
  text-shadow: 0 0 10px #FFD700, 0 0 20px #FF8C00;
}

@keyframes excellent-sparkle-fly {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.5) rotate(180deg);
    opacity: 0;
  }
}

/* ===== REVIEW MISTAKES SCREEN ===== */
#review-overlay {
  background: radial-gradient(ellipse at center, rgba(15, 10, 25, 0.98) 0%, rgba(5, 0, 10, 0.99) 100%);
  overflow-y: auto;
  padding: 30px 20px;
}

#review-overlay h1 {
  font-family: 'MedievalSharp', cursive;
  font-size: 36px;
  color: #FFD700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  margin-bottom: 15px;
}

/* Summary Stats */
#review-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
  font-family: 'Cinzel', serif;
  font-size: 16px;
}

.review-stat {
  padding: 5px 12px;
  border-radius: 4px;
  font-weight: bold;
}

.review-stat.excellent {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.review-stat.mistake {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.review-stat.blunder {
  color: #f87171;
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.review-stat-divider {
  color: #444;
}

/* Stage Filter Tabs */
#review-stage-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 15px auto;
  max-width: 900px;
  flex-wrap: wrap;
}

.review-stage-tab {
  background: rgba(40, 40, 60, 0.8);
  border: 1px solid #444;
  border-radius: 4px;
  color: #888;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.review-stage-tab:hover {
  background: rgba(60, 60, 90, 0.9);
  border-color: #666;
  color: #ccc;
}

.review-stage-tab.active {
  background: rgba(139, 92, 246, 0.3);
  border-color: #8b5cf6;
  color: #fff;
}

/* Stage Headers in Move List */
.review-stage-header {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 6px;
  padding: 10px 15px;
  margin: 15px 0 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.review-stage-header:first-child {
  margin-top: 0;
}

.review-stage-header-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: #c4b5fd;
  text-transform: uppercase;
}

.review-stage-header-opponent {
  font-size: 11px;
  color: #9ca3af;
}

.review-stage-header-stats {
  display: flex;
  gap: 12px;
  font-size: 10px;
}

.review-stage-stat {
  padding: 3px 8px;
  border-radius: 3px;
}

.review-stage-stat.excellent {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.15);
}

.review-stage-stat.mistakes {
  color: #fb923c;
  background: rgba(251, 146, 60, 0.15);
}

.review-stage-stat.blunders {
  color: #f87171;
  background: rgba(248, 113, 113, 0.15);
}

/* Move List Container */
#review-list-container {
  max-height: 60vh;
  overflow-y: auto;
  margin: 0 auto 20px;
  max-width: 900px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px;
}

#review-list-container::-webkit-scrollbar {
  width: 8px;
}

#review-list-container::-webkit-scrollbar-track {
  background: #1a1a2a;
  border-radius: 4px;
}

#review-list-container::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 4px;
}

#review-list-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Empty state */
.review-empty {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 40px 20px;
}

/* Individual Move Entries */
.review-entry {
  background: rgba(20, 20, 35, 0.8);
  border-radius: 6px;
  padding: 15px 18px;
  margin-bottom: 12px;
  border-left: 4px solid #444;
  transition: transform 0.2s, box-shadow 0.2s;
}

.review-entry:hover {
  transform: translateX(3px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Entry content layout - board + info side by side */
.review-entry-content {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

/* Board diagram container */
.review-board-container {
  flex-shrink: 0;
  width: 150px;
  height: 150px;
  border: 2px solid #444;
  border-radius: 4px;
  overflow: hidden;
  background: #2a2a2a;
}

.review-board-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Info section next to board */
.review-entry-info {
  flex: 1;
  min-width: 0;
}

/* Quality-based border colors */
.review-entry.quality-excellent {
  border-left-color: #4ade80;
}

.review-entry.quality-good {
  border-left-color: #60a5fa;
}

.review-entry.quality-inaccuracy {
  border-left-color: #fde047;
}

.review-entry.quality-mistake {
  border-left-color: #fb923c;
}

.review-entry.quality-blunder {
  border-left-color: #f87171;
}

/* Entry Header */
.review-entry-header {
  display: flex;
  gap: 15px;
  margin-bottom: 8px;
  font-size: 12px;
  color: #888;
}

.review-position {
  color: #FFD700;
  font-weight: bold;
}

.review-opponent {
  color: #c084fc;
}

.review-stage {
  color: #60a5fa;
}

/* Position Origin */
.review-position-origin {
  font-size: 12px;
  color: #a0a0a0;
  font-style: italic;
  margin-bottom: 8px;
}

/* Move Information */
.review-entry-moves {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.review-your-move,
.review-best-move {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.review-label {
  color: #888;
  min-width: 70px;
}

.review-move-san {
  font-family: monospace;
  font-size: 16px;
  font-weight: bold;
  color: #E8E4D9;
}

.review-move-san.best {
  color: #4ade80;
}

.review-eval-loss {
  color: #f87171;
  font-size: 12px;
}

/* Annotation symbols */
.review-annotation {
  font-weight: bold;
  font-size: 18px;
  margin-left: 5px;
}

.review-annotation.annotation-excellent {
  color: #4ade80;
}

.review-annotation.annotation-inaccuracy {
  color: #fde047;
}

.review-annotation.annotation-mistake {
  color: #fb923c;
}

.review-annotation.annotation-blunder {
  color: #f87171;
}

/* Lichess Link */
.review-lichess-link {
  display: inline-block;
  color: #c084fc;
  font-size: 12px;
  text-decoration: none;
  transition: color 0.2s, text-decoration 0.2s;
}

.review-lichess-link:hover {
  color: #a855f7;
  text-decoration: underline;
}

/* Close Button */
#review-close {
  margin-top: 15px;
}

/* Leaderboard buttons container */
.leaderboard-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
}

.leaderboard-buttons .arcade-btn.secondary {
  background: var(--gradient-btn-secondary);
  border-color: #555;
}

.leaderboard-buttons .arcade-btn.secondary:hover {
  background: linear-gradient(180deg, #444 0%, #333 100%);
}

/* Share button specific styling */
#leaderboard-share-button {
  background: linear-gradient(180deg, #1a4a6e 0%, #0d2840 100%);
  border-color: #2a6a9e;
}

#leaderboard-share-button:hover {
  background: linear-gradient(180deg, #2a5a7e 0%, #1d3850 100%);
  border-color: #3a7aae;
}

#leaderboard-share-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Share toast notification */
.share-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  background: linear-gradient(180deg, #1a1a2a 0%, #0a0a15 100%);
  border: 2px solid #8B7355;
  border-radius: 8px;
  color: #E8E4D9;
  font-family: 'Cinzel', serif;
  font-size: 16px;
  letter-spacing: 1px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: var(--z-tooltip);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

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

/* Responsive adjustments for review screen */
@media (max-width: 600px) {
  #review-overlay h1 {
    font-size: 28px;
  }

  #review-summary {
    flex-wrap: wrap;
    gap: 10px;
  }

  .review-stat {
    font-size: 14px;
    padding: 4px 10px;
  }

  #review-stage-tabs {
    gap: 5px;
    margin: 10px auto;
  }

  .review-stage-tab {
    font-size: 8px;
    padding: 6px 10px;
  }

  .review-stage-header {
    padding: 8px 12px;
    margin: 10px 0 8px 0;
    flex-direction: column;
    gap: 8px;
  }

  .review-stage-header-title {
    font-size: 10px;
  }

  .review-stage-header-stats {
    gap: 8px;
    font-size: 9px;
  }

  #review-list-container {
    max-height: 350px;
    padding: 8px;
  }

  .review-entry {
    padding: 10px 12px;
  }

  /* Stack board above info on mobile */
  .review-entry-content {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .review-board-container {
    width: 120px;
    height: 120px;
  }

  .review-entry-info {
    width: 100%;
    text-align: center;
  }

  .review-entry-header {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .review-entry-moves {
    align-items: center;
  }

  .review-your-move,
  .review-best-move {
    justify-content: center;
  }

  .review-label {
    min-width: 60px;
  }
}

/* ===== PERFORMANCE: Animation Pause Classes ===== */
/* Pause non-essential animations when overlays are visible */
.animations-paused .combo-particle,
.animations-paused .golden-particle,
.animations-paused .godlike-particle,
.animations-paused [data-tier],
.animations-paused .ember,
.animations-paused .screen-edge-glow {
  animation-play-state: paused;
}
