/* SNAKE CYBERPUNK - STYLES */

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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a0a1a 50%, #0a1a1a 100%);
    color: #00ffff;
    overflow: hidden;
    height: 100vh;
    user-select: none;
}

/* SCREEN MANAGEMENT */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    display: none;
}

/* LOADING SCREEN */
#loading {
    background: radial-gradient(circle, #001122 0%, #000000 100%);
}

.loading-container {
    text-align: center;
    animation: pulse 2s infinite;
}

.neon-logo h1 {
    font-size: 4rem;
    color: #00ffff;
    text-shadow: 
        0 0 10px #00ffff,
        0 0 20px #00ffff,
        0 0 30px #00ffff,
        0 0 40px #00ffff;
    margin-bottom: 1rem;
    animation: glitch 3s infinite;
}

.neon-logo h2 {
    font-size: 1.5rem;
    color: #ff00ff;
    text-shadow: 0 0 10px #ff00ff;
    margin-bottom: 2rem;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
    margin: 2rem auto;
}

.loading-progress {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #ff00ff);
    animation: loading 2s infinite;
}

.loading-text {
    color: #888;
    font-size: 1rem;
    margin-top: 1rem;
}

/* MAIN MENU */
#mainMenu {
    background: 
        radial-gradient(circle at 20% 80%, #001122 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, #220011 0%, transparent 50%),
        linear-gradient(135deg, #0a0a0a 0%, #1a0a1a 100%);
}

.menu-container {
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

.neon-title h1 {
    font-size: 3.5rem;
    color: #00ffff;
    text-shadow: 
        0 0 10px #00ffff,
        0 0 20px #00ffff,
        0 0 30px #00ffff;
    margin-bottom: 0.5rem;
    animation: glitch 4s infinite;
}

.subtitle {
    font-size: 1.2rem;
    color: #ff00ff;
    text-shadow: 0 0 10px #ff00ff;
    margin-bottom: 2rem;
}

.character-preview {
    margin: 2rem 0;
}

.character-showcase {
    width: 120px;
    height: 120px;
    border: 2px solid #00ffff;
    border-radius: 10px;
    box-shadow: 
        0 0 20px #00ffff,
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    animation: float 3s ease-in-out infinite;
    image-rendering: pixelated;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

/* NEON BUTTONS */
.neon-btn {
    background: transparent;
    border: 2px solid;
    padding: 1rem 2rem;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.neon-btn.primary {
    border-color: #00ffff;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.neon-btn.primary:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 
        0 0 30px rgba(0, 255, 255, 0.6),
        inset 0 0 30px rgba(0, 255, 255, 0.2);
    transform: translateY(-2px);
}

.neon-btn.secondary {
    border-color: #ff00ff;
    color: #ff00ff;
    text-shadow: 0 0 10px #ff00ff;
    box-shadow: 
        0 0 20px rgba(255, 0, 255, 0.3),
        inset 0 0 20px rgba(255, 0, 255, 0.1);
}

.neon-btn.secondary:hover {
    background: rgba(255, 0, 255, 0.1);
    box-shadow: 
        0 0 30px rgba(255, 0, 255, 0.6),
        inset 0 0 30px rgba(255, 0, 255, 0.2);
    transform: translateY(-2px);
}

.neon-btn.tertiary {
    border-color: #ffff00;
    color: #ffff00;
    text-shadow: 0 0 10px #ffff00;
    box-shadow: 
        0 0 20px rgba(255, 255, 0, 0.3),
        inset 0 0 20px rgba(255, 255, 0, 0.1);
}

.neon-btn.tertiary:hover {
    background: rgba(255, 255, 0, 0.1);
    box-shadow: 
        0 0 30px rgba(255, 255, 0, 0.6),
        inset 0 0 30px rgba(255, 255, 0, 0.2);
    transform: translateY(-2px);
}

/* CHARACTER SELECTION */
#characterSelect {
    background: 
        radial-gradient(circle at 30% 70%, #001122 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, #220011 0%, transparent 50%),
        linear-gradient(135deg, #0a0a0a 0%, #1a0a1a 100%);
}

.character-select-container {
    max-width: 900px;
    padding: 2rem;
    text-align: center;
}

.section-title {
    font-size: 2.5rem;
    color: #00ffff;
    text-shadow: 0 0 20px #00ffff;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.character-option {
    cursor: pointer;
    transition: all 0.3s ease;
}

.character-card {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #333;
    border-radius: 15px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.character-option.selected .character-card {
    border-color: #00ffff;
    box-shadow: 
        0 0 30px rgba(0, 255, 255, 0.5),
        inset 0 0 30px rgba(0, 255, 255, 0.1);
    transform: scale(1.05);
}

.character-card img {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    image-rendering: pixelated;
}

.character-option.selected .character-card img {
    border-color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.character-card h3 {
    font-size: 1.5rem;
    color: #00ffff;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px #00ffff;
}

.character-card p {
    color: #ff00ff;
    margin-bottom: 1rem;
    font-style: italic;
}

.stats {
    text-align: left;
    font-size: 0.9rem;
}

.stat {
    color: #ffff00;
    margin-bottom: 0.3rem;
}

.character-buttons {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

/* INSTRUCTIONS */
#instructionsScreen {
    background: 
        radial-gradient(circle at 50% 50%, #001122 0%, transparent 70%),
        linear-gradient(135deg, #0a0a0a 0%, #1a0a1a 100%);
}

.instructions-container {
    max-width: 800px;
    padding: 2rem;
    text-align: center;
}

.instructions-content {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
    text-align: left;
}

.instruction-block {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #333;
    border-radius: 10px;
    padding: 1.5rem;
    border-left: 4px solid #00ffff;
}

.instruction-block h3 {
    color: #00ffff;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px #00ffff;
}

.controls-grid, .powerups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.control-item, .powerup-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    background: rgba(0, 255, 255, 0.1);
    border-radius: 5px;
}

.key, .powerup-icon {
    background: #00ffff;
    color: #000;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}

.powerup-icon {
    background: #ffff00;
    min-width: 40px;
    font-size: 1.2rem;
}

/* GAME SCREEN */
#gameScreen {
    background: #000;
    flex-direction: column;
    padding: 0;
}

.game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.game-hud {
    background: linear-gradient(90deg, #001122, #220011);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #00ffff;
    box-shadow: 0 2px 20px rgba(0, 255, 255, 0.3);
    min-height: 60px;
}

.hud-left, .hud-right {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.hud-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.stat-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-label {
    color: #888;
    font-size: 0.9rem;
}

.stat-value {
    color: #00ffff;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 0 10px #00ffff;
}

.active-effects {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.effect-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    animation: pulse 1s infinite;
}

.effect-speed { background: rgba(0, 255, 255, 0.3); color: #00ffff; }
.effect-shield { background: rgba(255, 255, 0, 0.3); color: #ffff00; }
.effect-ghost { background: rgba(255, 0, 255, 0.3); color: #ff00ff; }
.effect-slow { background: rgba(128, 0, 255, 0.3); color: #8000ff; }
.effect-multiplier { background: rgba(255, 165, 0, 0.3); color: #ffa500; }

.hud-btn {
    background: transparent;
    border: 2px solid #ff00ff;
    color: #ff00ff;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.hud-btn:hover {
    background: rgba(255, 0, 255, 0.2);
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
}

.game-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: 
        radial-gradient(circle at 25% 25%, #001122 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, #220011 0%, transparent 50%),
        #0a0a0a;
    padding: 1rem;
}

#gameCanvas {
    border: 2px solid #00ffff;
    box-shadow: 
        0 0 30px rgba(0, 255, 255, 0.3),
        inset 0 0 30px rgba(0, 255, 255, 0.1);
    border-radius: 10px;
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
}

/* TOUCH CONTROLS */
.touch-controls {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
}

.dpad {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px);
    gap: 5px;
}

.dpad-btn {
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #00ffff;
    color: #00ffff;
    font-size: 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.dpad-btn:active {
    background: rgba(0, 255, 255, 0.5);
    transform: scale(0.95);
}

.dpad-btn.up { grid-column: 2; grid-row: 1; }
.dpad-btn.left { grid-column: 1; grid-row: 2; }
.dpad-btn.center { grid-column: 2; grid-row: 2; opacity: 0; pointer-events: none; }
.dpad-btn.right { grid-column: 3; grid-row: 2; }
.dpad-btn.down { grid-column: 2; grid-row: 3; }

/* PAUSE SCREEN */
#pauseScreen {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.pause-container {
    text-align: center;
    padding: 2rem;
    background: rgba(0, 20, 40, 0.9);
    border: 2px solid #00ffff;
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.3);
}

.pause-title {
    font-size: 2.5rem;
    color: #00ffff;
    text-shadow: 0 0 20px #00ffff;
    margin-bottom: 2rem;
}

.pause-buttons {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

/* GAME OVER */
#gameOverScreen {
    background: 
        radial-gradient(circle at 50% 50%, #220000 0%, transparent 70%),
        rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.gameover-container {
    text-align: center;
    padding: 2rem;
    background: rgba(40, 0, 0, 0.9);
    border: 2px solid #ff0000;
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.3);
}

.gameover-title {
    font-size: 2.5rem;
    color: #ff0000;
    text-shadow: 0 0 20px #ff0000;
    margin-bottom: 2rem;
}

.final-stats {
    margin: 2rem 0;
    font-size: 1.2rem;
}

.final-stats p {
    margin: 0.5rem 0;
    color: #ffff00;
}

.gameover-buttons {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

/* ANIMATIONS */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes glitch {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-2px) skewX(-1deg); }
    20% { transform: translateX(2px) skewX(1deg); }
    30% { transform: translateX(-1px) skewX(-0.5deg); }
    40% { transform: translateX(1px) skewX(0.5deg); }
    50% { transform: translateX(0); }
}

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

/* RESPONSIVE */
@media (max-width: 768px) {
    .neon-title h1 {
        font-size: 2.5rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .characters-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .character-buttons, .pause-buttons, .gameover-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .touch-controls {
        display: flex;
    }
    
    .game-hud {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .hud-left, .hud-right {
        gap: 1rem;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
    }
    
    .dpad {
        grid-template-columns: repeat(3, 50px);
        grid-template-rows: repeat(3, 50px);
    }
}

@media (max-width: 480px) {
    .menu-container, .character-select-container, .instructions-container {
        padding: 1rem;
    }
    
    .neon-title h1 {
        font-size: 2rem;
    }
    
    .character-showcase {
        width: 80px;
        height: 80px;
    }
    
    .touch-controls {
        bottom: 1rem;
    }
}

