* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #0a0a1a;
    overflow: hidden;
    user-select: none;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: none;
}
.screen.active { display: flex; }

/* ===== 主菜单 ===== */
#main-menu {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.menu-bg {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(100,150,255,0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,100,100,0.1) 0%, transparent 50%);
    animation: bgShift 15s ease-in-out infinite alternate;
}
@keyframes bgShift {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}
.menu-content {
    position: relative;
    z-index: 1;
    text-align: center;
}
.game-title {
    margin-bottom: 60px;
}
.title-text {
    display: block;
    font-size: 80px;
    font-weight: 900;
    background: linear-gradient(45deg, #ffd700, #ff6b35, #ffd700);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 10px;
    text-shadow: 0 0 50px rgba(255,150,50,0.3);
    animation: titleGlow 3s ease-in-out infinite alternate;
}
@keyframes titleGlow {
    0% { filter: drop-shadow(0 0 20px rgba(255,150,50,0.5)); }
    100% { filter: drop-shadow(0 0 40px rgba(255,150,50,0.9)); }
}
.title-sub {
    display: block;
    font-size: 20px;
    color: #a0c4ff;
    letter-spacing: 15px;
    margin-top: 15px;
    opacity: 0.8;
}
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}
.menu-btn {
    width: 300px;
    padding: 16px 32px;
    background: linear-gradient(135deg, rgba(50,80,140,0.8), rgba(30,50,100,0.9));
    border: 2px solid rgba(120,170,255,0.4);
    border-radius: 12px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-family: inherit;
    font-weight: 600;
}
.menu-btn:hover {
    transform: translateY(-3px) scale(1.03);
    border-color: #ffd700;
    background: linear-gradient(135deg, rgba(70,100,180,0.9), rgba(50,80,140,0.95));
    box-shadow: 0 8px 30px rgba(255,215,0,0.3);
}
/* 挑战BOSS按钮: 红色危险风格 */
.menu-btn.boss-btn {
    background: linear-gradient(135deg, rgba(180,40,40,0.85), rgba(120,20,20,0.95));
    border-color: rgba(255,120,80,0.6);
    position: relative;
    overflow: hidden;
}
.menu-btn.boss-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,200,50,0.35), transparent);
    animation: bossBtnShine 2.4s linear infinite;
}
@keyframes bossBtnShine {
    0% { left: -100%; }
    100% { left: 100%; }
}
.menu-btn.boss-btn:hover {
    border-color: #ff4444;
    background: linear-gradient(135deg, rgba(220,50,50,0.95), rgba(160,30,30,1));
    box-shadow: 0 8px 32px rgba(255,60,60,0.55), 0 0 20px rgba(255,150,50,0.4);
}
.btn-icon { font-size: 24px; }
.menu-footer {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(160,196,255,0.5);
    font-size: 13px;
}
.back-btn { margin-top: 30px; }

