/* ====================================================
   BATTLEMON 2 — AAA QUALITY CSS
   Created by happystoner5420 Games
   ==================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700;900&family=Rajdhani:wght@400;600;700&family=Orbitron:wght@400;700;900&display=swap');

:root {
  --gold: #FFD700;
  --gold-dark: #B8860B;
  --crimson: #DC143C;
  --electric: #00FFFF;
  --void: #7B00FF;
  --bg-dark: #050510;
  --panel-bg: rgba(5, 5, 20, 0.92);
  --panel-border: rgba(255, 215, 0, 0.5);
  --text-primary: #FFFFFF;
  --text-gold: #FFD700;
  --health-green: #00FF7F;
  --health-yellow: #FFD700;
  --health-red: #FF2400;
  --shadow-glow: 0 0 20px rgba(255, 215, 0, 0.6);
  --font-title: 'Cinzel Decorative', serif;
  --font-ui: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
}

* {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100%; height: 100%;
  background: #000;
  font-family: var(--font-body);
  color: var(--text-primary);
  overflow: hidden;
  user-select: none;
}

/* ============ CANVAS / LAYERS ============ */
#game-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
}

.screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  z-index: 10;
}
.screen.active { display: flex; }

/* ============ MAIN MENU ============ */
#screen-menu {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a0030 0%, #050510 60%, #000 100%);
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 0 30px;
  gap: 0;
}

#screen-menu::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('assets/backgrounds/stadium.jpg') center/cover;
  opacity: 0.15;
  filter: saturate(2) blur(2px);
}

.menu-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.star {
  position: absolute;
  border-radius: 50%;
  background: white;
  animation: twinkle var(--dur, 3s) var(--delay, 0s) infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.1; transform: scale(0.8); }
  to   { opacity: 1;   transform: scale(1.2); }
}

.menu-title-wrap {
  position: relative;
  z-index: 5;
  text-align: center;
  margin-bottom: clamp(16px, 3vh, 40px);
  flex-shrink: 0;
}

.menu-logo {
  width: min(500px, 82vw);
  max-height: 28vh;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 30px rgba(255,215,0,0.8)) drop-shadow(0 0 60px rgba(255,100,0,0.5));
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%,100% { filter: drop-shadow(0 0 30px rgba(255,215,0,0.8)) drop-shadow(0 0 60px rgba(255,100,0,0.5)); }
  50%      { filter: drop-shadow(0 0 50px rgba(255,215,0,1))   drop-shadow(0 0 90px rgba(255,100,0,0.8)); }
}

.menu-subtitle {
  font-family: var(--font-ui);
  font-size: clamp(10px, 2vw, 16px);
  color: var(--electric);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-top: 8px;
  text-shadow: 0 0 15px var(--electric);
  animation: subtitleFlicker 4s infinite;
}

@keyframes subtitleFlicker {
  0%,90%,100% { opacity:1; }
  95% { opacity:0.4; }
}

.menu-buttons {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vh, 18px);
  align-items: center;
  flex-shrink: 0;
}

.btn-menu {
  font-family: var(--font-ui);
  font-size: clamp(12px, 2vw, 18px);
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  padding: clamp(10px,1.5vh,16px) clamp(30px,5vw,60px);
  min-width: clamp(260px, 45vw, 320px);
  border: 2px solid var(--gold);
  background: linear-gradient(135deg, rgba(180,130,0,0.15) 0%, rgba(255,215,0,0.08) 50%, rgba(180,130,0,0.15) 100%);
  color: var(--gold);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  clip-path: polygon(12px 0%, 100% 0%, calc(100% - 12px) 100%, 0% 100%);
  transition: all 0.25s ease;
  text-shadow: 0 0 10px rgba(255,215,0,0.5);
}

.btn-menu::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,215,0,0.15) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}

