/* ===== Reset & Canvas ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a1a; }

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-container canvas {
    max-width: 100vw;
    max-height: 100vh;
    image-rendering: pixelated;
}

/* ===== HUD Overlay ===== */
#hud {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 10;
    font-family: 'Courier New', monospace;
}

#hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 20px;
}

#center-info {
    text-align: center;
    color: #f4ecd8;
    font-size: 14px;
    line-height: 1.6;
}

#center-info span { display: block; }
#wave-display { font-size: 20px; font-weight: bold; color: #ffcc00; }
#timer-display { font-size: 18px; color: #fff; }
#nuke-display { font-size: 16px; color: #ffcc00; font-weight: bold; }
#round-display { font-size: 14px; color: #aaa; }

.hud-label { font-size: 18px; font-weight: bold; }
.hud-score { font-size: 16px; color: #f4ecd8; display: block; margin-top: 4px; }

.hp-bar, .shield-bar {
    width: 120px; height: 12px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 3px;
    overflow: hidden;
    margin: 3px 0;
}

.hp-fill { height: 100%; transition: width 0.3s ease; }
.hp-fill-p1 { background: linear-gradient(90deg, #ff2222, #ff6644); }
.hp-fill-p2 { background: linear-gradient(90deg, #2266ff, #44aaff); }

.shield-bar { height: 6px; }
.shield-fill { height: 100%; transition: width 0.3s ease; }
.shield-fill-p1 { background: #44ddff; }
.shield-fill-p2 { background: #44ddff; }

#p1-hud { text-align: left; }
#p2-hud { text-align: right; }

#hud-bottom {
    position: absolute;
    bottom: 10px; left: 20px; right: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: bold;
}

.kill-streak { animation: streakFlash 0.5s ease; }
@keyframes streakFlash {
    0% { transform: scale(1.5); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

/* ===== Wave Announcement ===== */
#wave-announce {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    text-align: center;
    pointer-events: none;
}

#wave-announce-text {
    font-family: 'Courier New', monospace;
    font-size: 48px;
    font-weight: bold;
    color: #ffcc00;
    text-shadow: 0 0 20px rgba(255,200,0,0.8), 2px 2px 4px #000;
    animation: waveAnnounce 2s ease forwards;
}

@keyframes waveAnnounce {
    0% { opacity: 0; transform: scale(0.5); }
    20% { opacity: 1; transform: scale(1.1); }
    80% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1); }
}

/* ===== Pause Overlay ===== */
#pause-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    pointer-events: auto;
}

#pause-box {
    text-align: center;
    color: #f4ecd8;
    font-family: 'Courier New', monospace;
}

#pause-box h2 { font-size: 48px; color: #ffcc00; margin-bottom: 20px; }
#pause-box p { font-size: 18px; margin-bottom: 20px; color: #aaa; }

.pause-btn {
    display: block;
    margin: 10px auto;
    padding: 12px 32px;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    background: rgba(255,255,255,0.1);
    color: #f4ecd8;
    border: 2px solid #c9a44c;
    border-radius: 8px;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.2s;
}

.pause-btn:hover { background: rgba(201,164,76,0.3); }

/* ===== Game Over Overlay ===== */
#gameover-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    pointer-events: auto;
}

#gameover-box {
    text-align: center;
    color: #f4ecd8;
    font-family: 'Courier New', monospace;
    padding: 40px;
    background: rgba(20,20,40,0.9);
    border: 3px solid #c9a44c;
    border-radius: 16px;
    min-width: 400px;
}

#gameover-title { font-size: 42px; margin-bottom: 20px; }
#gameover-stats { font-size: 16px; line-height: 2; margin-bottom: 20px; color: #ccc; }

