* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', monospace;
    background: #0a0a0f;
    color: #4ade80;
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 10px;
    background: 
        radial-gradient(ellipse at center, rgba(74, 222, 128, 0.05) 0%, transparent 70%),
        linear-gradient(180deg, #0a0a0f 0%, #0f1419 100%);
}

#header {
    text-align: center;
    margin-bottom: 15px;
}

#header h1 {
    font-size: clamp(1.2rem, 5vw, 2rem);
    text-shadow: 
        0 0 10px rgba(74, 222, 128, 0.8),
        0 0 20px rgba(74, 222, 128, 0.5),
        0 0 40px rgba(74, 222, 128, 0.3);
    animation: glow 2s ease-in-out infinite alternate;
    letter-spacing: 4px;
}

@keyframes glow {
    from {
        text-shadow: 
            0 0 10px rgba(74, 222, 128, 0.8),
            0 0 20px rgba(74, 222, 128, 0.5),
            0 0 40px rgba(74, 222, 128, 0.3);
    }
    to {
        text-shadow: 
            0 0 15px rgba(74, 222, 128, 1),
            0 0 30px rgba(74, 222, 128, 0.7),
            0 0 60px rgba(74, 222, 128, 0.5);
    }
}

#score-panel {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 10px;
    font-size: clamp(0.5rem, 2.5vw, 0.75rem);
}

#current-score {
    color: #fbbf24;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

#high-score {
    color: #ef4444;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

#game-area {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#canvas {
    border: 3px solid #4ade80;
    box-shadow: 
        0 0 20px rgba(74, 222, 128, 0.3),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 15, 0.9);
    border-radius: 4px;
}

#overlay.hidden {
    display: none;
}

.screen {
    text-align: center;
    padding: 20px;
}

.screen.hidden {
    display: none;
}

.snake-logo {
    font-size: 4rem;
    animation: bounce 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.screen h2 {
    font-size: clamp(1rem, 4vw, 1.5rem);
    margin-bottom: 15px;
    color: #ef4444;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.screen p {
    font-size: clamp(0.4rem, 2vw, 0.6rem);
    margin: 10px 0;
    color: #9ca3af;
}

.blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.rainbow {
    background: linear-gradient(90deg, #ef4444, #fbbf24, #4ade80, #3b82f6, #a855f7);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow 2s linear infinite;
    font-size: clamp(0.5rem, 2.5vw, 0.7rem) !important;
}

@keyframes rainbow {
    to { background-position: 200% center; }
}

.high-score-display {
    color: #fbbf24 !important;
    margin-top: 15px !important;
}

#controls {
    margin-top: 15px;
    text-align: center;
}

.control-hint {
    font-size: clamp(0.35rem, 1.5vw, 0.5rem);
    color: #6b7280;
    margin: 5px 0;
}

.key {
    display: inline-block;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 3px;
    padding: 3px 6px;
    margin: 0 2px;
    color: #9ca3af;
    font-size: inherit;
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

footer {
    margin-top: 20px;
    font-size: 0.5rem;
}

footer a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.3s, text-shadow 0.3s;
}

footer a:hover {
    color: #4ade80;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

@media (max-width: 480px) {
    #game-container {
        padding: 5px;
    }
    
    #header {
        margin-bottom: 10px;
    }
    
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
    
    #controls {
        margin-top: 10px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
}