* {
    margin: 0;
    padding: 0;
}

body {
    background-color: rgb(112, 176, 15);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-family: Arial, Helvetica, sans-serif;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px;
}

#userScore,
#highestScore {
    font-size: 24px;
    font-weight: bold;
    color: white;
}

.level-selector select {
    background-color: rgba(2, 125, 10, 0.2);
    color: white;
    border: none;
    padding: 5px;
    border-radius: 5px;
}

.level-selector select option {
    background-color: rgb(129, 203, 17);
    color: #fff;
}

#board {
    background: linear-gradient(rgb(1, 104, 1), rgb(127, 127, 2));
    width: 90vmin;
    height: 92vmin;
    display: grid;
    grid-template-columns: repeat(18, 1fr);
    grid-template-rows: repeat(18, 1fr);
    max-width: 500px;
    max-height: 500px;
}

.head {
    border-radius: 10px;
    transform: scale(1.02);
    background: linear-gradient(145deg, #cdfb02, #04f10c);
    border-radius: 50%;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
    animation: snake-move 0.2s linear infinite;
}

.snake {
    border-radius: 10px;
    transform: scale(1.02);
    background: linear-gradient(145deg, #dbf569, #32bf36);
    border-radius: 50%;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
    animation: snake-move 0.2s linear infinite;
}

.food {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
}


.mobile-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 10px 0;
}

.control-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.control-btn:active {
    background-color: rgba(255, 255, 255, 0.4);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%; 
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: rgb(1, 54, 5);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    width: 250px;
    height: 250px; 
    max-width: none;
    max-height: none;
}

.modal-content h2 {
    color: white;
    margin-bottom: 20px;
}

.modal-content p {
    color: white;
    margin-bottom: 20px;
}

#play-again-btn {
    background-color: green;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#play-again-btn:hover {
    background-color: rgb(1, 36, 1);
}

@media screen and (max-width: 600px) {
    .game-header {
        flex-direction: column;
    }

    #userScore,
    #highestScore {
        font-size: 18px;
    }

    #board {
        width: 95vmin;
        height: 95vmin;
    }
}