:root {
    /* 霓虹、赛博朋克与废土配色系统 */
    --bg-dark: #080706; /* 偏红土沙黄色调的黑夜 */
    --card-bg: rgba(22, 18, 14, 0.72); /* 废弃工厂机械锈蚀毛玻璃 */
    --card-border: rgba(255, 170, 0, 0.2); /* 琥珀金边框 */
    --omega-cyan: #00f3ff;
    --alpha-orange: #ff5500;
    --amber-gold: #ffaa00; /* 废土科技琥珀色 */
    --crystal-green: #39ff14;
    --hud-red: #ff2255;
    --text-primary: #fff7e6; /* 温暖沙色文字 */
    --text-muted: rgba(255, 247, 230, 0.6);
    --glow-cyan: 0 0 10px rgba(0, 243, 255, 0.5), 0 0 20px rgba(0, 243, 255, 0.2);
    --glow-orange: 0 0 10px rgba(255, 85, 0, 0.5), 0 0 20px rgba(255, 85, 0, 0.2);
    --glow-amber: 0 0 10px rgba(255, 170, 0, 0.5), 0 0 20px rgba(255, 170, 0, 0.2);
    --glow-green: 0 0 10px rgba(57, 255, 20, 0.5), 0 0 20px rgba(57, 255, 20, 0.2);
}

/* 全局重置与排版 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--text-primary);
}

canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* 电影黑框 (只在特定剧情模式下激活) */
.cinematic-bar {
    position: absolute;
    left: 0;
    width: 100%;
    height: 0%;
    background-color: #000;
    z-index: 10;
    transition: height 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}
#cinematic-top { top: 0; border-bottom: 1px solid rgba(0, 243, 255, 0.1); }
#cinematic-bottom { bottom: 0; border-top: 1px solid rgba(0, 243, 255, 0.1); }

body.cinematic-mode #cinematic-top,
body.cinematic-mode #cinematic-bottom {
    height: 8vh;
}

/* ==========================================================================
   Overlay Panels (Start Screen, Chapter Select, Upgrade, GameOver)
   ========================================================================== */
.overlay-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(2, 4, 8, 0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overlay-panel.active {
    opacity: 1;
    pointer-events: auto;
}

/* 毛玻璃科幻卡片 */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.7), 
                inset 0 0 20px rgba(0, 243, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    border-top: 2px solid rgba(0, 243, 255, 0.4);
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay-panel.active .glass-card {
    transform: scale(1);
}

.glass-card.wide-card {
    max-width: 900px;
}

.glass-card.upgrade-card {
    max-width: 650px;
}

/* 科幻字体标题与扫描效果 */
.neon-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 6px;
    color: var(--omega-cyan);
    text-shadow: var(--glow-cyan);
    margin-bottom: 5px;
    position: relative;
}

.neon-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text-primary);
    margin-bottom: 25px;
    opacity: 0.9;
}

.story-teaser {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* 霓虹按钮 */
.neon-btn {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 1.5px;
    color: #fff;
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.3), rgba(0, 100, 255, 0.3));
    border: 1px solid var(--omega-cyan);
    border-radius: 6px;
    padding: 14px 28px;
    cursor: pointer;
    box-shadow: var(--glow-cyan);
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 20px;
    outline: none;
}

.neon-btn:hover {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.6), rgba(0, 100, 255, 0.6));
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.8), 0 0 30px rgba(0, 243, 255, 0.4);
    transform: translateY(-2px);
}

.neon-btn:active {
    transform: translateY(1px);
}