.btn-menu:hover {
  background: linear-gradient(135deg, rgba(255,215,0,0.25) 0%, rgba(255,215,0,0.15) 100%);
  color: #fff;
  border-color: #fff;
  box-shadow: 0 0 30px rgba(255,215,0,0.5), inset 0 0 20px rgba(255,215,0,0.1);
  transform: scale(1.03);
  text-shadow: 0 0 15px rgba(255,255,255,0.8);
}
.btn-menu:hover::before { transform: translateX(100%); }

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

.btn-menu.btn-start {
  font-size: clamp(14px, 2.5vw, 22px);
  padding: clamp(12px,2vh,20px) clamp(40px,6vw,80px);
  background: linear-gradient(135deg, rgba(220,20,60,0.3) 0%, rgba(180,10,30,0.2) 100%);
  border-color: var(--crimson);
  color: #fff;
  box-shadow: 0 0 20px rgba(220,20,60,0.4);
}
.btn-menu.btn-start:hover {
  background: linear-gradient(135deg, rgba(220,20,60,0.5) 0%, rgba(180,10,30,0.3) 100%);
  box-shadow: 0 0 40px rgba(220,20,60,0.7);
}

.btn-menu.btn-exit {
  border-color: rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.5);
  font-size: clamp(12px, 2vw, 18px);
}
.btn-menu.btn-exit:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.7);
  box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

.menu-version {
  position: absolute;
  bottom: 20px;
  right: 30px;
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255,215,0,0.4);
  z-index: 5;
}

/* ============ SELECTION SCREEN ============ */
#screen-select {
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 50%, #0a0025 0%, #05050F 70%);
  overflow-y: auto;
  overflow-x: hidden;
}

.select-header {
  text-align: center;
  padding: 30px 20px 20px;
  background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.select-header h2 {
  font-family: var(--font-title);
  font-size: clamp(22px, 4vw, 40px);
  color: var(--gold);
  text-shadow: var(--shadow-glow);
  margin-bottom: 8px;
}

.select-instructions {
  font-family: var(--font-ui);
  font-size: clamp(10px, 1.5vw, 14px);
  color: var(--electric);
  letter-spacing: 2px;
}

.select-teams {
  display: flex;
  gap: 20px;
  padding: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.team-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 15px;
  min-width: 200px;
}

.team-panel h3 {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--gold);
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.team-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 6px;
  min-height: 44px;
}

.team-slot .slot-num {
  font-family: var(--font-ui);
  font-size: 11px;
  color: rgba(255,215,0,0.5);
  min-width: 20px;
}

.team-slot .slot-name {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.team-slot .slot-type {
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  font-weight: 700;
}

.team-slot.empty .slot-name {
  color: rgba(255,255,255,0.2);
  font-style: italic;
}

.select-grid-wrap {
  padding: 20px;
  flex: 1;
}

.select-grid-wrap h3 {
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--gold);
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: 3px;
}

.type-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.type-filter-btn {
  font-family: var(--font-ui);
  font-size: 9px;
  padding: 5px 14px;
  border: 1px solid currentColor;
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
  opacity: 0.6;
}
.type-filter-btn:hover, .type-filter-btn.active {
  opacity: 1;
  background: currentColor;
  color: #000 !important;
}

.battlemon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,215,0,0.3) transparent;
}

.battlemon-card {
  background: linear-gradient(145deg, rgba(20,20,40,0.95), rgba(10,10,20,0.95));
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.battlemon-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,215,0,0.05) 100%);
  opacity: 0;
  transition: opacity 0.2s;
}
.battlemon-card:hover::after { opacity: 1; }

.battlemon-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(255,215,0,0.25);
}

.battlemon-card.selected {
  border-color: #00FF7F;
  box-shadow: 0 0 20px rgba(0,255,127,0.4);
  background: linear-gradient(145deg, rgba(0,40,20,0.95), rgba(0,30,15,0.95));
}

.battlemon-card.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.card-img-wrap {
  width: 100%;
  height: 100px;
  overflow: hidden;
  border-radius: 6px;
  background: radial-gradient(circle at 50% 60%, rgba(60,60,120,0.7) 0%, rgba(10,10,25,0.95) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  position: relative;
}

.card-img-wrap img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.7));
  transition: transform 0.2s ease;
}
.battlemon-card:hover .card-img-wrap img {
  transform: scale(1.12) translateY(-3px);
}

