* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #1a1a2e, #16213e);
            color: white;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            /* overflow: hidden; */
            overflow: auto; /* Change from hidden to auto */
            padding: 20px 0; /* Add some padding */
            justify-content: flex-start; /* Change from center to flex-start */
        }

        .header {
            text-align: center;
            margin-bottom: 20px;
        }

        .header h1 {
            font-size: 3.5rem;
            margin-bottom: 10px;
            color: #ff9e44;
            text-shadow: 0 0 10px #ff00ff, 0 0 20px #00ffff;
            font-family: 'Monoton', cursive;
            letter-spacing: 3px;
        }

        .header p {
            font-size: 1.2rem;
            color: #ccc;
            max-width: 600px;
            margin: 0 auto;
        }

        .difficulty-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 100;
        }

        .difficulty-content {
            background: linear-gradient(135deg, #2c3e50, #4a235a);
            padding: 2rem;
            border-radius: 15px;
            text-align: center;
            box-shadow: 0 0 30px rgba(255, 0, 123, 0.4);
            max-width: 500px;
            width: 90%;
        }

        .difficulty-content h2 {
            font-size: 2.5rem;
            margin-bottom: 1.5rem;
            color: #fff;
            text-shadow: 0 0 10px #ff00ff, 0 0 20px #00ffff;
        }

        .difficulty-options {
            display: flex;
            flex-direction: column;
            gap: 1rem;
            margin-bottom: 1.5rem;
        }

        .difficulty-btn {
            padding: 1rem;
            font-size: 1.2rem;
            background: linear-gradient(135deg, #3498db, #8e44ad);
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-family: 'Orbitron', sans-serif;
        }

        .difficulty-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
        }

        .game-info {
            margin-top: 1rem;
            font-size: 1rem;
            color: #ccc;
        }

        .container {
            /* Using a background pattern instead of external image for simplicity */
            background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23333333' fill-opacity='0.4'%3E%3Cpath d='M0 38.59l2.83-2.83 1.41 1.41L1.41 40H0v-1.41zM0 1.4l2.83 2.83 1.41-1.41L1.41 0H0v1.41zM38.59 40l-2.83-2.83 1.41-1.41L40 38.59V40h-1.41zM40 1.41l-2.83 2.83-1.41-1.41L38.59 0H40v1.41zM20 18.6l2.83-2.83 1.41 1.41L21.41 20l2.83 2.83-1.41 1.41L20 21.41l-2.83 2.83-1.41-1.41L18.59 20l-2.83-2.83 1.41-1.41L20 18.59z'/%3E%3C/g%3E%3C/svg%3E");
            /* min-height: 70vh; */
            background-size: 100vw 100vh;
            background-repeat: no-repeat;
            display: flex;
            justify-content: center;
            align-items: center;
            position: relative;
            /* margin-bottom: 30px; */
            min-height: auto; /* Remove fixed min-height */
            margin: 20px 0; /* Add margin */
        }

        #board {
            background: linear-gradient(rgb(0, 17, 255), rgb(255, 0, 123));
            width: 80vmin;
            height: 80vmin;
            max-width: 600px;
            max-height: 600px;
            border: 2px solid white;
            display: grid;
            grid-template-rows: repeat(18, 1fr);
            grid-template-columns: repeat(18, 1fr);
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
        }

        #scoreBox {
            position: absolute;
            top: 10px;
            right: 10px;
            font-size: 30px;
            font-weight: bold;
            color: white;
            font-size: 2.5rem;
            color: #ffffff;
            text-shadow: 0 0 10px #ff00ff, 0 0 20px #00ffff, 0 0 30px #ff00ff;
        }

        #highscoreBox {
            position: absolute;
            top: 70px;
            right: 8px;
            font-size: 30px;
            font-weight: bold;
            color: white;
            font-size: 2.5rem;
            color: #1fff44;
            text-shadow: 0 0 10px #ff00ff, 0 0 20px #00ffff, 0 0 30px #ff00ff;
        }

        .head {
            background: linear-gradient(135deg, #ffea00, #ff5f1f);
            border: .25vmin solid rgb(73, 0, 95);
            border-radius: 12px;
            transform: scale(1.02);
        }

        .snake {
            background: linear-gradient(135deg, #00ff99, #00ccff);
            border: .25vmin solid white;
            border-radius: 50%;
        }

        .food {
            background: linear-gradient(orange, green);
            border: .25vmin solid black;
            border-radius: 12px;
        }

        .game-over-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: none;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 100;
        }

        .game-over-content {
            background: linear-gradient(135deg, #2c3e50, #4a235a);
            padding: 2rem;
            border-radius: 15px;
            text-align: center;
            box-shadow: 0 0 20px rgba(255, 0, 123, 0.5);
            max-width: 500px;
            width: 90%;
        }

        .game-over-content h2 {
            font-size: 2.5rem;
            margin-bottom: 1rem;
            color: #ff5f1f;
            text-shadow: 0 0 10px #ff00ff;
        }

        .game-over-content p {
            font-size: 1.5rem;
            margin-bottom: 1.5rem;
            color: #fff;
        }

        .game-over-buttons {
            display: flex;
            justify-content: center;
            gap: 1rem;
        }

        .game-over-btn {
            padding: 0.8rem 1.5rem;
            font-size: 1.2rem;
            background: linear-gradient(135deg, #3498db, #8e44ad);
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-family: 'Orbitron', sans-serif;
        }

        .game-over-btn:hover {
            transform: scale(1.05);
            box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
        }

        .game-over-btn.cancel {
            background: linear-gradient(135deg, #e74c3c, #c0392b);
        }

        .pause-btn {
            position: absolute;
            top: 10px;
            left: 10px;
            padding: 0.5rem 1rem;
            font-size: 1rem;
            background: linear-gradient(135deg, #3498db, #8e44ad);
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-family: 'Orbitron', sans-serif;
        }

        .controls {
            margin-top: 20px;
            text-align: center;
            color: #ccc;
            font-size: 1.1rem;
        }

        .controls kbd {
            background: #333;
            padding: 2px 8px;
            border-radius: 4px;
            font-family: monospace;
        }

        .footer {
            /* margin-top: 30px; */
            color: #777;
            text-align: center;
            font-size: 0.9rem;
            margin: 20px 0;
            padding: 0 15px;
            width: 100%;
        }

        /* Mobile Responsiveness */
@media screen and (max-width: 768px) {
    .header h1 {
        font-size: 2.5rem;
    }
    
    .header p {
        font-size: 1rem;
        padding: 0 15px;
    }
    
    .difficulty-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    .difficulty-content h2 {
        font-size: 2rem;
    }
    
    .container {
        width: 100%;
        min-height: 60vh;
    }
    
    #board {
        width: 95vmin;
        height: 95vmin;
    }
    
    #scoreBox, #highscoreBox {
        font-size: 1.8rem;
        top: 5px;
        right: 5px;
    }
    
    #highscoreBox {
        top: 45px;
    }
    
    .pause-btn {
        top: 5px;
        left: 5px;
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .controls {
        font-size: 0.9rem;
        padding: 0 15px;
    }
    
    .footer {
        font-size: 0.8rem;
        padding: 0 15px;
    }
    
    /* Touch controls for mobile */
    .touch-controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 20px;
        width: 100%;
    }
    
    .touch-row {
        display: flex;
        justify-content: center;
        width: 100%;
        margin-bottom: 10px;
    }
    
    .touch-btn {
        width: 60px;
        height: 60px;
        background: linear-gradient(135deg, #3498db, #8e44ad);
        border-radius: 50%;
        margin: 0 10px;
        display: flex;
        justify-content: center;
        align-items: center;
        color: white;
        font-size: 24px;
        font-weight: bold;
        user-select: none;
        opacity: 0.7;
    }
    .touch-btn:active {
    transform: scale(0.9);
    opacity: 1;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 100vh;
    justify-content: space-between;
    padding: 20px 0;
}

/* Prevent scrolling on the game container */
.container:focus {
    outline: none;
}

/* Ensure the body doesn't scroll when game is active */
body.game-active {
    overflow: hidden;
}

@media screen and (max-width: 480px) {
    .header h1 {
        font-size: 2rem;
    }
    
    #scoreBox, #highscoreBox {
        font-size: 1.5rem;
    }
    
    .touch-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Add touch controls container (you'll need to add this HTML) */
.touch-controls {
    display: none;
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
    .touch-controls {
        display: flex;
    }
    
    .controls {
        display: none;
    }
}

/* Add media query for very small screens */
@media screen and (max-height: 700px) {
    .header {
        margin-bottom: 10px;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
    
    .container {
        margin: 10px 0;
    }
}