.neon-btn-secondary {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: var(--omega-cyan);
    background: transparent;
    border: 1px solid rgba(0, 243, 255, 0.4);
    border-radius: 6px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.neon-btn-secondary:hover {
    border-color: var(--omega-cyan);
    background-color: rgba(0, 243, 255, 0.08);
    box-shadow: var(--glow-cyan);
}

/* 操作说明面板 */
.controls-guide {
    text-align: left;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(0, 243, 255, 0.05);
}

.controls-guide h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: var(--omega-cyan);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.controls-guide ul {
    list-style: none;
}

.controls-guide li {
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.controls-guide li span {
    font-family: 'Orbitron', sans-serif;
    color: var(--text-primary);
    font-weight: 600;
}

/* ==========================================================================
   关卡选择界面
   ========================================================================== */
.neon-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.2rem;
    letter-spacing: 3px;
    color: var(--omega-cyan);
    text-shadow: var(--glow-cyan);
    margin-bottom: 30px;
}

.chapters-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.chapter-card {
    background: rgba(5, 10, 20, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 24px;
    text-align: left;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chapter-card.active {
    border-color: rgba(0, 243, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0, 243, 255, 0.05);
}

.chapter-card.active:hover {
    border-color: var(--omega-cyan);
    box-shadow: var(--glow-cyan);
    transform: translateY(-5px);
}

.chapter-card.locked {
    opacity: 0.4;
    background: rgba(2, 4, 8, 0.9);
    cursor: not-allowed;
}

.chapter-num {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.chapter-card.active .chapter-num {
    color: var(--omega-cyan);
}

.chapter-card h3 {
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.chapter-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex-grow: 1;
    margin-bottom: 20px;
}

.chapter-reward {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    color: var(--crystal-green);
    text-shadow: 0 0 5px rgba(57, 255, 20, 0.2);
    margin-bottom: 15px;
}

.chapter-btn {
    font-family: 'Orbitron', sans-serif;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.chapter-card.active .chapter-btn {
    background: rgba(0, 243, 255, 0.1);
    border-color: rgba(0, 243, 255, 0.5);
    color: var(--omega-cyan);
}

.chapter-card.active .chapter-btn:hover {
    background: var(--omega-cyan);
    color: #000;
    box-shadow: var(--glow-cyan);
}

.chapter-card.locked .chapter-btn {
    cursor: not-allowed;
}

.menu-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 25px;
}

.crystals-indicator {
    font-size: 1rem;
}

.crystal-num {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    color: var(--crystal-green);
    text-shadow: var(--glow-green);
}

/* ==========================================================================
   升级商店 (Hangar Upgrade)
   ========================================================================== */
.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: -20px;
    margin-bottom: 30px;
}

.upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    text-align: left;
}

.upgrade-item {
    background: rgba(5, 10, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s;
}

.upgrade-item:hover {
    border-color: rgba(0, 243, 255, 0.2);
}

.upg-info {
    max-width: 70%;
}

.upg-name {
    font-family: 'Orbitron', sans-serif;
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upg-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.upg-action {
    display: flex;
    align-items: center;
    gap: 15px;
}

.upg-level {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: var(--omega-cyan);
    font-weight: 600;
}

.upg-btn {
    font-family: 'Orbitron', sans-serif;
    background: rgba(57, 255, 20, 0.1);
    border: 1px solid rgba(57, 255, 20, 0.4);
    color: var(--crystal-green);
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(57, 255, 20, 0.1);
    transition: all 0.2s;
}

.upg-btn:hover {
    background: var(--crystal-green);
    color: #000;
    box-shadow: var(--glow-green);
}

.upg-btn:disabled {
    opacity: 0.3;
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    background: transparent;
    cursor: not-allowed;
    box-shadow: none;
}

/* ==========================================================================
   战斗 HUD (Visor Overlay)
   ========================================================================== */
#game-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none; /* HUD 不遮挡鼠标控制 */
    opacity: 0;
    transition: opacity 0.5s ease;
}

body.playing-mode #game-hud {
    opacity: 1;
}

/* 十字准星 */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.ch-line {
    position: absolute;
    background-color: var(--omega-cyan);
    opacity: 0.8;
}

.ch-top { top: 0; left: 19px; width: 2px; height: 10px; }
.ch-bottom { bottom: 0; left: 19px; width: 2px; height: 10px; }
.ch-left { left: 0; top: 19px; width: 10px; height: 2px; }
.ch-right { right: 0; top: 19px; width: 10px; height: 2px; }

.ch-dot {
    position: absolute;
    top: 18px;
    left: 18px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--omega-cyan);
    box-shadow: var(--glow-cyan);
}

/* 击中标记 X */
#hitmarker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.05s ease;
}

#hitmarker::before, #hitmarker::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 14px;
    background-color: var(--crystal-green);
    box-shadow: var(--glow-green);
    top: 13px;
    left: 19px;
}
#hitmarker::before { transform: rotate(45deg); }
#hitmarker::after { transform: rotate(-45deg); }

#hitmarker.active {
    opacity: 1;
}

