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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0f0f2d 100%);
    color: white;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 255, 200, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 100, 100, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(100, 100, 255, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* 粒子系统 */
.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* 动态星空效果 */
.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle ease-in-out infinite;
}

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

/* 网格背景 */
.grid-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 212, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

#gameContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(180deg, #0d1b2a 0%, #1b263b 50%, #0d1b2a 100%);
    z-index: 1;
}

#gameContainer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 30% 70%, rgba(0, 212, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 70% 30%, rgba(255, 0, 100, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(100, 0, 255, 0.04) 0%, transparent 60%);
    pointer-events: none;
    animation: ambientPulse 8s ease-in-out infinite;
}

@keyframes ambientPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 212, 255, 0.03) 2px,
        rgba(0, 212, 255, 0.03) 4px
    );
    pointer-events: none;
    z-index: 100;
    animation: scanlineMove 0.5s linear infinite;
}

@keyframes scanlineMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* 修复canvas显示问题 */
#gameCanvas {
    background: linear-gradient(180deg, #0a1628 0%, #162447 50%, #0a1628 100%);
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#gameUI {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

#topBar {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
}

#healthBar {
    width: 200px;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #ff6b6b;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
}

#health {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

#gold {
    font-size: 20px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#score {
    font-size: 18px;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

#buffAnnounceBar {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 300px;
    max-width: 500px;
    text-align: center;
    pointer-events: none;
    z-index: 100;
}

.buffAnnounce {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.85), rgba(30, 30, 60, 0.9));
    border: 2px solid;
    border-radius: 12px;
    padding: 10px 20px;
    margin: 5px 0;
    font-size: 14px;
    font-weight: bold;
    animation: buffAnnounceIn 0.3s ease-out, buffAnnounceOut 0.3s ease-in 2.7s forwards;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.buffAnnounce.enemy {
    border-color: #ff6b6b;
    color: #ff9999;
}

.buffAnnounce.friendly {
    border-color: #00ffcc;
    color: #00ffcc;
}

@keyframes buffAnnounceIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes buffAnnounceOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

#mineSkill {
    position: relative;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #2a2a4a, #1a1a3a);
    border: 2px solid #ff4444;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.3);
}

#mineSkill:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
}

#mineSkill.cooldown {
    border-color: #666;
    box-shadow: none;
    cursor: not-allowed;
}

.mineIcon {
    font-size: 24px;
    filter: drop-shadow(0 0 5px rgba(255, 68, 68, 0.8));
}

#mineSkill.cooldown .mineIcon {
    filter: grayscale(100%) opacity(0.5);
}

.mineCooldown {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 0 0 8px 8px;
    transition: height 0.1s linear;
}

.mineKey {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#mineSkill.cooldown .mineKey {
    background: #666;
}

#healSkill {
    position: relative;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border: 2px solid #1abc9c;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.3);
}

#healSkill:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
}

#healSkill.cooldown {
    border-color: #666;
    box-shadow: none;
    cursor: not-allowed;
}

.healIcon {
    font-size: 24px;
    filter: drop-shadow(0 0 5px rgba(46, 204, 113, 0.8));
}

#healSkill.cooldown .healIcon {
    filter: grayscale(100%) opacity(0.5);
}

.healCooldown {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 0 0 8px 8px;
    transition: height 0.1s linear;
}

.healKey {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #1abc9c;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#healSkill.cooldown .healKey {
    background: #666;
}

#bottomBar {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
}

#ammo {
    font-size: 16px;
    color: #f39c12;
}

#weaponName {
    font-size: 18px;
    font-weight: bold;
    color: #00ffcc;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}

.uiBtn {
    padding: 10px 20px;
    margin: 0 5px;
    background: rgba(0, 212, 255, 0.2);
    border: 2px solid #00d4ff;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.uiBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.3), transparent);
    transition: left 0.5s ease;
    z-index: -1;
}