.card-name {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.card-type-badge {
  display: block;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 8px;
  padding: 2px 0;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 700;
  color: #000;
  margin-bottom: 6px;
}

.card-stats {
  display: flex;
  gap: 3px;
  font-family: var(--font-ui);
  font-size: 7px;
  color: rgba(255,255,255,0.5);
  justify-content: space-between;
}

.select-confirm {
  padding: 20px;
  text-align: center;
  background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, transparent 100%);
  position: sticky;
  bottom: 0;
  backdrop-filter: blur(10px);
}

.btn-battle-start {
  font-family: var(--font-ui);
  font-size: clamp(14px, 2.5vw, 22px);
  font-weight: 900;
  letter-spacing: 6px;
  text-transform: uppercase;
  padding: 18px 80px;
  background: linear-gradient(135deg, #8B0000, #DC143C, #8B0000);
  color: #fff;
  border: 2px solid var(--crimson);
  cursor: pointer;
  clip-path: polygon(15px 0%, 100% 0%, calc(100% - 15px) 100%, 0% 100%);
  transition: all 0.3s;
  text-shadow: 0 0 10px rgba(255,255,255,0.5);
  box-shadow: 0 0 30px rgba(220,20,60,0.5);
  animation: battleBtnPulse 2s ease-in-out infinite;
  opacity: 0.4;
  pointer-events: none;
}

.btn-battle-start.ready {
  opacity: 1;
  pointer-events: auto;
  animation: battleBtnPulse 1.5s ease-in-out infinite;
}

@keyframes battleBtnPulse {
  0%,100% { box-shadow: 0 0 30px rgba(220,20,60,0.5); }
  50%      { box-shadow: 0 0 60px rgba(220,20,60,0.9), 0 0 100px rgba(220,20,60,0.4); }
}

.btn-battle-start:hover {
  background: linear-gradient(135deg, #DC143C, #FF2040, #DC143C);
  transform: scale(1.05);
}

/* ============ BATTLE SCREEN ============ */
#screen-battle {
  flex-direction: column;
  background: #000;
  position: relative;
  overflow: hidden;
}

.battle-arena {
  position: relative;
  width: 100%;
  flex: 1;
  overflow: hidden;
}

.arena-bg {
  position: absolute;
  inset: 0;
  background: url('assets/backgrounds/stadium.jpg') center/cover no-repeat;
  z-index: 0;
}

.arena-bg-overlay {
  position: absolute;
  inset: 0;
  /* lighter at the floor so sprites look like they're standing on it */
  background: linear-gradient(180deg,
    rgba(0,0,0,0.15) 0%,
    rgba(0,0,0,0.05) 50%,
    rgba(0,0,0,0.45) 85%,
    rgba(0,0,0,0.75) 100%);
  z-index: 1;
}

/* Battle platforms — sit on the visible stadium floor */
.battle-platform {
  position: absolute;
  bottom: 14%;
  width: min(240px, 28vw);
  height: 48px;
  border-radius: 50%;
  z-index: 2;
}

.platform-player {
  left: 6%;
  background: radial-gradient(ellipse, rgba(0,150,255,0.55) 0%, rgba(0,80,200,0.2) 60%, transparent 100%);
  box-shadow: 0 8px 28px rgba(0,100,255,0.5), inset 0 -4px 12px rgba(0,150,255,0.4);
  border: 1px solid rgba(0,200,255,0.4);
}

.platform-enemy {
  right: 6%;
  background: radial-gradient(ellipse, rgba(255,50,50,0.55) 0%, rgba(200,20,20,0.2) 60%, transparent 100%);
  box-shadow: 0 8px 28px rgba(255,0,0,0.5), inset 0 -4px 12px rgba(255,50,50,0.4);
  border: 1px solid rgba(255,100,100,0.4);
}

/* Battlemon sprites — bottoms sit on the platforms */
.battlemon-sprite-wrap {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.battlemon-sprite-wrap.player-sprite {
  left: 2%;
  bottom: 14%;           /* aligned with platform top */
  width: min(45vw, 450px);
  height: min(50vh, 450px);
  transform: scaleX(-1); /* face right */
}

.battlemon-sprite-wrap.enemy-sprite {
  right: 2%;
  bottom: 16%;           /* slightly higher for perspective */
  width: min(42vw, 420px);
  height: min(48vh, 420px);
}

.battlemon-sprite-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,0.9));
  transition: all 0.1s ease;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

