body,
html {
    min-height: 100%;
}

.games,
.snake-game {
    width: 100%;
    margin: 0;
}

.games {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: Arial, sans-serif;
    color: #0f0;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

#gameWrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1,
h2 {
    text-align: center;
}

canvas {
    border: 2px solid #0f0;
    background-color: #222;
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
}

#scoreDisplay {
    margin-top: 12px;
    text-align: center;
}

#startButton {
    position: absolute;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 20px;
    font-size: 20px;
    color: #0f0;
    background-color: #222;
    border: 2px solid #0f0;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.scoreboard {
    text-align: center;
    color: #0f0;
    font-family: monospace;
    width: 100%;
    max-width: 400px;
}

.scoreboard h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #0f0;
    text-transform: uppercase;
    text-decoration: underline;
}

#scoreTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#scoreTable th,
#scoreTable td {
    border: 1px solid #0f0;
    padding: 8px;
    font-size: 18px;
    color: #0f0;
    text-align: center;
}

#scoreTable th {
    background-color: #222;
    font-weight: bold;
    text-transform: uppercase;
}

#scoreTable tbody tr:nth-child(even) {
    background-color: #333;
}

.score-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
    gap: 8px;
}

.score-input input {
    background-color: #222;
    color: #0f0;
    border: 2px solid #0f0;
    padding: 8px;
    font-size: 16px;
    text-align: center;
    font-family: monospace;
    width: 200px;
}

.score-input input::placeholder {
    color: #0f0;
    background-color: #222;
}

.score-input button {
    background-color: #0f0;
    color: #222;
    font-size: 16px;
    padding: 8px 16px;
    border: 2px solid #0f0;
    font-family: monospace;
    cursor: pointer;
}

.score-input button:hover {
    background-color: #222;
    color: #0f0;
}

.custom-alert {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 16px;
}

.custom-alert-content {
    background-color: #222;
    color: #0f0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border: 2px solid #0f0;
    width: 100%;
    max-width: 400px;
}

.custom-alert button {
    background-color: #0f0;
    color: #111;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
}

.custom-alert button:hover {
    background-color: #0c0;
}

/* Desktop */
@media only screen and (min-width: 768px) {
    .game-container {
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
    }

    .scoreboard {
        margin-top: 0;
    }

    #startButton {
        top: 50%;
        left: 50%;
    }
}

/* Mobile */
@media only screen and (max-width: 767px) {
    canvas {
        max-width: 90vw;
    }

    .scoreboard {
        max-width: 90vw;
    }

    #scoreTable th,
    #scoreTable td {
        font-size: 14px;
        padding: 6px;
    }

    #startButton {
        font-size: 16px;
        padding: 8px 16px;
    }
}