.uiBtn:hover {
    background: rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5), 0 0 40px rgba(0, 212, 255, 0.3);
    transform: translateY(-2px) scale(1.05);
}

.uiBtn:hover::before {
    left: 100%;
}

.uiBtn:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

.uiBtn:focus {
    outline: none;
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.6), 0 0 0 3px rgba(0, 212, 255, 0.4);
}

/* ========== 开始菜单样式优化 ========== */
.menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 22, 40, 0.95);
    border: 2px solid #00d4ff;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    min-width: 400px;
    box-shadow: 0 0 50px rgba(0, 212, 255, 0.3);
    display: none;
    z-index: 100;
    max-height: 92vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.menu.active {
    display: block;
    animation: menuAppear 0.3s ease-out;
}

@keyframes menuAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 开始菜单样式 */
#gameMenu {
    background: linear-gradient(180deg, #0f1a2e 0%, #1a2d4a 50%, #0f1a2e 100%);
    border: none;
    box-shadow: none;
    padding: 60px 80px;
    min-width: 500px;
}

#gameMenu h1 {
    font-size: 52px;
    margin-bottom: 50px;
    color: #00e5d4;
    text-shadow: 
        0 0 20px rgba(0, 229, 212, 0.8),
        0 0 40px rgba(0, 229, 212, 0.5),
        0 0 60px rgba(0, 229, 212, 0.3);
    letter-spacing: 8px;
    font-weight: bold;
}

#gameMenu button {
    display: block;
    width: 280px;
    padding: 16px 30px;
    margin: 16px auto;
    background: rgba(0, 180, 170, 0.15);
    border: 2px solid rgba(0, 229, 212, 0.6);
    color: #00e5d4;
    border-radius: 30px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

#gameMenu button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 212, 0.2), transparent);
    transition: left 0.5s ease;
    z-index: -1;
}

#gameMenu button:hover {
    background: rgba(0, 229, 212, 0.25);
    border-color: #00e5d4;
    box-shadow: 0 0 25px rgba(0, 229, 212, 0.4), 0 0 50px rgba(0, 229, 212, 0.2);
    transform: translateY(-2px) scale(1.03);
}

#gameMenu button:hover::before {
    left: 100%;
}

#gameMenu button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 0 15px rgba(0, 229, 212, 0.3);
}

#gameMenu button:focus {
    outline: none;
    box-shadow: 0 0 30px rgba(0, 229, 212, 0.5), 0 0 0 3px rgba(0, 229, 212, 0.3);
}

#gameMenu .menuFooter {
    margin-top: 50px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1px;
}

.menu h2 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #00ffcc;
}

.menu button {
    display: block;
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 255, 204, 0.1));
    border: 2px solid #00d4ff;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.menu button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.3), transparent);
    transition: left 0.5s ease;
    z-index: -1;
}

.menu button:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.4), rgba(0, 255, 204, 0.2));
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5), 0 0 60px rgba(0, 212, 255, 0.3);
    transform: translateY(-2px) scale(1.02);
}

.menu button:hover::before {
    left: 100%;
}

.menu button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

.menu button:focus {
    outline: none;
    box-shadow: 0 0 35px rgba(0, 212, 255, 0.6), 0 0 0 3px rgba(0, 212, 255, 0.4);
}

/* ========== 徽章样式优化 ========== */
#allMedalsContainer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.medalItem {
    background: linear-gradient(135deg, rgba(100, 100, 100, 0.2), rgba(80, 80, 80, 0.15));
    border: 2px solid #555;
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.medalItem:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* 未解锁徽章 - 灰色样式 */
.medalItem.locked {
    background: linear-gradient(135deg, rgba(60, 60, 60, 0.3), rgba(40, 40, 40, 0.25));
    border-color: #444;
    opacity: 0.7;
}

.medalItem.locked .medalIcon {
    filter: grayscale(100%);
    opacity: 0.5;
}

