/* Server Saver Shield - Enhanced Styles */
:root {
    --bg-dark: #0a0a0f;
    --bg-panel: #12121a;
    --neon-purple: #8b5cf6;
    --neon-purple-light: #a78bfa;
    --neon-blue: #3b82f6;
    --neon-cyan: #06b6d4;
    --neon-green: #10b981;
    --neon-red: #ef4444;
    --neon-orange: #f59e0b;
    --neon-pink: #ec4899;
    --text-primary: #f5f5f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(10, 10, 15, 0.95);
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
}

.logo span { font-size: 1.2rem; }

.game-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.back-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--neon-purple), #7c3aed);
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: 0.3s ease;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* Game Wrapper */
.game-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, #1a1a3e 0%, #0a0a0f 70%);
}

#gameCanvas {
    background: linear-gradient(180deg, #0f0f23 0%, #1a1a3e 50%, #16213e 100%);
    border: 3px solid var(--neon-purple);
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
    cursor: crosshair;
    max-width: 100%;
    max-height: calc(100vh - 120px);
}

/* HUD */
.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 100;
}

.hud-section {
    display: flex;
    gap: 15px;
    align-items: center;
}

.hud-section.center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.stat-box {
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    padding: 8px 16px;
    text-align: center;
    min-width: 80px;
}

.stat-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-value {
    display: block;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
}

.score-box .stat-value { color: var(--neon-orange); text-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
.wave-box .stat-value { color: var(--neon-cyan); text-shadow: 0 0 10px rgba(6, 182, 212, 0.5); }

.server-health {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(10, 10, 15, 0.9);
    padding: 8px 16px;
    border-radius: 25px;
    border: 2px solid var(--neon-green);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.server-icon { font-size: 1.5rem; }

.health-bar {
    width: 150px;
    height: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-red), var(--neon-orange), var(--neon-green));
    border-radius: 6px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.health-text {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--neon-green);
    min-width: 45px;
}

.powerup-indicator {
    display: flex;
    gap: 5px;
}

.powerup-icon {
    font-size: 1.5rem;
    animation: pulse 1s ease-in-out infinite;
}

/* Screens */
.screen-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    z-index: 500;
    text-align: center;
    padding: 2rem;
    border-radius: 12px;
}

.screen-overlay.hidden { display: none; }

.logo-big {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple), var(--neon-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
}

.logo-big.glitch {
    animation: glitch 2s infinite;
    color: var(--neon-red);
}

@keyframes glitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(2px, -2px); }
    60% { transform: translate(-2px, -2px); }
    80% { transform: translate(2px, 2px); }
}

.tagline {
    font-size: 1.1rem;
    color: var(--neon-cyan);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.story {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(245, 158, 11, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 1.5rem;
    max-width: 450px;
}

.story p { margin-bottom: 10px; font-size: 0.95rem; color: var(--text-secondary); }
.story p:last-child { margin-bottom: 0; }
.story strong { color: var(--neon-red); }

.enemies-preview {
    display: flex;
    gap: 20px;
    margin-bottom: 1.5rem;
}

.enemy-type {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 15px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    transition: 0.3s ease;
}

.enemy-type:hover {
    transform: translateY(-5px);
    border-color: var(--neon-purple);
}

.enemy-type span { font-size: 2rem; }
.enemy-type small { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 35px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: 0.3s ease;
    margin: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-start {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    color: white;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(6, 182, 212, 0.6);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--neon-purple);
}

.btn-secondary:hover {
    background: rgba(139, 92, 246, 0.2);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

.controls-hint {
    display: flex;
    gap: 20px;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    justify-content: center;
}

.controls-hint span {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(139, 92, 246, 0.1);
    padding: 8px 12px;
    border-radius: 20px;
}

/* Final Stats */
.final-stats {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 1.5rem;
    min-width: 250px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.stat-row:last-child { border-bottom: none; }
.stat-row span:first-child { color: var(--text-secondary); font-size: 0.9rem; }
.stat-row .highlight {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--neon-orange);
}

/* Footer */
.footer-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 12px;
    background: rgba(10, 10, 15, 0.95);
    border-top: 1px solid rgba(139, 92, 246, 0.2);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-bar a { color: var(--neon-purple-light); text-decoration: none; }

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Responsive */
@media (max-width: 768px) {
    .header { padding: 10px 15px; }
    .game-title { font-size: 0.85rem; }
    .back-btn { padding: 6px 12px; font-size: 0.75rem; }
    .hud { top: 10px; left: 10px; right: 10px; }
    .stat-box { padding: 6px 12px; min-width: 60px; }
    .stat-value { font-size: 1rem; }
    .health-bar { width: 100px; height: 10px; }
    .enemies-preview { gap: 10px; }
    .enemy-type { padding: 10px; }
    .enemy-type span { font-size: 1.5rem; }
    .controls-hint { flex-direction: column; gap: 8px; }
    .controls-hint span { font-size: 0.7rem; padding: 6px 10px; }
    .footer-bar { flex-wrap: wrap; gap: 15px; font-size: 0.7rem; }
}

@media (max-width: 480px) {
    .hud-section.center { position: static; transform: none; order: -1; width: 100%; justify-content: center; margin-bottom: 10px; }
    .hud { flex-wrap: wrap; justify-content: center; }
    .health-bar { width: 120px; }
}
