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

body {
    overflow: hidden;
    font-family: 'Arial', sans-serif;
    background: #000;
    height: 100vh;
}

.cosmic-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at center, #1a0033 0%, #000000 70%);
    overflow: hidden;
    touch-action: none; /* Prevent browser zooming/scrolling */
}

/* Joystick Visuals */
.joystick-base {
    position: fixed;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    backdrop-filter: blur(5px);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
    opacity: 0;
    transition: opacity 0.2s;
}

.joystick-base.active {
    opacity: 1;
}

.joystick-stick {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle at 30% 30%, #fff, #ccc);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 
        0 0 10px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 255, 255, 0.5);
}

/* Starfield Background */
.starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 40px 70px, white, transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(1px 1px at 130px 80px, white, transparent),
        radial-gradient(2px 2px at 160px 30px, white, transparent),
        radial-gradient(1px 1px at 200px 90px, white, transparent),
        radial-gradient(2px 2px at 240px 50px, white, transparent),
        radial-gradient(1px 1px at 280px 10px, white, transparent),
        radial-gradient(1px 1px at 320px 70px, white, transparent),
        radial-gradient(2px 2px at 360px 40px, white, transparent);
    background-repeat: repeat;
    background-size: 400px 200px;
    opacity: 0.8;
}

/* Nebula Effects */
.nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    animation: nebulaFloat 30s ease-in-out infinite alternate;
    will-change: transform;
}

.nebula-1 {
    width: 300px;
    height: 200px;
    background: radial-gradient(circle, #ff00ff, transparent);
    top: 20%;
    left: -100px;
    animation-delay: 0s;
}

.nebula-2 {
    width: 250px;
    height: 150px;
    background: radial-gradient(circle, #00ffff, transparent);
    top: 60%;
    left: 70%;
    animation-delay: -10s;
}

.nebula-3 {
    width: 400px;
    height: 300px;
    background: radial-gradient(circle, #9900ff, transparent);
    top: 10%;
    left: 40%;
    animation-delay: -20s;
}

@keyframes nebulaFloat {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 30px) scale(1.1); }
}

/* Modern UFO Styling */
.ufo {
    position: absolute;
    left: 50px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.2));
    will-change: transform;
}

.ufo-body {
    position: relative;
    width: 36px;
    height: 14px;
    background: linear-gradient(135deg,
        #f8f9fa 0%,
        #e9ecef 20%,
        #ced4da 40%,
        #adb5bd 60%,
        #6c757d 80%,
        #495057 100%);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 0 16px rgba(255, 255, 255, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 -2px 6px rgba(0, 0, 0, 0.1),
        inset 0 2px 6px rgba(255, 255, 255, 0.4);
    animation: ufoHover 4s ease-in-out infinite alternate;
}

@keyframes ufoHover {
    0% { transform: translateY(0px) rotate(0deg); }
    100% { transform: translateY(-3px) rotate(1deg); }
}

.ufo-dome {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 12px;
    background: linear-gradient(135deg,
        rgba(0, 255, 255, 0.9) 0%,
        rgba(0, 200, 255, 0.7) 50%,
        rgba(0, 150, 255, 0.5) 100%);
    border-radius: 50%;
    box-shadow:
        0 0 12px rgba(0, 200, 255, 0.6),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.5);
    animation: domeGlow 2s ease-in-out infinite alternate;
}

@keyframes domeGlow {
    0% {
        box-shadow:
            0 0 12px rgba(0, 200, 255, 0.6),
            inset 0 -2px 4px rgba(0, 0, 0, 0.3),
            inset 0 2px 4px rgba(255, 255, 255, 0.5);
    }
    100% {
        box-shadow:
            0 0 20px rgba(0, 255, 255, 0.8),
            inset 0 -2px 4px rgba(0, 0, 0, 0.3),
            inset 0 2px 4px rgba(255, 255, 255, 0.7);
    }
}

.ufo-lights {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}

.light {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    animation: ufoLights 1.5s ease-in-out infinite alternate;
}