/* Anim states */
.sprite-shake {
  animation: spriteShake 0.4s ease-in-out;
}
.sprite-attack {
  animation: spriteAttack 0.5s ease-in-out;
}
.sprite-faint {
  animation: spriteFaint 1s ease-in-out forwards;
}
.sprite-enter {
  animation: spriteEnter 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes spriteShake {
  0%,100% { transform: translateX(0) scaleX(var(--sx,1)); }
  20% { transform: translateX(-15px) scaleX(var(--sx,1)); }
  40% { transform: translateX(15px) scaleX(var(--sx,1)); }
  60% { transform: translateX(-10px) scaleX(var(--sx,1)); }
  80% { transform: translateX(10px) scaleX(var(--sx,1)); }
}

@keyframes spriteAttack {
  0%,100% { transform: translateX(0) scaleX(var(--sx,1)); }
  40% { transform: translateX(calc(var(--atk-dir,1) * 60px)) scaleX(var(--sx,1)); }
}

@keyframes spriteFaint {
  0% { opacity:1; transform: translateY(0) scaleX(var(--sx,1)); }
  60% { opacity:0.3; transform: translateY(20px) scaleX(var(--sx,1)) rotate(var(--rot,20deg)); }
  100% { opacity:0; transform: translateY(60px) scaleX(var(--sx,1)) rotate(var(--rot,30deg)); }
}

@keyframes spriteEnter {
  0% { opacity:0; transform: scale(0.3) translateY(50px) scaleX(var(--sx,1)); }
  100% { opacity:1; transform: scale(1) translateY(0) scaleX(var(--sx,1)); }
}

/* HP Bars — anchored near top of arena */
.hp-bar-card {
  position: absolute;
  top: 4%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 16px;
  min-width: clamp(220px, 35vw, 300px);
  max-width: 300px;
  backdrop-filter: blur(8px);
  z-index: 10;
}

.hp-bar-card.player-card { left: 2%; }
.hp-bar-card.enemy-card  { right: 2%; text-align: right; }

.hp-card-name {
  font-family: var(--font-ui);
  font-size: clamp(12px, 1.8vw, 18px);
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: 2px;
}

.hp-card-level {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 8px;
}

.hp-bar-wrap {
  background: rgba(0,0,0,0.5);
  border-radius: 10px;
  height: 14px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,255,255,0.1);
}

.hp-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(0.25, 1, 0.5, 1), background 0.5s ease;
  background: linear-gradient(90deg, #00AA44, #00FF7F);
  box-shadow: 0 0 10px rgba(0,255,127,0.5);
  position: relative;
}

