/* ====== BATTLE FLOORS STYLES - OPTIMIZED V2 ====== */

/* Base floor styling with performance improvements */
.battle-floor {
    position: absolute;
    bottom: 0;
    left: -150px;
    width: 200%; /* Kept for visual layout consistency */
    height: 200px;
    /* OPTIMIZATION: Removed rotateX(65deg) - Major performance gain, significant visual change (flatter floor) */
    /* Compensate slightly by pushing down */
    transform: scale(2) translateY(60px);
    /* OPTIMIZATION: Removed preserve-3d as it's not needed without 3D rotation */
    will-change: transform; /* Hints browser to optimize transform animations */
    backface-visibility: hidden; /* Reduces paint complexity */
    /* OPTIMIZATION: Removed box-shadow as it was negligible or transparent */
    z-index: 3;
    image-rendering: pixelated; /* Keep for retro style */
    transition: background-color 0.8s ease;
    border-top: 6px solid rgba(0, 0, 0, 0.2); /* Keep border */
    overflow: hidden; /* Prevent potential background bleed */
}


/* DAY FLOORS - SIMPLIFIED SVGs */

/* Day - celestial */
.floor-day-celestial {
    background-color: #2a3a8c;
    /* OPTIMIZATION: Simplified SVG - basic diagonal lines */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 80 80"><rect width="80" height="80" fill="%232a3a8c"/><path d="M0 0L80 80M80 0L0 80" stroke="%234169e1" stroke-width="4" opacity="0.2"/><path d="M-20 20L20 60M20 -20L60 20M60 60L100 100" stroke="%234169e1" stroke-width="4" opacity="0.2"/></svg>');
    background-size: 80px 80px;
}

/* Day - forest */
.floor-day-forest {
    background-color: #1a4d1a;
    /* OPTIMIZATION: Simplified SVG - vertical lines */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><rect width="60" height="60" fill="%231a4d1a"/><rect x="10" width="5" height="60" fill="%23228b22" opacity="0.3"/><rect x="30" width="5" height="60" fill="%23228b22" opacity="0.3"/><rect x="50" width="5" height="60" fill="%23228b22" opacity="0.3"/></svg>');
    background-size: 60px 60px;
}

/* Day - desert */
.floor-day-desert {
    background-color: #c2b280;
    /* OPTIMIZATION: Simplified SVG - dots */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30"><rect width="30" height="30" fill="%23c2b280"/><circle cx="5" cy="5" r="2" fill="%23d2b48c" opacity="0.3"/><circle cx="15" cy="15" r="2" fill="%23d2b48c" opacity="0.3"/><circle cx="25" cy="25" r="2" fill="%23d2b48c" opacity="0.3"/></svg>');
    background-size: 30px 30px;
}

/* Day - lavaland */
.floor-day-lavaland {
    background-color: #8b2500;
    /* OPTIMIZATION: Simplified SVG - checkerboard */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><rect width="40" height="40" fill="%238b2500"/><rect width="20" height="20" fill="%23ff4500" opacity="0.4"/><rect x="20" y="20" width="20" height="20" fill="%23ff4500" opacity="0.4"/></svg>');
    background-size: 40px 40px;
    animation: lava-pulse 4s infinite alternate; /* Keep simple animation */
}

