﻿/**
 * NEON DEFENDERS - Styles
 * Cyberpunk/Synthwave aesthetic with neon colors and glow effects
 */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;900&family=Rajdhani:wght@300;400;500;600;700&display=swap');

/* Force Portrait Mode Overlay - REMOVED */
/*
#rotate-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 99999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--neon-cyan);
}

@media screen and (orientation: landscape) and (max-height: 600px) {
    #rotate-overlay { display: flex; }
}
*/

/* Landscape: Rotate the entire game to look like portrait */
@media screen and (orientation: landscape) {
    #game-screen .game-container {
        position: fixed;
        top: 50%;
        left: 50%;
        width: 100vh;
        height: 100vw;
        transform: translate(-50%, -50%) rotate(-90deg);
        transform-origin: center center;
    }
}

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

:root {
    --neon-cyan: #00ffff;
    --neon-pink: #ff00ff;
    --neon-green: #00ff00;
    --neon-yellow: #ffff00;
    --neon-orange: #ff8800;
    --neon-red: #ff0040;
    --neon-blue: #0088ff;
    --neon-purple: #aa00ff;
    --bg-dark: #000008;
    --bg-panel: rgba(0, 0, 20, 0.95);
    --font-display: 'Orbitron', monospace;
    --font-body: 'Rajdhani', sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    font-family: var(--font-body);
    color: #fff;
}

.screen { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; flex-direction: column; align-items: center; justify-content: center; z-index: 10; }
.screen.active { display: flex; }
#options-screen { z-index: 450; }
#save-screen { z-index: 450; }
#load-screen { z-index: 450; }

#main-menu { background: var(--bg-dark); overflow-y: auto; padding: 2rem 0; justify-content: flex-start; padding-top: 8vh; position: relative; }
#main-menu > * { position: relative; z-index: 2; }
#menu-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

.game-title { font-family: var(--font-display); font-size: clamp(2rem, 8vw, 4rem); font-weight: 900; letter-spacing: 0.1em; text-align: center; color: var(--neon-cyan); text-shadow: 0 0 10px var(--neon-cyan), 0 0 30px var(--neon-cyan), 0 0 60px var(--neon-cyan); animation: titlePulse 3s ease-in-out infinite; }
@keyframes titlePulse { 0%, 100% { text-shadow: 0 0 10px var(--neon-cyan), 0 0 30px var(--neon-cyan), 0 0 60px var(--neon-cyan); } 50% { text-shadow: 0 0 15px var(--neon-cyan), 0 0 40px var(--neon-cyan), 0 0 80px var(--neon-cyan); } }

.subtitle { font-family: var(--font-display); font-size: clamp(0.6rem, 2vw, 0.9rem); font-weight: 400; color: var(--neon-pink); letter-spacing: 1em; margin: 1rem 0 2rem; text-shadow: 0 0 10px var(--neon-pink); }

.difficulty-selector { margin-bottom: 2rem; text-align: center; }
.difficulty-label { font-family: var(--font-display); font-size: 0.7rem; color: var(--neon-orange); letter-spacing: 0.2em; display: block; margin-bottom: 0.8rem; }
.difficulty-buttons { display: flex; gap: 0.5rem; justify-content: center; }
.diff-btn { font-family: var(--font-display); font-size: 0.7rem; padding: 0.5rem 1rem; background: transparent; border: 1px solid rgba(255, 255, 255, 0.3); color: rgba(255, 255, 255, 0.5); border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.diff-btn:hover { border-color: var(--neon-cyan); color: var(--neon-cyan); }
.diff-btn.active { border-color: var(--neon-green); color: var(--neon-green); background: rgba(0, 255, 0, 0.1); box-shadow: 0 0 10px rgba(0, 255, 0, 0.3); }
.diff-btn[data-diff="easy"].active { border-color: var(--neon-green); color: var(--neon-green); background: rgba(0, 255, 0, 0.1); box-shadow: 0 0 10px rgba(0, 255, 0, 0.3); }
.diff-btn[data-diff="normal"].active { border-color: var(--neon-yellow); color: var(--neon-yellow); background: rgba(255, 255, 0, 0.1); box-shadow: 0 0 10px rgba(255, 255, 0, 0.3); }
.diff-btn[data-diff="hard"].active { border-color: var(--neon-red); color: var(--neon-red); background: rgba(255, 0, 64, 0.1); box-shadow: 0 0 10px rgba(255, 0, 64, 0.3); }

/* Graphics Mode Buttons */
.gfx-btn { font-family: var(--font-display); font-size: 0.65rem; padding: 0.4rem 0.8rem; background: transparent; border: 1px solid rgba(255, 255, 255, 0.3); color: rgba(255, 255, 255, 0.5); border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.gfx-btn:hover { border-color: var(--neon-cyan); color: var(--neon-cyan); }
.gfx-btn.active { border-color: var(--neon-cyan); color: var(--neon-cyan); background: rgba(0, 255, 255, 0.1); box-shadow: 0 0 10px rgba(0, 255, 255, 0.3); }
.gfx-btn[data-gfx="hd"].active { border-color: var(--neon-green); color: var(--neon-green); background: rgba(0, 255, 0, 0.1); }
.gfx-btn[data-gfx="sd"].active { border-color: var(--neon-orange); color: var(--neon-orange); background: rgba(255, 136, 0, 0.1); }
.gfx-selector { display: flex; gap: 0.5rem; }

.menu-buttons { display: flex; flex-direction: column; gap: 1rem; width: 90%; max-width: 300px; }

.neon-btn { font-family: var(--font-display); font-size: clamp(0.7rem, 2.5vw, 1rem); font-weight: 700; padding: 1rem 2rem; border: 2px solid var(--neon-cyan); background: transparent; color: var(--neon-cyan); letter-spacing: 0.1em; cursor: pointer; transition: all 0.2s ease; text-shadow: 0 0 10px currentColor; box-shadow: 0 0 5px currentColor, inset 0 0 20px rgba(0, 255, 255, 0.05); position: relative; overflow: hidden; text-align: center; white-space: nowrap; }
.neon-btn:hover, .neon-btn:active { background: rgba(0, 255, 255, 0.15); box-shadow: 0 0 30px currentColor; transform: scale(1.02); }
.neon-btn.pink { border-color: var(--neon-pink); color: var(--neon-pink); }
.neon-btn.green { border-color: var(--neon-green); color: var(--neon-green); }
.neon-btn.yellow { border-color: var(--neon-yellow); color: var(--neon-yellow); }
.neon-btn.orange { border-color: var(--neon-orange); color: var(--neon-orange); }
.neon-btn.small { font-size: 0.7rem; padding: 0.6rem 1rem; }

.options-container { width: 90%; max-width: 380px; padding: 2rem; background: var(--bg-panel); border: 2px solid var(--neon-cyan); box-shadow: 0 0 30px rgba(0, 255, 255, 0.3); }
.options-title { font-family: var(--font-display); font-size: 1.5rem; color: var(--neon-cyan); text-align: center; margin-bottom: 2rem; text-shadow: 0 0 20px var(--neon-cyan); }
.option-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; font-size: 1rem; }

input[type="range"] { width: 140px; height: 8px; -webkit-appearance: none; background: rgba(0, 255, 255, 0.2); border: 1px solid var(--neon-cyan); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; background: var(--neon-cyan); cursor: pointer; box-shadow: 0 0 15px var(--neon-cyan); }

.toggle-btn { padding: 0.5rem 1rem; font-family: var(--font-display); font-size: 0.8rem; border: 2px solid var(--neon-green); background: rgba(0, 255, 0, 0.1); color: var(--neon-green); cursor: pointer; transition: all 0.2s; }
.toggle-btn.off { border-color: var(--neon-red); background: rgba(255, 0, 64, 0.1); color: var(--neon-red); }

#game-screen { padding: 0; }
.game-container { width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden; }

.hud { display: flex; justify-content: space-around; align-items: center; padding: 0.6rem 1rem; background: linear-gradient(180deg, rgba(0, 0, 40, 0.98), rgba(0, 0, 20, 0.9)); border-bottom: 2px solid var(--neon-cyan); box-shadow: 0 5px 30px rgba(0, 255, 255, 0.2); z-index: 100; }
.hud-item { display: flex; align-items: center; gap: 0.4rem; font-family: var(--font-display); font-size: clamp(0.7rem, 2vw, 0.9rem); }
.hud-value { font-weight: 700; text-shadow: 0 0 15px currentColor; }
.hud-value.wave { color: var(--neon-pink); }
.hud-value.lives { color: var(--neon-red); }
.hud-value.score { color: var(--neon-cyan); }

/* Speed Control */
.speed-control { position: relative; display: flex; align-items: center; font-family: var(--font-display); font-size: 0.6rem; }
.speed-toggle { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 0 0.5rem; transition: transform 0.2s; }
.speed-toggle:hover { transform: scale(1.1); }
.speed-content { 
    display: none; 
    position: absolute; 
    top: 100%; 
    left: 50%; 
    transform: translateX(-50%); 
    background: rgba(0, 0, 20, 0.95); 
    border: 1px solid var(--neon-cyan); 
    padding: 0.5rem; 
    border-radius: 4px; 
    gap: 0.5rem; 
    align-items: center; 
    margin-top: 0.5rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    z-index: 200;
}
.speed-control.active .speed-content { display: flex; }
.speed-slider { width: 100px; position: relative; }
.speed-slider input[type="range"] { width: 100%; height: 6px; cursor: pointer; -webkit-appearance: none; appearance: none; background: linear-gradient(to right, rgba(0, 255, 255, 0.2), rgba(0, 255, 255, 0.5)); border-radius: 3px; border: none; outline: none; }
.speed-slider input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--neon-cyan); border: 2px solid #000; cursor: pointer; box-shadow: 0 0 12px rgba(0, 255, 255, 0.8), inset 0 0 4px rgba(0, 255, 255, 0.4); transition: all 0.2s; }
.speed-slider input[type="range"]::-webkit-slider-thumb:hover { width: 16px; height: 16px; box-shadow: 0 0 16px rgba(0, 255, 255, 1), inset 0 0 6px rgba(0, 255, 255, 0.6); }
.speed-slider input[type="range"]::-moz-range-track { background: transparent; border: none; }
.speed-slider input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--neon-cyan); border: 2px solid #000; cursor: pointer; box-shadow: 0 0 12px rgba(0, 255, 255, 0.8), inset 0 0 4px rgba(0, 255, 255, 0.4); transition: all 0.2s; }
.speed-slider input[type="range"]::-moz-range-thumb:hover { width: 16px; height: 16px; box-shadow: 0 0 16px rgba(0, 255, 255, 1), inset 0 0 6px rgba(0, 255, 255, 0.6); }
.speed-value { color: var(--neon-green); font-size: 0.75rem; font-weight: bold; min-width: 32px; text-align: center; text-shadow: 0 0 6px rgba(0, 255, 0, 0.5); letter-spacing: 0.5px; }

