/* === Keyframes === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes winAppear {
    from {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

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

@keyframes hintPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5), var(--shadow-sm);
        transform: translateY(0);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.9), 0 0 40px rgba(255, 215, 0, 0.5), var(--shadow-md);
        transform: translateY(-3px);
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.9);
    }
}

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

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

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

@keyframes cardDeal {
    from {
        transform: translate(-50vw, -50vh) rotate(180deg) scale(0.5);
        opacity: 0;
    }
    to {
        transform: translate(0, 0) rotate(0) scale(1);
        opacity: 1;
    }
}

@keyframes cardFlip {
    0% {
        transform: rotateY(0);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0);
    }
}

@keyframes cardMoveToFoundation {
    0% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(0, -30px) scale(1.1);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 50px rgba(255, 215, 0, 0.5);
    }
}

/* === Utility classes === */
.animate-deal {
    animation: cardDeal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.animate-flip {
    animation: cardFlip 0.4s ease-in-out;
}

.animate-move-to-foundation {
    animation: cardMoveToFoundation 0.4s ease-out;
}

.animate-shake {
    animation: shake 0.4s ease-in-out;
}

.animate-bounce {
    animation: bounce 0.5s ease-in-out;
}

.animate-glow {
    animation: glow 1.5s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

/* === Ripple effect for buttons === */
.btn {
    position: relative;
    overflow: hidden;
}

.btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

/* === Card transitions === */
.card {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

/* === Column highlight transition === */
.column, .foundation {
    transition: all var(--transition-normal);
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .confetti {
        display: none;
    }
}
