/**
 * Retro 8-16 Bit Crowd Effect CSS
 * Classic pixel-perfect crowd animation for retro games
 *
 * Usage: Include this CSS file and use retro-crowd-effect.js
 */

/* Main crowd container */
.retro-crowd-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 90px;

    overflow: hidden;
    z-index: 10;
    pointer-events: none;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Retro stadium stands - blocky 8-bit style */
.retro-stands {
    position: absolute;
    bottom: 120px;
    left: 0;
    right: 0;
    height: 80px;
    background:
            repeating-linear-gradient(
                    90deg,
                    #333 0px,
                    #333 20px,
                    #222 20px,
                    #222 24px,
                    #444 24px,
                    #444 44px,
                    #222 44px,
                    #222 48px
            );
    opacity: 0.8;
}

.retro-stands::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: repeating-linear-gradient(
            90deg,
            #666 0px,
            #666 16px,
            #333 16px,
            #333 20px
    );
}

/* Add some 8-bit style windows/lights */
.retro-stands::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 40px;
    background:
            repeating-linear-gradient(
                    90deg,
                    transparent 0px,
                    transparent 12px,
                    #ffff00 12px,
                    #ffff00 14px,
                    transparent 14px,
                    transparent 26px,
                    #ff8800 26px,
                    #ff8800 28px,
                    transparent 28px,
                    transparent 40px
            ),
            repeating-linear-gradient(
                    0deg,
                    transparent 0px,
                    transparent 8px,
                    rgba(255,255,255,0.1) 8px,
                    rgba(255,255,255,0.1) 12px,
                    transparent 12px,
                    transparent 20px
            );
}

/* Crowd depth layers */
.retro-crowd-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
}

.retro-crowd-back {
    bottom: 16px;
    opacity: 0.4;
    filter: contrast(0.8);
}

.retro-crowd-middle {
    bottom: 8px;
    opacity: 0.6;
}

.retro-crowd-front {
    bottom: 0px;
    opacity: 0.9;
}

/* 8-bit style spectator - blocky pixel art */
.retro-spectator {
    position: absolute;
    bottom: 0;
    background: #000;
    transform-origin: bottom center;
    opacity: 1;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Different 8-bit spectator sprites */
.retro-spectator.sprite1 {
    width: 16px;
    height: 32px;
    background:
            linear-gradient(to right,
            transparent 0px, transparent 2px,
            #000 2px, #000 6px,
            transparent 6px, transparent 8px,
            #000 8px, #000 10px,
            transparent 10px, transparent 14px,
            #000 14px, #000 16px
            ),
            linear-gradient(to bottom,
            #000 0px, #000 8px,
            transparent 8px, transparent 12px,
            #000 12px, #000 32px
            );
    animation: retroCheer1 1.5s ease-in-out infinite;
}

.retro-spectator.sprite2 {
    width: 20px;
    height: 36px;
    background:
            linear-gradient(to right,
            transparent 0px, transparent 4px,
            #000 4px, #000 8px,
            transparent 8px, transparent 12px,
            #000 12px, #000 16px,
            transparent 16px, transparent 20px
            ),
            linear-gradient(to bottom,
            #000 0px, #000 10px,
            transparent 10px, transparent 14px,
            #000 14px, #000 36px
            );
    animation: retroCheer2 2s ease-in-out infinite;
}

.retro-spectator.sprite3 {
    width: 12px;
    height: 28px;
    background:
            linear-gradient(to right,
            transparent 0px, transparent 2px,
            #000 2px, #000 4px,
            transparent 4px, transparent 6px,
            #000 6px, #000 8px,
            transparent 8px, transparent 10px,
            #000 10px, #000 12px
            ),
            linear-gradient(to bottom,
            #000 0px, #000 6px,
            transparent 6px, transparent 10px,
            #000 10px, #000 28px
            );
    animation: retroCheer3 1.2s ease-in-out infinite;
}

.retro-spectator.sprite4 {
    width: 24px;
    height: 40px;
    background:
            linear-gradient(to right,
            #000 0px, #000 4px,
            transparent 4px, transparent 8px,
            #000 8px, #000 12px,
            transparent 12px, transparent 16px,
            #000 16px, #000 20px,
            transparent 20px, transparent 24px
            ),
            linear-gradient(to bottom,
            #000 0px, #000 12px,
            transparent 12px, transparent 16px,
            #000 16px, #000 40px
            );
    animation: retroCheer4 2.5s ease-in-out infinite;
}

.retro-spectator.sprite5 {
    width: 18px;
    height: 34px;
    background:
            repeating-linear-gradient(
                    to right,
                    #000 0px, #000 2px,
                    transparent 2px, transparent 4px
            ),
            linear-gradient(to bottom,
            #000 0px, #000 8px,
            transparent 8px, transparent 12px,
            #000 12px, #000 34px
            );
    animation: retroCheer5 1.8s ease-in-out infinite;
}

/* 8-bit style cheering animations - more angular and snappy */
@keyframes retroCheer1 {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1) rotate(-4deg); }
    50% { transform: scale(1.2) rotate(0deg); }
    75% { transform: scale(1) rotate(4deg); }
}

@keyframes retroCheer2 {
    0%, 100% { transform: scale(1) skew(0deg); }
    33% { transform: scale(1.1) skew(-2deg); }
    66% { transform: scale(1.15) skew(2deg); }
}