/* 科幻头盔左右边界遮罩线 */
.visor-line {
    position: absolute;
    top: 10%;
    height: 80%;
    width: 40px;
    border: 2px solid rgba(0, 243, 255, 0.08);
    opacity: 0.7;
}

.left-visor {
    left: 4%;
    border-right: none;
    border-radius: 30px 0 0 30px;
    box-shadow: -5px 0 15px rgba(0, 243, 255, 0.02);
}

.right-visor {
    right: 4%;
    border-left: none;
    border-radius: 0 30px 30px 0;
    box-shadow: 5px 0 15px rgba(0, 243, 255, 0.02);
}

/* HUD 基础填充条 */
.bar-container {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 12px;
    border-radius: 3px;
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

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

.cyan-fill { background-color: var(--omega-cyan); }
.green-fill { background-color: var(--crystal-green); }
.red-fill { background-color: var(--hud-red); }

.cyan-glow-bar { border-color: rgba(0, 243, 255, 0.3); }
.green-glow-bar { border-color: rgba(57, 255, 20, 0.3); }
.red-glow-bar { border-color: rgba(255, 34, 85, 0.3); }

.cyan-fill { box-shadow: 0 0 8px var(--omega-cyan); }
.green-fill { box-shadow: 0 0 8px var(--crystal-green); }
.red-fill { box-shadow: 0 0 8px var(--hud-red); }

/* 守护目标 HUD (顶部偏下) */
#harvester-hud {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    background: rgba(10, 5, 5, 0.7);
    border: 1px solid rgba(255, 34, 85, 0.3);
    border-radius: 6px;
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    box-shadow: 0 0 15px rgba(255, 34, 85, 0.1);
    z-index: 6;
}

#harvester-hud.hidden {
    display: none;
}

.hud-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--hud-red);
    text-shadow: 0 0 4px rgba(255, 34, 85, 0.4);
    font-weight: 700;
}

.hud-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--hud-red);
}

/* 玩家状态 HUD (左下) */
#player-status-hud {
    position: absolute;
    bottom: 5%;
    left: 5%;
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(2, 6, 12, 0.65);
    border: 1px solid rgba(0, 243, 255, 0.1);
    padding: 15px;
    border-radius: 6px;
    backdrop-filter: blur(8px);
}

.hud-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-lbl {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    width: 50px;
    opacity: 0.8;
}

.stat-num {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    width: 30px;
    text-align: right;
}

#player-status-hud .hud-row:first-child .stat-lbl,
#player-status-hud .hud-row:first-child .stat-num {
    color: var(--omega-cyan);
}

#player-status-hud .hud-row:nth-child(2) .stat-lbl,
#player-status-hud .hud-row:nth-child(2) .stat-num {
    color: var(--crystal-green);
}

/* 武器/水晶 HUD (右下) */
#weapon-crystals-hud {
    position: absolute;
    bottom: 5%;
    right: 5%;
    width: 230px;
    background: rgba(2, 6, 12, 0.65);
    border: 1px solid rgba(0, 243, 255, 0.1);
    padding: 15px;
    border-radius: 6px;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crystal-hud-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.hud-crystal-value {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    color: var(--crystal-green);
}

.weapon-hud-row {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.ammo-info {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--omega-cyan);
    text-shadow: var(--glow-cyan);
}

.ammo-max {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

.ammo-lbl {
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: -2px;
}

#reload-indicator {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--hud-red);
    text-align: center;
    letter-spacing: 1px;
    animation: pulse-red 1s infinite alternate;
    display: none;
}

#reload-indicator.active {
    display: block;
}

/* 顶端章节及进度 */
#objective-hud {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    background: rgba(2, 6, 12, 0.5);
    border: 1px solid rgba(0, 243, 255, 0.05);
    padding: 10px 30px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

#objective-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 1px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

#objective-progress {
    font-size: 0.75rem;
    color: var(--omega-cyan);
}

#progress-val {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
}

/* 受击闪红 */
#damage-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 100px rgba(255, 34, 85, 0);
    pointer-events: none;
    z-index: 4;
    transition: box-shadow 0.05s ease-out;
}

#damage-flash.active {
    box-shadow: inset 0 0 100px rgba(255, 34, 85, 0.75);
}

/* 慢动作蓝色调 */
#slowmo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 243, 255, 0);
    pointer-events: none;
    z-index: 3;
    transition: background-color 0.3s ease;
}

