@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;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #3A506B;
    color: #FFFFFF;
}

.wrapper {
    width: 65vmin;
    height: 70vmin;
    display: flex;
    overflow: hidden;
    flex-direction: column;
    border-radius: 5px;
    background: #293447;
    margin-bottom: 20px;
}

.game-details {
    color: #B8C6DC;
    font-size: 1.2rem;
    font-weight: 500;
    padding: 20px 27px;
    display: flex;
    justify-content: space-between;
}

.play-board {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template: repeat(30, 1fr) / repeat(30, 1fr);
    background: #212837;
}

.play-board .food {
    background: #FF003D;
}

.play-board .head {
    background: #60CBFF;
}

.controls {
    display: none;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.controls .dpad {
    display: grid;
    grid-template-areas:
        ". up ."
        "left center right"
        ". down .";
    gap: 10px;
    padding: 20px;
    background: #2C3E50;
    border-radius: 10px;
    margin-top: 10px;
}

.controls .dpad i {
    color: #FFF;
    background: #34495E;
    padding: 15px;
    border-radius: 5px;
    font-size: 2rem;
    cursor: pointer;
    text-align: center;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.controls .dpad .up { grid-area: up; }
.controls .dpad .down { grid-area: down; }
.controls .dpad .left { grid-area: left; }
.controls .dpad .right { grid-area: right; }
.controls .dpad .center { grid-area: center; width: 60px; height: 60px; }

.controls .dpad i:hover {
    background: #1ABC9C;
}

@media screen and (max-width: 800px) {
    .wrapper {
        width: 90vmin;
        height: 100vmin;
    }
    .game-details {
        font-size: 1rem;
        padding: 15px 27px;
    }
    .controls {
        display: flex;
    }
    .controls .dpad i {
        padding: 10px;
        font-size: 1.5rem;
    }
}

.modal {
    display: none; 
    position: fixed; 
    z-index: 1; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.4); 
}

.modal-content {
    background-color: #293447;
    margin: 15% auto; 
    padding: 20px;
    border: 1px solid #666;
    width: 50%; 
    text-align: center;
    color: #B8C6DC;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.difficulty-button {
    padding: 10px 20px;
    margin: 10px;
    cursor: pointer;
    color: #FFFFFF;
    border: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.difficulty-button.easy { background-color: #4CAF50; }
.difficulty-button.medium { background-color: #2196F3; }
.difficulty-button.hard { background-color: #FF9800; }
.difficulty-button.expert { background-color: #F44336; }

.difficulty-button:hover {
    opacity: 0.8;
}

#playAgainButton {
    background-color: #4CAF50;
    color: white;
}

#changeDifficultyButton {
    background-color: #2196F3;
    color: white;
}

#playAgainButton, #changeDifficultyButton {
    padding: 10px 20px;
    margin: 10px 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
}

#playAgainButton:hover, #changeDifficultyButton:hover {
    opacity: 0.8;
    transform: scale(1.05);
}