.hud-btn { width: 36px; height: 36px; border: 2px solid var(--neon-cyan); background: rgba(0, 255, 255, 0.1); color: var(--neon-cyan); font-size: 1rem; cursor: pointer; transition: all 0.2s; }
.hud-btn:hover { background: rgba(0, 255, 255, 0.3); box-shadow: 0 0 20px var(--neon-cyan); }
.hud-btn.log-btn { border-color: var(--neon-yellow); color: var(--neon-yellow); background: rgba(255, 255, 0, 0.1); font-size: 0.8rem; }
.hud-btn.log-btn:hover { background: rgba(255, 255, 0, 0.3); box-shadow: 0 0 20px var(--neon-yellow); }

/* Wave Log Panel */
.log-panel { position: fixed; top: 60px; right: 10px; width: 320px; max-height: 70vh; background: rgba(0, 0, 20, 0.95); border: 2px solid var(--neon-yellow); box-shadow: 0 0 30px rgba(255, 255, 0, 0.3); z-index: 500; display: none; flex-direction: column; }
.log-panel.active { display: flex; }
.log-header { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.8rem; background: rgba(255, 255, 0, 0.1); border-bottom: 1px solid var(--neon-yellow); }
.log-title { font-family: var(--font-display); font-size: 0.9rem; color: var(--neon-yellow); }
.log-close { background: none; border: none; color: var(--neon-yellow); font-size: 1.2rem; cursor: pointer; }
.log-content { flex: 1; overflow-y: auto; padding: 0.5rem; max-height: 60vh; }
.log-second { margin-bottom: 0.5rem; border-bottom: 1px solid rgba(255, 255, 0, 0.2); padding-bottom: 0.3rem; }
.log-second-header { font-family: var(--font-display); font-size: 0.7rem; color: var(--neon-cyan); margin-bottom: 0.2rem; }
.log-entry { font-size: 0.6rem; color: #ccc; padding: 0.1rem 0; display: flex; justify-content: space-between; }
.log-entry .weapon-name { color: #fff; }
.log-entry .dmg-value { color: var(--neon-green); font-family: var(--font-display); }
.log-entry.ability { color: var(--neon-orange); }
.log-entry.ability .dmg-value { color: var(--neon-orange); }
.log-summary { padding: 0.5rem; border-top: 1px solid var(--neon-yellow); background: rgba(255, 255, 0, 0.05); }
.log-summary-title { font-family: var(--font-display); font-size: 0.7rem; color: var(--neon-yellow); margin-bottom: 0.3rem; }
.log-summary-row { display: flex; justify-content: space-between; font-size: 0.6rem; color: #ccc; }

.game-area { flex: 1; position: relative; overflow: hidden; background: var(--bg-dark); min-height: 0; display: flex; align-items: center; justify-content: center; }
#gameCanvas { display: block; max-width: 100%; max-height: 100%; margin: 0 auto; background-color: #000; }

.bottom-controls { display: flex; justify-content: flex-start; gap: 0.4rem; padding: 0.4rem 0.8rem; background: linear-gradient(0deg, rgba(0, 0, 40, 0.98), rgba(0, 0, 20, 0.9)); border-top: 2px solid var(--neon-pink); box-shadow: 0 -5px 30px rgba(255, 0, 255, 0.2); overflow-x: auto !important; overflow-y: hidden; scrollbar-width: none; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; touch-action: pan-x; width: 100%; height: 68px; flex-shrink: 0; scroll-padding-left: 0.8rem; scroll-padding-right: 0.8rem; }
.bottom-controls.centered { justify-content: center; }
.bottom-controls::-webkit-scrollbar { display: none; }

.control-btn { flex-shrink: 0; min-width: 60px; height: 60px; border: 2px solid var(--neon-cyan); background: rgba(0, 255, 255, 0.05); color: var(--neon-cyan); font-family: var(--font-display); font-size: 0.5rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem; cursor: pointer; transition: all 0.15s; text-shadow: 0 0 8px currentColor; touch-action: manipulation; }
.control-btn:hover, .control-btn:active { background: rgba(0, 255, 255, 0.2); box-shadow: 0 0 20px currentColor; }
.control-btn .icon { font-size: 1.4rem; }
.control-btn .level-badge { font-size: 0.45rem; color: var(--neon-yellow); }
.control-btn.start-wave { border-color: var(--neon-green); color: var(--neon-green); background: rgba(0, 255, 0, 0.1); min-width: 70px; }
.control-btn.locked { opacity: 0.3; pointer-events: none; }

.panel { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 20, 0.90); padding: 1rem; padding-bottom: 1.5rem; display: none; flex-direction: column; gap: 0.6rem; width: 96%; max-width: 450px; max-height: 70vh; overflow-y: auto; z-index: 200; animation: panelSlide 0.2s ease-out; }
@keyframes panelSlide { from { transform: translateX(-50%) translateY(20px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
.panel.active { display: flex; }
.panel.tower-panel { border: 2px solid var(--neon-pink); box-shadow: 0 0 20px rgba(255, 0, 255, 0.4); }
.panel.stats-panel { border: 2px solid var(--neon-orange); box-shadow: 0 0 20px rgba(255, 136, 0, 0.4); }
.panel.detail-panel { border: 2px solid var(--neon-cyan); box-shadow: 0 0 20px rgba(0, 255, 255, 0.4); }

.panel-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 0.6rem; border-bottom: 1px solid rgba(255, 255, 255, 0.2); }
.panel-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; text-shadow: 0 0 15px currentColor; }
.close-panel { width: 30px; height: 30px; border: 2px solid var(--neon-red); background: transparent; color: var(--neon-red); font-size: 1rem; cursor: pointer; transition: all 0.2s; }
.close-panel:hover { background: rgba(255, 0, 64, 0.3); box-shadow: 0 0 15px var(--neon-red); }

.tower-stats-box { background: rgba(0, 255, 255, 0.05); border: 1px solid rgba(0, 255, 255, 0.3); padding: 0.8rem; }
.dps-display { text-align: center; padding: 0.8rem; background: linear-gradient(135deg, rgba(255, 0, 255, 0.15), rgba(0, 255, 255, 0.1)); border: 1px solid var(--neon-pink); margin-bottom: 0.6rem; }
.dps-label { font-size: 0.6rem; color: #aaa; letter-spacing: 0.2em; }
.dps-value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 900; color: var(--neon-pink); text-shadow: 0 0 20px var(--neon-pink); }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.stat-item { text-align: center; padding: 0.4rem; background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.1); }
.stat-item.full-width { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 0.3rem 0.6rem; background: rgba(255, 68, 68, 0.15); border-color: rgba(255, 68, 68, 0.3); }
.stat-label { font-size: 0.5rem; color: #888; text-transform: uppercase; }
.stat-value { font-family: var(--font-display); font-size: 0.8rem; font-weight: 600; color: var(--neon-green); }
.stat-value.bonus { color: var(--neon-yellow); }

.slots-label { font-size: 0.65rem; color: var(--neon-cyan); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.1em; }
.tower-slots { display: flex; gap: 0.5rem; justify-content: center; }
.tower-slot { width: 80px; height: 105px; border: 2px solid rgba(255, 0, 255, 0.4); background: rgba(255, 0, 255, 0.05); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 8px; font-size: 0.55rem; color: rgba(255, 255, 255, 0.5); cursor: pointer; transition: all 0.2s; position: relative; }
.tower-slot.filled { border-color: var(--neon-cyan); background: rgba(0, 255, 255, 0.1); color: #fff; }
.tower-slot.selected { border-color: var(--neon-yellow); box-shadow: 0 0 20px var(--neon-yellow); background: rgba(255, 255, 0, 0.15); }
.tower-slot .slot-icon { font-size: 1.6rem; }
.tower-slot .slot-name { font-family: var(--font-display); font-size: 0.5rem; }
.tower-slot .slot-stats { font-size: 0.45rem; color: var(--neon-green); }
.tower-slot .slot-dps { font-size: 0.45rem; color: var(--neon-pink); margin-bottom: 2px; }
.tower-slot .slot-level { position: absolute; top: 3px; right: 3px; font-size: 0.5rem; color: var(--neon-yellow); background: rgba(0, 0, 0, 0.7); padding: 2px 5px; }
.tower-slot .remove-btn { position: absolute; top: -8px; left: -8px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--neon-red); background: var(--bg-dark); color: var(--neon-red); font-size: 0.6rem; cursor: pointer; display: none; align-items: center; justify-content: center; }
.tower-slot.filled:hover .remove-btn { display: flex; }
.tower-slot .slot-target { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 0.45rem; color: var(--neon-orange); background: rgba(0, 0, 0, 0.7); padding: 3px 8px; border-radius: 3px; cursor: pointer; display: flex; align-items: center; gap: 3px; border: 1px solid rgba(255, 136, 0, 0.4); }
.tower-slot .slot-target:hover { border-color: var(--neon-orange); background: rgba(255, 136, 0, 0.2); }
.tower-slot .slot-target .target-label { font-size: 0.4rem; opacity: 0.7; }
.tower-slot .slot-target .target-value { font-size: 0.6rem; }

.target-menu { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0, 0, 20, 0.95); border: 2px solid var(--neon-orange); padding: 0.5rem; z-index: 100; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3rem; min-width: 240px; }
.target-option { padding: 0.4rem 0.5rem; text-align: center; cursor: pointer; border: 1px solid rgba(255, 136, 0, 0.3); background: rgba(255, 136, 0, 0.05); transition: all 0.15s; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.target-option:hover { background: rgba(255, 136, 0, 0.2); border-color: var(--neon-orange); }
.target-option.active { background: rgba(255, 136, 0, 0.3); border-color: var(--neon-yellow); box-shadow: 0 0 10px var(--neon-orange); }
.target-option .opt-icon { font-size: 1rem; }
.target-option .opt-name { font-size: 0.45rem; color: #ccc; }

.cards-section { border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 0.6rem; }
.cards-label { font-size: 0.65rem; color: var(--neon-yellow); margin-bottom: 0.4rem; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 0.4rem; }

.skill-card { background: rgba(0, 255, 255, 0.05); border: 2px solid var(--neon-cyan); padding: 0.5rem; text-align: center; cursor: pointer; transition: all 0.15s; position: relative; }
.skill-card:hover { transform: scale(1.05); box-shadow: 0 0 20px currentColor; }
.skill-card .card-icon { font-size: 1.4rem; }
.skill-card .card-name { font-family: var(--font-display); font-size: 0.5rem; margin: 0.2rem 0; }
.skill-card .card-stat { font-size: 0.45rem; color: var(--neon-green); }
.skill-card .card-level { position: absolute; top: 3px; right: 3px; font-size: 0.5rem; color: var(--neon-yellow); background: rgba(0, 0, 0, 0.7); padding: 2px 5px; }
.skill-card.attack { border-color: var(--neon-red); }
.skill-card.upgrade { border-color: var(--neon-orange); }
.skill-card.defense { border-color: var(--neon-blue); }
.skill-card.passive { border-color: var(--neon-blue); }

.card-select-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 10, 0.97); display: none; align-items: center; justify-content: center; z-index: 500; flex-direction: column; padding: 1.5rem; }
.card-select-modal.active { display: flex; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.card-select-title { font-family: var(--font-display); font-size: 1.5rem; color: var(--neon-green); text-shadow: 0 0 30px var(--neon-green); margin-bottom: 0.5rem; }
.card-select-subtitle { font-size: 1rem; color: #aaa; margin-bottom: 2rem; }
.card-choices { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.choice-card { width: 130px; background: var(--bg-panel); border: 3px solid var(--neon-cyan); padding: 1.2rem 0.8rem; text-align: center; cursor: pointer; transition: all 0.2s; }
.choice-card:hover { transform: scale(1.08) translateY(-5px); box-shadow: 0 10px 40px currentColor; }
.choice-card.attack { border-color: var(--neon-red); }
.choice-card.upgrade { border-color: var(--neon-orange); }
.choice-card.defense { border-color: var(--neon-blue); }
.choice-card.passive { border-color: var(--neon-blue); }
.choice-card .choice-icon { font-size: 2.5rem; }
.choice-card .choice-name { font-family: var(--font-display); font-size: 0.8rem; margin: 0.5rem 0; }
.choice-card .choice-desc { font-size: 0.65rem; color: #aaa; margin-bottom: 0.4rem; }
.choice-card .choice-stats { font-size: 0.7rem; color: var(--neon-green); }

.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 10, 0.95); display: none; align-items: center; justify-content: center; z-index: 500; }
.modal.active { display: flex; animation: fadeIn 0.3s ease-out; }
.modal-content { background: linear-gradient(135deg, rgba(0,20,40,0.98), rgba(0,10,20,0.98)); border: 2px solid var(--neon-cyan); border-radius: 12px; padding: 2rem; text-align: center; max-width: 90%; box-shadow: 0 0 30px rgba(0, 255, 255, 0.3), inset 0 0 20px rgba(0, 255, 255, 0.05); }
.modal-title { font-family: var(--font-display); font-size: 1.8rem; margin-bottom: 1rem; color: var(--neon-cyan); }
.modal-title.defeat { color: var(--neon-red); text-shadow: 0 0 30px var(--neon-red); }

.pause-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 20, 0.95); display: none; align-items: center; justify-content: center; z-index: 400; flex-direction: column; }
.pause-overlay.active { display: flex; }
.pause-title { font-family: var(--font-display); font-size: 2.5rem; color: var(--neon-cyan); margin-bottom: 2rem; text-shadow: 0 0 40px var(--neon-cyan); }

.unlock-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--bg-panel); border: 4px solid var(--neon-green); padding: 2rem; text-align: center; z-index: 600; display: none; box-shadow: 0 0 80px rgba(0, 255, 0, 0.5); }
.unlock-popup.active { display: block; animation: unlockPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes unlockPop { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.unlock-icon { font-size: 4rem; }
.unlock-title { font-family: var(--font-display); font-size: 1.2rem; color: var(--neon-green); margin-top: 0.5rem; text-shadow: 0 0 20px var(--neon-green); }

.loading-content { text-align: center; }
.loading-text { font-family: var(--font-display); font-size: 1.2rem; color: var(--neon-cyan); margin-bottom: 1.5rem; animation: loadingPulse 1s ease-in-out infinite; }
@keyframes loadingPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.loading-bar { width: 200px; height: 8px; background: rgba(0, 255, 255, 0.1); border: 2px solid var(--neon-cyan); margin: 0 auto; overflow: hidden; }
.loading-fill { height: 100%; background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink)); width: 0%; animation: loadFill 2s ease-out forwards; }
@keyframes loadFill { to { width: 100%; } }

