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

:root {
    --neon-cyan: #00ffff;
    --neon-magenta: #ff00ff;
    --neon-green: #00ff00;
    --neon-orange: #ff9500;
    --neon-red: #ff0040;
    --bg-void: #000000;
    --bg-dark: #0a0a0a;
    --text-glow: 0 0 10px currentColor;
}

body {
    font-family: 'Orbitron', sans-serif;
    background: var(--bg-void);
    color: var(--neon-cyan);
    overflow-x: hidden;
    cursor: crosshair;
}

/* Starfield Background */
.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    z-index: 0;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Scanlines effect */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 255, 255, 0.03) 0px,
        transparent 1px,
        transparent 2px,
        rgba(0, 255, 255, 0.03) 3px
    );
    pointer-events: none;
    z-index: 999;
    animation: scanline-move 8s linear infinite;
}

@keyframes scanline-move {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

/* Game Container */
.game-container {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 10;
}

/* Glitch Title */
.game-logo {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(1.5rem, 5vw, 3rem);
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    animation: glitch-title 5s infinite;
}

@keyframes glitch-title {
    0%, 90%, 100% {
        text-shadow: 
            0 0 10px var(--neon-cyan),
            0 0 20px var(--neon-cyan),
            0 0 30px var(--neon-cyan);
    }
    92% {
        text-shadow: 
            -2px 0 var(--neon-magenta),
            2px 0 var(--neon-cyan);
        transform: skew(-0.5deg);
    }
    94% {
        text-shadow: 
            2px 0 var(--neon-magenta),
            -2px 0 var(--neon-cyan);
        transform: skew(0.5deg);
    }
}

.subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--neon-green);
    text-shadow: var(--text-glow);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Story Terminal */
.story-terminal {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--neon-cyan);
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    padding: 2rem;
    max-width: 800px;
    margin-bottom: 3rem;
    font-family: 'Share Tech Mono', monospace;
    position: relative;
}

.story-terminal::before {
    content: '> MISSION BRIEFING_';
    position: absolute;
    top: -1.5rem;
    left: 1rem;
    background: var(--bg-void);
    padding: 0.5rem 1rem;
    color: var(--neon-orange);
    font-size: 0.8rem;
    animation: blink-cursor 1s infinite;
}

@keyframes blink-cursor {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.story-text {
    color: var(--neon-green);
    line-height: 1.8;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.story-text.highlight {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

/* Level Selection Grid */
.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    width: 100%;
    margin-bottom: 2rem;
}

.level-card {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(10, 10, 10, 0.8));
    border: 2px solid var(--neon-cyan);
    padding: 2rem;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    text-decoration: none;
    display: block;
}

.level-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(0, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.5s;
}

.level-card:hover::before {
    left: 100%;
}

.level-card:hover {
    border-color: var(--neon-magenta);
    transform: translateY(-10px) scale(1.05);
    box-shadow: 
        0 0 30px rgba(255, 0, 255, 0.4),
        0 10px 50px rgba(0, 255, 255, 0.3);
}

.level-number {
    font-family: 'Press Start 2P', cursive;
    font-size: 3rem;
    color: var(--neon-magenta);
    text-shadow: 
        0 0 10px var(--neon-magenta),
        0 0 20px var(--neon-magenta);
    margin-bottom: 1rem;
    opacity: 0.3;
}

.level-card:hover .level-number {
    opacity: 1;
    animation: number-pulse 0.5s;
}

@keyframes number-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.level-title {
    font-size: 1.3rem;
    color: var(--neon-cyan);
    margin-bottom: 0.5rem;
    text-shadow: var(--text-glow);
}

.level-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    color: var(--neon-green);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.level-description {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.level-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 255, 255, 0.3);
}

.status-badge {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    color: var(--neon-orange);
    text-shadow: 0 0 5px var(--neon-orange);
}

.difficulty {
    display: flex;
    gap: 0.3rem;
}

