/* Baby Name Guesser - Animations */

/* Keyframe Animations */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

@keyframes tileReveal {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

@keyframes bounce {
    0%, 20%, 60%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    80% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

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

@keyframes heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.1); }
    28% { transform: scale(1); }
    42% { transform: scale(1.1); }
    70% { transform: scale(1); }
}

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

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary-pink);
    }
    50% {
        box-shadow: 0 0 20px var(--primary-pink), 0 0 30px var(--primary-pink);
    }
}

/* Animation Classes */
.tile-flip {
    animation: tileFlip 0.6s ease-in-out;
}

.tile-reveal {
    animation: tileReveal 0.3s ease-out;
}

.row-shake {
    animation: rowShake 0.5s ease-in-out;
}

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

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

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

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

.glow-effect {
    animation: glow 2s ease-in-out infinite;
}

/* Confetti Animation */
.confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti::before,
.confetti::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-pink);
    animation: confettiDrop 3s linear infinite;
}

.confetti::before {
    left: 10%;
    animation-delay: 0s;
    background: var(--soft-pink);
}

.confetti::after {
    left: 20%;
    animation-delay: 0.5s;
    background: var(--baby-blue);
}

/* Additional confetti particles */
.confetti-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--mint-green);
    border-radius: 50%;
    animation: confettiDrop 2.5s linear infinite;
}

.confetti-particle:nth-child(1) {
    left: 30%;
    animation-delay: 1s;
    background: var(--soft-yellow);
}

.confetti-particle:nth-child(2) {
    left: 40%;
    animation-delay: 1.5s;
    background: var(--lavender);
}

.confetti-particle:nth-child(3) {
    left: 50%;
    animation-delay: 2s;
    background: var(--primary-pink);
}

.confetti-particle:nth-child(4) {
    left: 60%;
    animation-delay: 0.3s;
    background: var(--baby-blue);
}

.confetti-particle:nth-child(5) {
    left: 70%;
    animation-delay: 0.8s;
    background: var(--mint-green);
}

.confetti-particle:nth-child(6) {
    left: 80%;
    animation-delay: 1.3s;
    background: var(--soft-pink);
}

.confetti-particle:nth-child(7) {
    left: 90%;
    animation-delay: 1.8s;
    background: var(--soft-yellow);
}

/* Sparkle Effects */
.sparkle {
    position: relative;
    overflow: visible;
}

.sparkle::before {
    content: '✨';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 12px;
    animation: sparkle 2s ease-in-out infinite;
    animation-delay: 0.5s;
}

.sparkle::after {
    content: '💫';
    position: absolute;
    bottom: -10px;
    left: -10px;
    font-size: 10px;
    animation: sparkle 2s ease-in-out infinite;
    animation-delay: 1s;
}

/* Special Effects for Success */
.celebration-mode .title {
    animation: heartbeat 1s ease-in-out infinite;
    color: var(--primary-pink);
}

.celebration-mode .tile.correct {
    animation: pulse 1s ease-in-out infinite;
}

.celebration-mode .game-board {
    position: relative;
}

.celebration-mode .game-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 105, 180, 0.1) 50%, transparent 70%);
    animation: sparkle 3s ease-in-out infinite;
    pointer-events: none;
}

/* Hover Effects */
.tile:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

.key:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 105, 180, 0.3);
}

.icon-btn:hover {
    animation: bounce 0.5s ease-in-out;
}

/* Loading Animation */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-pink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Typewriter Effect for Special Messages */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-pink);
    white-space: nowrap;
    animation: typewriter 2s steps(40, end), blink-cursor 0.75s step-end infinite;
}

@keyframes blink-cursor {
    from, to { border-color: transparent; }
    50% { border-color: var(--primary-pink); }
}

/* Smooth transitions for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .confetti,
    .confetti::before,
    .confetti::after,
    .confetti-particle {
        display: none;
    }
}

/* Focus animations for accessibility */
.key:focus,
.action-btn:focus,
.icon-btn:focus {
    outline: 2px solid var(--primary-pink);
    outline-offset: 2px;
    animation: pulse 1s ease-in-out;
}

/* Custom animations for MATILDA typing */
.matilda-typing .tile {
    animation: tileReveal 0.3s ease-out;
}


/* Entrance animations */
.game-board {
    animation: fadeIn 0.8s ease-out;
}

.keyboard {
    animation: slideUp 0.6s ease-out;
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

.header {
    animation: fadeIn 0.6s ease-out;
}

/* Success celebration animations */
.success-celebration {
    position: relative;
}

.success-celebration::before {
    content: '🎉';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 30px;
    animation: bounce 2s ease-in-out infinite;
}

.success-celebration::after {
    content: '💕';
    position: absolute;
    bottom: -30px;
    right: 10px;
    font-size: 20px;
    animation: heartbeat 1.5s ease-in-out infinite;
    animation-delay: 0.5s;
} 
/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for MATILDA (7 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for MATILDA (7 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for MATILDA (7 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for MATILDA (7 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for SEBASTIAN (9 letters) */

/* Dynamic animations for CHARLES (7 letters) */

/* Dynamic animations for CHARLES (7 letters) */

/* Dynamic animations for MATILDA (7 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for JEREMY (6 letters) */

/* Dynamic animations for MATILDA (7 letters) */
.matilda-typing .tile:nth-child(1) { animation-delay: 0.1s; }
.matilda-typing .tile:nth-child(2) { animation-delay: 0.2s; }
.matilda-typing .tile:nth-child(3) { animation-delay: 0.3s; }
.matilda-typing .tile:nth-child(4) { animation-delay: 0.4s; }
.matilda-typing .tile:nth-child(5) { animation-delay: 0.5s; }
.matilda-typing .tile:nth-child(6) { animation-delay: 0.6s; }
.matilda-typing .tile:nth-child(7) { animation-delay: 0.7s; }