.hp-bar-fill.yellow {
  background: linear-gradient(90deg, #AA8800, #FFD700);
  box-shadow: 0 0 10px rgba(255,215,0,0.5);
}

.hp-bar-fill.red {
  background: linear-gradient(90deg, #880000, #FF2400);
  box-shadow: 0 0 10px rgba(255,0,0,0.5);
  animation: hpFlicker 0.5s ease-in-out infinite alternate;
}

@keyframes hpFlicker {
  from { box-shadow: 0 0 10px rgba(255,0,0,0.5); }
  to   { box-shadow: 0 0 25px rgba(255,0,0,0.9); }
}

.hp-numbers {
  font-family: var(--font-ui);
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
}

.hp-bar-fill::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5%;
  width: 40%;
  height: 4px;
  background: rgba(255,255,255,0.4);
  border-radius: 3px;
}

.team-balls {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.team-ball {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.9), rgba(100,180,255,0.7));
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 2px 8px rgba(100,180,255,0.5);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.team-ball::after {
  content: '';
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: rgba(0,0,0,0.6);
}

.team-ball::before {
  content: '';
  position: absolute;
  top: 20%; left: 20%;
  width: 30%; height: 30%;
  background: rgba(255,255,255,0.8);
  border-radius: 50%;
}

.team-ball.fainted {
  background: radial-gradient(circle at 35% 35%, rgba(80,80,80,0.9), rgba(40,40,40,0.7));
  box-shadow: none;
  opacity: 0.4;
}

/* Ball throw animation */
.battleball-throw {
  position: absolute;
  width: 50px;
  height: 50px;
  z-index: 50;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.9), rgba(100,180,255,0.7));
  border: 2px solid rgba(255,255,255,0.6);
  box-shadow: 0 0 20px rgba(100,200,255,0.8);
  animation: throwBall 0.7s cubic-bezier(0.3, 0, 0.7, 1) forwards;
}

@keyframes throwBall {
  0%   { opacity: 1; transform: scale(0.5) translateY(0); }
  50%  { opacity: 1; transform: scale(1.2) translateY(-60px); }
  100% { opacity: 0; transform: scale(0.1) translateY(20px); }
}

/* ============ BATTLE UI (BOTTOM PANEL) ============ */
.battle-ui {
  background: linear-gradient(180deg, rgba(5,5,20,0.95) 0%, rgba(2,2,10,0.98) 100%);
  border-top: 2px solid var(--panel-border);
  padding: 16px 20px;
  z-index: 15;
  position: relative;
}

.battle-log {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
  min-height: 60px;
  font-family: var(--font-body);
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 600;
  color: #fff;
  line-height: 1.5;
  overflow: hidden;
}

.battle-log .log-line {
  animation: logSlideIn 0.3s ease-out;
}

@keyframes logSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.battle-log .highlight { color: var(--gold); font-weight: 700; }
.battle-log .damage { color: #FF6B6B; }
.battle-log .heal { color: #00FF7F; }
.battle-log .super-effective { color: #FFD700; font-style: italic; }
.battle-log .not-effective { color: #888; font-style: italic; }

.battle-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.moves-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-move {
  font-family: var(--font-ui);
  font-size: clamp(9px, 1.5vw, 13px);
  font-weight: 700;
  padding: 10px 6px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: rgba(0,0,0,0.4);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.btn-move:hover {
  background: currentColor;
  color: #000 !important;
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.btn-move:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.move-power {
  display: block;
  font-size: 9px;
  opacity: 0.7;
  margin-top: 2px;
}

.extra-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-switch, .btn-flee {
  font-family: var(--font-ui);
  font-size: clamp(10px, 1.5vw, 14px);
  font-weight: 700;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  background: rgba(0,0,0,0.4);
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 2px;
  flex: 1;
}

.btn-switch:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255,215,0,0.1);
}

.btn-flee:hover {
  border-color: rgba(255,100,100,0.7);
  color: #FF6B6B;
  background: rgba(255,0,0,0.1);
}

/* ============ EFFECTS LAYER ============ */
#effects-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

/* Particle effects */
.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFly var(--dur, 0.8s) ease-out forwards;
}

@keyframes particleFly {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx,0), var(--ty,-100px)) scale(0.2); }
}

/* Attack effect overlays */
.effect-fire {
  background: radial-gradient(circle, rgba(255,100,0,0.9) 0%, rgba(255,50,0,0.5) 40%, transparent 70%);
  animation: effectBurst 0.6s ease-out forwards;
}

.effect-water {
  background: radial-gradient(circle, rgba(0,150,255,0.9) 0%, rgba(0,100,200,0.5) 40%, transparent 70%);
  animation: effectBurst 0.6s ease-out forwards;
}

.effect-electric {
  background: radial-gradient(circle, rgba(255,255,0,0.9) 0%, rgba(200,200,0,0.5) 40%, transparent 70%);
  animation: effectBurst 0.4s ease-out forwards;
}

