/* ==========================================================================
   ZOMBIE CRISIS - 2.5D TOP-DOWN (BOXHEAD / 经典僵尸危机) STYLESHEET
   ========================================================================== */

:root {
    --bg-dark: #12141a;
    --panel-bg: rgba(18, 22, 32, 0.92);
    --panel-border: rgba(255, 255, 255, 0.15);
    --accent-red: #ef4444;
    --accent-gold: #facc15;
    --accent-blue: #38bdf8;
    --accent-green: #22c55e;
    --accent-purple: #c084fc;
    --font-ui: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-ui);
    color: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- MAIN CONTAINER --- */
#game-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    background: #0a0c10;
    overflow: hidden !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    background: #ebdcc4;
}

/* --- TOP RETRO TOOLBAR --- */
#top-toolbar {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 50;
}

.tool-btn {
    width: 36px;
    height: 36px;
    background: rgba(30, 41, 59, 0.8);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 16px;
    font-weight: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    transition: all 0.15s ease;
}

.tool-btn:hover {
    background: rgba(51, 65, 85, 0.95);
    border-color: #fff;
    transform: translateY(-2px);
}

.tool-btn:active {
    transform: scale(0.95);
}

/* --- HUD OVERLAY --- */
#hud-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px 18px;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.hud-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 240px;
}

.hud-bar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    border: 1px solid var(--panel-border);
    padding: 5px 10px;
    border-radius: 4px;
}

.bar-icon {
    font-size: 14px;
}

.bar-track {
    flex: 1;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    transition: width 0.15s ease-out;
}

.hp-fill {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.bar-label {
    font-size: 11px;
    font-weight: 700;
    min-width: 60px;
    text-align: right;
}

.hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin-top: 42px;
}

.hud-wave-badge {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--accent-red);
    padding: 4px 16px;
    border-radius: 14px;
    font-weight: 900;
    font-size: 13px;
    color: #f87171;
    letter-spacing: 1px;
}

.hud-score-badge {
    font-size: 12px;
    font-weight: 700;
    color: #cbd5e1;
}

.hud-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.hud-wallet {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(250, 204, 21, 0.4);
    padding: 5px 12px;
    border-radius: 16px;
}

.hud-wallet-val {
    color: var(--accent-gold);
    font-weight: 800;
    font-size: 14px;
}

.hud-controls-hint {
    font-size: 10px;
    color: #94a3b8;
    background: rgba(0,0,0,0.5);
    padding: 3px 6px;
    border-radius: 4px;
}

/* --- HUD BOTTOM & SEQUENTIAL WEAPON BAR --- */
.hud-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: auto;
}

.hud-weapon-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--panel-border);
    padding: 8px 14px;
    border-radius: 6px;
}

.hud-weapon-icon {
    font-size: 26px;
}

.hud-weapon-name {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    display: block;
}

.hud-ammo-text {
    font-size: 16px;
    font-weight: 900;
    color: var(--accent-blue);
}

.weapon-bar {
    display: flex;
    gap: 6px;
    background: rgba(15, 23, 42, 0.92);
    padding: 6px 8px;
    border-radius: 8px;
    border: 1.5px solid rgba(255,255,255,0.15);
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
}

.weapon-slot {
    position: relative;
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.weapon-slot.unlocked:hover, .weapon-slot.unlocked.active {
    background: rgba(56, 189, 248, 0.25);
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px var(--accent-blue);
    transform: translateY(-3px);
}

.weapon-slot.locked {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.08);
    opacity: 0.75;
    cursor: not-allowed;
}

.slot-num {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 9px;
    font-weight: 800;
    color: #94a3b8;
}

.slot-locked-icon {
    font-size: 14px;
    margin-top: -2px;
}

.slot-progress {
    font-size: 8px;
    font-weight: 800;
    color: #f59e0b;
    margin-top: 1px;
}

/* ==========================================================================
   CLASSIC TOUCH CONTROLS
   ========================================================================== */
#touch-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: block;
}

