/* --- 基础定标与配色 --- */
:root {
    --neon-blue: #00f2ff;
    --neon-yellow: #f4ff40;
    --neon-red: #ff3c3c;
    --bg-dark: #050a10;
    --panel-alpha: rgba(10, 20, 30, 0.85);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; /* 防止频繁点击导致文字被选中 */
}

body {
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

/* --- 主容器：严格 1356x768 --- */
#game-container {
    width: 1356px;
    height: 768px;
    position: relative;
    background: var(--bg-dark);
    border: 2px solid #224466;
    overflow: hidden;
}

/* --- 分层系统 --- */
.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 背景层：支持跃迁滤镜动画 */
#bg-layer {
    background-size: cover;
    background-position: center;
    transition: filter 0.8s ease, transform 0.8s ease;
    z-index: 1;
}

/* 实体层：子弹与怪物 */
#entities-container {
    z-index: 5;
    pointer-events: none; /* 穿透点击，让 game-container 接收鼠标事件 */
}

/* 驾驶舱层 */
#cockpit-layer {
    background: url('cockpit.png') no-repeat center center;
    background-size: contain;
    z-index: 10;
    pointer-events: none;
    opacity: 0.8;
}

/* 视觉特效：受伤红光 */
#vignette-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 15;
    pointer-events: none;
    transition: background 0.3s;
}

/* --- HUD UI 部分 --- */
#top-hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 40px;
    z-index: 20;
}

.stat-group {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-shadow: 0 0 5px #000;
}

.label { font-weight: bold; width: 30px; }

.bar-bg {
    width: 200px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #446688;
    overflow: hidden;
}

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

#hp-fill { background: linear-gradient(90deg, #ff3c3c, #ff7b7b); }
#en-fill { background: linear-gradient(90deg, #00f2ff, #7bfaff); }

.currency {
    margin-left: auto;
    font-size: 24px;
    color: var(--neon-yellow);
    font-weight: bold;
}

/* --- 武器槽位 --- */
#bottom-slots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 20;
}

.slot-box {
    width: 160px;
    height: 60px;
    background: var(--panel-alpha);
    border: 2px solid #224466;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    transition: all 0.2s;
}

.slot-box:hover {
    border-color: var(--neon-blue);
    background: rgba(0, 242, 255, 0.1);
}

.slot-content { font-size: 14px; text-align: center; }

kbd {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #446688;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 3px;
}

/* --- 导航菜单 --- */
#nav-menu {
    position: absolute;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
}

#nav-menu button {
    padding: 8px 15px;
    background: var(--panel-alpha);
    color: var(--neon-blue);
    border: 1px solid var(--neon-blue);
    cursor: pointer;
}

#nav-menu button:hover { background: var(--neon-blue); color: #000; }

/* --- 实体样式 --- */
.entity {
    position: absolute;
    width: 64px;
    height: 64px;
    background-size: contain;
    background-repeat: no-repeat;
    transition: transform 0.016s linear;
}

.entity.monster { background-image: url('monster.png'); }
.entity.ore { background-image: url('ore_big.png'); }

.hp-bar-mini {
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0,0,0,0.5);
}

.hp-bar-mini .fill {
    height: 100%;
    background: var(--neon-red);
    width: 100%;
}

.bullet {
    position: absolute;
    font-size: 20px;
    transform-origin: center;
}

/* --- 商店覆盖层 --- */
.overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.hidden { display: none !important; }

.shop-window {
    width: 900px;
    height: 600px;
    background: #0a141e;
    border: 1px solid var(--neon-blue);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    color: var(--neon-blue);
    border-bottom: 1px solid #224466;
    padding-bottom: 10px;
}

.shop-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding-right: 10px;
}

/* 商店列表滚动条 */
.shop-grid::-webkit-scrollbar { width: 6px; }
.shop-grid::-webkit-scrollbar-thumb { background: var(--neon-blue); }

.shop-item {
    background: rgba(255,255,255,0.05);
    border: 1px solid #224466;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.shop-item.active { border-color: var(--neon-yellow); background: rgba(244, 255, 64, 0.05); }

.item-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.item-icon { font-size: 24px; }
.item-title { font-weight: bold; color: #fff; }
.item-desc { font-size: 12px; color: #aaa; margin-bottom: 10px; }
.item-stats { font-size: 11px; color: var(--neon-blue); font-family: monospace; }

.item-actions { display: flex; gap: 10px; margin-top: 10px; }
.item-actions button {
    flex: 1;
    padding: 5px;
    font-size: 12px;
    cursor: pointer;
    background: transparent;
    border: 1px solid;
}

.btn-buy { color: var(--neon-yellow); border-color: var(--neon-yellow) !important; }
.btn-upgrade { color: var(--neon-blue); border-color: var(--neon-blue) !important; }
.btn-equip { color: #fff; border-color: #fff !important; }
.btn-equip.disabled { opacity: 0.3; cursor: not-allowed; }

/* 死亡/爆炸动画 */
.exploding {
    filter: brightness(3) saturate(2);
    transform: scale(1.5);
    opacity: 0;
    transition: all 0.3s;
}