@keyframes retroCheer3 {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.3) rotate(-6deg); }
}

@keyframes retroCheer4 {
    0%, 100% { transform: scale(1) rotate(0deg) scaleY(1); }
    25% { transform: scale(1.05) rotate(2deg) scaleY(1.1); }
    75% { transform: scale(1.1) rotate(-2deg) scaleY(0.95); }
}

@keyframes retroCheer5 {
    0%, 100% { transform: scale(1) rotate(0deg); }
    40% { transform: scale(1.25) rotate(8deg); }
    80% { transform: scale(1.05) rotate(-4deg); }
}

/* 8-bit wave effect - more choppy and pixelated */
.retro-spectator.retro-wave {
    animation: retroWaveMotion 0.8s steps(4) !important;
}

@keyframes retroWaveMotion {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.5) rotate(-12deg); }
    50% { transform: scale(1.2) rotate(0deg); }
    75% { transform: scale(1.8) rotate(12deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Celebration mode - faster, choppier animations */
.retro-crowd-container.retro-celebrate .retro-spectator {
    animation-duration: 0.3s !important;
    animation-timing-function: steps(2) !important;
}

/* 8-bit sound wave - pixelated concentric squares */
.retro-sound-wave {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border: 2px solid #00ff00;
    animation: retroSoundPulse 1.5s steps(8) forwards;
    pointer-events: none;
    image-rendering: pixelated;
}

@keyframes retroSoundPulse {
    0% {
        width: 8px;
        height: 8px;
        opacity: 1;
        border-color: #00ff00;
    }
    25% {
        width: 32px;
        height: 32px;
        opacity: 0.8;
        border-color: #ffff00;
    }
    50% {
        width: 64px;
        height: 64px;
        opacity: 0.6;
        border-color: #ff8800;
    }
    75% {
        width: 96px;
        height: 96px;
        opacity: 0.4;
        border-color: #ff0000;
    }
    100% {
        width: 128px;
        height: 128px;
        opacity: 0;
        border-color: #ff0000;
    }
}

/* 8-bit confetti - square pixels */
.retro-confetti {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ff00ff;
    animation: retroConfettiFall 2s steps(12) forwards;
    pointer-events: none;
    image-rendering: pixelated;
}

@keyframes retroConfettiFall {
    0% {
        transform: translateY(-32px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(128px) rotate(90deg);
        opacity: 0;
    }
}

/* 8-bit entrance/exit animations */
.retro-crowd-container.retro-entering {
    animation: retroCrowdEnter 1s steps(8) forwards;
}

.retro-crowd-container.retro-exiting {
    animation: retroCrowdExit 1s steps(8) forwards;
}

@keyframes retroCrowdEnter {
    0% {
        opacity: 0;
        transform: translateY(32px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes retroCrowdExit {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(32px);
    }
}

/* 8-bit color themes */
.retro-crowd-container.retro-theme-classic .retro-spectator {
    background: #004607;
}

.retro-crowd-container.retro-theme-gameboy .retro-spectator {
    background: #0f380f;
}



.retro-crowd-container.retro-theme-nes .retro-spectator {
    background: #000080;
}


.retro-crowd-container.retro-theme-cga .retro-spectator {
    background: #ff00ff;
}



/* Intensity levels - more choppy for retro feel */
.retro-crowd-container.retro-intensity-low .retro-spectator {
    animation-duration: 4s !important;
    animation-timing-function: steps(4) !important;
}

.retro-crowd-container.retro-intensity-medium .retro-spectator {
    animation-duration: 2s !important;
    animation-timing-function: steps(6) !important;
}

.retro-crowd-container.retro-intensity-high .retro-spectator {
    animation-duration: 1s !important;
    animation-timing-function: steps(8) !important;
}

.retro-crowd-container.retro-intensity-extreme .retro-spectator {
    animation-duration: 0.5s !important;
    animation-timing-function: steps(2) !important;
}

/* 8-bit style flash effect for celebrations */
.retro-crowd-container.retro-flash {
    animation: retroFlash 0.1s steps(1) infinite;
}

@keyframes retroFlash {
    0%, 50% { filter: invert(0); }
    51%, 100% { filter: invert(1); }
}

/* Pixel-perfect scaling for different screen sizes */
@media (max-width: 768px) {
    .retro-crowd-container {
        height: 50px;
    }

    .retro-spectator.sprite1 { width: 12px; height: 24px; }
    .retro-spectator.sprite2 { width: 16px; height: 28px; }
    .retro-spectator.sprite3 { width: 8px; height: 20px; }
    .retro-spectator.sprite4 { width: 20px; height: 32px; }
    .retro-spectator.sprite5 { width: 14px; height: 26px; }
}

@media (max-width: 480px) {
    .retro-crowd-container {
        height: 96px;
    }

    .retro-spectator.sprite1 { width: 8px; height: 16px; }
    .retro-spectator.sprite2 { width: 12px; height: 20px; }
    .retro-spectator.sprite3 { width: 6px; height: 14px; }
    .retro-spectator.sprite4 { width: 16px; height: 24px; }
    .retro-spectator.sprite5 { width: 10px; height: 18px; }
}

/* Add scanline effect for authentic CRT feel */
.retro-crowd-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 100;
}