/* ===== 全局重置与基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    color: #fff;
    user-select: none;
}

#game-container {
    position: relative;
    width: 480px;
    height: 720px;
    margin: 0 auto;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 40px rgba(80, 160, 255, 0.4);
    border: 1px solid #1a3a6a;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #000;
    image-rendering: pixelated;
}

/* ===== 覆盖层通用样式 ===== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* ===== 标题 ===== */
.game-title {
    font-size: 52px;
    font-weight: bold;
    letter-spacing: 6px;
    color: #5fc8ff;
    text-shadow:
        0 0 10px #1a7acc,
        0 0 20px #1a7acc,
        0 0 40px #1a7acc;
    margin-bottom: 8px;
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 10px #1a7acc, 0 0 20px #1a7acc; }
    to   { text-shadow: 0 0 15px #5fc8ff, 0 0 30px #5fc8ff, 0 0 60px #1a7acc; }
}

.game-subtitle {
    font-size: 20px;
    color: #a8c8e8;
    letter-spacing: 8px;
    margin-bottom: 50px;
}

h2 {
    font-size: 36px;
    color: #5fc8ff;
    margin-bottom: 30px;
    letter-spacing: 4px;
    text-shadow: 0 0 10px #1a7acc;
}

/* ===== 菜单按钮 ===== */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 30px;
}