#slowmo-overlay.active {
    background-color: rgba(0, 100, 255, 0.08);
}

/* ==========================================================================
   剧情无线电对话 Overlay (Dialogue UI)
   ========================================================================== */
#story-overlay {
    position: absolute;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 900px;
    z-index: 25;
    pointer-events: auto;
    opacity: 0;
    display: none;
    transition: opacity 0.3s ease;
}

#story-overlay.active {
    display: block;
    opacity: 1;
}

.dialogue-box {
    background: rgba(5, 8, 15, 0.85);
    border: 1px solid rgba(0, 243, 255, 0.25);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8),
                0 0 20px rgba(0, 243, 255, 0.08);
    backdrop-filter: blur(16px);
    padding: 25px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 25px;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.dialogue-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--omega-cyan), transparent);
}

.speaker-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    transition: all 0.3s;
}

.speaker-avatar.hidden {
    display: none;
}

.avatar-glow {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #111;
    border: 2px solid;
    position: relative;
    margin-bottom: 8px;
    background-size: cover;
    background-position: center;
}

/* 欧米伽指挥官头像占位矢量设计 */
.left-avatar .avatar-glow {
    border-color: var(--omega-cyan);
    box-shadow: var(--glow-cyan);
    background-image: radial-gradient(circle, rgba(0, 243, 255, 0.1) 20%, rgba(2, 6, 12, 0.9) 100%),
                      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 20c-11 0-20 9-20 20 0 14 20 40 20 40s20-26 20-40c0-11-9-20-20-20zm0 30c-5.5 0-10-4.5-10-10s4.5-10 10-10 10 4.5 10 10-4.5 10-10 10z' fill='%2300f3ff'/%3E%3C/svg%3E");
}

/* 阿尔法将军头像占位矢量设计 */
.right-avatar .avatar-glow {
    border-color: var(--alpha-orange);
    box-shadow: var(--glow-orange);
    background-image: radial-gradient(circle, rgba(255, 85, 0, 0.1) 20%, rgba(2, 6, 12, 0.9) 100%),
                      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 15L25 35v30l25 20 25-20V35L50 15zm0 15c8.3 0 15 6.7 15 15s-6.7 15-15 15-15-6.7-15-15 6.7-15 15-15z' fill='%23ff5500'/%3E%3C/svg%3E");
}

.avatar-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
}

.avatar-tag {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    opacity: 0.6;
    margin-top: 2px;
}

.left-avatar .avatar-tag { color: var(--omega-cyan); }
.right-avatar .avatar-tag { color: var(--alpha-orange); }

/* 对话正文 */
.dialogue-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.speaker-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    color: var(--omega-cyan);
}

.dialogue-box.alpha-speaking .speaker-title {
    color: var(--alpha-orange);
}

#dialogue-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    min-height: 50px;
}

/* 示波电波线条 */
.wave-lines {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 10px;
    margin-top: 10px;
    opacity: 0.5;
}

.wline {
    width: 2px;
    background-color: var(--omega-cyan);
    border-radius: 1px;
}

.dialogue-box.alpha-speaking .wline {
    background-color: var(--alpha-orange);
}

.w1 { height: 4px; animation: scale-y 0.6s infinite alternate; }
.w2 { height: 10px; animation: scale-y 0.4s infinite alternate 0.1s; }
.w3 { height: 6px; animation: scale-y 0.8s infinite alternate 0.2s; }
.w4 { height: 12px; animation: scale-y 0.3s infinite alternate 0.15s; }
.w5 { height: 5px; animation: scale-y 0.5s infinite alternate 0.05s; }

.dialogue-footer {
    grid-column: 1 / 4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 12px;
    font-size: 0.75rem;
}

.dialogue-tip {
    color: var(--text-muted);
}

.btn-skip {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    transition: color 0.2s;
    outline: none;
}

.btn-skip:hover {
    color: var(--hud-red);
    text-shadow: 0 0 5px rgba(255, 34, 85, 0.4);
}

/* ==========================================================================
   游戏结算面板
   ========================================================================== */
.result-card {
    max-width: 550px;
}