.light-1 {
    left: 8px;
    background: #ff0080;
    box-shadow: 0 0 6px #ff0080;
    animation-delay: 0s;
}

.light-2 {
    left: 18px;
    background: #00ff80;
    box-shadow: 0 0 6px #00ff80;
    animation-delay: 0.3s;
}

.light-3 {
    left: 28px;
    background: #8000ff;
    box-shadow: 0 0 6px #8000ff;
    animation-delay: 0.6s;
}

.light-4 {
    left: 30px;
    background: #ffff00;
    box-shadow: 0 0 6px #ffff00;
    animation-delay: 0.9s;
}

@keyframes ufoLights {
    0% {
        opacity: 0.4;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.ufo-beam {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 40px solid rgba(0, 255, 255, 0.15);
    opacity: 0.8;
    animation: beamPulse 2s ease-in-out infinite alternate;
}

@keyframes beamPulse {
    0% {
        opacity: 0.4;
        border-top-color: rgba(0, 255, 255, 0.1);
    }
    100% {
        opacity: 0.8;
        border-top-color: rgba(0, 255, 255, 0.2);
    }
}

/* Obstacles */
.obstacle {
    position: absolute;
    z-index: 5;
    will-change: transform;
}

.asteroid {
    width: 60px;
    height: 60px;
    background:
        radial-gradient(circle at 30% 30%, #8B4513, #654321, #2F1B14);
    border-radius: 50% 40% 60% 30%;
    box-shadow:
        0 0 10px rgba(139, 69, 19, 0.5),
        inset -10px -10px 0 rgba(0, 0, 0, 0.3);
}

.debris {
    width: 40px;
    height: 25px;
    background: linear-gradient(45deg, #666, #333, #999);
    border-radius: 5px;
    box-shadow:
        0 0 8px rgba(102, 102, 102, 0.4),
        inset -5px -5px 0 rgba(0, 0, 0, 0.4);
}

.rock {
    width: 50px;
    height: 45px;
    background:
        radial-gradient(circle at 40% 40%, #696969, #2F2F2F, #000000);
    border-radius: 60% 30% 70% 40%;
    box-shadow:
        0 0 8px rgba(105, 105, 105, 0.4),
        inset -8px -8px 0 rgba(0, 0, 0, 0.5);
}

/* NEW ENHANCED OBSTACLE TYPES */
.obstacle.spinner {
    background: radial-gradient(circle at center, #ff6600, #cc3300);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(255, 102, 0, 0.6);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.obstacle.plasma {
    background: linear-gradient(45deg, #9900ff, #ff00ff, #9900ff);
    border-radius: 30% 70% 70% 30%;
    box-shadow: 0 0 20px rgba(153, 0, 255, 0.8);
    animation: plasmaGlow 1.5s ease-in-out infinite alternate;
}

@keyframes plasmaGlow {
    0% { box-shadow: 0 0 20px rgba(153, 0, 255, 0.8); }
    100% { box-shadow: 0 0 30px rgba(255, 0, 255, 1); }
}

.obstacle.missile {
    background: linear-gradient(90deg, #ff0000, #cc0000, #ff0000);
    border-radius: 0 50% 50% 0;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
    position: relative;
}

.obstacle.missile::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-right: 8px solid #ff6600;
}

/* Obstacles container */
.obstacles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
}

/* Start Overlay */
.start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.start-content {
    text-align: center;
    color: white;
    font-size: 1.2em;
}

.start-content h1 {
    font-size: 3em;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #ff00ff, #00ffff, #ff00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 2s ease-in-out infinite alternate;
    will-change: transform, filter;
}

@keyframes titleGlow {
    0% { filter: drop-shadow(0 0 10px rgba(255, 0, 255, 0.5)); }
    100% { filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.8)); }
}

.start-content p {
    opacity: 0.8;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
}

.cosmic-cursor {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #00ffff;
    border-radius: 50%;
    animation: cursorFloat 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes cursorFloat {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); box-shadow: 0 0 20px #00ffff; }
}

.start-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease-out;
}

/* NEW ANIMATIONS AND EFFECTS */
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(20px); }
    20% { opacity: 1; transform: translateX(0); }
    80% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(20px); }
}