.effect-psychic {
  background: radial-gradient(circle, rgba(200,0,255,0.9) 0%, rgba(150,0,200,0.5) 40%, transparent 70%);
  animation: effectBurst 0.6s ease-out forwards;
}

.effect-earth {
  background: radial-gradient(circle, rgba(139,69,19,0.9) 0%, rgba(100,50,0,0.5) 40%, transparent 70%);
  animation: effectShake 0.8s ease-out forwards;
}

.effect-dark {
  background: radial-gradient(circle, rgba(50,0,100,0.9) 0%, rgba(20,0,60,0.5) 40%, transparent 70%);
  animation: effectBurst 0.6s ease-out forwards;
}

.effect-ice {
  background: radial-gradient(circle, rgba(150,230,255,0.9) 0%, rgba(100,200,255,0.5) 40%, transparent 70%);
  animation: effectBurst 0.6s ease-out forwards;
}

.effect-nature {
  background: radial-gradient(circle, rgba(0,200,50,0.9) 0%, rgba(0,150,30,0.5) 40%, transparent 70%);
  animation: effectBurst 0.6s ease-out forwards;
}

.effect-light {
  background: radial-gradient(circle, rgba(255,255,200,0.95) 0%, rgba(255,230,100,0.5) 40%, transparent 70%);
  animation: effectFlash 0.4s ease-out forwards;
}

.effect-void {
  background: radial-gradient(circle, rgba(100,0,200,0.9) 0%, rgba(50,0,100,0.5) 40%, transparent 70%);
  animation: effectRipple 0.8s ease-out forwards;
}

@keyframes effectBurst {
  0%   { transform: scale(0); opacity: 0.9; }
  50%  { transform: scale(1.5); opacity: 0.7; }
  100% { transform: scale(3); opacity: 0; }
}

@keyframes effectFlash {
  0%   { opacity: 0.95; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes effectShake {
  0%   { transform: translateY(0) scale(0); opacity: 0.9; }
  20%  { transform: translateY(-5px) scale(1); opacity: 0.8; }
  40%  { transform: translateY(5px) scale(1.2); opacity: 0.7; }
  60%  { transform: translateY(-3px) scale(1.5); opacity: 0.5; }
  100% { transform: translateY(0) scale(3); opacity: 0; }
}

@keyframes effectRipple {
  0%   { transform: scale(0); opacity: 1; border: 3px solid rgba(100,0,200,0.9); }
  50%  { transform: scale(2); opacity: 0.6; }
  100% { transform: scale(5); opacity: 0; }
}

/* Screen flash */
.screen-flash {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  animation: screenFlash var(--dur, 0.3s) ease-out forwards;
}

@keyframes screenFlash {
  0%,30% { opacity: 0.8; }
  100%   { opacity: 0; }
}

/* Ground shake */
.ground-shake {
  animation: groundShake 0.5s ease-in-out;
}

@keyframes groundShake {
  0%,100% { transform: translateY(0); }
  20%     { transform: translateY(-8px) translateX(4px); }
  40%     { transform: translateY(8px) translateX(-4px); }
  60%     { transform: translateY(-6px) translateX(3px); }
  80%     { transform: translateY(6px) translateX(-3px); }
}

/* Lightning bolt SVG effect */
.lightning-bolt {
  position: absolute;
  pointer-events: none;
  z-index: 120;
  animation: lightningStrike 0.4s ease-in-out forwards;
}

@keyframes lightningStrike {
  0%,100% { opacity: 0; }
  10%,30%,50%,70% { opacity: 1; }
  20%,40%,60% { opacity: 0.2; }
}

/* Battle win/lose overlay */
.battle-result-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.8) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 150;
  animation: resultFadeIn 0.5s ease-out;
}