.medalItem.locked .medalName {
    color: #777;
}

.medalItem.locked .medalDesc {
    color: #555;
}

/* 已解锁徽章 - 金色发光样式 */
.medalItem.unlocked {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 180, 0, 0.1));
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3), inset 0 0 20px rgba(255, 215, 0, 0.05);
    animation: medalGlow 2s ease-in-out infinite;
}

@keyframes medalGlow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.3), inset 0 0 20px rgba(255, 215, 0, 0.05);
        border-color: #ffd700;
    }
    50% { 
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.5), inset 0 0 30px rgba(255, 215, 0, 0.1);
        border-color: #ffec8b;
    }
}

.medalItem.unlocked .medalIcon {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.medalItem.unlocked .medalName {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.medalItem.unlocked .medalDesc {
    color: rgba(255, 215, 0, 0.8);
}

/* 锁定图标 */
.medalItem.locked::after {
    content: '🔒';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 10px;
    opacity: 0.6;
}

.medalIcon {
    font-size: 28px;
    margin-bottom: 6px;
    transition: all 0.3s;
}

.medalName {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
    transition: all 0.3s;
}

.medalDesc {
    font-size: 9px;
    line-height: 1.3;
    transition: all 0.3s;
}

/* ========== 关卡选择样式 - 横向布局 ========== */
#levelSelect {
    min-width: 800px;
    max-width: 95vw;
    padding: 30px 40px;
}

#levelSelect h2 {
    font-size: 28px;
    color: #00e5d4;
    margin-bottom: 25px;
    text-shadow: 0 0 15px rgba(0, 229, 212, 0.5);
}

.levelRows {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
    padding: 10px;
}

.levelRow {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 15px;
}

.levelBtn {
    flex: 0 0 130px;
    height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(0, 180, 170, 0.12) 0%, rgba(0, 100, 100, 0.08) 100%);
    border: 2px solid rgba(0, 229, 212, 0.4);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.levelBtn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(0, 229, 212, 0.1), transparent);
    transform: rotate(45deg);
    transition: left 0.5s ease;
    z-index: 0;
}

.levelBtn:hover {
    background: linear-gradient(180deg, rgba(0, 229, 212, 0.2) 0%, rgba(0, 150, 150, 0.12) 100%);
    border-color: #00e5d4;
    box-shadow: 0 0 25px rgba(0, 229, 212, 0.4), 0 0 50px rgba(0, 229, 212, 0.2);
    transform: translateY(-5px) scale(1.08);
}

.levelBtn:hover::before {
    left: 100%;
}

.levelBtn:focus {
    outline: none;
    box-shadow: 0 0 30px rgba(0, 229, 212, 0.6), 0 0 0 3px rgba(0, 229, 212, 0.4);
}

.levelBtn.locked {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #444;
    background: linear-gradient(180deg, rgba(60, 60, 60, 0.2) 0%, rgba(40, 40, 40, 0.1) 100%);
}

.levelBtn.locked:hover {
    transform: none;
    box-shadow: none;
}

.levelBtn.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    opacity: 0.6;
}

.levelBtn.completed {
    border-color: #00ff88;
    background: linear-gradient(180deg, rgba(0, 255, 136, 0.15) 0%, rgba(0, 150, 100, 0.08) 100%);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4), 0 0 40px rgba(0, 255, 136, 0.2);
}

.levelBtn {
    font-size: 28px;
    font-weight: bold;
    color: #00e5d4;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 10px rgba(0, 229, 212, 0.5);
}

.levelBtn small {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 8px;
    font-weight: normal;
    position: relative;
    z-index: 1;
}

.levelBtn.locked small {
    color: rgba(255, 255, 255, 0.3);
}