/* High contrast mode */
.high-contrast {
    filter: contrast(150%) brightness(120%);
}

.high-contrast .ufo {
    filter: contrast(200%) brightness(150%);
}

/* Volume helper animation */
@keyframes volumeFadeInOut {
    0% { opacity: 0; transform: translateX(20px); }
    20% { opacity: 1; transform: translateX(0); }
    80% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(20px); }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Game Controls */
.game-control-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.5rem;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none; /* Hidden by default until JS enables them */
}

.game-control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

#muteButton {
    right: 80px;
}

/* Mobile Optimized Responsive Design */
@media (max-width: 768px) {
    .ufo-body {
        width: 40px;
        height: 16px;
    }

    .ufo-dome {
        width: 20px;
        height: 10px;
        top: -6px;
    }

    .light {
        width: 2px;
        height: 2px;
    }

    .light-1 { left: 6px; }
    .light-2 { left: 14px; }
    .light-3 { left: 22px; }
    .light-4 { left: 30px; }

    .ufo-beam {
        border-left-width: 15px;
        border-right-width: 15px;
        border-top-width: 30px;
    }

    .asteroid {
        width: 45px;
        height: 45px;
    }

    .debris {
        width: 30px;
        height: 20px;
    }

    .rock {
        width: 40px;
        height: 35px;
    }

    .start-content h1 {
        font-size: 2em;
    }

    .start-content {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .ufo-body {
        width: 35px;
        height: 14px;
    }

    .ufo-dome {
        width: 18px;
        height: 9px;
        top: -5px;
    }

    .light {
        width: 1.5px;
        height: 1.5px;
    }

    .light-1 { left: 5px; }
    .light-2 { left: 12px; }
    .light-3 { left: 19px; }
    .light-4 { left: 26px; }

    .ufo-beam {
        border-left-width: 12px;
        border-right-width: 12px;
        border-top-width: 25px;
    }

    .asteroid {
        width: 35px;
        height: 35px;
    }

    .debris {
        width: 25px;
        height: 15px;
    }

    .rock {
        width: 30px;
        height: 25px;
    }

    .start-content h1 {
        font-size: 1.5em;
    }
}

/* Ultra small screens */
@media (max-width: 360px) {
    .ufo-body {
        width: 30px;
        height: 12px;
    }

    .ufo-dome {
        width: 15px;
        height: 7px;
        top: -4px;
    }

    .light {
        width: 1px;
        height: 1px;
    }

    .light-1 { left: 4px; }
    .light-2 { left: 10px; }
    .light-3 { left: 16px; }
    .light-4 { left: 22px; }

    .ufo-beam {
        border-left-width: 10px;
        border-right-width: 10px;
        border-top-width: 20px;
    }

    .asteroid {
        width: 25px;
        height: 25px;
    }

    .debris {
        width: 20px;
        height: 12px;
    }

    .rock {
        width: 22px;
        height: 18px;
    }

    .obstacle.plasma {
        width: 18px;
        height: 35px;
    }

    .obstacle.missile {
        width: 30px;
        height: 8px;
    }

    .obstacle.spinner {
        width: 20px;
        height: 20px;
    }

    .start-content h1 {
        font-size: 1.2em;
    }

    .start-content {
        font-size: 0.9em;
    }
}

/* Power-up Styles */
.obstacle.powerup-shield {
    background: radial-gradient(circle, #00ffff, #0088ff);
    box-shadow: 0 0 15px #00ffff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: pulse 1s infinite alternate;
}

.obstacle.powerup-boost {
    background: radial-gradient(circle, #ff00ff, #8800ff);
    box-shadow: 0 0 15px #ff00ff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: pulse 1s infinite alternate;
}

/* Shield Effect on UFO */
.ufo.shield-active .ufo-body {
    box-shadow: 0 0 20px 5px #00ffff;
    border-color: #00ffff;
}