@keyframes resultFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.result-title {
  font-family: var(--font-title);
  font-size: clamp(48px, 10vw, 100px);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 0 40px currentColor;
  animation: resultTitleBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-title.victory { color: var(--gold); }
.result-title.defeat  { color: var(--crimson); }

@keyframes resultTitleBounce {
  0%   { transform: scale(0) rotate(-5deg); }
  60%  { transform: scale(1.2) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.result-subtitle {
  font-family: var(--font-ui);
  font-size: clamp(14px, 2.5vw, 24px);
  color: rgba(255,255,255,0.8);
  margin-top: 20px;
  margin-bottom: 50px;
  letter-spacing: 4px;
  animation: subtitleSlideUp 0.6s 0.3s ease-out both;
}

@keyframes subtitleSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.result-buttons {
  display: flex;
  gap: 20px;
  animation: subtitleSlideUp 0.6s 0.6s ease-out both;
}

/* ============ SWITCH PANEL ============ */
.switch-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 130;
  backdrop-filter: blur(5px);
  animation: resultFadeIn 0.3s ease-out;
}

.switch-panel h3 {
  font-family: var(--font-title);
  font-size: clamp(20px, 4vw, 36px);
  color: var(--gold);
  margin-bottom: 30px;
  text-shadow: var(--shadow-glow);
}

.switch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  max-width: 800px;
}

.switch-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 15px;
  width: 160px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.switch-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.switch-card.fainted {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.switch-card img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.6));
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.switch-card-name {
  font-family: var(--font-ui);
  font-size: 12px;
  color: #fff;
  margin-top: 8px;
  font-weight: 700;
}

.switch-card-hp {
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--health-green);
  margin-top: 4px;
}

/* ============ HOW TO PLAY / CREDITS MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(8px);
  animation: resultFadeIn 0.3s ease-out;
}

.modal-box {
  background: linear-gradient(145deg, #0a0a20, #05050f);
  border: 2px solid var(--panel-border);
  border-radius: 16px;
  padding: 40px;
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 0 60px rgba(255,215,0,0.3);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,215,0,0.3) transparent;
}

.modal-box h2 {
  font-family: var(--font-title);
  font-size: clamp(22px, 4vw, 36px);
  color: var(--gold);
  text-align: center;
  margin-bottom: 25px;
  text-shadow: var(--shadow-glow);
}

.modal-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,215,0,0.15);
}

.modal-section:last-child { border-bottom: none; }

.modal-section h3 {
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--electric);
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.modal-section p, .modal-section li {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255,255,255,0.8);
  margin-bottom: 8px;
}

.modal-section ul { padding-left: 20px; }
.modal-section li::marker { color: var(--gold); }

.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-family: var(--font-ui);
  font-size: 20px;
  color: rgba(255,255,255,0.5);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}
.modal-close:hover { color: #fff; }

.credits-name {
  font-family: var(--font-title);
  font-size: clamp(28px, 5vw, 50px);
  color: var(--gold);
  text-align: center;
  text-shadow: var(--shadow-glow);
  animation: logoPulse 3s infinite;
}

/* ============ LOADING SCREEN ============ */
#screen-loading {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #0a0020 0%, #05050f 100%);
}

.loading-logo {
  font-family: var(--font-title);
  font-size: clamp(32px, 6vw, 60px);
  color: var(--gold);
  text-shadow: var(--shadow-glow);
  margin-bottom: 40px;
  text-align: center;
}

.loading-bar-wrap {
  width: 400px;
  max-width: 80vw;
  height: 6px;
  background: rgba(255,215,0,0.15);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 3px;
  box-shadow: 0 0 15px rgba(255,215,0,0.7);
  transition: width 0.3s ease;
  animation: loadingShimmer 1.5s ease-in-out infinite;
}

@keyframes loadingShimmer {
  0%,100% { box-shadow: 0 0 15px rgba(255,215,0,0.7); }
  50%      { box-shadow: 0 0 30px rgba(255,215,0,1); }
}

.loading-text {
  font-family: var(--font-ui);
  font-size: 13px;
  color: rgba(255,215,0,0.6);
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* ============ RETURN TO MENU BUTTON ============ */
.btn-return-menu {
  position: fixed;
  top: 12px;
  left: 360px;
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 6px 20px;
  border: 1px solid rgba(255,215,0,0.3);
  border-radius: 20px;
  background: rgba(0,0,0,0.6);
  color: rgba(255,215,0,0.6);
  cursor: pointer;
  z-index: 50;
  letter-spacing: 2px;
  transition: all 0.2s;
  backdrop-filter: blur(5px);
}
.btn-return-menu:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255,215,0,0.1);
}