.levelBtn.completed small {
    color: rgba(0, 255, 136, 0.9);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.stars {
    font-size: 16px;
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

#backToMenuBtn {
    margin-top: 20px;
    padding: 12px 40px;
    background: rgba(0, 180, 170, 0.15);
    border: 2px solid rgba(0, 229, 212, 0.4);
    color: #00e5d4;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

#backToMenuBtn:hover {
    background: rgba(0, 229, 212, 0.25);
    border-color: #00e5d4;
    box-shadow: 0 0 20px rgba(0, 229, 212, 0.3);
}

/* ========== 商店样式 - 横向布局 ========== */
#shop {
    min-width: 900px;
    max-width: 95vw;
    padding: 30px 40px;
}

#shop h2 {
    font-size: 28px;
    color: #00e5d4;
    margin-bottom: 15px;
    text-shadow: 0 0 15px rgba(0, 229, 212, 0.5);
}

.shopInfo {
    font-size: 18px;
    color: #ffd700;
    margin-bottom: 20px;
    text-align: center;
}

.shopTabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.shopTab {
    padding: 10px 25px;
    background: rgba(0, 180, 170, 0.15);
    border: 2px solid rgba(0, 229, 212, 0.4);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    flex: 0 0 auto;
    width: auto;
    transition: all 0.3s;
}

.shopTab:hover {
    background: rgba(0, 229, 212, 0.25);
    border-color: rgba(0, 229, 212, 0.6);
}

.shopTab.active {
    background: rgba(0, 229, 212, 0.3);
    border-color: #00e5d4;
    color: #00e5d4;
    box-shadow: 0 0 15px rgba(0, 229, 212, 0.3);
}

/* 提高特异性：抵消 .menu button { display:block; width:100%; padding:15px } 的拉伸，
   让分类标签按内容宽度并排换行，而不是每个占满一整行 */
.shopTabs .shopTab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    padding: 9px 20px;
}

.shopContent {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.shopPanel {
    display: none;
}

.shopPanel.active {
    display: block;
}

.shopGrid {
    display: flex;
    flex-direction: row;
    gap: 15px;
    overflow-x: auto;
    padding: 15px 10px;
    scrollbar-width: thin;
    scrollbar-color: #00e5d4 rgba(0, 0, 0, 0.3);
    background: linear-gradient(90deg, rgba(0, 229, 212, 0.05), rgba(0, 229, 212, 0.1), rgba(0, 229, 212, 0.05));
    border-radius: 10px;
    margin: 10px 0;
}

.shopGrid::-webkit-scrollbar {
    height: 6px;
}

.shopGrid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.shopGrid::-webkit-scrollbar-thumb {
    background: #00e5d4;
    border-radius: 3px;
}

.shopItem {
    flex: 0 0 170px;
    background: linear-gradient(180deg, rgba(0, 180, 170, 0.12) 0%, rgba(0, 100, 100, 0.08) 100%);
    border: 2px solid rgba(0, 229, 212, 0.4);
    border-radius: 15px;
    padding: 18px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 190px;
    position: relative;
    overflow: hidden;
}

.shopItem::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(0, 229, 212, 0.1), transparent);
    transform: rotate(45deg);
    transition: left 0.5s ease;
    z-index: 0;
}

.shopItem:hover {
    background: linear-gradient(180deg, rgba(0, 229, 212, 0.2) 0%, rgba(0, 150, 150, 0.12) 100%);
    border-color: #00e5d4;
    box-shadow: 0 0 25px rgba(0, 229, 212, 0.4), 0 0 50px rgba(0, 229, 212, 0.2);
    transform: translateY(-5px) scale(1.03);
}

.shopItem:hover::before {
    left: 100%;
}

.shopItem.owned {
    border-color: #00ff88;
    background: linear-gradient(180deg, rgba(0, 255, 136, 0.1) 0%, rgba(0, 150, 100, 0.05) 100%);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.shopItem.owned::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 16px;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.8);
}

.shopItem.owned .itemPrice {
    color: #00ff88;
}

