/* Arena Container */
.live-arena {
    border-radius: 0;
    box-shadow: none;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    border: none;
    min-height: auto;
}

/* Arena - full landscape rectangle on desktop, square on mobile */
.arena {
    width: 100%;
    height: calc(100vh - 140px);
    max-width: 100%;
    background: radial-gradient(circle at center, #1a1a2e 0%, #0f0f1e 100%);
    position: relative;
    border: none;
    border-radius: 0;
    transition: var(--transition);
    box-shadow: 0 0 60px rgba(102, 126, 234, 0.2), inset 0 0 80px rgba(102, 126, 234, 0.05);
    overflow: hidden;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Mobile: keep square aspect ratio */
@media (max-width: 768px) {
    .arena {
        width: calc(100vh - 140px);
        height: calc(100vh - 140px);
        aspect-ratio: 1;
    }
}

/* Arena theme styles - desaturated for cleaner look */
.arena.space {
    background: radial-gradient(circle at center, #0a0a2e 0%, #16213e 50%, #000 100%);
    border-color: rgba(74, 144, 226, 0.3);
    box-shadow: 0 0 40px rgba(74, 144, 226, 0.2);
}

.arena.underwater {
    background: radial-gradient(circle at center, #0066cc 0%, #003d7a 50%, #001a33 100%);
    border-color: rgba(0, 191, 255, 0.3);
    box-shadow: 0 0 40px rgba(0, 191, 255, 0.2);
}

.arena.lava {
    background: radial-gradient(circle at center, #ff4500 0%, #8b0000 50%, #2f0000 100%);
    border-color: rgba(255, 99, 71, 0.3);
    box-shadow: 0 0 40px rgba(255, 99, 71, 0.2);
}

.arena.neon {
    background: radial-gradient(circle at center, #ff00ff 0%, #00ffff 50%, #000 100%);
    border-color: rgba(255, 0, 255, 0.3);
    box-shadow: 0 0 40px rgba(255, 0, 255, 0.2);
}

.arena.forest {
    background: radial-gradient(circle at center, #228b22 0%, #006400 50%, #013220 100%);
    border-color: rgba(50, 205, 50, 0.3);
    box-shadow: 0 0 40px rgba(50, 205, 50, 0.2);
}

/* Particle effects */
.arena::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.2), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(2px 2px at 90% 60%, rgba(255, 255, 255, 0.2), transparent),
        radial-gradient(1px 1px at 33% 80%, rgba(255, 255, 255, 0.3), transparent),
        radial-gradient(1px 1px at 15% 90%, rgba(255, 255, 255, 0.2), transparent);
    background-size: 200% 200%;
    background-position: 0% 0%;
    animation: particles 20s ease-in-out infinite;
    opacity: 0.6;
    pointer-events: none;
}

@keyframes particles {
    0%, 100% {
        background-position: 0% 0%, 100% 100%, 50% 50%, 80% 20%, 20% 80%, 60% 40%, 10% 90%;
        opacity: 0.6;
    }
    50% {
        background-position: 100% 100%, 0% 0%, 25% 75%, 70% 30%, 30% 70%, 80% 60%, 40% 20%;
        opacity: 0.8;
    }
}

/* Glow pulse effect on arena */
@keyframes arenaPulse {
    0%, 100% {
        box-shadow: 0 0 60px rgba(102, 126, 234, 0.4), inset 0 0 80px rgba(102, 126, 234, 0.1);
    }
    50% {
        box-shadow: 0 0 80px rgba(102, 126, 234, 0.6), inset 0 0 100px rgba(102, 126, 234, 0.15);
    }
}

.arena {
    animation: arenaPulse 4s ease-in-out infinite;
}

/* Fighter */
.fighter {
    position: absolute;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.9);
    background-size: cover;
    background-position: center;
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(102, 126, 234, 0.3),
        inset 0 0 10px rgba(255, 255, 255, 0.1);
    width: 50px;
    height: 50px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    z-index: 1;
    box-sizing: border-box;
    pointer-events: none;
}

.fighter:hover {
    transform: scale(1.05);
    border-color: #667eea;
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(102, 126, 234, 0.6),
        inset 0 0 15px rgba(255, 255, 255, 0.2);
}

/* Health Bar - thinner for better avatar visibility */
.health-bar {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0050 0%, #ff4081 50%, #00f2fe 100%);
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.6);
    position: relative;
}

.health-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: healthShine 2s ease-in-out infinite;
}

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

/* Battle Info */
.battle-info {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(102, 126, 234, 0.3);
    padding: 18px 28px;
    border-radius: var(--border-radius);
    text-align: center;
    font-size: 19px;
    font-weight: 800;
    min-height: 60px;
    display: none;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow:
        var(--shadow-md),
        0 0 30px rgba(102, 126, 234, 0.2);
    letter-spacing: 0.5px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.battle-info.is-visible {
    display: flex;
    animation: pulse 2s ease-in-out infinite, slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            var(--shadow-md),
            0 0 30px rgba(102, 126, 234, 0.2);
    }
    50% {
        transform: scale(1.02);
        box-shadow:
            var(--shadow-lg),
            0 0 40px rgba(102, 126, 234, 0.4);
    }
}

.battle-info #fighterCount {
    background: linear-gradient(135deg, #667eea 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.15em;
    font-weight: 900;
}

/* Winner Modal */
.winner-modal {
    display: none;
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 0;
    pointer-events: none;
    animation: fadeIn 0.3s ease;
}

.winner-content {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    backdrop-filter: blur(30px);
    border: 2px solid rgba(102, 126, 234, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: clamp(20px, 6vw, 40px);
    text-align: center;
    overflow-y: auto;
    box-shadow:
        var(--shadow-xl),
        0 0 60px rgba(102, 126, 234, 0.3),
        inset 0 0 60px rgba(102, 126, 234, 0.1);
    animation: scaleIn 0.4s ease-out;
}

.winner-content::before {
    content: '👑';
    font-size: 64px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(255, 215, 0, 0.5));
}

.winner-portrait {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.winner-crown {
    position: absolute;
    top: -22px;
    font-size: clamp(36px, 9vw, 52px);
    transform: rotate(-8deg);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
    animation: float 2s ease-in-out infinite;
}

.final-winner-avatar {
    width: clamp(110px, 32vw, 160px);
    height: clamp(110px, 32vw, 160px);
    border-radius: 50%;
    border: 4px solid gold;
    margin: 0 auto;
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.4);
}

.winner-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(320px, 90%);
    margin: 0 auto;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: clamp(14px, 4vw, 18px);
}

.winner-details p {
    margin: 0;
    font-size: clamp(0.9rem, 2.5vw, 1.05rem);
}

.winner-handle {
    font-size: clamp(1.2rem, 4.5vw, 1.6rem);
    margin: 0;
    letter-spacing: 0.5px;
}

#winnerInfo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    width: 100%;
}