.score-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 14px;
}
.score-table th {
    color: #c9a44c;
    border-bottom: 2px solid #c9a44c;
    padding: 6px 12px;
    text-align: center;
}
.score-table td {
    padding: 5px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.stat-label { text-align: left !important; color: #aaa; }
.stat-p1 { color: #ff6644; }
.stat-p2 { color: #44aaff; }

/* ===== Boss HP Bar ===== */
#boss-hp-bar {
    position: fixed;
    top: 60px; left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Courier New', monospace;
    pointer-events: none;
}
#boss-hp-label {
    font-size: 18px; font-weight: bold; color: #ff4444;
    text-shadow: 0 0 8px rgba(255,0,0,0.6);
}
.boss-hp-track {
    width: 300px; height: 16px;
    background: rgba(0,0,0,0.7);
    border: 2px solid #ff4444;
    border-radius: 4px;
    overflow: hidden;
}
.boss-hp-fill {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, #ff0000, #ff4444, #ff8844);
    transition: width 0.3s ease;
}

/* ===== Keybinding Overlay ===== */
#keybind-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 35;
    pointer-events: auto;
}
#keybind-box {
    text-align: center;
    color: #f4ecd8;
    font-family: 'Courier New', monospace;
    padding: 30px;
    background: rgba(20,20,40,0.95);
    border: 2px solid #c9a44c;
    border-radius: 12px;
    min-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
#keybind-box h2 { font-size: 24px; color: #c9a44c; margin-bottom: 16px; }
#keybind-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 80px 1fr 1fr 80px;
    gap: 6px 10px;
    margin-bottom: 8px;
}
.keybind-header {
    font-size: 12px;
    color: #c9a44c;
    font-weight: bold;
    text-align: center;
    padding: 4px;
}
.keybind-row-label {
    font-size: 14px;
    color: #ccc;
    text-align: right;
    padding: 6px 8px;
}
.keybind-btn {
    font-size: 15px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    padding: 6px 10px;
    color: #fff;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    min-width: 70px;
    transition: all 0.15s;
}
.keybind-btn:hover { background: rgba(255,255,255,0.2); border-color: #c9a44c; }
.keybind-btn.listening {
    background: #c9a44c;
    color: #000;
    border-color: #ffcc00;
    animation: keyPulse 0.6s ease-in-out infinite;
}
@keyframes keyPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(255,200,0,0.4); }
    50% { box-shadow: 0 0 16px rgba(255,200,0,0.9); }
}
.keybind-actions { margin-top: 12px; }

.hud-nuke { font-size: 14px; color: #ffcc00; font-weight: bold; display: block; margin-top: 4px; }
.hud-swarm { font-size: 12px; color: #4488ff; display: block; min-height: 16px; }

/* ===== Tech Tree Overlay ===== */
#techtree-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 36;
    pointer-events: auto;
}
#techtree-box {
    text-align: center;
    color: #f4ecd8;
    font-family: 'Courier New', monospace;
    padding: 30px;
    background: rgba(20,20,40,0.95);
    border: 2px solid #c9a44c;
    border-radius: 12px;
    min-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
}
#techtree-box h2 { font-size: 24px; color: #c9a44c; margin-bottom: 8px; }
#techtree-grid { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.techtree-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}
.techtree-icon { font-size: 24px; width: 36px; text-align: center; }
.techtree-label { font-size: 15px; color: #ddd; flex: 1; text-align: left; }
.techtree-level { font-size: 14px; color: #aaa; min-width: 70px; text-align: center; }
.techtree-btn {
    font-size: 14px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    padding: 6px 16px;
    color: #000;
    background: #c9a44c;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    min-width: 90px;
    transition: background 0.15s;
}
.techtree-btn:hover { background: #e0bc60; }
.techtree-btn:disabled { background: #444; color: #888; cursor: not-allowed; }

.techtree-tab {
    font-size: 16px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    padding: 6px 24px;
    color: #888;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.techtree-tab:hover { color: #fff; border-color: #c9a44c; }
.techtree-tab.active { color: #000; background: #c9a44c; border-color: #c9a44c; }

/* ===== Menu Scene Styles (Phaser drawn, no DOM needed) ===== */
