:root {
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --darker: #020617;
    --light: #f1f5f9;
    --glass: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Rajdhani', sans-serif;
    background: radial-gradient(ellipse at top, #1e1b4b 0%, #0a0a0f 50%, #000000 100%);
    color: var(--light);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Modern Gradient Background */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.08) 0%, transparent 50%);
    animation: gradientShift 20s ease infinite;
}

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

.grid-bg {
    display: none;
}

/* Glassmorphism Container */
.arcade-frame {
    position: relative;
    max-width: 1400px;
    width: 95%;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(99, 102, 241, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    padding: 0;
    overflow: hidden;
    margin: 20px;
}

.arcade-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: radial-gradient(ellipse at top, rgba(99, 102, 241, 0.15), transparent);
    pointer-events: none;
}

.arcade-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), transparent, rgba(236, 72, 153, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    pointer-events: none;
}

/* Modern Header */
.frame-top {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.08));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    padding: 32px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.frame-top::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.arcade-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #a78bfa, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.arcade-logo i {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-right: 12px;
}

.arcade-logo .highlight {
    background: linear-gradient(135deg, var(--accent), var(--warning));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.arcade-subtitle {
    font-size: 0.875rem;
    color: rgba(241, 245, 249, 0.6);
    letter-spacing: 3px;
    font-weight: 500;
    text-transform: uppercase;
}

/* Game Container */
.game-container {
    position: relative;
    background: #000;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.game-container > canvas {
    flex: 1;
    min-height: 400px;
}

/* Modern HUD */
.hud-overlay {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    justify-content: space-between;
    z-index: 100;
    pointer-events: none;
    gap: 16px;
}

.hud-left, .hud-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Glassmorphic Cards */
.score-display,
.lives-display,
.wave-display {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(10, 10, 15, 0.85));
    backdrop-filter: blur(16px);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 14px;
    padding: 18px 22px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.score-display::before,
.lives-display::before,
.wave-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transition: left 0.6s ease;
}

.score-display:hover::before,
.lives-display:hover::before,
.wave-display:hover::before {
    left: 100%;
}

.score-display:hover,
.lives-display:hover,
.wave-display:hover {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(10, 10, 15, 0.9));
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-3px);
    box-shadow: 
        0 15px 50px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(99, 102, 241, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.score-display {
    min-width: 220px;
}

.wave-display {
    min-width: 160px;
    text-align: center;
}

.score-label,
.lives-label,
.wave-label {
    font-size: 0.75rem;
    color: rgba(241, 245, 249, 0.5);
    letter-spacing: 1.5px;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: 600;
}

.score-value {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

.score-multiplier {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.score-multiplier span {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--warning));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Orbitron', monospace;
}

.multiplier-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.multiplier-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--warning));
    border-radius: 3px;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.5);
}

/* Lives */
.lives-icons {
    display: flex;
    gap: 8px;
}

.lives-icons i {
    font-size: 1.3rem;
    color: var(--danger);
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.5));
    transition: transform 0.2s ease;
}

.lives-icons i:hover {
    transform: scale(1.1);
}

/* Wave */
.wave-value {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--success), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wave-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.wave-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--primary));
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

/* Power-ups */
.power-ups-display {
    display: flex;
    gap: 8px;
}

.powerup-slot {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.powerup-slot i {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.2);
}

.powerup-slot.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
    transform: scale(1.05);
}

.powerup-slot.active i {
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

/* Canvas */
#gameCanvas {
    width: 100%;
    max-height: 800px;
    aspect-ratio: 4 / 3;
    background: #000;
    display: block;
    image-rendering: auto;
}

.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

/* Control Panel */
.control-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    position: relative;
}

.control-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.controls-left {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

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

.control-key {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 600;
    color: var(--light);
    font-size: 0.875rem;
    display: flex;
    gap: 4px;
    transition: all 0.2s ease;
}

.control-key:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.control-text {
    font-size: 0.875rem;
    color: rgba(241, 245, 249, 0.7);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Modern Buttons */
.action-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Rajdhani', sans-serif;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.6);
}

.action-btn:active {
    transform: translateY(0);
}

.pause-btn {
    background: linear-gradient(135deg, var(--warning), var(--accent));
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.pause-btn:hover {
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.6);
}

.restart-btn {
    background: linear-gradient(135deg, var(--accent), var(--danger));
    box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4);
}

.restart-btn:hover {
    box-shadow: 0 8px 24px rgba(236, 72, 153, 0.6);
}

.btn-icon {
    font-size: 1.1rem;
}

/* Game Over Screen */
.game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border-radius: 0 0 24px 24px;
}

.game-over-content {
    text-align: center;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    padding: 48px 60px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.game-over-glitch {
    margin-bottom: 32px;
}

.game-over-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--danger), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    letter-spacing: 4px;
}

.final-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 36px;
}

.final-stat {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    padding: 16px 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.final-label {
    font-size: 0.75rem;
    color: rgba(241, 245, 249, 0.5);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 600;
}

.final-value {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Victory Screen */
.victory {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border-radius: 0 0 24px 24px;
}

.victory-content {
    text-align: center;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    padding: 48px 60px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.victory-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--success), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    letter-spacing: 3px;
}

.victory-message {
    font-size: 1.125rem;
    color: rgba(241, 245, 249, 0.8);
    margin-bottom: 32px;
    letter-spacing: 1px;
}

/* Responsive */
@media (max-width: 1200px) {
    .arcade-frame {
        max-width: 100%;
        width: 98%;
        margin: 10px;
    }
    
    .score-display,
    .lives-display,
    .wave-display {
        min-width: auto;
        padding: 14px 16px;
    }
    
    .score-value,
    .wave-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 900px) {
    .arcade-logo {
        font-size: 2rem;
    }
    
    .frame-top {
        padding: 24px 20px;
    }
    
    .game-over-title {
        font-size: 2.5rem;
    }
    
    .victory-title {
        font-size: 2.2rem;
    }
    
    .hud-overlay {
        flex-direction: column;
        gap: 8px;
        top: 12px;
        left: 12px;
        right: 12px;
    }
    
    .hud-left,
    .hud-right {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }
    
    .score-display,
    .lives-display,
    .wave-display {
        flex: 1;
        min-width: 0;
    }
    
    .power-ups-display {
        margin-top: 8px;
    }
    
    .final-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .control-panel {
        padding: 20px;
    }
}

@media (max-width: 600px) {
    .arcade-logo {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }
    
    .arcade-subtitle {
        font-size: 0.7rem;
        letter-spacing: 2px;
    }
    
    .control-panel {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }
    
    .controls-left {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }
    
    .control-group {
        width: 100%;
        justify-content: center;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .hud-left,
    .hud-right {
        flex-direction: column;
    }
    
    .score-value,
    .wave-value {
        font-size: 1.3rem;
    }
    
    .game-over-content,
    .victory-content {
        padding: 32px 28px;
    }
    
    .game-over-title {
        font-size: 2rem;
    }
    
    .victory-title {
        font-size: 1.8rem;
    }
    
    .final-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 400px) {
    .arcade-frame {
        border-radius: 12px;
        margin: 5px;
    }
    
    .arcade-logo {
        font-size: 1.2rem;
    }
    
    .score-display,
    .lives-display,
    .wave-display {
        padding: 10px 12px;
    }
    
    .powerup-slot {
        width: 36px;
        height: 36px;
    }
}