.stats-wave-header { text-align: center; padding: 0.6rem; background: linear-gradient(135deg, rgba(255, 136, 0, 0.2), rgba(255, 0, 255, 0.1)); border: 1px solid var(--neon-orange); }
.stats-wave-title { font-family: var(--font-display); font-size: 1.1rem; color: var(--neon-orange); }
.stats-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; margin: 0.6rem 0; }
.summary-box { background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.2); padding: 0.6rem; text-align: center; }
.summary-label { font-size: 0.55rem; color: #888; text-transform: uppercase; }
.summary-value { font-family: var(--font-display); font-size: 1.1rem; color: var(--neon-cyan); }
.breakdown-title { font-family: var(--font-display); font-size: 0.75rem; color: var(--neon-pink); margin-bottom: 0.4rem; }
.breakdown-list { display: flex; flex-direction: column; gap: 0.4rem; }
.breakdown-item { padding: 0.5rem; background: rgba(0, 0, 0, 0.4); border-left: 4px solid var(--neon-cyan); }
.breakdown-item .weapon-info { display: flex; align-items: center; gap: 0.5rem; }
.breakdown-item .weapon-icon { font-size: 1.2rem; }
.breakdown-item .weapon-name { font-size: 0.65rem; font-weight: 600; }
.breakdown-item .weapon-tower { font-size: 0.5rem; color: #888; }
.breakdown-item .damage-value { font-family: var(--font-display); font-size: 0.9rem; color: var(--neon-red); float: right; }
.damage-bar { width: 100%; height: 4px; background: rgba(255, 255, 255, 0.1); margin-top: 0.3rem; border-radius: 2px; overflow: hidden; }
.damage-bar-fill { height: 100%; background: linear-gradient(90deg, var(--neon-red), var(--neon-orange)); border-radius: 2px; }

@media (max-width: 400px) { .control-btn { min-width: 50px; height: 50px; } .tower-slot { width: 70px; height: 80px; } .choice-card { width: 100px; } }

/* ========== FUSION PANEL ========== */
.panel.fusion-panel { border: 2px solid var(--neon-yellow); box-shadow: 0 0 40px rgba(255, 255, 0, 0.4); }

.fusion-info { text-align: center; padding: 0.8rem; background: rgba(255, 255, 0, 0.05); border: 1px solid rgba(255, 255, 0, 0.3); margin-bottom: 0.8rem; }
.fusion-info p { font-size: 0.8rem; color: #ccc; margin: 0.2rem 0; }
.fusion-hint { font-size: 0.65rem !important; color: #888 !important; }

.fusion-workspace { display: flex; align-items: center; justify-content: center; gap: 0.8rem; padding: 1rem; background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.1); margin-bottom: 0.8rem; flex-wrap: wrap; }

.fusion-slot { width: 80px; height: 100px; border: 2px dashed rgba(255, 255, 0, 0.4); background: rgba(0, 0, 0, 0.4); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; position: relative; }
.fusion-slot:hover { border-color: var(--neon-yellow); background: rgba(255, 255, 0, 0.1); }
.fusion-slot.filled { border-style: solid; border-color: var(--neon-yellow); background: rgba(255, 255, 0, 0.15); }
.fusion-slot.selected { box-shadow: 0 0 20px var(--neon-yellow); animation: fusionGlow 0.5s ease-in-out infinite alternate; }
@keyframes fusionGlow { from { box-shadow: 0 0 10px var(--neon-yellow); } to { box-shadow: 0 0 25px var(--neon-yellow); } }

.fusion-slot-label { font-size: 0.5rem; color: #888; position: absolute; top: 5px; }
.fusion-slot-icon { font-size: 2rem; }
.fusion-slot-name { font-family: var(--font-display); font-size: 0.5rem; margin-top: 0.2rem; }
.fusion-slot-level { font-size: 0.45rem; color: var(--neon-yellow); }
.fusion-slot-stats { font-size: 0.4rem; color: var(--neon-green); }

.fusion-plus, .fusion-arrow { font-size: 1.5rem; color: var(--neon-yellow); font-weight: bold; }

.fusion-result { width: 80px; height: 100px; border: 2px solid var(--neon-green); background: rgba(0, 255, 0, 0.1); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.fusion-result.ready { animation: resultGlow 0.8s ease-in-out infinite alternate; }
@keyframes resultGlow { from { box-shadow: 0 0 10px var(--neon-green); } to { box-shadow: 0 0 30px var(--neon-green); } }

.fusion-available { margin-top: 0.8rem; }
.fusion-available-title { font-family: var(--font-display); font-size: 0.7rem; color: var(--neon-cyan); margin-bottom: 0.5rem; }
.fusion-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 0.4rem; max-height: 150px; overflow-y: auto; }

.fusion-card { background: rgba(0, 255, 255, 0.05); border: 2px solid var(--neon-cyan); padding: 0.4rem; text-align: center; cursor: pointer; transition: all 0.15s; position: relative; }
.fusion-card:hover { transform: scale(1.05); box-shadow: 0 0 15px currentColor; }
.fusion-card.selected { border-color: var(--neon-yellow); box-shadow: 0 0 15px var(--neon-yellow); background: rgba(255, 255, 0, 0.1); }
.fusion-card.attack { border-color: var(--neon-red); }
.fusion-card.compatible { border-color: var(--neon-green); animation: compatiblePulse 1s ease-in-out infinite; }
@keyframes compatiblePulse { 0%, 100% { box-shadow: 0 0 5px var(--neon-green); } 50% { box-shadow: 0 0 15px var(--neon-green); } }

.fusion-card .fc-icon { font-size: 1.2rem; }
.fusion-card .fc-name { font-family: var(--font-display); font-size: 0.4rem; }
.fusion-card .fc-level { font-size: 0.4rem; color: var(--neon-yellow); }
.fusion-card .fc-stats { font-size: 0.35rem; color: var(--neon-green); }

.fusion-pairs { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.fusion-pairs-title { font-family: var(--font-display); font-size: 0.7rem; color: var(--neon-pink); margin-bottom: 0.5rem; }
.fusion-pairs-list { display: flex; flex-direction: column; gap: 0.4rem; max-height: 120px; overflow-y: auto; }

.fusion-pair { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; background: rgba(255, 0, 255, 0.05); border: 1px solid rgba(255, 0, 255, 0.3); cursor: pointer; transition: all 0.2s; }
.fusion-pair:hover { background: rgba(255, 0, 255, 0.15); border-color: var(--neon-pink); }
.fusion-pair .fp-cards { display: flex; align-items: center; gap: 0.3rem; }
.fusion-pair .fp-icon { font-size: 1.2rem; }
.fusion-pair .fp-plus { color: var(--neon-yellow); font-weight: bold; }
.fusion-pair .fp-arrow { color: var(--neon-green); margin: 0 0.3rem; }
.fusion-pair .fp-result { display: flex; align-items: center; gap: 0.3rem; }
.fusion-pair .fp-name { font-size: 0.6rem; }
.fusion-pair .fp-level { font-size: 0.55rem; color: var(--neon-yellow); }
.fusion-pair .fp-stats { font-size: 0.5rem; color: var(--neon-green); margin-left: auto; }

/* ========== DETAIL PANEL ========== */
.detail-header { text-align: center; padding: 1rem; background: linear-gradient(135deg, rgba(0, 255, 255, 0.1), rgba(255, 0, 255, 0.1)); border: 1px solid var(--neon-cyan); margin-bottom: 0.8rem; }
.detail-tower-icon { font-size: 2.5rem; }
.detail-tower-name { font-family: var(--font-display); font-size: 1.3rem; color: var(--neon-cyan); margin: 0.3rem 0; }
.detail-tower-level { font-size: 0.75rem; color: var(--neon-yellow); }

.detail-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; margin-bottom: 0.8rem; }
.detail-stat { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.6rem; background: rgba(0, 0, 0, 0.4); border-left: 3px solid var(--neon-cyan); }
.detail-stat-name { font-size: 0.6rem; color: #aaa; display: flex; align-items: center; gap: 0.4rem; }
.detail-stat-icon { font-size: 0.9rem; }
.detail-stat-value { font-family: var(--font-display); font-size: 0.8rem; color: var(--neon-green); }
.detail-stat-value.high { color: var(--neon-yellow); text-shadow: 0 0 10px var(--neon-yellow); }
.detail-stat-value.low { color: #888; }

.detail-weapons { margin-top: 0.8rem; }
.detail-weapons-title { font-family: var(--font-display); font-size: 0.7rem; color: var(--neon-pink); margin-bottom: 0.5rem; }
.detail-weapons-list { display: flex; flex-direction: column; gap: 0.4rem; }

.detail-weapon { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem; background: rgba(255, 0, 255, 0.05); border: 1px solid rgba(255, 0, 255, 0.3); }
.detail-weapon-icon { font-size: 1.5rem; }
.detail-weapon-info { flex: 1; }
.detail-weapon-name { font-family: var(--font-display); font-size: 0.7rem; }
.detail-weapon-level { font-size: 0.55rem; color: var(--neon-yellow); }
.detail-weapon-stats { display: flex; gap: 0.8rem; margin-top: 0.2rem; }
.detail-weapon-stat { font-size: 0.5rem; color: var(--neon-green); }
.detail-weapon-dps { font-family: var(--font-display); font-size: 0.8rem; color: var(--neon-pink); }

.detail-empty-slot { padding: 0.6rem; background: rgba(100, 100, 100, 0.1); border: 1px dashed rgba(100, 100, 100, 0.3); text-align: center; font-size: 0.6rem; color: #666; }

/* ========== FUSION SUCCESS ========== */
.fusion-success { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--bg-panel); border: 4px solid var(--neon-yellow); padding: 2rem 3rem; text-align: center; z-index: 700; display: none; box-shadow: 0 0 80px rgba(255, 255, 0, 0.5); }
.fusion-success.active { display: block; animation: fusionPopIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes fusionPopIn { 0% { transform: translate(-50%, -50%) scale(0.3) rotate(-10deg); opacity: 0; } 50% { transform: translate(-50%, -50%) scale(1.1) rotate(5deg); } 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; } }
.fusion-success-icon { font-size: 4rem; animation: fusionIconBounce 0.5s ease-out 0.3s; }
@keyframes fusionIconBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); } }
.fusion-success-text { font-family: var(--font-display); font-size: 0.9rem; color: var(--neon-yellow); margin-top: 0.5rem; }
.fusion-success-name { font-family: var(--font-display); font-size: 1.2rem; color: #fff; margin-top: 0.3rem; }
.fusion-success-level { font-family: var(--font-display); font-size: 1.5rem; color: var(--neon-green); text-shadow: 0 0 20px var(--neon-green); }
.fusion-success-stats { font-size: 0.7rem; color: var(--neon-cyan); margin-top: 0.5rem; }

/* ========== STATS TABS ========== */
.stats-tabs { display: flex; gap: 0.3rem; margin: 0.6rem 0; }
.stats-tab { flex: 1; padding: 0.5rem 0.3rem; background: rgba(255, 136, 0, 0.1); border: 1px solid rgba(255, 136, 0, 0.3); color: #aaa; font-family: var(--font-display); font-size: 0.55rem; cursor: pointer; transition: all 0.2s; }
.stats-tab:hover { background: rgba(255, 136, 0, 0.2); }
.stats-tab.active { background: rgba(255, 136, 0, 0.3); border-color: var(--neon-orange); color: var(--neon-orange); }

.stats-tab-content { display: none; }
.stats-tab-content.active { display: block; }

/* ========== WEAPONS STATS ========== */
.weapons-stats-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 250px; overflow-y: auto; }

.weapon-stat-card { background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 0, 255, 0.3); padding: 0.6rem; }
.weapon-stat-card.equipped { border-color: var(--neon-green); background: rgba(0, 255, 0, 0.05); }
.weapon-stat-card.inventory { border-color: var(--neon-cyan); }

.weapon-stat-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.weapon-stat-icon { font-size: 1.5rem; }
.weapon-stat-info { flex: 1; }
.weapon-stat-name { font-family: var(--font-display); font-size: 0.7rem; }
.weapon-stat-level { font-size: 0.55rem; color: var(--neon-yellow); }
.weapon-stat-location { font-size: 0.5rem; color: var(--neon-green); }
.weapon-stat-location.inv { color: var(--neon-cyan); }
.weapon-stat-dps { font-family: var(--font-display); font-size: 1rem; color: var(--neon-pink); }

.weapon-stat-details { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem; }
.weapon-detail { text-align: center; padding: 0.3rem; background: rgba(0, 0, 0, 0.3); }
.weapon-detail-label { font-size: 0.4rem; color: #888; text-transform: uppercase; }
.weapon-detail-value { font-family: var(--font-display); font-size: 0.65rem; color: var(--neon-cyan); }
.weapon-detail-value.bonus { color: var(--neon-yellow); }

/* ========== TOWERS STATS ========== */
.towers-stats-list { display: flex; flex-direction: column; gap: 0.5rem; }

.tower-stat-card { background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(0, 255, 255, 0.3); padding: 0.6rem; }
.tower-stat-card.locked { opacity: 0.4; border-style: dashed; }

.tower-stat-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.tower-stat-icon { font-size: 1.8rem; }
.tower-stat-info { flex: 1; }
.tower-stat-name { font-family: var(--font-display); font-size: 0.8rem; color: var(--neon-cyan); }
.tower-stat-level { font-size: 0.55rem; color: var(--neon-yellow); }
.tower-stat-dps { font-family: var(--font-display); font-size: 1.2rem; color: var(--neon-pink); }
.tower-stat-dps-label { font-size: 0.45rem; color: #888; }

.tower-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3rem; margin-bottom: 0.4rem; }
.tower-stat-item { text-align: center; padding: 0.3rem; background: rgba(0, 0, 0, 0.3); }
.tower-stat-item-label { font-size: 0.4rem; color: #888; }
.tower-stat-item-value { font-family: var(--font-display); font-size: 0.6rem; color: var(--neon-green); }

.tower-weapons-mini { display: flex; gap: 0.3rem; justify-content: center; }
.tower-weapon-mini { width: 30px; height: 30px; background: rgba(255, 0, 255, 0.1); border: 1px solid rgba(255, 0, 255, 0.3); display: flex; align-items: center; justify-content: center; font-size: 0.9rem; }
.tower-weapon-mini.empty { opacity: 0.3; font-size: 0.6rem; color: #666; }

/* ========== WAVE BUTTON ACTIVE STATE ========== */
.control-btn.start-wave.wave-active { 
    border-color: var(--neon-orange); 
    color: var(--neon-orange); 
    background: rgba(255, 136, 0, 0.2);
    animation: waveActiveGlow 0.8s ease-in-out infinite alternate;
}
@keyframes waveActiveGlow {
    from { box-shadow: 0 0 10px var(--neon-orange); }
    to { box-shadow: 0 0 25px var(--neon-orange), inset 0 0 15px rgba(255, 136, 0, 0.2); }
}

/* Cross-Fusion Style */
.fusion-pair.cross-fusion { border-color: var(--neon-pink); background: rgba(255, 0, 255, 0.1); }
.fusion-pair.cross-fusion::before { content: '✨'; position: absolute; right: 5px; top: 5px; font-size: 0.7rem; }

.fusion-card.compatible { border-color: var(--neon-green) !important; }

/* Highscore Liste im Hauptmenü */
.highscore-container { margin-top: 2rem; width: 90%; max-width: 300px; }
.highscore-title { font-family: var(--font-display); font-size: 0.9rem; color: var(--neon-orange); letter-spacing: 0.15em; margin-bottom: 0.8rem; text-align: center; text-shadow: 0 0 10px var(--neon-orange); }
#highscoreList { background: rgba(0, 0, 20, 0.6); border: 1px solid rgba(255, 136, 0, 0.4); border-radius: 8px; padding: 0.8rem; min-height: 60px; max-height: 300px; overflow-y: auto; }
#highscoreList::-webkit-scrollbar { width: 6px; }
#highscoreList::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
#highscoreList::-webkit-scrollbar-thumb { background: var(--neon-orange); border-radius: 3px; }
.highscore-entry { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0.5rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); font-size: 0.8rem; }
.highscore-entry:last-child { border-bottom: none; }
.hs-rank { width: 30px; font-weight: bold; }
.hs-score { flex: 1; text-align: right; color: var(--neon-yellow); font-family: var(--font-display); margin-right: 0.5rem; }
.hs-wave { width: 40px; text-align: center; color: var(--neon-cyan); }
.hs-diff { width: 25px; text-align: center; font-weight: bold; font-size: 0.7rem; }
.no-scores { text-align: center; color: rgba(255, 255, 255, 0.6); padding: 1rem; font-size: 0.85rem; font-style: italic; }

/* Game Over Rank */
#finalRank { color: var(--neon-yellow); font-family: var(--font-display); font-size: 1rem; margin-top: 0.5rem; text-shadow: 0 0 10px var(--neon-yellow); }

/* Castle/Burg Button Styling */
.control-btn.castle { border-color: #ffd700 !important; color: #ffd700 !important; background: rgba(255, 215, 0, 0.1); }
.control-btn.castle .icon { text-shadow: 0 0 10px #ffd700; }

/* Skill Tree System */
.skill-tree-btn { width: 100%; margin-top: 0.5rem; padding: 0.5rem; background: rgba(255, 215, 0, 0.1); border: 2px solid rgba(255, 215, 0, 0.5); color: var(--neon-yellow); font-family: var(--font-display); font-size: 0.7rem; cursor: pointer; transition: all 0.2s; position: relative; }
.skill-tree-btn:hover { background: rgba(255, 215, 0, 0.2); border-color: var(--neon-yellow); box-shadow: 0 0 15px rgba(255, 215, 0, 0.3); }
.skill-tree-btn.has-points { animation: pulse-gold 1.5s infinite; }
.skill-points-badge { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: var(--neon-yellow); color: #000; padding: 2px 8px; border-radius: 10px; font-size: 0.6rem; font-weight: bold; }
@keyframes pulse-gold { 0%, 100% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.3); } 50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); } }

.skill-panel { max-height: 85vh; overflow-y: auto; }
.skill-points-display { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 1rem; background: rgba(255, 215, 0, 0.1); border-bottom: 1px solid rgba(255, 215, 0, 0.3); font-family: var(--font-display); font-size: 0.7rem; color: var(--neon-yellow); }
.skill-points-count { font-size: 0.8rem; }

.skill-trees-container { display: flex; flex-direction: column; gap: 0.8rem; padding: 0.5rem; }
.skill-tree { background: rgba(0, 0, 20, 0.5); border: 1px solid rgba(255, 255, 255, 0.2); padding: 0.5rem; border-radius: 6px; }
.skill-tree-header { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem; border-bottom: 2px solid; margin-bottom: 0.4rem; }
.tree-icon { font-size: 1.1rem; }
.tree-name { font-family: var(--font-display); font-size: 0.8rem; letter-spacing: 0.1em; }

.skill-tree-grid { display: flex; flex-direction: column; gap: 0.3rem; }
.skill-tier { display: flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0; }
.tier-num { font-family: var(--font-display); font-size: 0.55rem; color: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.1); width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tier-nodes { display: flex; flex-wrap: wrap; gap: 0.25rem; flex: 1; }

.skill-node { padding: 0.3rem 0.4rem; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.2); cursor: default; transition: all 0.2s; border-radius: 4px; flex-shrink: 0; }
.skill-node.locked { opacity: 0.4; }
.skill-node.available { border-color: var(--neon-green); cursor: pointer; animation: pulse-available 1.5s infinite; }
.skill-node.available:hover { background: rgba(0, 255, 0, 0.2); transform: scale(1.03); }
.skill-node.learned { background: rgba(255, 255, 255, 0.15); border-width: 2px; }
.skill-icon-inline { font-size: 0.75rem; }
@keyframes pulse-available { 0%, 100% { box-shadow: 0 0 3px rgba(0, 255, 0, 0.3); } 50% { box-shadow: 0 0 8px rgba(0, 255, 0, 0.5); } }

.skill-name { font-family: var(--font-display); font-size: 0.65rem; color: #fff; white-space: nowrap; }
.skill-desc { font-size: 0.55rem; color: rgba(255, 255, 255, 0.7); margin-top: 2px; }

/* Skill-Bonus in Stats */
.skill-bonus { color: var(--neon-yellow); font-size: 0.55rem; }

/* Leaderboard Styles */
.leaderboard-header { margin-bottom: 1rem; }
.leaderboard-tabs { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.lb-tab { font-family: var(--font-display); font-size: 0.65rem; padding: 0.4rem 0.8rem; background: transparent; border: 1px solid rgba(255,255,255,0.3); color: rgba(255,255,255,0.5); border-radius: 4px; cursor: pointer; transition: all 0.2s; flex: 1; }
.lb-tab:hover { border-color: var(--tab-color); color: var(--tab-color); }
.lb-tab.active { border-color: var(--tab-color); color: var(--tab-color); background: rgba(255,255,255,0.05); box-shadow: 0 0 10px rgba(255,255,255,0.1); }
.leaderboard-timer { text-align: center; font-size: 0.7rem; color: var(--neon-cyan); margin-top: 0.3rem; }
.leaderboard-status { text-align: center; font-size: 0.6rem; color: rgba(255,255,255,0.5); margin: 0.5rem 0; }
.leaderboard-list { display: flex; flex-direction: column; gap: 0.4rem; }
.lb-entry { display: flex; align-items: center; padding: 0.5rem 0.8rem; background: rgba(255,255,255,0.03); border-radius: 6px; border: 1px solid rgba(255,255,255,0.1); }
.lb-entry:nth-child(-n+3) { border-color: rgba(255,215,0,0.3); }
.lb-rank { width: 2rem; font-size: 0.9rem; text-align: center; }
.lb-name { flex: 1; font-family: var(--font-display); font-size: 0.8rem; color: var(--neon-cyan); letter-spacing: 1px; }
.lb-score { font-family: var(--font-display); font-size: 0.8rem; color: var(--neon-yellow); margin-right: 0.8rem; }
.lb-wave { font-size: 0.7rem; color: rgba(255,255,255,0.6); }
.loading-scores { text-align: center; color: rgba(255,255,255,0.5); padding: 2rem; }

/* Name Input Section */
#nameInputSection { margin: 1rem 0; padding: 0.8rem; background: rgba(0,255,255,0.05); border: 1px solid var(--neon-cyan); border-radius: 8px; }
.name-input-label { font-size: 0.7rem; color: var(--neon-cyan); margin-bottom: 0.5rem; display: block; }
.name-input-row { display: flex; gap: 0.5rem; }
#playerNameInput { flex: 1; font-family: var(--font-display); font-size: 1rem; padding: 0.5rem; background: rgba(0,0,0,0.5); border: 1px solid var(--neon-cyan); border-radius: 4px; color: white; text-transform: uppercase; letter-spacing: 2px; max-width: 100px; text-align: center; }
#playerNameInput::placeholder { color: rgba(255,255,255,0.3); }
#submitScoreBtn { font-family: var(--font-display); font-size: 0.8rem; padding: 0.5rem 1rem; background: var(--neon-cyan); border: none; border-radius: 4px; color: black; cursor: pointer; transition: all 0.2s; }
#submitScoreBtn:hover { background: white; box-shadow: 0 0 15px var(--neon-cyan); }
.submit-success { color: var(--neon-green); font-size: 0.9rem; text-align: center; }

/* How-To Tabs */
.howto-tabs { display: flex; gap: 0.3rem; margin-bottom: 1rem; flex-wrap: wrap; }
.howto-tab { font-family: var(--font-display); font-size: 0.6rem; padding: 0.4rem 0.6rem; background: transparent; border: 1px solid rgba(255,255,255,0.2); color: rgba(255,255,255,0.5); border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.howto-tab:hover { border-color: var(--neon-cyan); color: var(--neon-cyan); }
.howto-tab.active { border-color: var(--neon-cyan); color: var(--neon-cyan); background: rgba(0,255,255,0.1); }
.howto-content { display: none; text-align: left; }
.howto-content.active { display: block; }
.howto-section { margin-bottom: 1rem; padding: 0.8rem; background: rgba(255,255,255,0.02); border-radius: 6px; border-left: 2px solid var(--neon-cyan); }
.howto-title { font-family: var(--font-display); font-size: 0.8rem; font-weight: bold; margin-bottom: 0.4rem; }
.howto-section p { font-size: 0.75rem; color: #bbb; line-height: 1.6; margin: 0.2rem 0; }
.howto-section b { color: #fff; }
.howto-container { max-width: 400px; }

/* Tutorial Overlay */
.tutorial-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; }
.tutorial-overlay.active { display: block; }
.tutorial-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); }
.tutorial-box { position: absolute; background: linear-gradient(135deg, rgba(0,20,40,0.98), rgba(0,10,20,0.98)); border: 2px solid var(--neon-cyan); border-radius: 12px; padding: 1.2rem; max-width: 300px; box-shadow: 0 0 30px rgba(0,255,255,0.3), inset 0 0 20px rgba(0,255,255,0.05); z-index: 10001; }
.tutorial-step { font-family: var(--font-display); font-size: 0.6rem; color: var(--neon-cyan); margin-bottom: 0.3rem; opacity: 0.7; }
.tutorial-title { font-family: var(--font-display); font-size: 1rem; color: var(--neon-yellow); margin-bottom: 0.5rem; }
.tutorial-text { font-size: 0.8rem; color: #ccc; line-height: 1.6; margin-bottom: 1rem; }
.tutorial-buttons { display: flex; gap: 0.5rem; justify-content: space-between; }
.tutorial-skip { font-family: var(--font-display); font-size: 0.7rem; padding: 0.4rem 0.8rem; background: transparent; border: 1px solid rgba(255,255,255,0.3); color: rgba(255,255,255,0.5); border-radius: 4px; cursor: pointer; }
.tutorial-skip:hover { border-color: var(--neon-pink); color: var(--neon-pink); }
.tutorial-next { font-family: var(--font-display); font-size: 0.7rem; padding: 0.4rem 1rem; background: rgba(0,255,255,0.1); border: 1px solid var(--neon-cyan); color: var(--neon-cyan); border-radius: 4px; cursor: pointer; }
.tutorial-next:hover { background: rgba(0,255,255,0.2); box-shadow: 0 0 10px rgba(0,255,255,0.3); }
.tutorial-highlight { position: absolute; border: 3px solid var(--neon-yellow); border-radius: 8px; box-shadow: 0 0 20px var(--neon-yellow), inset 0 0 20px rgba(255,255,0,0.1); pointer-events: none; z-index: 10000; animation: tutorial-pulse 1.5s ease-in-out infinite; }
@keyframes tutorial-pulse { 0%, 100% { box-shadow: 0 0 20px var(--neon-yellow); } 50% { box-shadow: 0 0 40px var(--neon-yellow), 0 0 60px var(--neon-yellow); } }

/* Lobby Screen */
.lobby-list { width: 100%; max-width: 400px; max-height: 300px; overflow-y: auto; margin: 1rem 0; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 0.5rem; }
.lobby-item { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem; background: rgba(255,255,255,0.05); margin-bottom: 0.5rem; border-radius: 4px; border: 1px solid transparent; transition: all 0.2s; }
.lobby-item:hover { border-color: var(--neon-cyan); background: rgba(0,255,255,0.1); }
.lobby-name { font-family: var(--font-display); color: var(--neon-cyan); font-size: 0.9rem; }
.lobby-status { font-size: 0.7rem; color: rgba(255,255,255,0.5); }
.lobby-join-btn { padding: 0.4rem 0.8rem; background: var(--neon-green); border: none; border-radius: 4px; color: black; font-family: var(--font-display); font-size: 0.7rem; cursor: pointer; }
.lobby-join-btn:hover { box-shadow: 0 0 10px var(--neon-green); }
.lobby-create-section { display: flex; gap: 0.5rem; width: 100%; max-width: 400px; margin-bottom: 1rem; }
.lobby-input { flex: 1; padding: 0.8rem; background: rgba(0,0,0,0.5); border: 1px solid var(--neon-cyan); color: white; font-family: var(--font-display); border-radius: 4px; }
.lobby-waiting { text-align: center; margin: 2rem 0; }
.lobby-waiting-spinner { display: inline-block; width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1); border-top-color: var(--neon-cyan); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 1rem; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.lobby-code { font-family: var(--font-display); font-size: 1.5rem; color: var(--neon-yellow); letter-spacing: 2px; margin: 1rem 0; }

/* Shop Screen */
.shop-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
    gap: 1rem;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.shop-title {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
}

.shop-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.shop-filter-btn {
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    padding: 0.4rem 0.8rem;
    font-family: var(--font-display);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
    flex: 1 1 auto;
    text-align: center;
    min-width: 60px;
}

.shop-filter-btn:hover, .shop-filter-btn.active {
    background: var(--neon-cyan);
    color: black;
    box-shadow: 0 0 10px var(--neon-cyan);
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.5rem;
    overflow-y: auto;
    padding: 0.5rem;
    flex: 1;
    /* Ensure scrollbar is visible if needed */
    scrollbar-width: thin;
    scrollbar-color: var(--neon-cyan) rgba(0,0,0,0.3);
    /* Limit height to roughly 4 rows (approx 140px per row on desktop) */
    max-height: 560px; 
}

/* Mobile optimization: Max 3 items per row on small screens */
@media (max-width: 600px) {
    .shop-grid {
        grid-template-columns: repeat(3, 1fr);
        /* Limit height to roughly 4 rows (approx 100px per row on mobile) */
        max-height: 400px;
    }
    .shop-item {
        padding: 0.3rem;
    }
    .shop-item-icon {
        font-size: 1.5rem;
    }
    .shop-item-name {
        font-size: 0.6rem;
    }
}

/* Hero Selection */
.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    max-width: 1000px;
    margin: 1rem auto;
    padding: 1rem;
    max-height: 70vh;
    overflow-y: auto;
}

.hero-card {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--neon-cyan);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.hero-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 255, 255, 0.5);
}

.hero-card.selected {
    border-color: var(--neon-green);
    box-shadow: 0 0 15px var(--neon-green);
}

.hero-avatar {
    width: 60px;
    height: 60px;
    margin: 0 auto 0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    display: block;
}

.hero-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    text-align: center;
}

.hero-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin-bottom: 0.5rem;
}

.hero-stats {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-stat-title {
    font-size: 0.7rem;
    color: var(--neon-yellow);
    margin-bottom: 0.3rem;
    font-weight: bold;
}

.hero-weapons, .hero-bonuses {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.3rem;
}

.hero-select-btn {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--neon-green);
    border: none;
    border-radius: 5px;
    color: black;
    font-family: var(--font-display);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
}

.hero-select-btn:hover {
    background: white;
    box-shadow: 0 0 10px var(--neon-green);
}

@media (max-width: 768px) {
    .hero-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        max-height: 65vh;
    }
    
    .hero-card {
        padding: 0.75rem;
    }
    
    .hero-avatar {
        width: 50px;
        height: 50px;
    }
    
    .hero-name {
        font-size: 1rem;
    }
    
    .hero-desc {
        font-size: 0.65rem;
    }
}

