/* ===================================
   Kick Raffle System - Animations
   =================================== */

/* ============ Keyframes ============ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

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

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

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.95);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 245, 147, 0.4);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 245, 147, 0.8);
    }
}

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

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

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes confetti {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ============ Animation Classes ============ */

.animate-fade-in {
    animation: fadeIn var(--transition-slow) ease;
}

.animate-slide-in {
    animation: slideIn var(--transition-slow) ease;
}

.animate-slide-up {
    animation: slideUp var(--transition-slow) ease;
}

.animate-scale-in {
    animation: scaleIn var(--transition-slow) ease;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-glow {
    animation: glow 2s infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 1s ease infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ============ Winner Reveal Animation ============ */

.winner-reveal {
    animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.winner-text {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-extrabold);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(0, 245, 147, 0.5);
    animation: glow 2s infinite, float 3s ease-in-out infinite;
}

/* ============ Particle Effects ============ */

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-green);
    border-radius: 50%;
    opacity: 0.8;
    animation: confetti 3s linear forwards;
}

.particle:nth-child(2n) {
    background: var(--secondary-purple);
}

.particle:nth-child(3n) {
    background: var(--primary-green-light);
}

/* ============ Strojny Pixies ============ */

.strojny-pixie {
    position: fixed;
    width: 80px;
    height: 80px;
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
}

.strojny-pixie img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(0, 245, 147, 0.6));
}

.strojny-pixie.flying {
    opacity: 1;
}

/* Pixie 1 - Circular path around top-left area */
.strojny-pixie-1 {
    animation: pixieFly1 8s ease-in-out infinite;
}

@keyframes pixieFly1 {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(15vw, 10vh) rotate(15deg);
    }
    50% {
        transform: translate(25vw, -5vh) rotate(-10deg);
    }
    75% {
        transform: translate(10vw, 15vh) rotate(8deg);
    }
    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

/* Pixie 2 - Figure-8 path around center-right area */
.strojny-pixie-2 {
    animation: pixieFly2 10s ease-in-out infinite;
}

@keyframes pixieFly2 {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    20% {
        transform: translate(-20vw, 15vh) rotate(-12deg) scale(1.1);
    }
    40% {
        transform: translate(-35vw, 5vh) rotate(8deg) scale(0.9);
    }
    60% {
        transform: translate(-25vw, -10vh) rotate(-8deg) scale(1.05);
    }
    80% {
        transform: translate(-10vw, 10vh) rotate(10deg) scale(0.95);
    }
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
}

/* Pixie 3 - Wavy path around bottom-left area */
.strojny-pixie-3 {
    animation: pixieFly3 9s ease-in-out infinite;
}

@keyframes pixieFly3 {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(20vw, -15vh) rotate(-15deg);
    }
    50% {
        transform: translate(35vw, -5vh) rotate(10deg);
    }
    75% {
        transform: translate(15vw, -20vh) rotate(-8deg);
    }
    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

/* Pixie explosion effect */
@keyframes pixieExplode {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

.strojny-pixie.exploding {
    animation: pixieExplode 0.6s ease-out forwards !important;
}

/* Pixie explosion particles */
.pixie-particle {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--primary-green);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: particleExplode 0.8s ease-out forwards;
}

@keyframes particleExplode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* ============ Avalanche Mode - V-Formation Flying Ducks ============ */

/* Formation container */
.duck-formation {
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.duck-formation.flying {
    opacity: 1;
}

/* Individual duck in formation */
.formation-duck {
    position: absolute;
    width: 50px;
    height: 50px;
    transition: transform 0.3s ease;
}

.formation-duck img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(255, 200, 0, 0.5));
}

/* Formation 1 - Left to right, top area */
.duck-formation-1 {
    left: 0;
    top: 0;
    animation: formationFly1 9s linear infinite;
}

@keyframes formationFly1 {
    0% {
        transform: translate(-200px, 15vh) rotate(0deg);
    }
    100% {
        transform: translate(calc(100vw + 200px), 25vh) rotate(0deg);
    }
}

/* Formation 2 - Right to left, middle - kaczki odwrócone */
.duck-formation-2 {
    left: 0;
    top: 0;
    animation: formationFly2 11s linear infinite;
}

