/* Snake Specific Styles */

body {
    touch-action: pan-y;
    /* Allow vertical scrolling on the page */
}

.container {
    padding-top: 10px;
    /* Reduce top padding from 24px */
}

.neon-title {
    margin-top: 0;
    margin-bottom: 10px;
    /* Reduce from 40px */
}

.game-container {
    position: relative;
    margin: 0 auto 20px;
    /* Reduce top margin from 20px */
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    width: min(500px, 90vw);
    /* Removed touch-action: none to allow scrolling past the container */
}

.game-header {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
}

.score-box {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary);
}

#game-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 1/1;
    background: #000;
    touch-action: none;
    /* Keep canvas isolated to prevent swipe/zoom issues */
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    font-family: 'Press Start 2P', monospace;
}

.overlay-content p {
    margin-bottom: 25px;
    letter-spacing: 2px;
}

.controls-hint {
    margin-top: 25px;
    font-size: 0.6rem;
    color: var(--text-dim);
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    /* Hidden by default, shown on mobile via JS or media query */
    flex-direction: column;
    align-items: center;
    margin-top: 30px;
    gap: 10px;
}

.control-row {
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Allow scrolling and standard gestures, but avoid double-tap zoom if possible */
}

.control-btn:active {
    background: var(--primary);
    color: #000;
    transform: scale(0.95);
    box-shadow: 0 0 20px var(--primary);
}

.spacer {
    width: 60px;
}

@media (max-width: 768px) {
    .mobile-controls {
        display: flex;
    }
}

@media (max-height: 800px) and (max-width: 600px) {
    .game-container {
        margin: 5px auto;
    }

    .neon-title {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }

    .mobile-controls {
        margin-top: 15px;
    }

    .control-btn {
        width: 50px;
        height: 50px;
    }

    .spacer {
        width: 50px;
    }
}