.result-card h1.neon-title {
    font-size: 3rem;
    color: var(--hud-red);
    text-shadow: 0 0 10px rgba(255, 34, 85, 0.5), 0 0 20px rgba(255, 34, 85, 0.2);
    border-bottom: 1px solid rgba(255, 34, 85, 0.1);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.result-card.victory h1.neon-title {
    color: var(--crystal-green);
    text-shadow: var(--glow-green);
    border-bottom: 1px solid rgba(57, 255, 20, 0.15);
}

.result-msg {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 25px;
    color: var(--text-primary);
}

.stats-summary {
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-line {
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.stat-line span {
    font-family: 'Orbitron', sans-serif;
    color: var(--text-primary);
    font-weight: 600;
}

.result-buttons {
    display: flex;
    gap: 15px;
}

.result-buttons button {
    flex: 1;
    margin-bottom: 0;
}

/* ==========================================================================
   CSS 关键帧动画
   ========================================================================== */
@keyframes pulse-red {
    from { opacity: 0.4; text-shadow: 0 0 2px rgba(255, 34, 85, 0.2); }
    to { opacity: 1; text-shadow: 0 0 12px rgba(255, 34, 85, 0.8), 0 0 24px rgba(255, 34, 85, 0.4); }
}

@keyframes scale-y {
    from { transform: scaleY(0.4); }
    to { transform: scaleY(1.3); }
}

/* 呼吸灯头像光效 */
.cyan-pulse {
    animation: cyan-breathe 2s infinite alternate;
}

.orange-pulse {
    animation: orange-breathe 2s infinite alternate;
}

@keyframes cyan-breathe {
    from { box-shadow: 0 0 5px rgba(0, 243, 255, 0.2); border-color: rgba(0, 243, 255, 0.4); }
    to { box-shadow: 0 0 15px rgba(0, 243, 255, 0.6); border-color: rgba(0, 243, 255, 1); }
}

@keyframes orange-breathe {
    from { box-shadow: 0 0 5px rgba(255, 85, 0, 0.2); border-color: rgba(255, 85, 0, 0.4); }
    to { box-shadow: 0 0 15px rgba(255, 85, 0, 0.6); border-color: rgba(255, 85, 0, 1); }
}

/* ==========================================================================
   波次警告横幅样式
   ========================================================================== */
#warning-banner {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(255, 34, 85, 0.12);
    border-top: 2px solid var(--hud-red);
    border-bottom: 2px solid var(--hud-red);
    padding: 18px 50px;
    color: var(--text-primary);
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    z-index: 8;
    backdrop-filter: blur(12px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#warning-banner.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 35px rgba(255, 34, 85, 0.2), inset 0 0 15px rgba(255, 34, 85, 0.05);
}

.warn-title {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 5px;
    color: var(--hud-red);
    text-shadow: 0 0 12px rgba(255, 34, 85, 0.6);
    margin-bottom: 5px;
}

.warn-desc {
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    color: var(--text-primary);
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
}

/* 琥珀色面板高亮类，用于废土科技氛围 */
.amber-text {
    color: var(--amber-gold) !important;
    text-shadow: var(--glow-amber) !important;
}
.amber-border {
    border-color: rgba(255, 170, 0, 0.4) !important;
}
.amber-fill {
    background-color: var(--amber-gold) !important;
    box-shadow: 0 0 8px var(--amber-gold) !important;
}
.amber-glow-bar {
    border-color: rgba(255, 170, 0, 0.3) !important;
}

/* ==========================================================================
   电影级头盔面罩滤镜特效 (#visor-effects)
   ========================================================================== */
#visor-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4; /* 置于 canvas 上层，但低于 HUD 文字与交互面板 */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

/* 只有在战斗模式下 (body.playing-mode) 才激活滤镜 */
body.playing-mode #visor-effects {
    opacity: 1;
}

/* 1. 战术面罩边缘暗角与偏光镜玻璃反光 */
.visor-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 渐变暗角：中心透明 -> 地平线尘土橙红过渡 -> 边缘深邃黑 */
    background: radial-gradient(circle, rgba(0,0,0,0) 45%, rgba(40, 20, 8, 0.45) 82%, rgba(5, 3, 2, 0.92) 100%);
    mix-blend-mode: multiply;
}

/* 面罩玻璃对角高亮反射 */
.visor-vignette::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.04) 0%, 
        rgba(255, 255, 255, 0) 30%, 
        rgba(255, 255, 255, 0) 70%, 
        rgba(255, 255, 255, 0.02) 100%
    );
    pointer-events: none;
}