@keyframes formationFly2 {
    0% {
        transform: translate(calc(100vw + 200px), 45vh) scaleX(-1);
    }
    100% {
        transform: translate(-200px, 55vh) scaleX(-1);
    }
}

/* Formation 3 - Left to right, lower area, slight tilt */
.duck-formation-3 {
    left: 0;
    top: 0;
    animation: formationFly3 10s linear infinite;
}

@keyframes formationFly3 {
    0% {
        transform: translate(-200px, 70vh) rotate(15deg);
    }
    100% {
        transform: translate(calc(100vw + 200px), 60vh) rotate(15deg);
    }
}

/* Formation 4 - Right to left, top, slight tilt */
.duck-formation-4 {
    left: 0;
    top: 0;
    animation: formationFly4 12s linear infinite;
}

@keyframes formationFly4 {
    0% {
        transform: translate(calc(100vw + 200px), 20vh) scaleX(-1) rotate(-10deg);
    }
    100% {
        transform: translate(-200px, 35vh) scaleX(-1) rotate(-10deg);
    }
}

/* Wing flap animation for ducks */
.formation-duck img {
    animation: wingFlap 0.3s ease-in-out infinite;
}

@keyframes wingFlap {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(0.9);
    }
}

/* Scatter explosion when winner is chosen */
@keyframes duckScatter {
    0% {
        opacity: 1;
    }
    20% {
        transform: scale(1.2);
    }
    100% {
        transform: translate(var(--scatter-x), var(--scatter-y)) rotate(var(--scatter-rot)) scale(0.3);
        opacity: 0;
    }
}

.duck-formation.scattering .formation-duck {
    animation: duckScatter 1.2s ease-out forwards;
}

/* Feather trail effect */
.duck-feather {
    position: fixed;
    width: 12px;
    height: 6px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    pointer-events: none;
    z-index: 9999;
    animation: featherFloat 2s ease-out forwards;
}

@keyframes featherFloat {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(0.2);
        opacity: 0;
    }
}

/* Quack text popup */
.quack-popup {
    position: fixed;
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 200, 0, 0.5);
    pointer-events: none;
    z-index: 10000;
    animation: quackPop 1s ease-out forwards;
    font-family: 'Comic Sans MS', cursive, sans-serif;
}

@keyframes quackPop {
    0% {
        transform: scale(0.5) translateY(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) translateY(-20px);
        opacity: 1;
    }
    100% {
        transform: scale(0.8) translateY(-50px);
        opacity: 0;
    }
}

/* ============ Sedron Mode - Clean, Elegant & Icy ============ */

/* Frost frame container */
.sedron-frost-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9996;
}

/* Corner frost accents - soft radial fade */
.frost-corner {
    position: absolute;
    width: 250px;
    height: 250px;
    pointer-events: none;
    animation: frostCornerPulse 4s ease-in-out infinite alternate;
}

.frost-corner-tl {
    top: 0;
    left: 0;
    background: radial-gradient(ellipse at 0% 0%, rgba(200, 230, 255, 0.35) 0%, rgba(180, 220, 250, 0.15) 30%, transparent 60%);
}

.frost-corner-tr {
    top: 0;
    right: 0;
    background: radial-gradient(ellipse at 100% 0%, rgba(200, 230, 255, 0.35) 0%, rgba(180, 220, 250, 0.15) 30%, transparent 60%);
}

.frost-corner-bl {
    bottom: 0;
    left: 0;
    background: radial-gradient(ellipse at 0% 100%, rgba(200, 230, 255, 0.35) 0%, rgba(180, 220, 250, 0.15) 30%, transparent 60%);
}

.frost-corner-br {
    bottom: 0;
    right: 0;
    background: radial-gradient(ellipse at 100% 100%, rgba(200, 230, 255, 0.35) 0%, rgba(180, 220, 250, 0.15) 30%, transparent 60%);
}

/* Edge frost strips - smooth fade to transparent */
.frost-edge {
    position: absolute;
    pointer-events: none;
    animation: frostEdgePulse 3s ease-in-out infinite alternate;
}

.frost-edge-top {
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to bottom, rgba(200, 230, 255, 0.2) 0%, rgba(190, 220, 250, 0.08) 40%, transparent 100%);
}

.frost-edge-bottom {
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to top, rgba(200, 230, 255, 0.2) 0%, rgba(190, 220, 250, 0.08) 40%, transparent 100%);
}

