/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(45deg, #0a0a0a, #1a0a1a, #0a1a1a, #1a1a0a);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    color: #00ffff;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Animated gradient background */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Game container */
#gameContainer {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Logo */
#logoContainer {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 15;
}

#logo {
    width: 80px;
    height: auto;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.5));
}

#logo:hover {
    opacity: 1;
    filter: drop-shadow(0 0 15px rgba(0, 255, 255, 0.8));
}

/* Game UI */
#gameUI {
    position: absolute;
    top: 20px;
    width: 100%;
    z-index: 10;
    text-align: center;
}

#gameTitle {
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 
        0 0 10px #ff00ff,
        0 0 20px #ff00ff,
        0 0 30px #ff00ff,
        0 0 40px #ff00ff;
    animation: titlePulse 2s ease-in-out infinite alternate;
    margin-bottom: 20px;
}

@keyframes titlePulse {
    from { 
        text-shadow: 
            0 0 10px #ff00ff,
            0 0 20px #ff00ff,
            0 0 30px #ff00ff,
            0 0 40px #ff00ff;
    }
    to { 
        text-shadow: 
            0 0 5px #ff00ff,
            0 0 10px #ff00ff,
            0 0 15px #ff00ff,
            0 0 20px #ff00ff;
    }
}

#scoreDisplay {
    display: flex;
    justify-content: space-between;
    max-width: 400px;
    margin: 0 auto;
    font-size: 1.2rem;
}

#currentScore, #highScore {
    text-shadow: 
        0 0 5px #00ffff,
        0 0 10px #00ffff;
}

/* Game canvas */
#gameCanvas {
    border: 2px solid #00ffff;
    border-radius: 10px;
    box-shadow: 
        0 0 20px #00ffff,
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    max-width: 100%;
    height: auto;
}

/* Game screens */
#gameOverScreen, #startScreen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #ff00ff;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 
        0 0 30px #ff00ff,
        inset 0 0 20px rgba(255, 0, 255, 0.1);
    z-index: 20;
}

#gameOverScreen h2, #startScreen h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 
        0 0 10px #ff00ff,
        0 0 20px #ff00ff;
    animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
    from { 
        text-shadow: 
            0 0 10px #ff00ff,
            0 0 20px #ff00ff;
    }
    to { 
        text-shadow: 
            0 0 5px #ff00ff,
            0 0 15px #ff00ff,
            0 0 25px #ff00ff;
    }
}

#gameOverScreen p, #startScreen p {
    margin: 10px 0;
    font-size: 1.1rem;
    text-shadow: 0 0 5px #00ffff;
}

#newHighScore {
    color: #ffff00;
    font-weight: bold;
    text-shadow: 
        0 0 10px #ffff00,
        0 0 20px #ffff00;
    animation: highScorePulse 1s ease-in-out infinite;
}

@keyframes highScorePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Buttons */
#restartButton {
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    border: none;
    color: #000;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    margin: 20px 0;
    box-shadow: 
        0 0 20px #ff00ff,
        0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
}

#restartButton:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 0 30px #ff00ff,
        0 6px 12px rgba(0, 0, 0, 0.4);
}

#restartButton:active {
    transform: translateY(0);
}

/* Instructions and controls */
#instructions, #startInstructions {
    font-size: 0.9rem;
    opacity: 0.8;
    animation: instructionBlink 3s ease-in-out infinite;
}

@keyframes instructionBlink {
    0%, 50%, 100% { opacity: 0.8; }
    25%, 75% { opacity: 0.4; }
}

#controls {
    margin-top: 15px;
    font-size: 0.8rem;
    opacity: 0.6;
}

#controls p {
    margin: 5px 0;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 850px) {
    #gameContainer {
        padding: 10px;
    }
    
    #logo {
        width: 60px;
    }
    
    #gameTitle {
        font-size: 2rem;
    }
    
    #scoreDisplay {
        flex-direction: column;
        gap: 10px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 100vw;
        height: auto;
    }
    
    #gameOverScreen, #startScreen {
        width: 90%;
        max-width: 400px;
        padding: 20px;
    }
    
    #gameOverScreen h2, #startScreen h2 {
        font-size: 1.8rem;
    }
}

@media (max-height: 600px) {
    #gameTitle {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    #scoreDisplay {
        font-size: 1rem;
    }
    
    #gameCanvas {
        height: 60vh;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    #restartButton {
        padding: 20px 40px;
        font-size: 1.3rem;
    }
    
    #gameCanvas {
        touch-action: none;
    }
}
