<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>时空探险家 - 优化升级版</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
            color: white;
            min-height: 100vh;
            padding: 20px;
            transition: background 1s ease;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: rgba(0, 0, 0, 0.7);
            border-radius: 15px;
            padding: 20px;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
        }
        
        .tabs {
            display: flex;
            margin-bottom: 20px;
            background: rgba(0, 0, 0, 0.5);
            border-radius: 10px;
            padding: 5px;
        }
        
        .tab {
            flex: 1;
            text-align: center;
            padding: 10px;
            cursor: pointer;
            border-radius: 8px;
            transition: all 0.3s;
        }
        
        .tab.active {
            background: rgba(255, 204, 0, 0.2);
            border: 1px solid #ffcc00;
        }
        
        .tab-content {
            display: none;
        }
        
        .tab-content.active {
            display: block;
        }
        
        .level-info {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            background: rgba(0, 0, 0, 0.5);
            padding: 15px;
            border-radius: 10px;
        }
        
        .level-name {
            font-size: 1.5rem;
            font-weight: bold;
            color: #ffcc00;
        }
        
        .level-progress {
            flex-grow: 1;
            margin: 0 15px;
        }
        
        .progress-bar {
            height: 20px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 10px;
            overflow: hidden;
        }
        
        .progress-fill {
            height: 100%;
            background: linear-gradient(to right, #00b09b, #96c93d);
            border-radius: 10px;
            transition: width 0.5s ease;
        }
        
        .level-target {
            font-size: 0.9rem;
            color: #aaa;
        }
        
        .game-stats {
            display: flex;
            justify-content: space-between;
            margin-bottom: 20px;
            background: rgba(0, 0, 0, 0.5);
            padding: 15px;
            border-radius: 10px;
        }
        
        .stat {
            text-align: center;
        }
        
        .stat-value {
            font-size: 1.8rem;
            font-weight: bold;
            color: #ffcc00;
        }
        
        .game-area {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
        }
        
        .resource-area {
            background: rgba(0, 0, 0, 0.6);
            padding: 30px;
            border-radius: 15px;
            text-align: center;
            border: 2px solid #ffcc00;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
        
        .resource-core {
            width: 180px;
            height: 180px;
            background: linear-gradient(to bottom right, #ffcc00, #ff9900);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 20px;
            box-shadow: 0 0 30px rgba(255, 204, 0, 0.5);
            position: relative;
            overflow: hidden;
        }
        
        .resource-core::before {
            content: '';
            position: absolute;
            top: -10px;
            left: -10px;
            right: -10px;
            bottom: -10px;
            background: linear-gradient(45deg, #ffcc00, #ff9900, #ffcc00);
            border-radius: 50%;
            z-index: -1;
            opacity: 0.7;
            animation: rotate 4s linear infinite;
        }
        
        .resource-icon {
            font-size: 4rem;
            color: white;
            text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
        }
        
        .resource-display {
            margin-top: 10px;
        }
        
        .resource-amount {
            font-size: 2.5rem;
            font-weight: bold;
            color: #ffcc00;
            text-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
        }
        
        .resource-name {
            font-size: 1.2rem;
            margin-top: 5px;
            color: #aaa;
        }
        
        .upgrades-area {
            background: rgba(0, 0, 0, 0.6);
            padding: 20px;
            border-radius: 15px;
            border: 2px solid #ffcc00;
            max-height: 500px;
            overflow-y: auto;
        }
        
        .upgrades {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 15px;
        }
        
        .upgrade {
            background: rgba(30, 30, 60, 0.8);
            padding: 15px;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.3s;
            border: 1px solid #444;
        }
        
        .upgrade:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
            border-color: #ffcc00;
        }
        
        .upgrade-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
        }
        
        .upgrade-name {
            font-weight: bold;
            color: #ffcc00;
        }
        
        .upgrade-cost {
            color: #ff6666;
            font-weight: bold;
        }
        
        .upgrade-level {
            color: #66ccff;
            font-size: 0.9rem;
        }
        
        .upgrade-description {
            font-size: 0.9rem;
            color: #ccc;
            margin-top: 5px;
        }
        
        .save-section {
            display: flex;
            justify-content: space-between;
            margin-top: 20px;
        }
        
        button {
            background: linear-gradient(to right, #ff8a00, #da1b60);
            border: none;
            color: white;
            padding: 12px 20px;
            border-radius: 5px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.3s;
        }
        
        button:hover {
            transform: scale(1.05);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }
        
        .save-btn {
            background: linear-gradient(to right, #00b09b, #96c93d);
        }
        
        .load-btn {
            background: linear-gradient(to right, #2193b0, #6dd5ed);
        }
        
        .reset-btn {
            background: linear-gradient(to right, #ff416c, #ff4b2b);
        }
        
        .prestige-btn {
            background: linear-gradient(to right, #8e2de2, #4a00e0);
            width: 100%;
            margin-top: 15px;
            font-size: 1.2rem;
            padding: 15px;
        }
        
        .next-level-btn {
            background: linear-gradient(to right, #8e2de2, #4a00e0);
            width: 100%;
            margin-top: 15px;
            font-size: 1.2rem;
            padding: 15px;
        }
        
        .notification {
            position: fixed;
            top: 20px;
            right: 20px;
            padding: 15px 20px;
            background: rgba(0, 0, 0, 0.8);
            border-left: 5px solid #ffcc00;
            border-radius: 5px;
            transform: translateX(150%);
            transition: transform 0.5s;
            z-index: 1000;
        }
        
        .notification.show {
            transform: translateX(0);
        }
        
        .levels-panel {
            margin-top: 20px;
            background: rgba(0, 0, 0, 0.5);
            padding: 15px;
            border-radius: 10px;
        }
        
        .levels-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
            gap: 10px;
            margin-top: 10px;
        }
        
        .level-card {
            background: rgba(30, 30, 60, 0.8);
            padding: 15px;
            border-radius: 10px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s;
            border: 2px solid transparent;
        }
        
        .level-card:hover {
            transform: scale(1.05);
        }
        
        .level-card.active {
            border-color: #ffcc00;
            box-shadow: 0 0 15px rgba(255, 204, 0, 0.5);
        }
        
        .level-card.completed {
            border-color: #00b09b;
        }
        
        .level-card.locked {
            opacity: 0.5;
            cursor: not-allowed;
        }
        
        .level-icon {
            font-size: 2rem;
            margin-bottom: 10px;
        }
        
        .tech-tree {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 15px;
        }
        
        .tech-node {
            background: rgba(30, 30, 60, 0.8);
            padding: 15px;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.3s;
            border: 1px solid #444;
            position: relative;
        }
        
        .tech-node.unlocked {
            border-color: #00b09b;
            background: rgba(0, 80, 60, 0.8);
        }
        
        .tech-node.available {
            border-color: #ffcc00;
        }
        
        .tech-node:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }
        
        .tech-node-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
        }
        
        .tech-node-name {
            font-weight: bold;
            color: #ffcc00;
        }
        
        .tech-node-cost {
            color: #ff6666;
            font-weight: bold;
        }
        
        .tech-node-description {
            font-size: 0.9rem;
            color: #ccc;
            margin-top: 5px;
        }
        
        .prestige-panel {
            background: rgba(0, 0, 0, 0.5);
            padding: 20px;
            border-radius: 10px;
            text-align: center;
        }
        
        .prestige-reward {
            font-size: 1.5rem;
            color: #ffcc00;
            margin: 15px 0;
        }
        
        .prestige-description {
            margin-bottom: 20px;
            color: #ccc;
        }
        
        .resources-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
            gap: 10px;
            margin-top: 15px;
        }
        
        .resource-item {
            background: rgba(30, 30, 60, 0.8);
            padding: 10px;
            border-radius: 8px;
            text-align: center;
        }
        
        .resource-icon {
            font-size: 1.5rem;
            margin-bottom: 5px;
        }
        
        .resource-count {
            font-size: 1.2rem;
            font-weight: bold;
            color: #ffcc00;
        }
        
        .achievements-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 15px;
            margin-top: 15px;
        }
        
        .achievement {
            background: rgba(30, 30, 60, 0.8);
            padding: 15px;
            border-radius: 10px;
            border: 1px solid #444;
            transition: all 0.3s;
        }
        
        .achievement.unlocked {
            border-color: #00b09b;
            background: rgba(0, 80, 60, 0.8);
        }
        
        .achievement-progress {
            height: 10px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 5px;
            margin-top: 10px;
            overflow: hidden;
        }
        
        .achievement-progress-fill {
            height: 100%;
            background: linear-gradient(to right, #00b09b, #96c93d);
            border-radius: 5px;
            transition: width 0.5s ease;
        }
        
        @keyframes rotate {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
        
        @keyframes float {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
        }
        
        @media (max-width: 900px) {
            .game-area {
                grid-template-columns: 1fr;
            }
            
            .upgrades {
                grid-template-columns: 1fr;
            }
            
            .tech-tree {
                grid-template-columns: 1fr;
            }
            
            .achievements-grid {
                grid-template-columns: 1fr;
            }
            
            .game-stats {
                flex-direction: column;
                gap: 10px;
            }
            
            .save-section {
                flex-direction: column;
                gap: 10px;
            }
            
            .levels-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            
            .resources-grid {
                grid-template-columns: repeat(3, 1fr);
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <header class="text-center mb-8">
            <h1 class="text-4xl font-bold mb-2" style="background: linear-gradient(to right, #ff8a00, #da1b60); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);">时空探险家 - 优化升级版</h1>
            <p class="text-lg text-gray-300">探索不同时空,每个关卡独立发展,通过重生获得永久加成!</p>
        </header>
        
        <div class="tabs">
            <div class="tab active" data-tab="game">游戏</div>
            <div class="tab" data-tab="tech">科技树</div>
            <div class="tab" data-tab="achievements">成就</div>
            <div class="tab" data-tab="prestige">重生</div>
        </div>
        
        <div class="tab-content active" id="game-tab">
            <div class="level-info">
                <div class="level-name" id="current-level-name">时间矿场</div>
                <div class="level-progress">
                    <div class="progress-bar">
                        <div class="progress-fill" id="level-progress-bar" style="width: 0%"></div>
                    </div>
                    <div class="level-target" id="level-target">目标: 0/100,000 时间晶体</div>
                </div>
                <button class="next-level-btn" id="next-level-btn" style="display: none;">进入下一关</button>
            </div>
            
            <div class="game-stats">
                <div class="stat">
                    <div class="stat-label">每秒产量</div>
                    <div class="stat-value" id="production-rate">1.0</div>
                </div>
                <div class="stat">
                    <div class="stat-label">总收集</div>
                    <div class="stat-value" id="total-collected">0</div>
                </div>
                <div class="stat">
                    <div class="stat-label">游戏时间</div>
                    <div class="stat-value" id="play-time">00:00:00</div>
                </div>
                <div class="stat">
                    <div class="stat-label">关卡进度</div>
                    <div class="stat-value" id="level-progress">0%</div>
                </div>
            </div>
            
            <div class="game-area">
                <div class="resource-area">
                    <div class="resource-core" id="resource-core">
                        <div class="resource-icon" id="resource-core-icon">?</div>
                    </div>
                    <div class="resource-display">
                        <div class="resource-amount" id="resource-amount">0</div>
                        <div class="resource-name" id="resource-name">时间晶体</div>
                    </div>
                </div>
                
                <div class="upgrades-area">
                    <h2 class="text-2xl font-bold text-white mb-4 text-center">关卡升级</h2>
                    <div class="upgrades" id="upgrades-container">
                        <!-- 升级项将通过JavaScript动态生成 -->
                    </div>
                </div>
            </div>
            
            <div class="levels-panel">
                <h2 class="text-2xl font-bold text-white mb-4 text-center">关卡选择</h2>
                <div class="levels-grid" id="levels-grid">
                    <!-- 关卡卡片将通过JavaScript动态生成 -->
                </div>
            </div>
            
            <div class="save-section">
                <button class="save-btn" onclick="saveGame()">保存游戏</button>
                <button class="load-btn" onclick="loadGame()">加载游戏</button>
                <button class="reset-btn" onclick="resetGame()">重置游戏</button>
            </div>
        </div>
        
        <div class="tab-content" id="tech-tab">
            <h2 class="text-2xl font-bold text-white mb-4 text-center">科技树</h2>
            <p class="text-gray-300 mb-6 text-center">解锁科技获得永久性加成,这些加成会在重生后保留</p>
            
            <div class="tech-tree" id="tech-tree-container">
                <!-- 科技节点将通过JavaScript动态生成 -->
            </div>
        </div>
        
        <div class="tab-content" id="achievements-tab">
            <h2 class="text-2xl font-bold text-white mb-4 text-center">成就系统</h2>
            <p class="text-gray-300 mb-6 text-center">完成各种挑战,解锁成就获得奖励</p>
            
            <div class="achievements-grid" id="achievements-container">
                <!-- 成就将通过JavaScript动态生成 -->
            </div>
        </div>
        
        <div class="tab-content" id="prestige-tab">
            <h2 class="text-2xl font-bold text-white mb-4 text-center">重生系统</h2>
            <p class="text-gray-300 mb-6 text-center">通过重生获得时空精华,用于解锁永久性加成</p>
            
            <div class="prestige-panel">
                <div class="prestige-description">
                    重生将重置你的所有进度,但你会获得时空精华,用于解锁强大的永久加成。<br>
                    <span class="text-yellow-400 font-bold">需要解锁所有关卡才能重生!</span>
                </div>
                
                <div class="prestige-reward">
                    本次重生可获得: <span id="prestige-reward">0</span> 时空精华
                </div>
                
                <button class="prestige-btn" id="prestige-btn" onclick="prestige()">重生</button>
                
                <div class="resources-grid" id="prestige-resources">
                    <!-- 重生资源将通过JavaScript动态生成 -->
                </div>
            </div>
        </div>
    </div>
    
    <div class="notification" id="notification">游戏已保存!</div>

    <script>
        // 关卡定义 - 增加到8个关卡
        const levels = [
            {
                id: 1,
                name: "时间矿场",
                background: "linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d)",
                resourceName: "时间晶体",
                resourceIcon: "?",
                baseProduction: 1,
                targetAmount: 100000, // 增加目标数量
                upgrades: [
                    {
                        id: 'time_miner',
                        name: '时间矿工',
                        description: '基础时间采集设备',
                        baseCost: 15,
                        production: 0.5,
                        maxLevel: 99999,
                        icon: 'fa-robot',
                        color: 'from-blue-400 to-cyan-500'
                    },
                    {
                        id: 'time_drill',
                        name: '时间钻机',
                        description: '高效时间采集',
                        baseCost: 100,
                        production: 2,
                        maxLevel: 99999,
                        icon: 'fa-mountain',
                        color: 'from-green-400 to-emerald-500'
                    },
                    {
                        id: 'time_reactor',
                        name: '时间反应堆',
                        description: '高级时间设备',
                        baseCost: 500,
                        production: 5,
                        maxLevel: 99999,
                        icon: 'fa-atom',
                        color: 'from-purple-400 to-pink-500'
                    },
                    {
                        id: 'time_core',
                        name: '时间核心',
                        description: '终极时间源',
                        baseCost: 2000,
                        production: 15,
                        maxLevel: 99999,
                        icon: 'fa-infinity',
                        color: 'from-orange-400 to-red-500'
                    }
                ]
            },
            {
                id: 2,
                name: "空间裂缝",
                background: "linear-gradient(135deg, #3a1c71, #d76d77, #ffaf7b)",
                resourceName: "空间宝石",
                resourceIcon: "??",
                baseProduction: 2,
                targetAmount: 500000, // 增加目标数量
                upgrades: [
                    {
                        id: 'space_miner',
                        name: '空间矿工',
                        description: '基础空间采集设备',
                        baseCost: 50,
                        production: 1,
                        maxLevel: 99999,
                        icon: 'fa-robot',
                        color: 'from-blue-400 to-cyan-500'
                    },
                    {
                        id: 'space_drill',
                        name: '空间钻机',
                        description: '高效空间采集',
                        baseCost: 250,
                        production: 4,
                        maxLevel: 99999,
                        icon: 'fa-mountain',
                        color: 'from-green-400 to-emerald-500'
                    },
                    {
                        id: 'space_reactor',
                        name: '空间反应堆',
                        description: '高级空间设备',
                        baseCost: 1000,
                        production: 10,
                        maxLevel: 99999,
                        icon: 'fa-atom',
                        color: 'from-purple-400 to-pink-500'
                    },
                    {
                        id: 'space_core',
                        name: '空间核心',
                        description: '终极空间源',
                        baseCost: 5000,
                        production: 30,
                        maxLevel: 99999,
                        icon: 'fa-infinity',
                        color: 'from-orange-400 to-red-500'
                    }
                ]
            },
            {
                id: 3,
                name: "暗物质领域",
                background: "linear-gradient(135deg, #0f0c29, #302b63, #24243e)",
                resourceName: "暗物质",
                resourceIcon: "?",
                baseProduction: 5,
                targetAmount: 2000000, // 增加目标数量
                upgrades: [
                    {
                        id: 'dark_miner',
                        name: '暗物质矿工',
                        description: '基础暗物质采集设备',
                        baseCost: 150,
                        production: 2.5,
                        maxLevel: 99999,
                        icon: 'fa-robot',
                        color: 'from-blue-400 to-cyan-500'
                    },
                    {
                        id: 'dark_drill',
                        name: '暗物质钻机',
                        description: '高效暗物质采集',
                        baseCost: 750,
                        production: 10,
                        maxLevel: 99999,
                        icon: 'fa-mountain',
                        color: 'from-green-400 to-emerald-500'
                    },
                    {
                        id: 'dark_reactor',
                        name: '暗物质反应堆',
                        description: '高级暗物质设备',
                        baseCost: 3000,
                        production: 25,
                        maxLevel: 99999,
                        icon: 'fa-atom',
                        color: 'from-purple-400 to-pink-500'
                    },
                    {
                        id: 'dark_core',
                        name: '暗物质核心',
                        description: '终极暗物质源',
                        baseCost: 15000,
                        production: 75,
                        maxLevel: 99999,
                        icon: 'fa-infinity',
                        color: 'from-orange-400 to-red-500'
                    }
                ]
            },
            {
                id: 4,
                name: "能量核心",
                background: "linear-gradient(135deg, #00416a, #799f0c, #ffe000)",
                resourceName: "能量核心",
                resourceIcon: "?",
                baseProduction: 10,
                targetAmount: 10000000, // 增加目标数量
                upgrades: [
                    {
                        id: 'energy_miner',
                        name: '能量矿工',
                        description: '基础能量采集设备',
                        baseCost: 500,
                        production: 5,
                        maxLevel: 99999,
                        icon: 'fa-robot',
                        color: 'from-blue-400 to-cyan-500'
                    },
                    {
                        id: 'energy_drill',
                        name: '能量钻机',
                        description: '高效能量采集',
                        baseCost: 2500,
                        production: 20,
                        maxLevel: 99999,
                        icon: 'fa-mountain',
                        color: 'from-green-400 to-emerald-500'
                    },
                    {
                        id: 'energy_reactor',
                        name: '能量反应堆',
                        description: '高级能量设备',
                        baseCost: 10000,
                        production: 50,
                        maxLevel: 99999,
                        icon: 'fa-atom',
                        color: 'from-purple-400 to-pink-500'
                    },
                    {
                        id: 'energy_core',
                        name: '能量核心',
                        description: '终极能量源',
                        baseCost: 50000,
                        production: 150,
                        maxLevel: 99999,
                        icon: 'fa-infinity',
                        color: 'from-orange-400 to-red-500'
                    }
                ]
            },
            {
                id: 5,
                name: "宇宙尽头",
                background: "linear-gradient(135deg, #000000, #434343, #000000)",
                resourceName: "宇宙尘埃",
                resourceIcon: "?",
                baseProduction: 20,
                targetAmount: 50000000, // 增加目标数量
                upgrades: [
                    {
                        id: 'cosmic_miner',
                        name: '宇宙矿工',
                        description: '基础宇宙采集设备',
                        baseCost: 2000,
                        production: 10,
                        maxLevel: 99999,
                        icon: 'fa-robot',
                        color: 'from-blue-400 to-cyan-500'
                    },
                    {
                        id: 'cosmic_drill',
                        name: '宇宙钻机',
                        description: '高效宇宙采集',
                        baseCost: 10000,
                        production: 40,
                        maxLevel: 99999,
                        icon: 'fa-mountain',
                        color: 'from-green-400 to-emerald-500'
                    },
                    {
                        id: 'cosmic_reactor',
                        name: '宇宙反应堆',
                        description: '高级宇宙设备',
                        baseCost: 50000,
                        production: 100,
                        maxLevel: 99999,
                        icon: 'fa-atom',
                        color: 'from-purple-400 to-pink-500'
                    },
                    {
                        id: 'cosmic_core',
                        name: '宇宙核心',
                        description: '终极宇宙源',
                        baseCost: 250000,
                        production: 300,
                        maxLevel: 99999,
                        icon: 'fa-infinity',
                        color: 'from-orange-400 to-red-500'
                    }
                ]
            },
            {
                id: 6,
                name: "量子领域",
                background: "linear-gradient(135deg, #1e3c72, #2a5298, #1e3c72)",
                resourceName: "量子粒子",
                resourceIcon: "??",
                baseProduction: 50,
                targetAmount: 200000000, // 增加目标数量
                upgrades: [
                    {
                        id: 'quantum_miner',
                        name: '量子矿工',
                        description: '基础量子采集设备',
                        baseCost: 10000,
                        production: 25,
                        maxLevel: 99999,
                        icon: 'fa-robot',
                        color: 'from-blue-400 to-cyan-500'
                    },
                    {
                        id: 'quantum_drill',
                        name: '量子钻机',
                        description: '高效量子采集',
                        baseCost: 50000,
                        production: 100,
                        maxLevel: 99999,
                        icon: 'fa-mountain',
                        color: 'from-green-400 to-emerald-500'
                    },
                    {
                        id: 'quantum_reactor',
                        name: '量子反应堆',
                        description: '高级量子设备',
                        baseCost: 250000,
                        production: 250,
                        maxLevel: 99999,
                        icon: 'fa-atom',
                        color: 'from-purple-400 to-pink-500'
                    },
                    {
                        id: 'quantum_core',
                        name: '量子核心',
                        description: '终极量子源',
                        baseCost: 1250000,
                        production: 750,
                        maxLevel: 99999,
                        icon: 'fa-infinity',
                        color: 'from-orange-400 to-red-500'
                    }
                ]
            },
            {
                id: 7,
                name: "维度之门",
                background: "linear-gradient(135deg, #6a11cb, #2575fc, #6a11cb)",
                resourceName: "维度碎片",
                resourceIcon: "??",
                baseProduction: 100,
                targetAmount: 1000000000, // 增加目标数量
                upgrades: [
                    {
                        id: 'dimension_miner',
                        name: '维度矿工',
                        description: '基础维度采集设备',
                        baseCost: 50000,
                        production: 50,
                        maxLevel: 99999,
                        icon: 'fa-robot',
                        color: 'from-blue-400 to-cyan-500'
                    },
                    {
                        id: 'dimension_drill',
                        name: '维度钻机',
                        description: '高效维度采集',
                        baseCost: 250000,
                        production: 200,
                        maxLevel: 99999,
                        icon: 'fa-mountain',
                        color: 'from-green-400 to-emerald-500'
                    },
                    {
                        id: 'dimension_reactor',
                        name: '维度反应堆',
                        description: '高级维度设备',
                        baseCost: 1250000,
                        production: 500,
                        maxLevel: 99999,
                        icon: 'fa-atom',
                        color: 'from-purple-400 to-pink-500'
                    },
                    {
                        id: 'dimension_core',
                        name: '维度核心',
                        description: '终极维度源',
                        baseCost: 6250000,
                        production: 1500,
                        maxLevel: 99999,
                        icon: 'fa-infinity',
                        color: 'from-orange-400 to-red-500'
                    }
                ]
            },
            {
                id: 8,
                name: "创世之源",
                background: "linear-gradient(135deg, #ff0000, #ff8000, #ffff00, #00ff00, #00ffff, #0000ff, #8000ff, #ff00ff)",
                resourceName: "创世能量",
                resourceIcon: "??",
                baseProduction: 200,
                targetAmount: 5000000000, // 增加目标数量
                upgrades: [
                    {
                        id: 'creation_miner',
                        name: '创世矿工',
                        description: '基础创世采集设备',
                        baseCost: 250000,
                        production: 100,
                        maxLevel: 99999,
                        icon: 'fa-robot',
                        color: 'from-blue-400 to-cyan-500'
                    },
                    {
                        id: 'creation_drill',
                        name: '创世钻机',
                        description: '高效创世采集',
                        baseCost: 1250000,
                        production: 400,
                        maxLevel: 99999,
                        icon: 'fa-mountain',
                        color: 'from-green-400 to-emerald-500'
                    },
                    {
                        id: 'creation_reactor',
                        name: '创世反应堆',
                        description: '高级创世设备',
                        baseCost: 6250000,
                        production: 1000,
                        maxLevel: 99999,
                        icon: 'fa-atom',
                        color: 'from-purple-400 to-pink-500'
                    },
                    {
                        id: 'creation_core',
                        name: '创世核心',
                        description: '终极创世源',
                        baseCost: 31250000,
                        production: 3000,
                        maxLevel: 99999,
                        icon: 'fa-infinity',
                        color: 'from-orange-400 to-red-500'
                    }
                ]
            }
        ];

        // 科技树定义 - 增加更多科技
        const techTree = [
            {
                id: "production_boost",
                name: "生产加速",
                description: "所有资源生产速度提高10%",
                cost: 5,
                effect: { type: "production", value: 0.1 },
                dependencies: [],
                icon: "fa-rocket"
            },
            {
                id: "cost_reduction",
                name: "成本降低",
                description: "所有升级成本降低5%",
                cost: 10,
                effect: { type: "cost", value: 0.05 },
                dependencies: [],
                icon: "fa-coins"
            },
            {
                id: "prestige_boost",
                name: "重生加成",
                description: "重生获得的时空精华增加20%",
                cost: 15,
                effect: { type: "prestige", value: 0.2 },
                dependencies: [],
                icon: "fa-sync"
            },
            {
                id: "automation_boost",
                name: "自动化增强",
                description: "自动化效率提高50%",
                cost: 20,
                effect: { type: "automation", value: 0.5 },
                dependencies: ["production_boost"],
                icon: "fa-robot"
            },
            {
                id: "multiplier_boost",
                name: "倍率增强",
                description: "所有倍率升级效果提高25%",
                cost: 25,
                effect: { type: "multiplier", value: 0.25 },
                dependencies: ["cost_reduction"],
                icon: "fa-bolt"
            },
            {
                id: "quantum_leap",
                name: "量子飞跃",
                description: "解锁量子生产,所有资源生产速度翻倍",
                cost: 50,
                effect: { type: "quantum", value: 2 },
                dependencies: ["automation_boost", "multiplier_boost"],
                icon: "fa-atom"
            },
            {
                id: "time_warp",
                name: "时间扭曲",
                description: "时间流速增加50%",
                cost: 75,
                effect: { type: "time", value: 0.5 },
                dependencies: ["quantum_leap"],
                icon: "fa-clock"
            },
            {
                id: "multiverse_connection",
                name: "多元宇宙连接",
                description: "连接平行宇宙,获得额外100%产量",
                cost: 100,
                effect: { type: "multiverse", value: 1.0 },
                dependencies: ["time_warp"],
                icon: "fa-globe"
            },
            {
                id: "resource_recycling",
                name: "资源回收",
                description: "所有资源回收效率提高30%",
                cost: 40,
                effect: { type: "recycling", value: 0.3 },
                dependencies: ["production_boost"],
                icon: "fa-recycle"
            },
            {
                id: "energy_efficiency",
                name: "能源效率",
                description: "所有设备能源消耗降低25%",
                cost: 60,
                effect: { type: "efficiency", value: 0.25 },
                dependencies: ["cost_reduction"],
                icon: "fa-battery-full"
            },
            {
                id: "parallel_processing",
                name: "并行处理",
                description: "所有设备可以同时工作,产量提高40%",
                cost: 80,
                effect: { type: "parallel", value: 0.4 },
                dependencies: ["automation_boost"],
                icon: "fa-microchip"
            },
            {
                id: "dimensional_shift",
                name: "维度转换",
                description: "可以访问更高维度,产量提高100%",
                cost: 120,
                effect: { type: "dimensional", value: 1.0 },
                dependencies: ["multiverse_connection"],
                icon: "fa-cube"
            },
            {
                id: "time_compression",
                name: "时间压缩",
                description: "压缩时间流,生产速度提高75%",
                cost: 150,
                effect: { type: "compression", value: 0.75 },
                dependencies: ["time_warp"],
                icon: "fa-hourglass-half"
            },
            {
                id: "singularity_engine",
                name: "奇点引擎",
                description: "利用奇点能量,所有产量提高300%",
                cost: 200,
                effect: { type: "singularity", value: 3.0 },
                dependencies: ["dimensional_shift", "time_compression"],
                icon: "fa-star"
            }
        ];

        // 成就定义 - 每个关卡有不同但数量相同的成就
        const achievements = [
            // 时间矿场成就
            {
                id: "time_miner_novice",
                name: "时间矿工新手",
                description: "在时间矿场收集10,000时间晶体",
                target: 10000,
                reward: 5,
                icon: "fa-clock",
                level: 1
            },
            {
                id: "time_master",
                name: "时间大师",
                description: "在时间矿场收集100,000时间晶体",
                target: 100000,
                reward: 10,
                icon: "fa-hourglass",
                level: 1
            },
            {
                id: "time_upgrader",
                name: "时间升级者",
                description: "在时间矿场达到50级总升级",
                target: 50,
                reward: 8,
                icon: "fa-cogs",
                level: 1
            },
            {
                id: "time_speedster",
                name: "时间速行者",
                description: "在时间矿场达到100/秒产量",
                target: 100,
                reward: 12,
                icon: "fa-bolt",
                level: 1
            },
            {
                id: "time_completionist",
                name: "时间完成者",
                description: "完成时间矿场所有目标",
                target: 1,
                reward: 15,
                icon: "fa-check-circle",
                level: 1
            },
            
            // 空间裂缝成就
            {
                id: "space_explorer",
                name: "空间探索者",
                description: "在空间裂缝收集50,000空间宝石",
                target: 50000,
                reward: 8,
                icon: "fa-globe",
                level: 2
            },
            {
                id: "space_master",
                name: "空间大师",
                description: "在空间裂缝收集500,000空间宝石",
                target: 500000,
                reward: 15,
                icon: "fa-satellite",
                level: 2
            },
            {
                id: "space_upgrader",
                name: "空间升级者",
                description: "在空间裂缝达到75级总升级",
                target: 75,
                reward: 12,
                icon: "fa-cogs",
                level: 2
            },
            {
                id: "space_speedster",
                name: "空间速行者",
                description: "在空间裂缝达到500/秒产量",
                target: 500,
                reward: 18,
                icon: "fa-bolt",
                level: 2
            },
            {
                id: "space_completionist",
                name: "空间完成者",
                description: "完成空间裂缝所有目标",
                target: 1,
                reward: 20,
                icon: "fa-check-circle",
                level: 2
            },