/* ============ SCROLLBAR STYLING ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,215,0,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,215,0,0.6); }

/* ============ RESPONSIVE ============ */
@media (max-width: 600px) {
  .hp-bar-card { min-width: 200px; padding: 8px 12px; }
  .battle-actions { grid-template-columns: 1fr; }
  .moves-panel { grid-template-columns: 1fr 1fr; }
  .extra-actions { flex-direction: row; }
  .battlemon-sprite-wrap.player-sprite { width: 40vw; }
  .battlemon-sprite-wrap.enemy-sprite  { width: 38vw; }
}

@media (max-width: 400px) {
  .btn-menu { min-width: 260px; padding: 14px 40px; }
  .battlemon-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* ===== Status badges + 2P UI (Battlemon 2 update) ===== */
.status-badge {
  display:inline-block; padding:2px 8px; margin-left:6px;
  border-radius:8px; font-size:10px; font-weight:900;
  font-family: var(--font-ui, 'Orbitron', monospace);
  letter-spacing:1px; vertical-align:middle;
  box-shadow:0 0 8px currentColor;
  animation: statusPulse 1.2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%,100% { filter: brightness(1); }
  50%     { filter: brightness(1.5); }
}
.status-badge.burn   { background:#FF6A00; color:#1a0500; }
.status-badge.poison { background:#9933CC; color:#1a0024; }
.status-badge.shock  { background:#FFD700; color:#1a1500; }

.log-line.crit       { color:#ff2d55; text-shadow:0 0 12px #ff2d55; font-weight:900; }
.log-line.status     { color:#ffae00; }

.pass-device-overlay {
  position:fixed; inset:0; z-index:1500;
  background: radial-gradient(ellipse at center, rgba(20,0,40,0.95), rgba(0,0,0,0.98));
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; padding:30px;
}
.pass-device-overlay h1 {
  font-family: var(--font-title, serif);
  font-size: clamp(36px, 7vw, 72px);
  color:#FFD700;
  text-shadow:0 0 30px rgba(255,215,0,0.8), 0 0 60px rgba(255,100,0,0.5);
  margin:0 0 10px 0;
  letter-spacing:3px;
}
.pass-device-overlay .pd-sub {
  font-family: var(--font-ui, monospace);
  color:#aef;
  font-size: clamp(16px, 2.4vw, 22px);
  margin-bottom:30px; max-width:700px;
}
.pass-device-overlay .pd-icon {
  font-size: 80px; margin: 20px 0;
  animation: pdBounce 1.5s ease-in-out infinite;
}
@keyframes pdBounce {
  0%,100%{ transform:translateY(0); }
  50%    { transform:translateY(-20px); }
}
.pass-device-overlay button {
  font-family: var(--font-ui, monospace);
  font-weight:900; letter-spacing:2px;
  padding:18px 50px; font-size:20px;
  background: linear-gradient(180deg,#ffd700,#ff6a00);
  color:#1a0500; border:3px solid #fff; border-radius:14px;
  cursor:pointer; box-shadow:0 0 30px rgba(255,215,0,0.6);
  transition: transform 0.2s;
}
.pass-device-overlay button:hover { transform:scale(1.05); }

.player-turn-banner {
  position:absolute; top:10px; left:50%; transform:translateX(-50%);
  background:linear-gradient(90deg, rgba(0,0,0,0.7), rgba(40,0,80,0.7), rgba(0,0,0,0.7));
  color:#FFD700; padding:6px 18px; border-radius:12px;
  font-family: var(--font-ui, monospace); font-weight:900;
  font-size:14px; letter-spacing:2px; z-index:50;
  border:2px solid #FFD700; box-shadow:0 0 14px rgba(255,215,0,0.6);
}
