* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: #0a0a0a;
    color: #00ffff;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    background: #0a0a0a;
    display: block;
}

/* HUD 样式 */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#swarm-count {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 64px;
    font-weight: bold;
    color: #00ffff;
    text-shadow: 0 0 20px #00ffff;
}

#timer {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    color: #ffffff;
}

#gene-display {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
}

#xp-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: rgba(0, 255, 0, 0.2);
}

#xp-bar {
    height: 100%;
    width: 0%;
    background: #00ff00;
    box-shadow: 0 0 10px #00ff00;
    transition: width 0.3s ease;
}

/* 升级面板 */
#upgrades-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 240px;
    max-height: 280px;
    background: rgba(10, 10, 10, 0.9);
    border: 2px solid #00ffff;
    border-radius: 5px;
    padding: 12px;
    overflow-y: auto;
    pointer-events: auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

/* 永久增幅面板 */
#permanent-buffs-panel {
    position: absolute;
    top: 320px;
    right: 20px;
    width: 240px;
    max-height: 280px;
    background: rgba(10, 10, 10, 0.9);
    border: 2px solid #ffaa00;
    border-radius: 5px;
    padding: 12px;
    overflow-y: auto;
    pointer-events: auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

#upgrades-panel h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #00ffff;
    text-align: center;
    border-bottom: 1px solid rgba(0, 255, 255, 0.5);
    padding-bottom: 5px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

#permanent-buffs-panel h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #ffaa00;
    text-align: center;
    border-bottom: 1px solid rgba(255, 170, 0, 0.5);
    padding-bottom: 5px;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
}

/* 面板悬停时增加不透明度 */
#upgrades-panel:hover,
#permanent-buffs-panel:hover {
    background: rgba(10, 10, 10, 0.95);
}

#upgrades-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#permanent-buffs-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.upgrade-item {
    padding: 6px 8px;
    background: rgba(0, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 3px;
    font-size: 11px;
    transition: all 0.2s;
}

.upgrade-item:hover {
    background: rgba(0, 255, 255, 0.15);
    border-color: #00ffff;
}

.upgrade-item .upgrade-name {
    font-weight: bold;
    color: #00ffff;
    margin-bottom: 2px;
    font-size: 12px;
    line-height: 1.2;
}

.upgrade-item .upgrade-desc {
    color: #aaaaaa;
    font-size: 10px;
    line-height: 1.3;
}

.upgrade-item.rarity-common {
    border-color: #aaaaaa;
}

.upgrade-item.rarity-uncommon {
    border-color: #00ff00;
}

.upgrade-item.rarity-rare {
    border-color: #0088ff;
}

.upgrade-item.rarity-legendary {
    border-color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
}

/* 滚动条样式 */
#upgrades-panel::-webkit-scrollbar,
#permanent-buffs-panel::-webkit-scrollbar {
    width: 6px;
}

#upgrades-panel::-webkit-scrollbar-track,
#permanent-buffs-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
}

#upgrades-panel::-webkit-scrollbar-thumb {
    background: #00ffff;
    border-radius: 3px;
}

#upgrades-panel::-webkit-scrollbar-thumb:hover {
    background: #00aaaa;
}

#permanent-buffs-panel::-webkit-scrollbar-thumb {
    background: #ffaa00;
    border-radius: 3px;
}

#permanent-buffs-panel::-webkit-scrollbar-thumb:hover {
    background: #cc8800;
}



.permanent-buff-item {
    padding: 5px 7px;
    background: rgba(255, 170, 0, 0.08);
    border: 1px solid rgba(255, 170, 0, 0.5);
    border-radius: 3px;
    font-size: 10px;
    transition: all 0.2s;
}

.permanent-buff-item:hover {
    background: rgba(255, 170, 0, 0.15);
    border-color: #ffaa00;
}

.permanent-buff-item .buff-name {
    font-weight: bold;
    color: #ffaa00;
    margin-bottom: 2px;
    font-size: 11px;
    line-height: 1.2;
}

.permanent-buff-item .buff-value {
    color: #ffffff;
    font-size: 10px;
    line-height: 1.3;
}

.permanent-buff-item .buff-level {
    color: #aaaaaa;
    font-size: 9px;
    margin-left: 4px;
}

/* 菜单样式 */
.menu-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(10, 10, 10, 0.95);
    padding: 40px;
    border: 2px solid #00ffff;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    min-width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* 实验室特殊样式 */
#lab-screen {
    min-width: 800px;
    max-width: 1200px;
    padding: 30px 50px;
}

.lab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #00ffff;
}

.lab-header h2 {
    font-size: 36px;
    margin: 0;
    color: #00ffff;
    text-shadow: 0 0 20px #00ffff;
}