/* 2. CRT/全息显示电子微扫描线 (3px 极细间距，透明度极小以保真) */
.visor-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0) 0px,
        rgba(0, 0, 0, 0) 1.5px,
        rgba(0, 243, 255, 0.028) 2px,
        rgba(0, 0, 0, 0) 3px
    );
}

/* 3. 程序化动态胶片噪点/电磁杂波 */
.visor-noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.038; /* 极轻微的微小杂点，提供质感但不影响清晰度 */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    animation: grain-shift 0.7s steps(6) infinite;
}

/* 噪点帧平移，形成噪点跳动 */
@keyframes grain-shift {
    0%, 100% { background-position: 0 0; }
    20% { background-position: 80px 40px; }
    40% { background-position: -40px 80px; }
    60% { background-position: 120px -80px; }
    80% { background-position: -120px 40px; }
}

/* ==========================================================================
   战术雷达小地图 (Tactical Minimap CSS)
   ========================================================================== */
#minimap-container {
    position: absolute;
    top: 4%;
    right: 4%;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(2, 6, 12, 0.65);
    border: 1.5px solid var(--omega-cyan);
    box-shadow: var(--glow-cyan), inset 0 0 12px rgba(0, 243, 255, 0.12);
    backdrop-filter: blur(8px);
    z-index: 6;
    pointer-events: none; /* HUD 不遮挡鼠标控制 */
}

#minimap-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
}

/* ==========================================================================
   手机虚拟摇杆与动作按钮 (Mobile Controls CSS)
   ========================================================================== */
#mobile-controls {
    display: none; /* 默认隐藏，仅在触屏设备上通过 .touch-device 激活 */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* 允许未触及按钮区域的点击/拖拽穿透到底层进行视角操作 */
}

/* 触控设备激活状态 */
body.touch-device #mobile-controls {
    display: block;
}

/* 虚拟摇杆底座 */
#joystick-container {
    position: absolute;
    bottom: 8%;
    left: 8%;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(2, 6, 12, 0.5);
    border: 2px solid rgba(0, 243, 255, 0.25);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.05), inset 0 0 10px rgba(0, 243, 255, 0.08);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto; /* 允许触摸 */
    touch-action: none;
}

/* 虚拟摇杆操纵杆 (Thumb) */
#joystick-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 243, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--glow-cyan);
    transition: transform 0.05s ease-out;
}

/* 动作按钮布局 */
#mobile-action-buttons {
    position: absolute;
    bottom: 8%;
    right: 8%;
    display: grid;
    grid-template-areas: 
        "reload jump"
        "shoot shoot";
    gap: 15px;
    align-items: center;
    justify-items: center;
    pointer-events: auto; /* 允许触摸 */
}

/* 动作按钮基础样式 */
.mobile-btn {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(2, 6, 12, 0.6);
    color: var(--text-primary);
    cursor: pointer;
    backdrop-filter: blur(4px);
    touch-action: none;
    font-size: 0.75rem;
    transition: background 0.15s, transform 0.1s;
}

#btn-mobile-reload {
    grid-area: reload;
    border: 1.5px solid var(--amber-gold);
    color: var(--amber-gold);
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.15);
}

#btn-mobile-reload:active {
    background: var(--amber-gold);
    color: #000;
    box-shadow: var(--glow-amber);
    transform: scale(0.92);
}

#btn-mobile-jump {
    grid-area: jump;
    border: 1.5px solid var(--omega-cyan);
    color: var(--omega-cyan);
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.15);
}

#btn-mobile-jump:active {
    background: var(--omega-cyan);
    color: #000;
    box-shadow: var(--glow-cyan);
    transform: scale(0.92);
}

/* 大号红色开火按钮 */
.mobile-btn-fire {
    grid-area: shoot;
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background: rgba(255, 34, 85, 0.15);
    border: 2px solid var(--hud-red);
    box-shadow: 0 0 12px rgba(255, 34, 85, 0.2);
    cursor: pointer;
    touch-action: none;
    position: relative;
    transition: background 0.15s, transform 0.1s;
}

.mobile-btn-fire::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--hud-red);
    box-shadow: var(--glow-red);
}

.mobile-btn-fire:active {
    background: var(--hud-red);
    transform: scale(0.94);
}


