/* === 全局 === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #000;
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* === 顶部信息栏 === */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    color: #e8d5a0;
    font-size: 14px;
    z-index: 100;
    pointer-events: none;
}

.game-title {
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(200,160,60,0.6);
    letter-spacing: 2px;
}

.top-center {
    display: flex;
    gap: 24px;
    font-size: 15px;
}

.top-center strong {
    color: #ff6b4a;
    font-size: 18px;
}

.top-right strong {
    color: #5b9bd5;
}

/* === 选中面板 === */
#selection-panel {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.92);
    border: 1px solid #5b9bd5;
    border-radius: 8px;
    padding: 12px 18px;
    color: #ccc;
    font-size: 13px;
    z-index: 100;
    min-width: 200px;
}

#selection-panel.hidden {
    display: none;
}

#selection-title {
    color: #5b9bd5;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
}

#selection-detail {
    color: #e8d5a0;
    line-height: 1.6;
}

#selection-stats {
    margin-top: 6px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-chip {
    background: rgba(91,155,213,0.2);
    border: 1px solid rgba(91,155,213,0.4);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    color: #5b9bd5;
}

/* === 命令面板 === */
#command-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 100;
}

.cmd-btn {
    width: 140px;
    padding: 10px 14px;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    font-family: inherit;
}

.cmd-btn:hover {
    background: rgba(40, 40, 40, 0.9);
    border-color: #5b9bd5;
    color: #fff;
}

.cmd-btn.active {
    background: rgba(91,155,213,0.25);
    border-color: #5b9bd5;
    color: #5b9bd5;
    box-shadow: 0 0 8px rgba(91,155,213,0.3);
}

/* === 小地图 === */
#minimap-container {
    position: fixed;
    top: 58px;
    left: 16px;
    width: 180px;
    height: 180px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    overflow: hidden;
}

#minimap {
    width: 100%;
    height: 100%;
}

/* === 提示 === */
#tooltip {
    position: fixed;
    padding: 6px 12px;
    background: rgba(0,0,0,0.85);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    pointer-events: none;
    z-index: 200;
    display: none;
    white-space: nowrap;
}

/* === 游戏结束 === */
#game-over-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#game-over-screen.hidden {
    display: none;
}

#game-over-content {
    text-align: center;
    color: #e8d5a0;
    max-width: 420px;
    padding: 40px;
    background: rgba(20,20,20,0.95);
    border: 1px solid rgba(200,160,60,0.4);
    border-radius: 12px;
}

#game-over-content h1 {
    font-size: 36px;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(200,120,40,0.6);
}

#game-over-content .victory { color: #ffd700; }
#game-over-content .defeat { color: #ff4444; }

#game-over-subtitle {
    font-size: 16px;
    margin-bottom: 24px;
    color: #aaa;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 16px;
}

.stat-row span:last-child {
    color: #ff6b4a;
    font-weight: bold;
}

#restart-btn {
    margin-top: 24px;
    padding: 12px 32px;
    background: #8b4513;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

#restart-btn:hover {
    background: #a0522d;
}

/* === 击杀提示 === */
#kill-feed {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 150;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
}

.kill-msg {
    padding: 4px 10px;
    background: rgba(255,60,30,0.15);
    border-left: 3px solid #ff3c1e;
    color: #ffa090;
    font-size: 12px;
    animation: killFade 2.5s forwards;
}

@keyframes killFade {
    0%   { opacity: 1; transform: translateX(0); }
    70%  { opacity: 0.8; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(30px); }
}

/* === 波次公告 === */
#wave-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    pointer-events: none;
    text-align: center;
    animation: waveBanner 3s forwards;
}

#wave-banner.hidden {
    display: none;
}

#wave-banner-text {
    font-size: 40px;
    font-weight: bold;
    color: #ff4444;
    text-shadow: 0 0 30px rgba(255,60,30,0.8), 0 0 60px rgba(255,60,30,0.4);
    letter-spacing: 4px;
}

@keyframes waveBanner {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    25%  { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
    80%  { opacity: 0.8; transform: translate(-50%, -50%) scale(1.0); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

/* === 框选矩形 === */
#selection-box {
    position: fixed;
    border: 1px solid #5b9bd5;
    background: rgba(91,155,213,0.15);
    pointer-events: none;
    z-index: 300;
    display: none;
}

/* === 响应式 === */
@media (max-width: 768px) {
    #command-panel {
        bottom: 10px;
        right: 8px;
        gap: 3px;
    }
    .cmd-btn {
        width: 110px;
        padding: 8px 10px;
        font-size: 11px;
    }
    #minimap-container {
        width: 120px;
        height: 120px;
    }
    #minimap {
        width: 100%;
        height: 100%;
    }
}