.lab-currency {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.currency-label {
    font-size: 14px;
    color: #aaaaaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.currency-value {
    font-size: 28px;
    font-weight: bold;
    color: #ffff00;
    text-shadow: 0 0 15px #ffff00;
}

#lab-screen .menu-btn {
    margin-top: 30px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

/* 排行榜特殊样式 */
#leaderboard-screen {
    min-width: 600px;
    max-width: 800px;
}

#leaderboard-screen h2 {
    font-size: 32px;
    margin-bottom: 25px;
}

.menu-screen h1 {
    font-size: 48px;
    margin-bottom: 10px;
    text-shadow: 0 0 20px #00ffff;
}

.menu-screen h2 {
    font-size: 24px;
    margin-bottom: 30px;
    color: #ffffff;
}

.menu-btn {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 15px;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    background: transparent;
    color: #00ffff;
    border: 2px solid #00ffff;
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: auto;
}

.menu-btn:hover {
    background: #00ffff;
    color: #0a0a0a;
    box-shadow: 0 0 20px #00ffff;
}

/* 升级界面 */
#levelup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

#upgrade-cards {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 20px;
    pointer-events: auto;
}

.upgrade-card {
    width: 250px;
    padding: 20px;
    background: rgba(10, 10, 10, 0.95);
    border: 2px solid #00ffff;
    cursor: pointer;
    transition: all 0.3s;
}

.upgrade-card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px #00ffff;
}

.upgrade-card h3 {
    margin-bottom: 10px;
    color: #00ffff;
}

.upgrade-card p {
    color: #ffffff;
    font-size: 14px;
}

/* 升级卡片稀有度样式 */
.upgrade-card.rarity-common {
    border-color: #aaaaaa;
}

.upgrade-card.rarity-common:hover {
    box-shadow: 0 0 30px #aaaaaa;
}

.upgrade-card.rarity-uncommon {
    border-color: #00ff00;
}

.upgrade-card.rarity-uncommon:hover {
    box-shadow: 0 0 30px #00ff00;
}

.upgrade-card.rarity-rare {
    border-color: #0088ff;
}

.upgrade-card.rarity-rare:hover {
    box-shadow: 0 0 30px #0088ff;
}

.upgrade-card.rarity-legendary {
    border-color: #ffaa00;
    background: rgba(255, 170, 0, 0.05);
}

.upgrade-card.rarity-legendary:hover {
    box-shadow: 0 0 40px #ffaa00;
}

/* 输入框 */
input[type="text"] {
    width: 100%;
    padding: 10px;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #00ffff;
    color: #00ffff;
    text-align: center;
}

/* 实验室升级网格 */
#lab-upgrades {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 15px;
    margin: 20px 0;
    max-height: 550px;
    overflow-y: auto;
    padding-right: 10px;
}

/* 实验室滚动条 */
#lab-upgrades::-webkit-scrollbar {
    width: 10px;
}

#lab-upgrades::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
}

#lab-upgrades::-webkit-scrollbar-thumb {
    background: #00ffff;
    border-radius: 5px;
}

#lab-upgrades::-webkit-scrollbar-thumb:hover {
    background: #00aaaa;
}

.lab-category-title {
    grid-column: 1 / -1;
    font-size: 16px;
    font-weight: bold;
    color: #00ffff;
    text-transform: uppercase;
    border-bottom: 2px solid #00ffff;
    padding: 10px 0 8px 0;
    margin-top: 15px;
}

.lab-category-title:first-child {
    margin-top: 0;
}

.lab-upgrade-item {
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #00ffff;
    border-radius: 5px;
    transition: all 0.3s;
    position: relative;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.lab-upgrade-item:hover:not(.maxed):not(.locked):not(.unaffordable) {
    background: rgba(0, 255, 255, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 255, 255, 0.4);
}

.lab-upgrade-item.maxed {
    border-color: #00ff00;
    background: rgba(0, 255, 0, 0.05);
    opacity: 0.6;
    cursor: default;
}

.lab-upgrade-item.locked {
    border-color: #666666;
    opacity: 0.4;
    cursor: not-allowed;
}

.lab-upgrade-item.unaffordable {
    border-color: #ff6666;
    opacity: 0.7;
    cursor: not-allowed;
}

.lab-upgrade-item h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #00ffff;
    font-weight: bold;
}

.lab-upgrade-item p {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #cccccc;
    line-height: 1.4;
    flex-grow: 1;
}

.lab-upgrade-item .price {
    color: #ffff00;
    font-weight: bold;
    font-size: 14px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.lab-upgrade-item.maxed .price {
    color: #00ff00;
}

.lab-upgrade-item.locked .price {
    color: #999999;
}

/* 排行榜 */
#leaderboard-list {
    max-height: 500px;
    overflow-y: auto;
    margin: 20px 0;
    padding-right: 10px;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #00ffff;
    border-radius: 5px;
    transition: all 0.3s;
}

.leaderboard-entry:hover {
    background: rgba(0, 255, 255, 0.1);
    transform: translateX(5px);
}