/* Simplified lava animation */
@keyframes lava-pulse {
    0% { background-color: #8b2500; }
    100% { background-color: #b22222; }
}

/* Day - castle */
.floor-day-castle {
    background-color: #777777;
    /* OPTIMIZATION: Simplified SVG - basic checkerboard */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect width="32" height="32" fill="%23777777"/><rect width="16" height="16" fill="%23555555" opacity="0.5"/><rect x="16" y="16" width="16" height="16" fill="%23555555" opacity="0.5"/></svg>');
    background-size: 32px 32px;
}

/* Day - plains */
.floor-day-plains {
    background-color: #7cba3d;
    /* OPTIMIZATION: Simplified SVG - fewer circles */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30"><rect width="30" height="30" fill="%237cba3d"/><circle cx="10" cy="10" r="3" fill="%2390ee90" opacity="0.4"/><circle cx="20" cy="20" r="3" fill="%2390ee90" opacity="0.4"/></svg>');
    background-size: 30px 30px;
}

/* NIGHT FLOORS - SIMPLIFIED SVGs */

/* Night - void */
.floor-night-void {
    background-color: #1e0033;
    /* OPTIMIZATION: Simplified SVG - radial gradient */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><radialGradient id="g" cx="50%" cy="50%" r="50%"><stop offset="0%" stop-color="%234b0082" stop-opacity="0.3"/><stop offset="100%" stop-color="%231e0033" stop-opacity="0.3"/></radialGradient></defs><rect width="100" height="100" fill="%231e0033"/><rect width="100" height="100" fill="url(%23g)"/></svg>');
    background-size: 100px 100px;
}

/* Night - neon */
.floor-night-neon {
    background-color: #000000;
    /* OPTIMIZATION: Simplified SVG - fewer lines */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><rect width="60" height="60" fill="%23000000"/><line x1="0" y1="15" x2="60" y2="15" stroke="%2300ffff" stroke-width="1" opacity="0.5"/><line x1="0" y1="45" x2="60" y2="45" stroke="%2300ffff" stroke-width="1" opacity="0.5"/><line x1="15" y1="0" x2="15" y2="60" stroke="%23ff00ff" stroke-width="1" opacity="0.5"/><line x1="45" y1="0" x2="45" y2="60" stroke="%23ff00ff" stroke-width="1" opacity="0.5"/></svg>');
    background-size: 60px 60px;
}

/* Night - ice */
.floor-night-ice {
    background-color: #0a2c3d;
    /* OPTIMIZATION: Simplified SVG - basic cross pattern */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="70" height="70" viewBox="0 0 70 70"><rect width="70" height="70" fill="%230a2c3d"/><path d="M0 35H70M35 0V70" stroke="%23add8e6" stroke-width="3" opacity="0.15"/><path d="M15 15L55 55M55 15L15 55" stroke="%2387cefa" stroke-width="2" opacity="0.1"/></svg>');
    background-size: 70px 70px;
}

/* Night - space */
.floor-night-space {
    background-color: #090418;
    /* OPTIMIZATION: Simplified SVG - fewer circles */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 50 50"><rect width="50" height="50" fill="%23090418"/><circle cx="10" cy="10" r="1" fill="%23ffffff" opacity="0.8"/><circle cx="30" cy="40" r="1" fill="%23ffffff" opacity="0.8"/><circle cx="45" cy="15" r="1" fill="%23ffffff" opacity="0.6"/><circle cx="20" cy="25" r="1" fill="%23ffffff" opacity="0.4"/></svg>');
    background-size: 50px 50px;
    animation: space-twinkle 6s infinite ease-in-out; /* Keep simple animation */
}

/* Simplified space animation */
@keyframes space-twinkle {
    0%, 100% { opacity: 0.9; } /* Animating opacity of the whole floor */
    50% { opacity: 1; }
}

/* Night - haunted */
.floor-night-haunted {
    background-color: #3a2e39;
    /* OPTIMIZATION: Simplified SVG - vertical stripes */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><rect width="40" height="40" fill="%233a2e39"/><rect x="0" y="0" width="20" height="40" fill="%23493948" opacity="0.5"/></svg>');
    background-size: 40px 40px;
}

/* Night - cyber */
.floor-night-cyber {
    background-color: #000033;
    /* OPTIMIZATION: Simplified SVG - basic grid */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><rect width="20" height="20" fill="%23000033"/><path d="M0 10H20M10 0V20" stroke="%230096c7" stroke-width="1" opacity="0.3"/></svg>');
    background-size: 20px 20px;
    animation: cyber-scan 3s infinite linear; /* Keep simple animation */
}

/* Simplified cyber animation */
@keyframes cyber-scan {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

/* MADNESS FLOORS - SIMPLIFIED SVGs & ANIMATIONS */

/* Madness - chaotic */
.floor-madness-chaotic {
    background-color: #4b0000;
    /* OPTIMIZATION: Simplified SVG - diagonal lines */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><rect width="60" height="60" fill="%234b0000"/><path d="M0 0L60 60M60 0L0 60" stroke="%23dc143c" stroke-width="3" opacity="0.2"/><path d="M-10 10L10 30M30 -10L50 10M70 30L90 50" stroke="%238b0000" stroke-width="2" opacity="0.1"/></svg>');
    background-size: 60px 60px;
    /* OPTIMIZATION: Removed distort animation, maybe add subtle pulse */
    animation: madness-opacity-pulse 5s infinite alternate;
}

@keyframes madness-opacity-pulse {
    0% { opacity: 0.9; }
    100% { opacity: 1; }
}

/* Madness - broken */
.floor-madness-broken {
    background-color: #241c1c;
    /* OPTIMIZATION: Simplified SVG - cracks */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><rect width="60" height="60" fill="%23241c1c"/><path d="M0 0L30 25L20 60M60 0L25 30L40 60M0 60L35 35L60 60" stroke="%23ffa500" stroke-width="1" opacity="0.2"/><path d="M30 0L30 60M0 30L60 30" stroke="%238a2be2" stroke-width="1" opacity="0.1"/></svg>');
    background-size: 60px 60px;
    /* OPTIMIZATION: Reduced hue-rotate range */
    animation: madness-floor-pulse 4s infinite alternate;
}

/* Simplified pulse animation */
@keyframes madness-floor-pulse {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(10deg); } /* Reduced from 20deg */
}

/* Madness - glitch */
.floor-madness-glitch {
    background-color: #0a0a0a;
    /* OPTIMIZATION: Simplified SVG - horizontal lines */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><rect width="32" height="32" fill="%230a0a0a"/><rect y="8" width="32" height="2" fill="%2300ff00" opacity="0.05"/><rect y="18" width="32" height="2" fill="%23ff0000" opacity="0.05"/><rect y="28" width="32" height="1" fill="%23ffffff" opacity="0.03"/></svg>');
    background-size: 32px 32px;
}

/* Optional: add a simpler glitch animation through a class */
.enable-glitch {
    /* OPTIMIZATION: Uses only transform and opacity */
    animation: simple-glitch 0.8s steps(2) infinite;
}

@keyframes simple-glitch {
    0%, 100% { transform: scale(2) translateY(60px); opacity: 1; }
    50% { transform: scale(2) translateY(60px) translateX(3px); opacity: 0.9; }
}

/* Madness - vortex */
.floor-madness-vortex {
    background-color: #2d1152;
    /* OPTIMIZATION: Simplified SVG - just the gradient */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><defs><radialGradient id="grad" cx="50%" cy="50%" r="50%"><stop offset="0%" stop-color="%238a2be2" stop-opacity="0.7"/><stop offset="100%" stop-color="%234b0082" stop-opacity="0.7"/></radialGradient></defs><rect width="200" height="200" fill="%232d1152"/><circle cx="100" cy="100" r="100" fill="url(%23grad)"/></svg>');
    background-size: 200px 200px;
    animation: simple-rotate 10s infinite linear; /* Keep simple animation */
}

@keyframes simple-rotate {
    0% { background-position: center 0; }
    100% { background-position: center 200px; }
}

/* Madness - psychedelic */
.floor-madness-psychedelic {
    background-color: #ff00ff;
    /* OPTIMIZATION: Simplified SVG - checkerboard */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><rect width="40" height="40" fill="%23ff00ff"/><rect width="20" height="20" fill="%2300ffff" opacity="0.7"/><rect x="20" y="20" width="20" height="20" fill="%2300ffff" opacity="0.7"/></svg>');
    background-size: 40px 40px;
    /* OPTIMIZATION: Reduced hue-rotate range */
    animation: color-shift 4s infinite alternate;
}

@keyframes color-shift {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(45deg); } /* Reduced from 90deg */
}

/* Madness - corrupted */
.floor-madness-corrupted {
    background-color: #222222;
    /* OPTIMIZATION: Simplified SVG - checkerboard */
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><rect width="16" height="16" fill="%23222222"/><rect width="8" height="8" fill="%23ff0000" opacity="0.5"/><rect x="8" y="8" width="8" height="8" fill="%2300ff00" opacity="0.5"/></svg>');
    background-size: 16px 16px;
}

/* Optional: add a simpler corrupt glitch animation through a class */
.enable-corrupt {
    /* OPTIMIZATION: Uses only transform */
    animation: corrupt-shift 0.5s steps(2) infinite;
}

@keyframes corrupt-shift {
    0%, 100% { transform: scale(2) translateY(60px); }
    25%, 75% { transform: scale(2) translateY(60px) translateX(-3px); }
    50% { transform: scale(2) translateY(60px) translateX(3px); }
}

/* Media queries for mobile optimization */
@media (max-width: 768px) {
    .battle-floor {
        /* Further adjust scale/position if needed for mobile */
        transform: scale(1.8) translateY(50px);
    }

    /* Disable more animations on mobile */
    .floor-day-lavaland,
    .floor-night-space,
    .floor-night-cyber,
    .floor-madness-chaotic,
    .floor-madness-broken,
    .floor-madness-vortex,
    .floor-madness-psychedelic,
    .enable-glitch,
    .enable-corrupt {
        animation: none;
    }

    /* Optionally simplify madness filters further on mobile */
    .floor-madness-broken,
    .floor-madness-psychedelic {
        filter: none;
    }
}