:root {
    --bg: #2D1B3D;
    --card: #3A2550;
    --pink: #FF7CE7;
    --teal: #5EF2F2;
    --light-purple: #C2A6FF;
    --text: #ffffff;
    --wrong: #FF4E88;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

.container {
    /* width: 850px; */
    background: var(--card);
    display: flex;
    gap: 70px;
    align-items: flex-end;
    padding: 60px 40px;
    border-radius: 10px;
    color: var(--text);
}

.hangman-box img {
    max-width: 270px;
}

.hangman-box h1 {
    font-size: 1.5rem;
    margin-top: 20px;
    text-align: center;
    text-transform: uppercase;
    color: var(--light-purple);
}

.word-display {
    display: flex;
    gap: 10px;
    list-style: none;
    align-items: center;
    justify-content: center;
}

.word-display .letter {
    width: 28px;
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 40px;
    color: var(--text);
    border-bottom: 3px solid var(--pink);
}

.word-display .letter.guessed {
    margin: -40px 0 35px;
    border-color: transparent;
}

.game-box h4 {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 15px;
    color: var(--light-purple);
}

.game-box h4 b {
    font-weight: 600;
    color: var(--teal);
}

.game-box .guesses-text b {
    color: var(--wrong);
}

.game-box .keyboard {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    margin-top: 40px;
}

:where(.game-modal, .keyboard) button {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    text-transform: uppercase;
    background-color: var(--pink);
    border: none;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.keyboard button {
    padding: 7px;
    width: calc(100% / 9 - 5px);
}

.keyboard button[disabled] {
    opacity: 0.5;
    pointer-events: none;
}

:where(.game-modal, .keyboard) button:hover {
    background-color: var(--teal);
    color: #000;
}

.game-modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    padding: 0 10px;
    pointer-events: none;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(20, 10, 40, 0.7);
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    animation: modalBgFade 0.4s ease forwards;
}

.game-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.game-modal .content {
    background: var(--card);
    max-width: 420px;
    width: 100%;
    text-align: center;
    border-radius: 10px;
    padding: 30px;
    color: var(--text);
}

.game-modal img {
    width: 150px;
    margin-bottom: 20px;
}

.game-modal h4 {
    font-size: 1.53rem;
    color: var(--light-purple);
}

.game-modal p {
    font-size: 1.15rem;
    margin: 15px 0 30px;
    font-weight: 500;
    color: var(--text);
}

.game-modal p b {
    color: var(--teal);
    font-weight: 600;
}

.game-modal button {
    padding: 12px 23px;
    background: var(--pink);
}

.game-modal button:hover {
    background: var(--teal);
    color: #000;
}

@media (max-width: 782px) {
    .container {
        flex-direction: column;
        padding: 30px 15px;
        align-items: center;
    }

    .hangman-box img {
        max-width: 200px;
    }

    .hangman-box h1 {
        display: none;
    }
}


:where(.game-modal, .keyboard) button::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.8);
    opacity: 0;
    border-radius: 50%;
    transform: scale(1);
    pointer-events: none;
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
}

:where(.game-modal, .keyboard) button:active::after {
    opacity: 1;
    transform: scale(35);
    transition: transform 0.5s ease-out, opacity 0.6s ease-out;
}

/* Button Press Scale Effect */
:where(.game-modal, .keyboard) button:active {
    transform: scale(0.92);
}

@keyframes modalBgFade {
    0% {
        background: rgba(20, 10, 40, 0);
    }

    100% {
        background: rgba(20, 10, 40, 0.7);
    }
}

/* Modal card animation */
.game-modal.show .content {
    animation: modalPop 0.55s cubic-bezier(0.22, 1.15, 0.62, 1) forwards;
    opacity: 0;
    transform: scale(0.7) translateY(20px);
}

@keyframes modalPop {
    0% {
        opacity: 0;
        transform: scale(0.7) translateY(20px);
    }

    60% {
        opacity: 1;
        transform: scale(1.05) translateY(-5px);
    }

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