.difficulty-bar {
    width: 20px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid var(--neon-cyan);
}

.difficulty-bar.active {
    background: var(--neon-magenta);
    box-shadow: 0 0 5px var(--neon-magenta);
}

/* HUD Elements */
.hud {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--neon-orange);
    padding: 1rem;
    font-family: 'Share Tech Mono', monospace;
    z-index: 100;
    box-shadow: 0 0 20px rgba(255, 149, 0, 0.3);
}

.hud-item {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.hud-label {
    color: var(--neon-green);
}

.hud-value {
    color: var(--neon-cyan);
    text-shadow: var(--text-glow);
}

/* Progress Bar */
.progress-container {
    width: 100%;
    max-width: 600px;
    margin-bottom: 2rem;
}

.progress-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    color: var(--neon-orange);
    margin-bottom: 0.5rem;
    text-shadow: var(--text-glow);
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--neon-cyan);
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
    width: 0%;
    animation: progress-load 2s ease-out forwards;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
}

@keyframes progress-load {
    to { width: 85%; }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    color: white;
    text-shadow: 
        0 0 5px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(0, 0, 0, 0.8);
}

/* Start Button */
.start-button, .nav-button {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    padding: 1.5rem 3rem;
    background: transparent;
    color: var(--neon-green);
    border: 3px solid var(--neon-green);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    text-shadow: var(--text-glow);
    margin-top: 2rem;
    text-decoration: none;
    display: inline-block;
}

.start-button::before, .nav-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--neon-green);
    transition: left 0.3s;
    z-index: -1;
}

.start-button:hover::before, .nav-button:hover::before {
    left: 0;
}

.start-button:hover, .nav-button:hover {
    color: black;
    box-shadow: 
        0 0 30px var(--neon-green),
        0 0 60px var(--neon-green);
    transform: scale(1.05);
}

/* Particle System */
.particle-system {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.energy-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--neon-cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--neon-cyan);
    animation: float-particle 10s infinite;
}

@keyframes float-particle {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(1);
        opacity: 0;
    }
}

/* Achievement Unlocked */
.achievement {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(200px);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--neon-orange);
    padding: 1rem 2rem;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    color: var(--neon-orange);
    text-shadow: var(--text-glow);
    z-index: 200;
    animation: achievement-popup 4s ease-in-out;
}

@keyframes achievement-popup {
    0%, 100% { transform: translateX(-50%) translateY(200px); }
    10%, 90% { transform: translateX(-50%) translateY(0); }
}

/* Navigation Buttons */
.nav-buttons {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.nav-button {
    font-size: 0.9rem;
    padding: 1rem 2rem;
}

.nav-button.back {
    border-color: var(--neon-magenta);
    color: var(--neon-magenta);
}

.nav-button.back::before {
    background: var(--neon-magenta);
}

.nav-button.next {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.nav-button.next::before {
    background: var(--neon-cyan);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .game-logo {
        font-size: 1.2rem;
    }

    .level-grid {
        grid-template-columns: 1fr;
    }

    .hud {
        font-size: 0.7rem;
        padding: 0.5rem;
        top: 10px;
        right: 10px;
    }

    .story-terminal {
        padding: 1rem;
    }

    .start-button, .nav-button {
        font-size: 0.8rem;
        padding: 1rem 1.5rem;
    }
}

/* Loading Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
    opacity: 0;
}

.fade-in:nth-child(1) { animation-delay: 0.2s; }
.fade-in:nth-child(2) { animation-delay: 0.4s; }
.fade-in:nth-child(3) { animation-delay: 0.6s; }
.fade-in:nth-child(4) { animation-delay: 0.8s; }
.fade-in:nth-child(5) { animation-delay: 1s; }
.fade-in:nth-child(6) { animation-delay: 1.2s; }

@keyframes trail-fade {
    to {
        opacity: 0;
        transform: scale(0);
    }
}