.menu-btn {
    width: 200px;
    height: 48px;
    font-size: 18px;
    font-family: inherit;
    color: #dceeff;
    background: linear-gradient(180deg, #0a1a30 0%, #000000 100%);
    border: 1px solid #2a5a9a;
    border-radius: 6px;
    cursor: pointer;
    letter-spacing: 4px;
    transition: all 0.15s ease;
    /* 暗蓝色荧光：四周多层发光 */
    box-shadow:
        0 0 8px rgba(40, 110, 220, 0.7),
        0 0 18px rgba(40, 110, 220, 0.45),
        0 0 32px rgba(30, 90, 200, 0.25),
        inset 0 0 10px rgba(40, 110, 220, 0.35);
    text-shadow: 0 0 8px rgba(90, 180, 255, 0.8);
}

.menu-btn:hover {
    background: linear-gradient(180deg, #10254a 0%, #04102a 100%);
    border-color: #4a8ad8;
    box-shadow:
        0 0 14px rgba(80, 160, 255, 0.9),
        0 0 28px rgba(60, 140, 255, 0.6),
        0 0 48px rgba(40, 110, 220, 0.35),
        inset 0 0 14px rgba(80, 160, 255, 0.5);
    transform: translateY(-1px);
}

.menu-btn:active {
    transform: translateY(1px);
    box-shadow:
        0 0 6px rgba(40, 110, 220, 0.6),
        0 0 14px rgba(40, 110, 220, 0.3),
        inset 0 0 8px rgba(40, 110, 220, 0.3);
}

/* ===== 最高分显示 ===== */
.high-score-display {
    position: absolute;
    bottom: 30px;
    font-size: 16px;
    color: #ffd700;
    letter-spacing: 2px;
}

#menu-high-score {
    font-weight: bold;
    color: #fff;
}

/* ===== 操作说明 ===== */
.howto-content {
    width: 320px;
    text-align: left;
    margin-bottom: 30px;
    line-height: 2.2;
    font-size: 15px;
    color: #d0e0f0;
}

.howto-content hr {
    border: none;
    border-top: 1px dashed #3a5a8a;
    margin: 12px 0;
}

.key {
    display: inline-block;
    min-width: 28px;
    padding: 2px 8px;
    background: #1a3a6a;
    border: 1px solid #4a8ad8;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
    color: #5fc8ff;
    margin: 0 2px;
}

.power-icon {
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border: 1px solid currentColor;
    border-radius: 4px;
    font-weight: bold;
    margin-right: 6px;
    font-size: 14px;
}

/* ===== 游戏结束 ===== */
.final-score, .final-stage {
    font-size: 20px;
    margin-bottom: 12px;
    color: #d0e0f0;
}

.final-score span, .final-stage span {
    color: #ffd700;
    font-weight: bold;
}

.new-record {
    color: #ff6b6b;
    font-size: 22px;
    margin: 10px 0 20px;
    animation: pulse 0.6s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to   { transform: scale(1.1); }
}

/* ===== 关卡过渡横幅 ===== */
.stage-banner {
    position: absolute;
    top: 40%;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 9;
    pointer-events: none;
}

.stage-banner h2 {
    font-size: 48px;
    color: #ffd700;
    text-shadow: 0 0 20px #ff8800;
    animation: bannerFade 2.5s ease-out forwards;
}

.stage-banner p {
    font-size: 22px;
    color: #5fc8ff;
    margin-top: 12px;
    letter-spacing: 4px;
    animation: bannerFade 2.5s ease-out forwards;
}

@keyframes bannerFade {
    0%   { opacity: 0; transform: translateY(20px); }
    20%  { opacity: 1; transform: translateY(0); }
    80%  { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* ===== 飞船选择 ===== */
.ship-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.ship-card {
    width: 130px;
    padding: 14px 10px;
    background: rgba(20, 40, 80, 0.6);
    border: 2px solid #2a4a7a;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ship-card:hover {
    border-color: #5fc8ff;
    box-shadow: 0 0 16px rgba(95, 200, 255, 0.5);
    transform: translateY(-3px);
    background: rgba(40, 70, 120, 0.7);
}

.ship-card canvas {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    display: block;
    margin: 0 auto 8px;
}

.ship-card h3 {
    color: #5fc8ff;
    font-size: 18px;
    margin-bottom: 4px;
    letter-spacing: 2px;
}

.ship-desc {
    font-size: 12px;
    color: #a8c8e8;
    margin-bottom: 10px;
    line-height: 1.4;
}

.ship-stats {
    text-align: left;
    font-size: 11px;
    color: #a8c8e8;
}

.ship-stats > div {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    gap: 6px;
}

.ship-stats span {
    width: 32px;
    flex-shrink: 0;
}

.bar {
    flex: 1;
    height: 6px;
    background: #1a2a44;
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2a6acc, #5fc8ff);
}

/* ===== 排行榜 ===== */
.leaderboard-content {
    width: 360px;
    margin-bottom: 24px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid #2a4a7a;
}

.leaderboard-table th {
    color: #5fc8ff;
    font-weight: bold;
}

.leaderboard-table td {
    color: #d0e0f0;
}

.leaderboard-table tr:first-child td { color: #ffd700; font-weight: bold; }
.leaderboard-table tr:nth-child(2) td { color: #c0c0c0; }
.leaderboard-table tr:nth-child(3) td { color: #cd7f32; }

.leaderboard-empty {
    text-align: center;
    color: #6a8aaa;
    padding: 20px;
}

/* ===== 设置 ===== */
.settings-content {
    width: 280px;
    margin-bottom: 24px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 8px;
    border-bottom: 1px solid #2a4a7a;
    font-size: 17px;
    color: #d0e0f0;
    cursor: pointer;
}

.setting-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: #5fc8ff;
    cursor: pointer;
}

/* ===== 成就 ===== */
.achievements-content {
    width: 360px;
    max-height: 380px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: rgba(20, 40, 80, 0.5);
    border: 1px solid #2a4a7a;
    border-radius: 6px;
    opacity: 0.45;
}

.achievement-item.unlocked {
    opacity: 1;
    border-color: #ffd700;
    background: rgba(80, 60, 20, 0.4);
}

.achievement-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #1a2a44;
    border: 2px solid #2a4a7a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #6a8aaa;
}

.achievement-item.unlocked .achievement-icon {
    background: #ffd700;
    color: #1a1a1a;
    border-color: #ffaa00;
}

.achievement-info { flex: 1; }
.achievement-info h4 { color: #d0e0f0; font-size: 15px; margin-bottom: 2px; }
.achievement-item.unlocked .achievement-info h4 { color: #ffd700; }
.achievement-info p { color: #8aa0b8; font-size: 12px; }

.achievement-stats {
    color: #ffd700;
    font-size: 15px;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

/* ===== 移动端适配 ===== */
@media (max-height: 720px) {
    #game-container {
        top: 0;
        transform: none;
    }
}

@media (max-width: 480px) {
    #game-container {
        width: 100vw;
        height: 100vh;
        border: none;
        box-shadow: none;
    }
}