.shopItem .itemIcon {
    font-size: 36px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.shopItem:hover .itemIcon {
    transform: scale(1.1) rotate(5deg);
}

.shopItem .itemName {
    font-weight: bold;
    color: #00e5d4;
    margin-bottom: 10px;
    font-size: 16px;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 10px rgba(0, 229, 212, 0.5);
}

.shopItem .itemDesc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 15px;
    line-height: 1.4;
    flex-grow: 1;
    position: relative;
    z-index: 1;
}

.shopItem .itemPrice {
    color: #ffd700;
    font-weight: bold;
    font-size: 15px;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.shopActions {
    text-align: center;
}

.shopActions button {
    padding: 12px 40px;
    background: rgba(255, 100, 100, 0.2);
    border: 2px solid rgba(255, 100, 100, 0.6);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.shopActions button:hover {
    background: rgba(255, 100, 100, 0.35);
    border-color: #ff6464;
    box-shadow: 0 0 20px rgba(255, 100, 100, 0.4);
}

.notification {
    position: fixed;
    top: 100px;
    right: -300px;
    background: rgba(0, 212, 255, 0.9);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    font-weight: bold;
    z-index: 1000;
    transition: right 0.3s;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

.notification.show {
    right: 20px;
}

.notification.success {
    background: rgba(0, 255, 100, 0.9);
    box-shadow: 0 0 20px rgba(0, 255, 100, 0.5);
}

.notification.danger {
    background: rgba(255, 50, 50, 0.9);
    box-shadow: 0 0 20px rgba(255, 50, 50, 0.5);
}

#fullscreenBtn {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #00d4ff;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s;
}

#fullscreenBtn:hover {
    background: rgba(0, 212, 255, 0.3);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #00d4ff;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00ffcc;
}

/* 游戏结束和关卡完成界面 */
#gameOver, #levelComplete {
    text-align: center;
}

#gameOver h2 {
    color: #ff6b6b;
    font-size: 32px;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

#levelComplete h2 {
    color: #00ffcc;
    font-size: 32px;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(0, 255, 204, 0.5);
}

#levelComplete p {
    font-size: 16px;
    margin: 8px 0;
    color: rgba(255, 255, 255, 0.8);
}

/* 星星样式 */
#starsContainer {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.star {
    font-size: 36px;
    color: rgba(180, 150, 50, 0.3);
    text-shadow: none;
    transition: all 0.5s ease;
}

.star.active {
    color: #ffd700;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.5),
        0 0 30px rgba(255, 215, 0, 0.3);
    animation: starEarned 0.6s ease-out;
}

@keyframes starEarned {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.3) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.finalScore {
    font-size: 24px;
    margin: 20px 0;
    color: #ffd700;
}

/* ========== 世界观界面样式 ========== */
#loreMenu {
    min-width: 700px;
    max-width: 900px;
    max-height: 85vh;
    padding: 30px 40px;
}

#loreMenu h2 {
    font-size: 28px;
    color: #00e5d4;
    margin-bottom: 20px;
    text-shadow: 0 0 15px rgba(0, 229, 212, 0.5);
}

.loreContent {
    height: 65vh;
    overflow-y: auto;
    padding: 20px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    scrollbar-width: thin;
    scrollbar-color: #00d4ff rgba(0, 0, 0, 0.3);
}

.loreContent::-webkit-scrollbar {
    width: 8px;
}

.loreContent::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.loreContent::-webkit-scrollbar-thumb {
    background: #00d4ff;
    border-radius: 4px;
}

.loreIntro {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 212, 255, 0.1);
    border-left: 4px solid #00d4ff;
    border-radius: 10px;
}

.loreIntro h3 {
    color: #00e5d4;
    font-size: 22px;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(0, 229, 212, 0.5);
}

.loreHighlight {
    color: #ffd700;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.loreIntro p {
    line-height: 1.8;
    margin-bottom: 12px;
    color: #e0e0e0;
}