.frost-edge-left {
    top: 0;
    left: 0;
    bottom: 0;
    width: 60px;
    background: linear-gradient(to right, rgba(200, 230, 255, 0.2) 0%, rgba(190, 220, 250, 0.08) 40%, transparent 100%);
}

.frost-edge-right {
    top: 0;
    right: 0;
    bottom: 0;
    width: 60px;
    background: linear-gradient(to left, rgba(200, 230, 255, 0.2) 0%, rgba(190, 220, 250, 0.08) 40%, transparent 100%);
}

@keyframes frostCornerPulse {
    0% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

@keyframes frostEdgePulse {
    0% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
    }
}

/* Rising Nordic runes */
.sedron-rune {
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    font-family: serif;
    color: rgba(200, 230, 255, 0.9);
    text-shadow:
        0 0 10px rgba(147, 197, 253, 0.9),
        0 0 20px rgba(100, 180, 255, 0.7),
        0 0 30px rgba(59, 130, 246, 0.5),
        0 0 40px rgba(59, 130, 246, 0.3);
    animation: runeRise 6s ease-out forwards;
}

@keyframes runeRise {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.9;
    }
    50% {
        opacity: 1;
    }
    85% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(-110vh) translateX(var(--drift-x, 0px)) rotate(10deg);
        opacity: 0;
    }
}

/* Rising ice particles */
.sedron-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(147, 197, 253, 0.8) 50%, rgba(59, 130, 246, 0.4) 100%);
    box-shadow: 0 0 10px rgba(147, 197, 253, 0.8), 0 0 20px rgba(59, 130, 246, 0.5), 0 0 30px rgba(147, 197, 253, 0.3);
    animation: sedronRise 4s ease-out forwards;
}

@keyframes sedronRise {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-100vh) translateX(var(--drift-x, 0px)) scale(0.5);
        opacity: 0;
    }
}

/* Burst effect on winner - icy explosion */
.sedron-particle.sedron-burst {
    background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(147, 197, 253, 0.9) 40%, rgba(59, 130, 246, 0.6) 100%);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.9), 0 0 30px rgba(147, 197, 253, 0.7), 0 0 45px rgba(59, 130, 246, 0.4);
    animation: sedronBurst 1.5s ease-out forwards;
}

@keyframes sedronBurst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--burst-x, 0px), var(--burst-y, 0px)) scale(0);
        opacity: 0;
    }
}

/* ============ Maxigashi Mode - Flames & Crazy Flying ============ */

/* Fire particles - bigger and more intense */
.fire-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
}

.fire-particle.orange {
    background: radial-gradient(circle, #FFAA00 0%, #FF6600 50%, #FF3300 100%);
    box-shadow: 0 0 15px #FF6600, 0 0 30px #FF3300;
}

.fire-particle.yellow {
    background: radial-gradient(circle, #FFFF00 0%, #FFCC00 50%, #FF9900 100%);
    box-shadow: 0 0 15px #FFCC00, 0 0 30px #FF9900;
}

.fire-particle.red {
    background: radial-gradient(circle, #FF6600 0%, #FF3300 50%, #CC0000 100%);
    box-shadow: 0 0 15px #FF3300, 0 0 30px #CC0000;
}

@keyframes fireRise {
    0% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 0.9;
    }
    100% {
        transform: translateY(var(--rise-y, -200px)) translateX(var(--drift-x, 0px)) scale(0.2);
        opacity: 0;
    }
}

/* Crazy flying maxiguz */
.maxiguz-flyer {
    position: fixed;
    left: 0;
    top: 0;
    width: 80px;
    height: 80px;
    pointer-events: none;
    z-index: 9999;
    will-change: transform;
}

.maxiguz-flyer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 100, 0, 0.8)) drop-shadow(0 0 20px rgba(255, 50, 0, 0.5));
}

/* Orbital flight patterns - circling around screen center */
.maxiguz-flyer-1 {
    animation: orbit1 6s linear infinite;
}

@keyframes orbit1 {
    0% { transform: translate(calc(50vw - 40px + 30vw), calc(50vh - 40px)) rotate(0deg); }
    25% { transform: translate(calc(50vw - 40px), calc(50vh - 40px + 25vh)) rotate(90deg); }
    50% { transform: translate(calc(50vw - 40px - 30vw), calc(50vh - 40px)) rotate(180deg); }
    75% { transform: translate(calc(50vw - 40px), calc(50vh - 40px - 25vh)) rotate(270deg); }
    100% { transform: translate(calc(50vw - 40px + 30vw), calc(50vh - 40px)) rotate(360deg); }
}

