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

body {
    background: #0a0a0f;
    overflow: hidden;
    font-family: 'Courier New', monospace;
    color: #fff;
    user-select: none;
}

canvas {
    display: block;
    cursor: crosshair;
}

/* ===== 屏幕遮罩 ===== */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(10, 10, 15, 0.92);
}

/* ===== 菜单内容 ===== */
.menu-content {
    text-align: center;
    padding: 40px;
}

.game-title {
    font-size: 72px;
    font-weight: 900;
    letter-spacing: 12px;
    background: linear-gradient(135deg, #00f0ff, #ff00e4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(0, 240, 255, 0.3));
    margin-bottom: 10px;
}

.subtitle {
    font-size: 20px;
    letter-spacing: 16px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 30px;
}

.menu-decoration {
    width: 200px;
    height: 2px;
    margin: 0 auto 40px;
    background: linear-gradient(90deg, transparent, #00f0ff, #ff00e4, transparent);
}

/* ===== 霓虹按钮 ===== */
.neon-btn {
    background: transparent;
    border: 2px solid #00f0ff;
    color: #00f0ff;
    font-family: 'Courier New', monospace;
    font-size: 20px;
    padding: 14px 48px;
    cursor: pointer;
    letter-spacing: 4px;
    transition: all 0.3s ease;
    position: relative;
    text-transform: uppercase;
}

.neon-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3), inset 0 0 20px rgba(0, 240, 255, 0.1);
}

.neon-btn:active {
    transform: scale(0.97);
}

/* ===== 控制提示 ===== */
.controls-info {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.35);
}

.controls-info .key {
    color: rgba(0, 240, 255, 0.6);
    font-weight: bold;
    font-size: 13px;
}

/* ===== 游戏结束 ===== */
.gameover-title {
    font-size: 64px;
    font-weight: 900;
    letter-spacing: 8px;
    color: #ff0044;
    text-shadow: 0 0 40px rgba(255, 0, 68, 0.4);
    margin-bottom: 20px;
}

.final-score, .final-wave {
    font-size: 20px;
    margin: 8px 0;
    color: rgba(255, 255, 255, 0.7);
}

.final-score span, .final-wave span {
    color: #00f0ff;
    font-weight: bold;
}

#restart-btn {
    margin-top: 40px;
    border-color: #ff0044;
    color: #ff0044;
}

#restart-btn:hover {
    background: rgba(255, 0, 68, 0.1);
    box-shadow: 0 0 20px rgba(255, 0, 68, 0.3);
}

/* ===== HUD ===== */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 50;
    pointer-events: none;
}

.hud-left, .hud-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hud-left {
    align-items: flex-start;
}

.hud-right {
    align-items: flex-end;
}

/* 血条 */
#health-bar {
    width: 220px;
    height: 22px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

#health-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #00f0ff, #00ff88);
    transition: width 0.3s ease;
}

#health-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: #fff;
    text-shadow: 0 0 4px rgba(0,0,0,0.8);
}

/* 弹药 */
#ammo-display {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
}

#ammo-text {
    font-family: 'Courier New', monospace;
}

/* 得分 */
#score-display {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

#score-text {
    color: #ffcc00;
}

/* 波次 */
#wave-display {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

#wave-text {
    color: #00f0ff;
}

/* 换弹提示 */
#reload-indicator {
    font-size: 14px;
    color: #ffcc00;
    animation: blink 0.6s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== 波次公告 ===== */
.wave-announce {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 900;
    letter-spacing: 8px;
    color: #00f0ff;
    text-shadow: 0 0 40px rgba(0, 240, 255, 0.5);
    z-index: 60;
    pointer-events: none;
    animation: waveIn 2s ease-out forwards;
}

@keyframes waveIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    40% {
        transform: translate(-50%, -50%) scale(1);
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.9);
    }
}

/* 伤害闪红 */
.damage-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.15);
    z-index: 40;
    pointer-events: none;
    animation: flashOut 0.3s ease-out forwards;
}

@keyframes flashOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ===== 移动端专用 ===== */
.mobile-only {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .mobile-only {
        display: block !important;
    }
}

/* 移动端控制按钮 */
#mobile-controls {
    position: fixed;
    bottom: 30px;
    right: 20px;
    display: flex;
    gap: 14px;
    z-index: 80;
    pointer-events: none;
}

.touch-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.15);
    border: 2px solid rgba(0, 240, 255, 0.4);
    color: #00f0ff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: all 0.15s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.touch-btn:active, .touch-btn.active {
    background: rgba(0, 240, 255, 0.35);
    border-color: #00f0ff;
    transform: scale(0.92);
}

#btn-reload {
    border-color: rgba(255, 204, 0, 0.4);
    color: #ffcc00;
    background: rgba(255, 204, 0, 0.1);
}

#btn-reload:active, #btn-reload.active {
    background: rgba(255, 204, 0, 0.3);
    border-color: #ffcc00;
}

#btn-dodge {
    border-color: rgba(0, 255, 136, 0.4);
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}

#btn-dodge:active, #btn-dodge.active {
    background: rgba(0, 255, 136, 0.3);
    border-color: #00ff88;
}

/* 虚拟摇杆光标 */
.joystick-cursor {
    position: fixed;
    pointer-events: none;
    z-index: 70;
    border-radius: 50%;
    border: 2px solid rgba(0, 240, 255, 0.25);
    background: rgba(0, 240, 255, 0.05);
    transform: translate(-50%, -50%);
}

.joystick-cursor .joystick-knob {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.35);
    border: 2px solid rgba(0, 240, 255, 0.5);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.05s ease;
}

/* 移动端 HUD 适配 */
@media (max-width: 480px) {
    #hud {
        padding: 10px 14px;
    }

    #health-bar {
        width: 120px;
        height: 16px;
    }

    #health-text {
        font-size: 10px;
    }

    #ammo-display, #score-display, #wave-display {
        font-size: 12px;
    }

    .game-title {
        font-size: 36px;
        letter-spacing: 6px;
    }

    .subtitle {
        font-size: 14px;
        letter-spacing: 8px;
    }

    .gameover-title {
        font-size: 36px;
    }

    .neon-btn {
        font-size: 16px;
        padding: 12px 32px;
    }

    .menu-content {
        padding: 20px;
    }

    .controls-info {
        font-size: 12px;
    }

    .touch-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    #mobile-controls {
        bottom: 20px;
        right: 14px;
        gap: 10px;
    }
}