.loreSection {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.loreSection h3 {
    color: #00d4ff;
    font-size: 20px;
    border-bottom: 2px solid rgba(0, 212, 255, 0.4);
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.loreSection p {
    line-height: 1.8;
    margin-bottom: 12px;
    color: #d0d0d0;
    text-align: left;
}

.loreSection p strong {
    color: #ffd700;
    font-weight: bold;
}

.loreSection em {
    color: #00e5d4;
    font-style: italic;
    display: block;
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 229, 212, 0.1);
    border-radius: 8px;
    border-left: 3px solid #00e5d4;
}

#backFromLoreBtn {
    display: block;
    width: 200px;
    margin: 0 auto;
    padding: 12px 24px;
    background: rgba(0, 180, 170, 0.2);
    border: 2px solid rgba(0, 229, 212, 0.6);
    color: #00e5d4;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#backFromLoreBtn:hover {
    background: rgba(0, 229, 212, 0.3);
    border-color: #00e5d4;
    box-shadow: 0 0 20px rgba(0, 229, 212, 0.4);
    transform: translateY(-2px);
}

#backFromLoreBtn:active {
    transform: translateY(0);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .menu {
        min-width: 90%;
        padding: 20px;
    }
    
    #gameMenu {
        min-width: 90%;
        padding: 30px;
    }
    
    #gameMenu h1 {
        font-size: 32px;
    }
    
    #levelSelect {
        min-width: 90vw;
        padding: 20px;
    }
    
    .levelRow {
        gap: 10px;
    }
    
    .levelBtn {
        flex: 0 0 90px;
        height: 90px;
    }
    
    .levelBtn {
        font-size: 18px;
    }
    
    .levelBtn small {
        font-size: 10px;
    }
    
    #shop {
        min-width: 90vw;
        /* 底部留出悬浮「关闭商店」按钮的高度，滚到底时商品不会被长期遮住 */
        padding: 20px 20px 96px;
    }

    /* 窄屏上面板内容超出视口时需要滚动，把「关闭商店」固定在面板底部，避免要滚到底才找得到 */
    .shopActions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        padding: 10px 0 4px;
        margin-top: 6px;
        background: rgba(10, 22, 40, 0.96);
        box-shadow: 0 -8px 18px rgba(0, 0, 0, 0.35);
    }

    .shopActions button {
        padding: 10px 28px;
        font-size: 14px;
    }
    
    .shopGrid {
        gap: 8px;
    }
    
    .shopItem {
        flex: 0 0 140px;
        min-height: 160px;
        padding: 12px 10px;
    }
    
    #allMedalsContainer {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #topBar {
        flex-direction: column;
        gap: 10px;
    }
    
    #healthBar {
        width: 150px;
    }
}

/* 伤害数字动画 */
.damageNumber {
    position: absolute;
    font-weight: bold;
    font-size: 16px;
    pointer-events: none;
    animation: damageFloat 1s ease-out forwards;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

.damageNumber.critical {
    font-size: 24px;
    color: #ff0000;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

@keyframes damageFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(0.5);
    }
}

/* 枪口火焰效果 */
.muzzleFlash {
    position: absolute;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #ffff00 0%, #ff8800 50%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: flashFade 0.1s ease-out forwards;
}

@keyframes flashFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.5);
    }
}

/* 弹幕样式 */
#danmakuContainer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.danmaku {
    position: absolute;
    top: 10%;
    left: 100%;
    white-space: nowrap;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    animation: danmakuMove linear forwards;
    opacity: 0.9;
}

@keyframes danmakuMove {
    0% {
        left: 100%;
        top: 10%;
        opacity: 0.9;
    }
    100% {
        left: -100%;
        top: 5%;
        opacity: 0.9;
    }
}

/* 弹幕按钮样式 */
#danmakuBtn {
    padding: 10px 15px;
    margin: 0 5px;
    background: rgba(0, 212, 255, 0.2);
    border: 2px solid #00d4ff;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    pointer-events: auto;
}

