/* Animations for the game */

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.bounce {
    animation: bounce 1s ease;
}

@keyframes sparkle {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

.sparkle {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: gold;
    clip-path: polygon(
        50% 0%,
        61% 35%,
        98% 35%,
        68% 57%,
        79% 91%,
        50% 70%,
        21% 91%,
        32% 57%,
        2% 35%,
        39% 35%
    );
    animation: sparkle 0.8s linear forwards;
    z-index: 999;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(54, 199, 89, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(54, 199, 89, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(54, 199, 89, 0);
    }
}

.pulse {
    animation: pulse 1s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

.hidden {
    display: none !important;
}

/* Confetti animation */
@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(-100vh) rotateZ(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotateZ(360deg);
    }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    z-index: 1000;
    animation: confettiFall linear forwards;
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9000;
    overflow: hidden;
}

/* Congratulations text animation */
@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.scale-in {
    animation: scaleIn 0.7s ease-out forwards;
}

/* Snap animation */
@keyframes snapTo {
    0% {
        transform: scale(1.1);
        opacity: 0.9;
        box-shadow: 0 0 20px rgba(76, 110, 245, 0.6);
    }
    40% {
        transform: scale(0.95);
        box-shadow: 0 0 10px rgba(76, 110, 245, 0.4);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 15px rgba(76, 110, 245, 0.5);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 rgba(76, 110, 245, 0);
    }
}

.snap-animation {
    animation: snapTo 0.4s ease-in-out forwards;
    z-index: 100;
}

/* Fly to position animation */
@keyframes flyTo {
    0% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 3px 10px rgba(76, 110, 245, 0.3);
    }
    50% {
        opacity: 0.95;
        transform: scale(1.05);
        box-shadow: 0 5px 15px rgba(76, 110, 245, 0.5);
    }
    100% {
        opacity: 0.9;
        transform: scale(1);
        box-shadow: 0 7px 20px rgba(76, 110, 245, 0.6);
    }
}

.fly-to {
    animation: flyTo 0.3s ease-out;
    transition: transform 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
    z-index: 100;
}

/* Return animation */
@keyframes returnToOrigin {
    0% {
        opacity: 0.9;
        transform: translateY(-5px) scale(1.05);
        box-shadow: 0 5px 15px rgba(255, 87, 87, 0.5);
    }
    30% {
        transform: translateY(3px) scale(0.97);
    }
    60% {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 3px 10px rgba(255, 87, 87, 0.3);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        box-shadow: 0 0 0 rgba(255, 87, 87, 0);
    }
}

.return-to-origin {
    animation: returnToOrigin 0.4s ease-in-out;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
}