.touch-side-left-extra {
    position: absolute;
    top: 300px;
    left: 20px;
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.touch-side-right-extra {
    position: absolute;
    top: 300px;
    right: 20px;
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.t-btn-pill {
    background: rgba(30, 41, 59, 0.8);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: #f1f5f9;
    font-size: 11px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.t-btn-pill:active {
    background: rgba(56, 189, 248, 0.4);
}

.dpad-container {
    position: absolute;
    bottom: 50px;
    left: 40px;
    width: 140px;
    height: 140px;
    pointer-events: auto;
}

.dpad-btn {
    position: absolute;
    width: 44px;
    height: 44px;
    background: rgba(30, 41, 59, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: #f1f5f9;
    font-size: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 4px;
    touch-action: manipulation;
}

.dpad-btn:active {
    background: rgba(56, 189, 248, 0.5);
    border-color: #fff;
}

.dpad-up { top: 0; left: 48px; }
.dpad-down { bottom: 0; left: 48px; }
.dpad-left { top: 48px; left: 0; }
.dpad-right { top: 48px; right: 0; }
.dpad-center {
    position: absolute;
    top: 48px;
    left: 48px;
    width: 44px;
    height: 44px;
    background: rgba(30, 41, 59, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
}

.action-cluster {
    position: absolute;
    bottom: 40px;
    right: 40px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    pointer-events: auto;
}

.action-row {
    display: flex;
    gap: 8px;
}

.t-act-btn {
    width: 52px;
    height: 52px;
    background: rgba(30, 41, 59, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #f1f5f9;
    font-size: 15px;
    font-weight: 900;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    touch-action: manipulation;
}

.t-act-btn.small-btn {
    width: 46px;
    height: 46px;
    font-size: 11px;
    border-radius: 23px;
}

.t-act-btn.main-fire {
    background: rgba(239, 68, 68, 0.5);
    border-color: #ef4444;
}

.t-act-btn:active {
    background: rgba(56, 189, 248, 0.5);
    border-color: #fff;
    transform: scale(0.92);
}

/* --- MODAL DIALOGS --- */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 22, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}

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

.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 24px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.game-logo {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #ef4444;
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
    text-align: center;
}

.game-tagline {
    font-size: 12px;
    color: var(--accent-blue);
    text-align: center;
    margin-top: -8px;
    margin-bottom: 12px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 800;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-primary { background: #ef4444; color: #fff; }
.btn-primary:hover { background: #dc2626; transform: translateY(-2px); }

.btn-secondary { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--panel-border); color: #fff; }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.16); transform: translateY(-2px); }

.btn-gold { background: #facc15; color: #111; }

.btn-close-modal {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
}

.item-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
}

.arsenal-card, .talent-card, .skin-card, .achieve-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.arsenal-header { display: flex; align-items: center; gap: 10px; }
.arsenal-icon { font-size: 24px; }
.arsenal-name, .talent-title, .skin-name, .achieve-title { font-size: 14px; font-weight: 800; }
.arsenal-desc, .talent-desc, .skin-bonus, .achieve-desc { font-size: 11px; color: #94a3b8; }

#toast-msg {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--accent-blue);
    color: #fff;
    padding: 8px 20px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 800;
    z-index: 200;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

#toast-msg.hidden { display: none; }

/* Retro Glowing Buttons for Game Over & Modals */
.btn-ad-revive {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
    color: #ffffff !important;
    border: 1.5px solid #60a5fa !important;
    border-radius: 10px !important;
    padding: 12px 20px !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4) !important;
    transition: all 0.2s ease !important;
    width: 100% !important;
    margin-bottom: 8px !important;
}
.btn-ad-revive:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6) !important;
}

.btn-menu-sub {
    background: rgba(30, 41, 59, 0.8) !important;
    color: #e2e8f0 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    padding: 10px 18px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.btn-menu-sub:hover {
    background: rgba(51, 65, 85, 0.9) !important;
    border-color: #38bdf8 !important;
    color: #38bdf8 !important;
}
