/* Animations */

/* Pop animation for entering letters */
@keyframes pop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    40% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Shake animation for invalid words */
@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

.shake {
    animation: shake 0.82s cubic-bezier(.36, .07, .19, .97) both;
}

/* Flip animation for revealing tiles */
.tile.flip {
    animation: flip 0.5s ease-in;
}

@keyframes flip {
    0% {
        transform: rotateX(0);
        background-color: transparent;
        border-color: var(--color-tone-3);
    }

    45% {
        transform: rotateX(90deg);
        background-color: transparent;
        border-color: var(--color-tone-3);
    }

    55% {
        transform: rotateX(90deg);
        /* Color change happens here in JS usually by class toggle, but keyframe helps sync */
    }

    100% {
        transform: rotateX(0);
    }
}

/* Win Bounce Animation */
@keyframes bounce {

    0%,
    20% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-30px);
    }

    50% {
        transform: translateY(5px);
    }

    60% {
        transform: translateY(-15px);
    }

    80% {
        transform: translateY(2px);
    }

    100% {
        transform: translateY(0);
    }
}

.bounce {
    animation: bounce 1s;
}