/* ===== 帮助界面 ===== */
#help-screen, #achievement-hall {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px;
}
.help-content, .hall-content {
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(20,30,60,0.8);
    border: 2px solid rgba(120,170,255,0.3);
    border-radius: 20px;
    padding: 40px;
    backdrop-filter: blur(15px);
    text-align: center;
}
.help-content h2, .hall-content h2 {
    color: #ffd700;
    font-size: 36px;
    margin-bottom: 30px;
}
.help-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}
.help-section {
    background: rgba(40,60,120,0.5);
    border-radius: 12px;
    padding: 20px;
    text-align: left;
}
.help-section h3 {
    color: #a0c4ff;
    margin-bottom: 15px;
    font-size: 18px;
}
.key-row {
    color: #e0e8ff;
    margin-bottom: 10px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.key {
    display: inline-block;
    background: linear-gradient(180deg, #4a6fa5, #2d4a7c);
    color: #fff;
    padding: 4px 10px;
    border-radius: 5px;
    font-family: monospace;
    font-weight: bold;
    border: 1px solid #6a8fc5;
    box-shadow: 0 2px 0 #1a2d4a;
    min-width: 28px;
    text-align: center;
}
.help-tips {
    background: rgba(255,200,50,0.1);
    border-left: 4px solid #ffd700;
    border-radius: 8px;
    padding: 20px;
    text-align: left;
}
.help-tips h3 { color: #ffd700; margin-bottom: 12px; }
.help-tips ul { color: #e0e8ff; padding-left: 20px; line-height: 1.8; }

/* ===== 勋章展馆 ===== */
.hall-stats {
    display: flex;
    justify-content: center;
    gap: 50px;
    margin-bottom: 30px;
}
.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.stat-label { color: #a0c4ff; font-size: 14px; }
.stat-value { color: #ffd700; font-size: 36px; font-weight: 900; }
.timeline {
    text-align: left;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}
.timeline-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    margin-bottom: 12px;
    background: rgba(40,60,120,0.4);
    border-radius: 10px;
    border-left: 4px solid #4a6fa5;
    transition: all 0.3s;
}
.timeline-item.unlocked {
    border-left-color: #ffd700;
    background: linear-gradient(90deg, rgba(255,200,50,0.15), rgba(40,60,120,0.3));
}
.timeline-item.locked {
    opacity: 0.5;
    filter: grayscale(1);
}
.timeline-icon {
    width: 50px; height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    flex-shrink: 0;
}
.timeline-body { flex: 1; }
.timeline-name {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}
.timeline-desc {
    color: #a0c4ff;
    font-size: 13px;
    margin-bottom: 6px;
}
.timeline-time {
    color: rgba(255,255,255,0.4);
    font-size: 12px;
}

/* ===== 游戏画面 ===== */
#game-screen {
    background: #000;
    flex-direction: column;
}
#game-canvas {
    display: block;
    margin: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
#screen-shake {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

/* HUD */
.hud {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    padding: 15px 25px;
    z-index: 10;
    pointer-events: none;
}
.hud.hidden { display: none; }
.hud-top, .hud-double-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0,0,0,0.6);
    padding: 8px 16px;
    border-radius: 12px;
    border: 2px solid rgba(120,170,255,0.3);
}
.player-info.double { gap: 10px; padding: 8px 12px; }
.hud-avatar {
    font-size: 32px;
    width: 48px; height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(50,80,140,0.5);
    border-radius: 10px;
}
.hud-avatar.p1 { background: rgba(50,150,255,0.3); }
.hud-avatar.p2 { background: rgba(255,80,80,0.3); }
.hud-details { min-width: 180px; }
.hud-name {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}
.p1-name { color: #5aa8ff; }
.p2-name { color: #ff6b6b; }
.hp-bar {
    position: relative;
    width: 180px;
    height: 18px;
    background: rgba(0,0,0,0.5);
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
}
.hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    transition: width 0.3s ease;
    border-radius: 9px;
}
.hp-bar span {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.score-small {
    color: #ffd700;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 600;
}
.center-info { text-align: center; }
.score-display {
    color: #ffd700;
    font-size: 24px;
    font-weight: 900;
    text-shadow: 0 2px 10px rgba(255,215,0,0.5);
}
.stage-display, .stage-display-center {
    color: #a0c4ff;
    font-size: 14px;
    margin-top: 5px;
    background: rgba(0,0,0,0.4);
    padding: 3px 12px;
    border-radius: 10px;
    display: inline-block;
}
.stage-display-center {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 11;
}
.skill-info { display: flex; gap: 10px; }
.skill-icon {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, rgba(150,80,255,0.6), rgba(80,50,180,0.8));
    border: 2px solid rgba(200,150,255,0.5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: filter 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
/* 技能冷却中: 灰下去, 变半透明, 边框变灰 */
.skill-icon.cooling {
    filter: grayscale(0.7) brightness(0.6);
    border-color: rgba(140,140,140,0.7);
    box-shadow: none;
}
/* 技能就绪: 高亮, 金光外边框, 轻微浮起 */
.skill-icon.ready {
    filter: brightness(1.25) saturate(1.3);
    border-color: rgba(255,230,120,0.95);
    box-shadow: 0 0 14px rgba(255,215,0,0.65), 0 0 28px rgba(200,150,255,0.5);
    transform: translateY(-1px);
}
.skill-cooldown {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 0%;           /* 由 HUD 代码更新: 从顶部下降, height=冷却剩余比例 */
    background: rgba(0,0,0,0.68);
    transition: height 0.12s linear;
    border-bottom: 1px solid rgba(255,255,255,0.35);
}
.skill-key {
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    z-index: 1;
}
/* 技能百分比文字 */
.skill-cd-text {
    position: absolute;
    bottom: 1px;
    left: 0; right: 0;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.9);
    z-index: 2;
    pointer-events: none;
}
/* 冷却中字大一点, 提示明确 */
.skill-icon.cooling .skill-cd-text { color: #fde68a; }
.vs-info {
    color: #ffd700;
    font-size: 28px;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(255,215,0,0.6);
    padding: 0 15px;
}

/* PK 回合制指示 */
.pk-round-indicator {
    text-align: center;
    padding: 4px 14px;
    background: linear-gradient(135deg, rgba(220,38,38,0.5), rgba(127,29,29,0.8));
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    min-width: 110px;
}
.pk-round-title {
    color: #fff;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 1px;
}
.pk-round-sub {
    color: #fecaca;
    font-size: 10px;
    margin-top: 2px;
    opacity: 0.9;
}
/* 回合胜场显示 */
.round-win {
    color: #60a5fa;
    font-size: 12px;
    margin-top: 3px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
.round-win.p2 {
    color: #f472b6;
    text-align: right;
}
.round-win span {
    color: #ffd700;
    font-weight: 900;
    font-size: 14px;
}

/* BOSS HP */
.boss-hp-container {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    z-index: 10;
    text-align: center;
}
.boss-hp-container.hidden { display: none; }
.boss-name {
    color: #ff4444;
    font-size: 20px;
    font-weight: 900;
    margin-bottom: 6px;
    letter-spacing: 3px;
    text-shadow: 0 0 15px rgba(255,50,50,0.8);
    animation: bossNamePulse 1s ease-in-out infinite alternate;
}
@keyframes bossNamePulse {
    0% { opacity: 0.8; }
    100% { opacity: 1; }
}
.boss-hp-bar {
    height: 22px;
    background: rgba(0,0,0,0.7);
    border: 2px solid #ff4444;
    border-radius: 11px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255,50,50,0.4);
}
.boss-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff1e1e, #ff6b35, #ff1e1e);
    background-size: 200% 100%;
    transition: width 0.4s ease;
    animation: bossHpAnim 2s linear infinite;
}
@keyframes bossHpAnim {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* CG 动画 */
.cg-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.cg-overlay.hidden { display: none; }
.cg-content { text-align: center; position: relative; }
.cg-title {
    color: #ff1e1e;
    font-size: 72px;
    font-weight: 900;
    letter-spacing: 20px;
    text-shadow: 0 0 40px rgba(255,50,50,0.8);
    animation: cgZoomIn 0.8s ease-out forwards;
    opacity: 0;
}
.cg-subtitle {
    color: #ffd700;
    font-size: 36px;
    margin-top: 20px;
    letter-spacing: 10px;
    text-shadow: 0 0 30px rgba(255,215,0,0.6);
    animation: cgFadeUp 0.6s ease-out 0.4s forwards;
    opacity: 0;
}
.cg-bars { margin-top: 50px; overflow: hidden; }
.cg-bar {
    height: 4px;
    background: linear-gradient(90deg, transparent, #ff1e1e, #ffd700, #ff1e1e, transparent);
    animation: cgBarSweep 1s ease-out 0.6s forwards;
    transform: scaleX(0);
}
.bar-left { margin-bottom: 10px; transform-origin: left; }
.bar-right { transform-origin: right; }
@keyframes cgZoomIn {
    0% { opacity: 0; transform: scale(3); filter: blur(20px); }
    60% { opacity: 1; transform: scale(1); filter: blur(0); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes cgFadeUp {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes cgBarSweep {
    0% { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}

/* 成就弹窗 */
.achievement-popup {
    position: absolute;
    top: 100px;
    right: 30px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, rgba(255,200,50,0.95), rgba(255,130,50,0.95));
    padding: 15px 25px;
    border-radius: 12px;
    border: 2px solid #ffd700;
    box-shadow: 0 5px 30px rgba(255,200,50,0.5);
    animation: achSlideIn 0.5s ease-out forwards;
}
.achievement-popup.hidden { display: none; }
.popup-icon {
    font-size: 40px;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.5));
}
.popup-label {
    font-size: 12px;
    color: rgba(0,0,0,0.6);
    font-weight: 600;
}
.popup-name {
    font-size: 18px;
    font-weight: 900;
    color: #3a2000;
}
.popup-desc {
    font-size: 13px;
    color: rgba(58,32,0,0.8);
}
@keyframes achSlideIn {
    0% { transform: translateX(120%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

/* 暂停 & 游戏结束 */
.pause-menu, .game-over {
    position: absolute;
    inset: 0;
    z-index: 80;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}
.pause-menu.hidden, .game-over.hidden { display: none; }
.pause-content, .over-content {
    background: rgba(30,40,80,0.95);
    border: 2px solid rgba(120,170,255,0.4);
    border-radius: 20px;
    padding: 40px 60px;
    text-align: center;
}
.pause-content h2, .over-content h2 {
    color: #ffd700;
    font-size: 36px;
    margin-bottom: 30px;
}
.pause-content .menu-btn, .over-content .menu-btn {
    margin-bottom: 12px;
}
.over-stats {
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 20px 40px;
    margin-bottom: 25px;
    color: #e0e8ff;
    line-height: 2;
    font-size: 16px;
}
.over-stats .stat-row {
    display: flex;
    justify-content: space-between;
    gap: 40px;
}
.over-stats .stat-val {
    color: #ffd700;
    font-weight: 700;
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(120,170,255,0.4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,170,255,0.7); }