.shop-item {
    background: rgba(0,20,40,0.8);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.shop-item:hover {
    border-color: var(--neon-yellow);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255,255,0,0.2);
}

.shop-item-icon {
    font-size: 2rem;
    margin-bottom: 0.3rem;
}

.shop-item-name {
    font-family: var(--font-display);
    font-size: 0.75rem;
    color: white;
    text-align: center;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.shop-item-rarity {
    font-size: 0.6rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    margin-bottom: 0.3rem;
}

.shop-item-rarity.common { color: #ccc; border-color: #ccc; }
.shop-item-rarity.rare { color: var(--neon-cyan); border-color: var(--neon-cyan); }
.shop-item-rarity.epic { color: var(--neon-purple); border-color: var(--neon-purple); }
.shop-item-rarity.legendary { color: var(--neon-yellow); border-color: var(--neon-yellow); }
.shop-item-rarity.hero { color: var(--neon-green); border-color: var(--neon-green); }

/* Shop Detail Modal */
.shop-detail-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.shop-detail-overlay.active {
    display: flex;
}

.shop-detail-content {
    background: linear-gradient(135deg, rgba(0,20,40,0.98), rgba(0,10,20,0.98));
    border: 2px solid var(--neon-cyan);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 0 30px rgba(0,255,255,0.2);
}

.shop-detail-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.5rem;
    cursor: pointer;
}

.shop-detail-close:hover { color: white; }

.shop-detail-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 1rem;
}

