/* Pop Animation - When Tile is Filled */
@keyframes pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Flip Animation - When Revealing Tile Color */
@keyframes flip {
    0% {
        transform: rotateX(0);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0);
    }
}

.tile.flip {
    animation: flip 0.5s ease;
}

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

.row.shake {
    animation: shake 0.5s ease;
}

/* Bounce Animation - Win State */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.tile.bounce {
    animation: bounce 1s ease;
}

/* Fade In Animation - Modals */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.active {
    animation: fadeIn 0.2s ease;
}

/* Slide Up Animation - Modal Content */
@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal.active .modal-content {
    animation: slideUp 0.3s ease;
}

/* Pulse Animation - Message */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.message.show {
    animation: pulse 0.3s ease;
}

/* Stagger Flip Animation for Row */
.tile.flip:nth-child(1) {
    animation-delay: 0s;
}

.tile.flip:nth-child(2) {
    animation-delay: 0.15s;
}

.tile.flip:nth-child(3) {
    animation-delay: 0.3s;
}

.tile.flip:nth-child(4) {
    animation-delay: 0.45s;
}

.tile.flip:nth-child(5) {
    animation-delay: 0.6s;
}

/* Stagger Bounce Animation for Win */
.tile.bounce:nth-child(1) {
    animation-delay: 0s;
}

.tile.bounce:nth-child(2) {
    animation-delay: 0.1s;
}

.tile.bounce:nth-child(3) {
    animation-delay: 0.2s;
}

.tile.bounce:nth-child(4) {
    animation-delay: 0.3s;
}

.tile.bounce:nth-child(5) {
    animation-delay: 0.4s;
}