.leaderboard-entry .rank {
    color: #ffff00;
    font-weight: bold;
    font-size: 18px;
    min-width: 50px;
}

.leaderboard-entry .name {
    flex: 1;
    text-align: left;
    padding: 0 20px;
    font-size: 16px;
    color: #ffffff;
}

.leaderboard-entry .time {
    color: #00ff00;
    font-weight: bold;
    font-size: 16px;
    min-width: 100px;
    text-align: right;
}

.leaderboard-entry.top3 {
    border-color: #ffaa00;
    background: rgba(255, 170, 0, 0.15);
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.3);
}

.leaderboard-entry.top3 .rank {
    font-size: 20px;
    color: #ffaa00;
}

/* 排行榜滚动条 */
#leaderboard-list::-webkit-scrollbar {
    width: 10px;
}

#leaderboard-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
}

#leaderboard-list::-webkit-scrollbar-thumb {
    background: #00ffff;
    border-radius: 5px;
}

#leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: #00aaaa;
}

/* 技能栏 */
#skill-bar {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
}

.skill-slot {
    position: relative;
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #00ffff;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.skill-slot:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.skill-slot.ready {
    border-color: #00ff00;
    animation: skill-pulse 2s infinite;
}

@keyframes skill-pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 0, 0.8); }
}

.skill-slot.on-cooldown {
    border-color: #666666;
    cursor: not-allowed;
}

.skill-slot.insufficient {
    border-color: #ff6666;
    cursor: not-allowed;
}

.skill-icon {
    font-size: 24px;
    font-weight: bold;
    color: #00ffff;
    margin-bottom: 5px;
}

.skill-name {
    font-size: 10px;
    color: #ffffff;
    text-align: center;
}

.skill-cost {
    font-size: 9px;
    color: #ffff00;
    margin-top: 2px;
}

.skill-cooldown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    height: 0%;
    transition: height 0.1s linear;
}

.skill-cooldown-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 5px #000000;
}

/* 响应式设计 */
@media (max-width: 1440px) {
    /* 在中等屏幕上缩小右侧面板 */
    #upgrades-panel,
    #permanent-buffs-panel {
        width: 220px;
        max-height: 250px;
        padding: 10px;
    }
    
    #upgrades-panel h3,
    #permanent-buffs-panel h3 {
        font-size: 14px;
    }
}

@media (max-width: 1024px) {
    /* 在小屏幕上进一步缩小 */
    #upgrades-panel,
    #permanent-buffs-panel {
        width: 200px;
        max-height: 220px;
        padding: 8px;
        right: 10px;
    }
    
    #upgrades-panel {
        top: 10px;
    }
    
    #permanent-buffs-panel {
        top: 250px;
    }
    
    .upgrade-item,
    .permanent-buff-item {
        padding: 6px;
        font-size: 10px;
    }
    
    #lab-screen {
        min-width: 600px;
        padding: 25px 30px;
    }
    
    #lab-upgrades {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 12px;
    }
    
    .lab-header h2 {
        font-size: 28px;
    }
    
    .currency-value {
        font-size: 24px;
    }
}

@media (max-width: 768px) {
    /* 在移动设备上隐藏或最小化右侧面板 */
    #upgrades-panel,
    #permanent-buffs-panel {
        width: 180px;
        max-height: 180px;
        padding: 6px;
        font-size: 9px;
        opacity: 0.8;
    }
    
    #upgrades-panel {
        top: 5px;
        right: 5px;
    }
    
    #permanent-buffs-panel {
        top: 195px;
        right: 5px;
    }
    
    #lab-screen {
        min-width: 90vw;
        padding: 20px;
    }
    
    #lab-upgrades {
        grid-template-columns: 1fr;
        max-height: 400px;
    }
    
    .lab-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .lab-currency {
        align-items: flex-start;
    }
    
    #leaderboard-screen {
        min-width: 90vw;
    }
}

/* 隐藏类 */
.hidden {
    display: none !important;
}


/* 阶段切换通知 */
.phase-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: bold;
    color: #00ffff;
    text-shadow: 
        0 0 10px #00ffff,
        0 0 20px #00ffff,
        0 0 30px #00ffff,
        0 0 40px #00ffff;
    z-index: 9999;
    pointer-events: none;
    text-align: center;
    padding: 20px 40px;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid #00ffff;
    border-radius: 10px;
    white-space: nowrap;
}

.phase-notification.fade-in {
    animation: phaseNotificationIn 0.5s ease-out;
}

.phase-notification.fade-out {
    animation: phaseNotificationOut 0.5s ease-in;
    opacity: 0;
}

@keyframes phaseNotificationIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes phaseNotificationOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* 屏幕闪烁效果 */
.screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 255, 255, 0.3);
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
}

.screen-flash.flash-animation {
    animation: screenFlash 0.5s ease-out;
}

@keyframes screenFlash {
    0% {
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}