.shop-detail-icon {
    font-size: 4rem;
    background: rgba(255,255,255,0.05);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

.shop-detail-info h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--neon-yellow);
    margin: 0 0 0.5rem 0;
}

.shop-detail-type {
    font-size: 0.9rem;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.shop-detail-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.shop-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
}

.shop-stat-label { color: #aaa; font-size: 0.9rem; }
.shop-stat-value { color: white; font-weight: bold; font-family: var(--font-display); }

.shop-detail-desc {
    color: #ccc;
    line-height: 1.6;
    font-size: 0.95rem;
    padding: 1rem;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    border-left: 3px solid var(--neon-cyan);
}

.passive-icon {
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--neon-cyan);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--neon-cyan);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}
.passive-icon:hover {
    transform: scale(1.1);
    border-color: var(--neon-yellow);
    box-shadow: 0 0 10px var(--neon-cyan);
}
.passive-tooltip {
    position: absolute;
    top: 110%;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--neon-cyan);
    padding: 5px 8px;
    font-size: 10px;
    white-space: nowrap;
    display: none;
    z-index: 100;
    pointer-events: none;
    color: #fff;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.passive-icon:hover .passive-tooltip {
    display: block;
}
.shop-item.locked {
    opacity: 0.6;
    filter: grayscale(0.8);
    border-color: #555;
}
.shop-item.locked:hover {
    border-color: var(--neon-red);
    box-shadow: 0 0 15px rgba(255,0,0,0.2);
}
.shop-price-tag {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.8);
    color: var(--neon-yellow);
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 4px;
    border: 1px solid var(--neon-yellow);
}
.shop-locked-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: rgba(255,0,0,0.7);
    z-index: 2;
    text-shadow: 0 0 10px black;
}
