* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
    background-image: linear-gradient(to bottom right, #f0f0f0, #d0e8d0);
}

.game-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 500px;
    width: 100%;
    position: relative;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #333;
    margin-bottom: 15px;
}

.score-container, .high-score-container {
    font-size: 18px;
    margin: 5px 0;
    color: #555;
}

#score, #highScore {
    font-weight: bold;
    color: #2c8a2c;
}

#gameCanvas {
    display: block;
    background-color: #e8f5e9;
    border: 2px solid #2c8a2c;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

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

button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#startBtn {
    background-color: #4caf50;
    color: white;
}

#startBtn:hover {
    background-color: #388e3c;
}

#resetBtn {
    background-color: #f44336;
    color: white;
}

#resetBtn:hover {
    background-color: #d32f2f;
}

.instructions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.instructions h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #333;
}

.instructions p {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
    line-height: 1.4;
}

/* Game Screens */
.game-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 10;
    padding: 20px;
    text-align: center;
    border-radius: 10px;
}

.game-screen h2 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #2c8a2c;
}

.game-screen p {
    font-size: 16px;
    margin-bottom: 30px;
    color: #555;
    max-width: 80%;
    line-height: 1.5;
}

.action-btn {
    padding: 12px 30px;
    font-size: 18px;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    background-color: #388e3c;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hidden {
    display: none;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
    gap: 10px;
}

.horizontal-controls {
    display: flex;
    gap: 50px;
}

.control-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.control-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
    background-color: #388e3c;
}

@media (max-width: 500px) {
    #gameCanvas {
        width: 100%;
        height: auto;
    }
    
    .game-container {
        padding: 15px;
    }
    
    .mobile-controls {
        display: flex;
    }
    
    .instructions p:first-of-type {
        display: none; /* Hide the keyboard instructions on mobile */
    }
    
    .instructions::before {
        content: "Use the on-screen buttons to control the snake.";
        display: block;
        font-size: 14px;
        color: #666;
        margin-bottom: 5px;
        line-height: 1.4;
    }
}