/* Confetti Animation Styles - Enhanced for GameVote */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99999; /* Increased from 9999 to ensure it's above award reveal */
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    opacity: 1;
    transform-origin: center;
    will-change: transform, opacity;
}

/* Confetti Shape Variations */
.confetti-piece.confetti-0 {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    border-radius: 50%;
    width: 8px;
    height: 8px;
}

.confetti-piece.confetti-1 {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    border-radius: 0;
    width: 12px;
    height: 6px;
}

.confetti-piece.confetti-2 {
    background: linear-gradient(45deg, #45b7d1, #2980b9);
    border-radius: 50%;
    width: 6px;
    height: 6px;
    box-shadow: 0 0 10px rgba(69, 183, 209, 0.6);
}

.confetti-piece.confetti-3 {
    background: linear-gradient(45deg, #f093fb, #f5576c);
    border-radius: 2px;
    transform: rotate(45deg);
    width: 10px;
    height: 10px;
}

/* Enhanced Animation Classes */
.confetti-piece.confetti-falling {
    animation: 
        confetti-fall var(--fall-duration, 3s) linear var(--fall-delay, 0ms) 1 forwards,
        confetti-rotate var(--fall-duration, 3s) linear var(--fall-delay, 0ms) 1 forwards,
        confetti-sway var(--fall-duration, 3s) ease-in-out var(--fall-delay, 0ms) 1 forwards;
}

/* Simple fallback animation without CSS variables */
.confetti-piece.confetti-falling-simple {
    animation: confetti-fall-simple 3s linear forwards;
}

/* Main falling animation */
@keyframes confetti-fall {
    0% {
        transform: translateY(-20px) translateX(0px) rotate(var(--rotation, 0deg));
        opacity: 1;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(calc(100vh + 20px)) translateX(var(--horizontal-movement, 0px)) rotate(calc(var(--rotation, 0deg) + 720deg));
        opacity: 0;
    }
}

/* Simple fallback animation */
@keyframes confetti-fall-simple {
    0% {
        transform: translateY(-20px) translateX(0px) rotate(0deg);
        opacity: 1;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(calc(100vh + 20px)) translateX(50px) rotate(720deg);
        opacity: 0;
    }
}

/* Rotation animation for more realistic physics */
@keyframes confetti-rotate {
    0% {
        transform: rotate(var(--rotation, 0deg));
    }
    100% {
        transform: rotate(calc(var(--rotation, 0deg) + 1080deg));
    }
}

/* Swaying motion for realistic falling */
@keyframes confetti-sway {
    0%, 100% {
        transform: translateX(0px);
    }
    25% {
        transform: translateX(-20px);
    }
    75% {
        transform: translateX(20px);
    }
}

/* Screen shake effect for confetti burst */
@keyframes confettiScreenShake {
    0%, 100% { transform: translateX(0px); }
    10% { transform: translateX(-2px); }
    20% { transform: translateX(2px); }
    30% { transform: translateX(-2px); }
    40% { transform: translateX(2px); }
    50% { transform: translateX(-1px); }
    60% { transform: translateX(1px); }
    70% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
    90% { transform: translateX(-1px); }
}

/* Additional confetti variations for more variety */
.confetti-piece:nth-child(5n) {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.confetti-piece:nth-child(6n) {
    background: linear-gradient(45deg, #32cd32, #228b22);
    border-radius: 0;
    transform: rotate(30deg);
}

.confetti-piece:nth-child(7n) {
    background: linear-gradient(45deg, #ff69b4, #ff1493);
    border-radius: 50%;
    width: 14px;
    height: 14px;
}

.confetti-piece:nth-child(8n) {
    background: linear-gradient(45deg, #9966cc, #663399);
    border-radius: 2px;
    width: 8px;
    height: 16px;
}

/* Size variations */
.confetti-piece:nth-child(3n) {
    width: 6px;
    height: 6px;
}

.confetti-piece:nth-child(4n) {
    width: 14px;
    height: 14px;
}

.confetti-piece:nth-child(5n) {
    width: 12px;
    height: 8px;
}

/* Staggered animation timing for more natural effect */
.confetti-piece:nth-child(odd) {
    --fall-delay: 0ms;
}

.confetti-piece:nth-child(even) {
    --fall-delay: 100ms;
}

.confetti-piece:nth-child(3n) {
    --fall-delay: 200ms;
}

.confetti-piece:nth-child(4n) {
    --fall-delay: 300ms;
}

.confetti-piece:nth-child(5n) {
    --fall-delay: 50ms;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .confetti-piece {
        width: 8px;
        height: 8px;
    }
    
    .confetti-piece:nth-child(4n) {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .confetti-piece {
        width: 6px;
        height: 6px;
    }
    
    .confetti-piece:nth-child(4n) {
        width: 8px;
        height: 8px;
    }
}

/* Debug styles for troubleshooting */
.confetti-container.debug-visible {
    background: rgba(255, 0, 0, 0.1);
    border: 2px solid red;
}

/* Test animation to verify CSS is working */
.confetti-test-animation {
    animation: confetti-test 2s ease-in-out infinite alternate;
}

@keyframes confetti-test {
    0% {
        background-color: red;
        transform: scale(1);
    }
    100% {
        background-color: blue;
        transform: scale(1.5);
    }
}