body {
    background: #222;
    color: #fff;
    font-family: 'Press Start 2P', monospace, Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

header {
    text-align: center;
    padding: 1em 0 0.5em 0;
    background: #111;
    border-bottom: 2px solid #444;
}

h1 {
    font-size: 2em;
    letter-spacing: 0.1em;
    margin: 0;
}

.back-link {
    color: #ff0;
    text-decoration: none;
    font-size: 1em;
    margin-top: 0.5em;
    display: inline-block;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
}

#game-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25em;
    margin: 0.5em 0 0.5em 0;
    height: 40vh;
}

.tile {
    width: 2em;
    height: 2em;
    background: #333;
    border: 2px solid #555;
    color: #fff;
    font-size: 1.2em;
    text-align: center;
    line-height: 2em;
    font-family: inherit;
    text-transform: uppercase;
    transition: background 0.2s, border 0.2s;
}

.tile.correct {
    background: #4caf50;
    border-color: #388e3c;
}

.tile.present {
    background: #ffeb3b;
    border-color: #fbc02d;
    color: #222;
}

.tile.absent {
    background: #616161;
    border-color: #333;
}

#keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.2em;
    height: 30vh;
    justify-content: flex-end;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    margin: 0.1em 0;
}

.key {
    background: #444;
    color: #fff;
    border: 2px solid #666;
    border-radius: 0.2em;
    margin: 0 0.05em;
    padding: 0.4em 0.3em;
    font-size: 0.9em;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    transition: background 0.2s, border 0.2s;
}

.key.used {
    background: #888;
    color: #222;
}

.key.correct {
    background: #4caf50;
    color: #fff;
}

.key.present {
    background: #ffeb3b;
    color: #222;
}

.key.absent {
    background: #616161;
    color: #fff;
}

#game-over {
    background: #111;
    color: #fff;
    border: 2px solid #f00;
    padding: 1em;
    margin: 1em 0;
    text-align: center;
    font-size: 1.2em;
}

#level-info {
    margin: 1em 0;
    font-size: 1.1em;
    color: #ff0;
}

#controls-desc {
    text-align: center;
    padding: 1em;
    background: #111;
    border-top: 2px solid #444;
    font-size: 1em;
}

#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: #222;
    color: #fff;
    border: 3px solid #f00;
    padding: 2em 2em;
    border-radius: 1em;
    text-align: center;
    font-size: 1.5em;
    box-shadow: 0 0 20px #000;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-8px);
    }

    80% {
        transform: translateX(8px);
    }

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

.shake {
    animation: shake 0.4s;
}

.board-row {
    display: flex;
    justify-content: center;
    margin-bottom: 0.1em;
}

@media (max-width: 600px) {
    #game-board {
        gap: 0.15em;
        margin: 0.2em 0 0.2em 0;
        height: 35vh;
    }

    .tile {
        width: 1.5em;
        height: 1.5em;
        font-size: 1em;
        line-height: 1.5em;
    }

    #keyboard {
        height: 25vh;
    }

    .key {
        padding: 0.3em 0.2em;
        font-size: 0.8em;
    }
}

@media (min-width: 601px) {
    #game-board {
        height: 40vh;
    }

    #keyboard {
        height: 30vh;
    }
}