#danmakuBtn:hover {
    background: rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
}

/* 弹幕输入区域样式 */
#danmakuInputContainer {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 300px;
    max-width: 80%;
    display: flex;
    gap: 8px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border: 1px solid #00d4ff;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

#danmakuInputContainer.hidden {
    display: none;
}

#danmakuInput {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #00d4ff;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 12px;
    outline: none;
    transition: all 0.3s;
}

#danmakuInput:focus {
    border-color: #00ffcc;
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.5);
}

#danmakuInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#sendDanmakuBtn, #closeDanmakuBtn {
    padding: 0 12px;
    border: none;
    border-radius: 15px;
    color: white;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

#sendDanmakuBtn {
    background: #00d4ff;
}

#closeDanmakuBtn {
    background: #ff6b6b;
}

#sendDanmakuBtn:hover {
    background: #00ffcc;
    box-shadow: 0 0 8px rgba(0, 255, 204, 0.5);
}

#closeDanmakuBtn:hover {
    background: #ff5252;
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
}

/* 职业选择样式 */
.classGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.classGrid::-webkit-scrollbar {
    width: 8px;
}

.classGrid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.classGrid::-webkit-scrollbar-thumb {
    background: #00e5d4;
    border-radius: 4px;
}

.classBtn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px;
    background: linear-gradient(180deg, rgba(0, 180, 170, 0.12) 0%, rgba(0, 100, 100, 0.08) 100%);
    border: 2px solid rgba(0, 229, 212, 0.4);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 200px;
    position: relative;
    overflow: hidden;
}

.classBtn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(0, 229, 212, 0.1), transparent);
    transform: rotate(45deg);
    transition: left 0.5s ease;
    z-index: 0;
}

.classBtn:hover {
    background: linear-gradient(180deg, rgba(0, 229, 212, 0.2) 0%, rgba(0, 150, 150, 0.12) 100%);
    border-color: #00e5d4;
    box-shadow: 0 0 30px rgba(0, 229, 212, 0.5), 0 0 60px rgba(0, 229, 212, 0.3);
    transform: translateY(-8px) scale(1.05);
}

.classBtn:hover::before {
    left: 100%;
}

.classIcon {
    font-size: 56px;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.classBtn:hover .classIcon {
    transform: scale(1.1) rotate(10deg);
}

.className {
    font-size: 22px;
    font-weight: bold;
    color: #00e5d4;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 15px rgba(0, 229, 212, 0.6);
}

.classDesc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
    text-align: center;
    position: relative;
    z-index: 1;
    line-height: 1.4;
}

.classBonus {
    font-size: 16px;
    color: #ffd700;
    font-weight: bold;
    text-align: center;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

/* 为每个职业添加独特的发光效果 */
.classBtn[data-class="sharpshooter"]:hover {
    box-shadow: 0 0 30px rgba(255, 165, 0, 0.5), 0 0 60px rgba(255, 165, 0, 0.3);
    border-color: #ffa500;
}

.classBtn[data-class="survivor"]:hover {
    box-shadow: 0 0 30px rgba(0, 128, 0, 0.5), 0 0 60px rgba(0, 128, 0, 0.3);
    border-color: #008000;
}

.classBtn[data-class="speedrunner"]:hover {
    box-shadow: 0 0 30px rgba(255, 255, 0, 0.5), 0 0 60px rgba(255, 255, 0, 0.3);
    border-color: #ffff00;
}

.classBtn[data-class="sharpshooter"] .className {
    color: #ffa500;
    text-shadow: 0 0 15px rgba(255, 165, 0, 0.6);
}

.classBtn[data-class="survivor"] .className {
    color: #00ff88;
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.6);
}

.classBtn[data-class="speedrunner"] .className {
    color: #ffff00;
    text-shadow: 0 0 15px rgba(255, 255, 0, 0.6);
}
