* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Courier New', monospace;
    background: #000;
    color: #0ff;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.screen.active {
    display: flex;
}

.screen.overlay {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

/* Canvas */
#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #000;
}

/* Menu Content */
.menu-content {
    text-align: center;
    padding: 20px;
    max-width: 600px;
    width: 90%;
}

.game-title {
    font-size: 4rem;
    font-weight: bold;
    color: #0ff;
    text-shadow:
        0 0 10px #0ff,
        0 0 20px #0ff,
        0 0 30px #0ff,
        0 0 40px #00f,
        0 0 70px #00f,
        0 0 80px #00f,
        0 0 100px #00f;
    margin-bottom: 2rem;
    animation: pulse 2s ease-in-out infinite;
    letter-spacing: 0.2em;
}

@keyframes pulse {
    0%, 100% {
        text-shadow:
            0 0 10px #0ff,
            0 0 20px #0ff,
            0 0 30px #0ff,
            0 0 40px #00f,
            0 0 70px #00f;
    }
    50% {
        text-shadow:
            0 0 20px #0ff,
            0 0 30px #0ff,
            0 0 40px #0ff,
            0 0 50px #00f,
            0 0 80px #00f,
            0 0 100px #00f;
    }
}

.screen-title {
    font-size: 2.5rem;
    color: #0ff;
    text-shadow: 0 0 10px #0ff, 0 0 20px #0ff, 0 0 30px #00f;
    margin-bottom: 2rem;
    letter-spacing: 0.2em;
}

.game-over-title {
    color: #f0f;
    text-shadow: 0 0 10px #f0f, 0 0 20px #f0f, 0 0 30px #f0f;
    animation: flicker 0.5s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.menu-btn {
    background: transparent;
    border: 2px solid #0ff;
    color: #0ff;
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    padding: 1rem 2rem;
    cursor: pointer;
    text-shadow: 0 0 5px #0ff;
    box-shadow: 0 0 10px #0ff, inset 0 0 10px rgba(0, 255, 255, 0.1);
    transition: all 0.3s;
    letter-spacing: 0.1em;
}

.menu-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 20px #0ff, inset 0 0 20px rgba(0, 255, 255, 0.2);
    transform: scale(1.05);
}

.menu-btn:active {
    transform: scale(0.95);
}

/* High Score Display */
.high-score-display {
    font-size: 1.2rem;
    color: #ff0;
    text-shadow: 0 0 10px #ff0;
}

/* Instructions */
.instructions {
    text-align: left;
    margin: 2rem 0;
    max-height: 60vh;
    overflow-y: auto;
}

.control-section {
    margin-bottom: 2rem;
}

.control-section h3 {
    color: #f0f;
    text-shadow: 0 0 10px #f0f;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    letter-spacing: 0.1em;
}

.control-section p {
    color: #0ff;
    margin: 0.5rem 0;
    font-size: 1.1rem;
    text-shadow: 0 0 5px #0ff;
}

/* HUD */
#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 1.2rem;
    color: #0ff;
    text-shadow: 0 0 10px #0ff;
    z-index: 100;
    pointer-events: none;
}

#hud > div {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border: 1px solid #0ff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    letter-spacing: 0.1em;
}

/* Final Stats */
.final-stats {
    margin: 2rem 0;
    font-size: 1.5rem;
}

.final-stats p {
    margin: 1rem 0;
    color: #0ff;
    text-shadow: 0 0 10px #0ff;
}

.new-high-score {
    color: #ff0 !important;
    text-shadow: 0 0 20px #ff0 !important;
    font-size: 1.8rem !important;
    animation: pulse 1s ease-in-out infinite;
    display: none;
}

.new-high-score.show {
    display: block;
}

/* Mobile Controls */
#mobileControls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: none;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
}

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

.center-controls {
    flex-direction: column;
    align-items: center;
}

.touch-btn {
    width: 70px;
    height: 70px;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #0ff;
    border-radius: 50%;
    color: #0ff;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    transition: all 0.1s;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.touch-btn.small {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
}

.touch-btn.fire {
    width: 80px;
    height: 80px;
    font-size: 2rem;
    color: #f0f;
    border-color: #f0f;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.5);
}

.touch-btn:active {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.8);
    transform: scale(0.95);
}

.touch-btn.fire:active {
    background: rgba(255, 0, 255, 0.3);
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.8);
}

/* Loading */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.5s;
}

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

.loading-text {
    font-size: 2rem;
    color: #0ff;
    text-shadow: 0 0 10px #0ff, 0 0 20px #0ff;
    animation: pulse 1s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }

    .screen-title {
        font-size: 1.8rem;
    }

    .menu-btn {
        font-size: 1.2rem;
        padding: 0.8rem 1.5rem;
    }

    #hud {
        font-size: 0.9rem;
        gap: 10px;
    }

    #hud > div {
        padding: 5px 10px;
    }

    #mobileControls {
        display: flex;
    }

    .control-section p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2rem;
    }

    .touch-btn {
        width: 60px;
        height: 60px;
        font-size: 1.2rem;
    }

    .touch-btn.fire {
        width: 70px;
        height: 70px;
    }

    .touch-btn.small {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
}

/* Landscape mode adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .game-title {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .menu-buttons {
        margin-bottom: 1rem;
    }

    .menu-btn {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
}

/* Hide scrollbar but keep functionality */
.instructions::-webkit-scrollbar {
    width: 5px;
}

.instructions::-webkit-scrollbar-track {
    background: rgba(0, 255, 255, 0.1);
}

.instructions::-webkit-scrollbar-thumb {
    background: #0ff;
    box-shadow: 0 0 5px #0ff;
}
