/* ==================== BATTLE ARENA ==================== */
.battle-arena {
    display: none;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.battle-arena.active {
    display: block;
}

.battle-scene {
    position: relative;
    width: 100%;
    height: 580px;
    background: 
        linear-gradient(180deg, rgba(26, 58, 42, 0.7) 0%, rgba(13, 40, 24, 0.8) 50%, rgba(26, 58, 42, 0.7) 100%),
        url('../assets/battle-bg.png') center/cover no-repeat;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid rgba(0, 255, 136, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 100px rgba(0, 255, 136, 0.05);
}

/* Fallback gradient if no background image */
.battle-scene::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, #1a3a2a 0%, #0d2818 50%, #1a3a2a 100%);
    z-index: -1;
}

.battle-scene::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(180deg, transparent, rgba(0, 100, 50, 0.3));
}

/* Enemy Zone - HP Box top left */
.enemy-zone {
    position: absolute;
    top: 30px;
    left: 30px;
    z-index: 10;
}

/* Enemy Sprite - top right */
.enemy-sprite-zone {
    position: absolute;
    top: 30px;
    right: 60px;
    z-index: 5;
}

.enemy-sprite {
    width: 300px;
    height: 300px;
    object-fit: contain;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.5));
    animation: enemyIdle 3s ease-in-out infinite;
}

@keyframes enemyIdle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Player Zone - HP Box bottom right */
.player-zone {
    position: absolute;
    bottom: 120px;
    right: 30px;
    z-index: 10;
}

/* Player Sprite - bottom left, touching the bottom edge */
.player-sprite-zone {
    position: absolute;
    bottom: -80px;
    left: 30px;
    z-index: 5;
}

.player-sprite {
    width: 380px;
    height: 380px;
    object-fit: contain;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.5));
    animation: playerIdle 3s ease-in-out infinite;
}

@keyframes playerIdle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* HP Box */
.hp-box {
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(240,240,240,0.95));
    border-radius: 12px;
    padding: 12px 20px;
    min-width: 220px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.hp-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.hp-box .name {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    color: #222;
}

.hp-box .level {
    background: #333;
    color: #fff;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 700;
}

.hp-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hp-label {
    font-size: 10px;
    font-weight: 900;
    color: #f4a261;
}

.hp-bar-outer {
    flex: 1;
    height: 12px;
    background: #333;
    border-radius: 6px;
    overflow: hidden;
}

.hp-bar-inner {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

.hp-bar-inner.high { background: linear-gradient(90deg, #4ade80, #22c55e); }
.hp-bar-inner.medium { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.hp-bar-inner.low { background: linear-gradient(90deg, #f87171, #ef4444); animation: lowHpPulse 0.5s infinite; }

@keyframes lowHpPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.hp-numbers {
    text-align: right;
    font-size: 11px;
    color: #333;
    margin-top: 5px;
    font-weight: 700;
}

/* Turn Badge */
.turn-badge {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--gold), #ff9500);
    color: #000;
    padding: 10px 30px;
    border-radius: 25px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    box-shadow: 0 5px 20px var(--gold-glow);
    z-index: 20;
    animation: turnPulse 1.5s ease-in-out infinite;
}

@keyframes turnPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

/* Battle Animations */
.enemy-sprite.hit, .player-sprite.hit {
    animation: hitShake 0.3s ease-out;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.5)) brightness(2);
}

@keyframes hitShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-15px); }
    75% { transform: translateX(15px); }
}

.enemy-sprite.attacking {
    animation: enemyAttack 0.5s ease-out;
}

@keyframes enemyAttack {
    0% { transform: translate(0, 0); }
    40% { transform: translate(40px, 30px) scale(1.15); }
    100% { transform: translate(0, 0); }
}

.player-sprite.attacking {
    animation: playerAttack 0.5s ease-out;
}

@keyframes playerAttack {
    0% { transform: translate(0, 0); }
    40% { transform: translate(50px, -30px) scale(1.15); }
    100% { transform: translate(0, 0); }
}