/* Sudden Death Effects */
@keyframes poisonPulse {
    0%, 100% { filter: hue-rotate(0deg) brightness(1); }
    50% { filter: hue-rotate(120deg) brightness(1.3); }
}

.poisoned {
    animation: poisonPulse 1.5s infinite;
    border: 2px solid #9d4edd !important;
    box-shadow: 0 0 15px #9d4edd, inset 0 0 10px rgba(157, 78, 221, 0.3) !important;
}

.poisoned::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 70%, #9d4edd 100%);
    pointer-events: none;
    opacity: 0.6;
}

/* Pre-battle overlay */
.pre-battle-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pre-battle-overlay.active {
    opacity: 1;
    transform: scale(1);
}

.pre-battle-overlay.fade-out {
    opacity: 0;
    transform: scale(1.1);
}

.pre-battle-content {
    text-align: center;
    color: white;
    animation: preBattlePulse 1.5s ease-in-out infinite;
}

.pre-battle-logo {
    font-size: clamp(48px, 8vw, 72px);
    font-weight: 900;
    letter-spacing: 4px;
    text-shadow:
        0 0 30px rgba(255, 255, 255, 0.8),
        0 4px 20px rgba(0, 0, 0, 0.5),
        -3px -3px 0 #000,
        3px -3px 0 #000,
        -3px 3px 0 #000,
        3px 3px 0 #000,
        -3px 0 0 #000,
        3px 0 0 #000,
        0 -3px 0 #000,
        0 3px 0 #000;
    margin-bottom: 20px;
    color: #fff;
}

.pre-battle-subtitle {
    font-size: clamp(16px, 2.5vw, 24px);
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.pre-battle-count {
    font-size: clamp(20px, 3vw, 32px);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.count-label {
    opacity: 0.8;
    letter-spacing: 1px;
}

.count-number {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-width: 80px;
}

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

/* Fighter highlight animation */
@keyframes fighterHighlight {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 20px rgba(102, 126, 234, 0.3);
    }
    25%, 75% {
        transform: scale(1.3);
        box-shadow: 0 0 40px rgba(255, 215, 0, 1), 0 0 60px rgba(255, 215, 0, 0.8), inset 0 0 20px rgba(255, 215, 0, 0.5);
    }
    50% {
        transform: scale(1.4);
        box-shadow: 0 0 50px rgba(255, 215, 0, 1), 0 0 80px rgba(255, 215, 0, 0.9), inset 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

.fighter-highlighted {
    animation: fighterHighlight 3s ease-in-out;
    border: 4px solid gold !important;
    z-index: 1000 !important;
}