.maxiguz-flyer-2 {
    animation: orbit2 5s linear infinite;
}

@keyframes orbit2 {
    0% { transform: translate(calc(50vw - 40px), calc(50vh - 40px + 35vh)) rotate(0deg); }
    25% { transform: translate(calc(50vw - 40px - 40vw), calc(50vh - 40px)) rotate(-90deg); }
    50% { transform: translate(calc(50vw - 40px), calc(50vh - 40px - 35vh)) rotate(-180deg); }
    75% { transform: translate(calc(50vw - 40px + 40vw), calc(50vh - 40px)) rotate(-270deg); }
    100% { transform: translate(calc(50vw - 40px), calc(50vh - 40px + 35vh)) rotate(-360deg); }
}

.maxiguz-flyer-3 {
    animation: orbit3 7s linear infinite;
}

@keyframes orbit3 {
    0% { transform: translate(calc(50vw - 40px - 35vw), calc(50vh - 40px - 20vh)) rotate(0deg); }
    25% { transform: translate(calc(50vw - 40px + 35vw), calc(50vh - 40px - 20vh)) rotate(90deg); }
    50% { transform: translate(calc(50vw - 40px + 35vw), calc(50vh - 40px + 20vh)) rotate(180deg); }
    75% { transform: translate(calc(50vw - 40px - 35vw), calc(50vh - 40px + 20vh)) rotate(270deg); }
    100% { transform: translate(calc(50vw - 40px - 35vw), calc(50vh - 40px - 20vh)) rotate(360deg); }
}

.maxiguz-flyer-4 {
    animation: orbit4 4.5s linear infinite;
}

@keyframes orbit4 {
    0% { transform: translate(calc(50vw - 40px + 20vw), calc(50vh - 40px - 30vh)) rotate(0deg); }
    33% { transform: translate(calc(50vw - 40px - 25vw), calc(50vh - 40px + 15vh)) rotate(120deg); }
    66% { transform: translate(calc(50vw - 40px + 5vw), calc(50vh - 40px + 30vh)) rotate(240deg); }
    100% { transform: translate(calc(50vw - 40px + 20vw), calc(50vh - 40px - 30vh)) rotate(360deg); }
}

.maxiguz-flyer-5 {
    animation: orbit5 5.5s linear infinite;
}

@keyframes orbit5 {
    0% { transform: translate(calc(50vw - 40px - 15vw), calc(50vh - 40px + 35vh)) rotate(0deg); }
    33% { transform: translate(calc(50vw - 40px + 30vw), calc(50vh - 40px)) rotate(-120deg); }
    66% { transform: translate(calc(50vw - 40px - 20vw), calc(50vh - 40px - 30vh)) rotate(-240deg); }
    100% { transform: translate(calc(50vw - 40px - 15vw), calc(50vh - 40px + 35vh)) rotate(-360deg); }
}

/* Fly to center on winner */
.maxiguz-flyer.fly-to-center {
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1) !important;
    animation: none !important;
}

/* Final burst at center */
@keyframes maxiguzBurst {
    0% {
        transform: translate(calc(50vw - 40px), calc(50vh - 40px)) scale(1) rotate(0deg);
        opacity: 1;
    }
    40% {
        transform: translate(calc(50vw - 40px), calc(50vh - 40px)) scale(1.5) rotate(180deg);
        opacity: 1;
        filter: brightness(2) drop-shadow(0 0 30px #FF6600);
    }
    100% {
        transform: translate(calc(50vw - 40px), calc(50vh - 40px)) scale(0) rotate(360deg);
        opacity: 0;
    }
}

.maxiguz-flyer.bursting {
    animation: maxiguzBurst 0.6s ease-out forwards !important;
}

/* ============ Transition Utilities ============ */

.transition-all {
    transition: all var(--transition-base);
}

.transition-fast {
    transition: all var(--transition-fast);
}

.transition-slow {
    transition: all var(--transition-slow);
}

.transition-bounce {
    transition: all var(--transition-bounce);
}
