/* Importing Google font - Open Sans */
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap");

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Open Sans", sans-serif;
}

body {
    display: flex;
    padding: 0 10px;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: url("baground.jpeg") no-repeat center center fixed;
    background-size: cover;
    position: relative;
}

/* Optional: dark overlay for readability */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: -1;
}

.wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.page-title {
    font-size: 2.5rem;
    color: #fff;
    text-align: center;
    margin: 20px 0 30px;
    text-transform: uppercase;
}

.container {
    background: rgba(255, 250, 240, 0.85); /* warm creamy tone */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 200, 150, 0.4); /* subtle warm border */
    display: flex;
    width: 850px;
    gap: 70px;
    padding: 60px 40px;
    border-radius: 10px;
    align-items: flex-end;
    justify-content: space-between;
}

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

.hangman-box h1 {
    font-size: 1.45rem;
    text-align: center;
    margin-top: 20px;
    text-transform: uppercase;
}

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

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

.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;
}

.game-box h4 b {
    font-weight: 600;
}

.game-box .guesses-text b {
    color: #ff0000;
}

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

:where(.game-modal, .keyboard) button {
    color: #fff;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    background: #5A7D7C; /* muted teal */
}

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

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

:where(.game-modal, .keyboard) button:hover {
    background: #789E9D;
}

.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 0 10px;
    transition: opacity 0.4s ease;
}

.game-modal.show {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.4s 0.4s ease;
}

.game-modal .content {
    padding: 30px;
    max-width: 420px;
    width: 100%;
    border-radius: 10px;
    background: #fff;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

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

.game-modal img[src="images/victory.gif"] {
    margin-left: -10px;
}

.game-modal h4 {
    font-size: 1.53rem;
}

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

.game-modal p b {
    color: #5A7D7C;
    font-weight: 600;
}

.game-modal button {
    padding: 12px 23px;
}

/* Responsive Layout */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        align-items: center;
        padding: 40px 20px;
        width: 90%;
        gap: 40px;
    }

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

    .page-title {
        font-size: 2rem;
        margin: 15px 0 25px;
    }

    .hangman-box h1 {
        font-size: 1.2rem;
    }

    .keyboard button {
        font-size: 0.9rem;
        padding: 6px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 25px 10px;
        width: 100%;
    }

    .page-title {
        font-size: 1.8rem;
        margin: 10px 0 20px;
    }

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

    .word-display .letter {
        font-size: 1.5rem;
        width: 24px;
        margin-bottom: 30px;
    }

    .game-box .keyboard {
        gap: 4px;
        margin-top: 30px;
    }

    .keyboard button {
        font-size: 0.8rem;
        padding: 5px;
        width: calc(100% / 9 - 4px);
    }

    .game-box h4 {
        font-size: 0.95rem;
    }
}
