跳到正文

休闲·娱乐

教师模拟器

Zhao_Yinghe约 250 分钟
原文

这是 2025年12月14日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

发布
2025年12月14日
收录
2025年12月14日
更新
2026年11月21日
篇幅
约 250 分钟

版本

  1. v2当前
  2. v1
HTML
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>教师模拟器 - 体验教师的日常工作</title>
    <!-- Tailwind CSS v3 -->
    <script src="https://cdn.tailwindcss.com"></script>
    <!-- Font Awesome -->
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3b82f6', // 蓝色
                        secondary: '#10b981', // 绿色
                        accent: '#f59e0b', // 橙色
                        danger: '#ef4444', // 红色
                        dark: '#1e293b',
                        light: '#f8fafc'
                    },
                    fontFamily: {
                        sans: ['Inter', 'system-ui', 'sans-serif'],
                    },
                    animation: {
                        'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite',
                        'bounce-slow': 'bounce 2s infinite',
                        'fade-in': 'fadeIn 0.5s ease-in-out',
                        'slide-in': 'slideIn 0.5s ease-in-out',
                    },
                    keyframes: {
                        fadeIn: {
                            '0%': { opacity: '0' },
                            '100%': { opacity: '1' },
                        },
                        slideIn: {
                            '0%': { transform: 'translateY(20px)', opacity: '0' },
                            '100%': { transform: 'translateY(0)', opacity: '1' },
                        }
                    }
                }
            }
        }
    </script>
    <style type="text/tailwindcss">
        @layer utilities {
            .text-shadow {
                text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
            }
            .card-shadow {
                box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            }
            .transition-all-300 {
                transition: all 300ms ease-in-out;
            }
            .bg-pattern {
                background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
            }
        }
    </style>
    <style>
        /* 自定义样式 */
        .pressure-bar {
            height: 8px;
            border-radius: 4px;
            transition: width 0.5s ease-in-out;
        }
        
        .student-card:hover {
            transform: translateY(-5px);
        }
        
        .activity-card {
            transition: all 0.3s ease;
        }
        
        .activity-card:hover {
            transform: scale(1.03);
        }
        
        .activity-card.selected {
            border: 2px solid #3b82f6;
            box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
        }
        
        .week-card {
            min-height: 120px;
        }
        
        .notification {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 1000;
            transform: translateX(400px);
            transition: transform 0.3s ease-in-out;
        }
        
        .notification.show {
            transform: translateX(0);
        }
        
        /* 加载动画 */
        .loading {
            display: inline-block;
            position: relative;
            width: 80px;
            height: 80px;
        }
        
        .loading div {
            position: absolute;
            top: 33px;
            width: 13px;
            height: 13px;
            border-radius: 50%;
            background: #3b82f6;
            animation-timing-function: cubic-bezier(0, 1, 1, 0);
        }
        
        .loading div:nth-child(1) {
            left: 8px;
            animation: loading1 0.6s infinite;
        }
        
        .loading div:nth-child(2) {
            left: 8px;
            animation: loading2 0.6s infinite;
        }
        
        .loading div:nth-child(3) {
            left: 32px;
            animation: loading2 0.6s infinite;
        }
        
        .loading div:nth-child(4) {
            left: 56px;
            animation: loading3 0.6s infinite;
        }
        
        @keyframes loading1 {
            0% { transform: scale(0); }
            100% { transform: scale(1); }
        }
        
        @keyframes loading3 {
            0% { transform: scale(1); }
            100% { transform: scale(0); }
        }
        
        @keyframes loading2 {
            0% { transform: translate(0, 0); }
            100% { transform: translate(24px, 0); }
        }
        
        /* 成就解锁动画 */
        @keyframes achievementUnlock {
            0% { transform: scale(0) rotate(0deg); opacity: 0; }
            50% { transform: scale(1.2) rotate(180deg); opacity: 1; }
            100% { transform: scale(1) rotate(360deg); opacity: 1; }
        }
        
        .achievement-unlock {
            animation: achievementUnlock 1s ease-out forwards;
        }
    </style>
</head>
<body class="bg-gray-50 bg-pattern min-h-screen">
    <!-- 初始设置弹窗 -->
    <div id="setupModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
        <div class="bg-white rounded-lg shadow-xl p-8 max-w-md w-full animate-fade-in">
            <h2 class="text-2xl font-bold text-center mb-6 text-primary">欢迎来到教师模拟器!</h2>
            <p class="text-gray-600 mb-6">请选择你将要工作的地区,不同地区有不同的教育环境和资源条件。</p>
            
            <div class="space-y-4 mb-6">
                <div class="region-card p-4 border rounded-lg cursor-pointer hover:bg-blue-50 transition-all-300" data-region="city">
                    <div class="flex items-center">
                        <div class="w-12 h-12 bg-primary rounded-full flex items-center justify-center text-white mr-4">
                            <i class="fa fa-building text-xl"></i>
                        </div>
                        <div>
                            <h3 class="font-bold text-lg">城市学校</h3>
                            <p class="text-sm text-gray-600">资源丰富,家长期望高,学生竞争压力大</p>
                            <div class="flex mt-2 text-sm">
                                <span class="mr-4"><i class="fa fa-money text-green-500"></i> 班费: 1000元</span>
                                <span><i class="fa fa-users text-blue-500"></i> 学生: 40人</span>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="region-card p-4 border rounded-lg cursor-pointer hover:bg-blue-50 transition-all-300" data-region="suburb">
                    <div class="flex items-center">
                        <div class="w-12 h-12 bg-secondary rounded-full flex items-center justify-center text-white mr-4">
                            <i class="fa fa-tree text-xl"></i>
                        </div>
                        <div>
                            <h3 class="font-bold text-lg">郊区学校</h3>
                            <p class="text-sm text-gray-600">资源适中,家长配合度高,学生压力中等</p>
                            <div class="flex mt-2 text-sm">
                                <span class="mr-4"><i class="fa fa-money text-green-500"></i> 班费: 700元</span>
                                <span><i class="fa fa-users text-blue-500"></i> 学生: 35人</span>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div class="region-card p-4 border rounded-lg cursor-pointer hover:bg-blue-50 transition-all-300" data-region="rural">
                    <div class="flex items-center">
                        <div class="w-12 h-12 bg-accent rounded-full flex items-center justify-center text-white mr-4">
                            <i class="fa fa-pagelines text-xl"></i>
                        </div>
                        <div>
                            <h3 class="font-bold text-lg">乡村学校</h3>
                            <p class="text-sm text-gray-600">资源有限,学生基础参差不齐,需要更多耐心</p>
                            <div class="flex mt-2 text-sm">
                                <span class="mr-4"><i class="fa fa-money text-green-500"></i> 班费: 400元</span>
                                <span><i class="fa fa-users text-blue-500"></i> 学生: 30人</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="text-center">
                <button id="startGame" class="bg-primary hover:bg-blue-600 text-white font-bold py-2 px-6 rounded-lg transition-all disabled:opacity-50 disabled:cursor-not-allowed" disabled>
                    开始游戏
                </button>
            </div>
        </div>
    </div>

    <!-- 主游戏界面 -->
    <div id="gameContainer" class="flex flex-col h-screen hidden">
        <!-- 顶部状态栏 -->
        <header class="bg-white shadow-md">
            <div class="container mx-auto px-4 py-3 flex justify-between items-center">
                <div class="flex items-center">
                    <h1 class="text-2xl font-bold text-primary mr-6">教师模拟器</h1>
                    <div class="flex items-center bg-blue-50 px-3 py-1 rounded-full">
                        <i class="fa fa-calendar text-primary mr-2"></i>
                        <span class="font-medium">第 <span id="currentWeek">1</span> 周</span>
                    </div>
                </div>
                
                <div class="flex items-center space-x-6">
                    <div class="flex items-center">
                        <i class="fa fa-money text-green-500 text-xl mr-2"></i>
                        <span class="font-bold text-lg">班费: <span id="classFund">0</span>元</span>
                    </div>
                    
                    <div class="flex items-center">
                        <i class="fa fa-users text-blue-500 text-xl mr-2"></i>
                        <span class="font-bold text-lg">班级状态: </span>
                        <span id="classStatus" class="ml-1 px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800">
                            良好
                        </span>
                    </div>
                    
                    <button id="achievementBtn" class="flex items-center bg-yellow-50 hover:bg-yellow-100 text-yellow-700 px-3 py-1 rounded-full transition-all">
                        <i class="fa fa-trophy mr-2"></i>
                        <span>成就</span>
                    </button>
                </div>
            </div>
        </header>

        <!-- 主要内容区域 -->
        <div class="flex flex-1 overflow-hidden">
            <!-- 左侧导航菜单 -->
            <nav class="w-64 bg-white shadow-md overflow-y-auto">
                <div class="p-4">
                    <h2 class="text-lg font-bold mb-4 text-gray-700 border-b pb-2">功能菜单</h2>
                    
                    <ul class="space-y-2">
                        <li>
                            <button class="nav-btn w-full flex items-center px-3 py-2 text-gray-700 rounded-lg hover:bg-blue-50 transition-all active" data-target="dashboard">
                                <i class="fa fa-home w-6 text-primary"></i>
                                <span>班级概览</span>
                            </button>
                        </li>
                        <li>
                            <button class="nav-btn w-full flex items-center px-3 py-2 text-gray-700 rounded-lg hover:bg-blue-50 transition-all" data-target="students">
                                <i class="fa fa-user-circle w-6 text-primary"></i>
                                <span>学生管理</span>
                            </button>
                        </li>
                        <li>
                            <button class="nav-btn w-full flex items-center px-3 py-2 text-gray-700 rounded-lg hover:bg-blue-50 transition-all" data-target="schedule">
                                <i class="fa fa-calendar-check-o w-6 text-primary"></i>
                                <span>课程安排</span>
                            </button>
                        </li>
                        <li>
                            <button class="nav-btn w-full flex items-center px-3 py-2 text-gray-700 rounded-lg hover:bg-blue-50 transition-all" data-target="finances">
                                <i class="fa fa-money w-6 text-primary"></i>
                                <span>班费管理</span>
                            </button>
                        </li>
                        <li>
                            <button class="nav-btn w-full flex items-center px-3 py-2 text-gray-700 rounded-lg hover:bg-blue-50 transition-all" data-target="events">
                                <i class="fa fa-bell w-6 text-primary"></i>
                                <span>事件记录</span>
                            </button>
                        </li>
                    </ul>
                </div>
                
                <div class="p-4 border-t">
                    <h2 class="text-lg font-bold mb-4 text-gray-700">游戏控制</h2>
                    
                    <div class="space-y-3">
                        <button id="nextWeekBtn" class="w-full bg-primary hover:bg-blue-600 text-white font-bold py-2 px-4 rounded-lg transition-all flex items-center justify-center">
                            <i class="fa fa-arrow-right mr-2"></i>
                            进入下一周
                        </button>
                        
                        <button id="saveGameBtn" class="w-full bg-secondary hover:bg-green-600 text-white font-bold py-2 px-4 rounded-lg transition-all flex items-center justify-center">
                            <i class="fa fa-save mr-2"></i>
                            保存游戏
                        </button>
                        
                        <button id="restartGameBtn" class="w-full bg-gray-600 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded-lg transition-all flex items-center justify-center">
                            <i class="fa fa-refresh mr-2"></i>
                            重新开始
                        </button>
                    </div>
                </div>
            </nav>

            <!-- 右侧内容区域 -->
            <main class="flex-1 overflow-y-auto p-6">
                <!-- 班级概览页面 -->
                <section id="dashboard" class="page-content">
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
                        <!-- 班级基本信息 -->
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <h3 class="text-lg font-bold mb-4 text-gray-700 flex items-center">
                                <i class="fa fa-info-circle text-primary mr-2"></i>
                                班级信息
                            </h3>
                            <div class="space-y-3">
                                <div class="flex justify-between">
                                    <span class="text-gray-600">地区:</span>
                                    <span id="regionDisplay" class="font-medium">--</span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-gray-600">学生人数:</span>
                                    <span id="studentCount" class="font-medium">--</span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-gray-600">平均压力值:</span>
                                    <div class="flex items-center">
                                        <div class="w-24 bg-gray-200 rounded-full h-2 mr-2">
                                            <div id="avgPressureBar" class="bg-yellow-500 h-2 rounded-full" style="width: 0%"></div>
                                        </div>
                                        <span id="avgPressureValue" class="font-medium">0%</span>
                                    </div>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-gray-600">班级满意度:</span>
                                    <div class="flex items-center">
                                        <div class="w-24 bg-gray-200 rounded-full h-2 mr-2">
                                            <div id="satisfactionBar" class="bg-green-500 h-2 rounded-full" style="width: 0%"></div>
                                        </div>
                                        <span id="satisfactionValue" class="font-medium">0%</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 本周活动 -->
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <h3 class="text-lg font-bold mb-4 text-gray-700 flex items-center">
                                <i class="fa fa-calendar text-primary mr-2"></i>
                                本周活动
                            </h3>
                            <div id="weeklyActivity" class="text-center py-4 text-gray-500">
                                尚未安排活动
                            </div>
                        </div>
                        
                        <!-- 最近事件 -->
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <h3 class="text-lg font-bold mb-4 text-gray-700 flex items-center">
                                <i class="fa fa-bell text-primary mr-2"></i>
                                最近事件
                            </h3>
                            <div id="recentEvents" class="space-y-3 max-h-40 overflow-y-auto">
                                <div class="text-center py-4 text-gray-500">
                                    暂无事件记录
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- 学生压力分布 -->
                    <div class="bg-white rounded-lg shadow-md p-6 mb-6">
                        <h3 class="text-lg font-bold mb-4 text-gray-700 flex items-center">
                            <i class="fa fa-line-chart text-primary mr-2"></i>
                            学生压力分布
                        </h3>
                        <div class="h-64">
                            <canvas id="pressureChart"></canvas>
                        </div>
                    </div>
                    
                    <!-- 本周建议 -->
                    <div class="bg-white rounded-lg shadow-md p-6">
                        <h3 class="text-lg font-bold mb-4 text-gray-700 flex items-center">
                            <i class="fa fa-lightbulb-o text-primary mr-2"></i>
                            本周建议
                        </h3>
                        <div id="weeklySuggestion" class="p-4 bg-blue-50 rounded-lg text-gray-700">
                            根据学生当前状态,建议本周安排一次轻松的班级活动,缓解学生压力。
                        </div>
                    </div>
                </section>

                <!-- 学生管理页面 -->
                <section id="students" class="page-content hidden">
                    <div class="mb-6 flex justify-between items-center">
                        <h2 class="text-2xl font-bold text-gray-800">学生管理</h2>
                        <div class="flex space-x-2">
                            <div class="relative">
                                <input type="text" id="studentSearch" placeholder="搜索学生..." class="pl-8 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary">
                                <i class="fa fa-search absolute left-3 top-3 text-gray-400"></i>
                            </div>
                            <select id="studentFilter" class="border rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary">
                                <option value="all">全部学生</option>
                                <option value="high-pressure">高压力</option>
                                <option value="medium-pressure">中等压力</option>
                                <option value="low-pressure">低压力</option>
                            </select>
                        </div>
                    </div>
                    
                    <div id="studentsContainer" class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
                        <!-- 学生卡片将通过JavaScript动态生成 -->
                    </div>
                </section>

                <!-- 课程安排页面 -->
                <section id="schedule" class="page-content hidden">
                    <div class="mb-6">
                        <h2 class="text-2xl font-bold text-gray-800 mb-4">课程安排</h2>
                        <p class="text-gray-600">安排未来几周的教学活动。每个活动持续一周,会影响学生的压力和班级状态。</p>
                    </div>
                    
                    <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
                        <!-- 左侧活动选择 -->
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <h3 class="text-lg font-bold mb-4 text-gray-700">可用活动</h3>
                            <div class="space-y-3" id="activitiesList">
                                <!-- 活动卡片将通过JavaScript动态生成 -->
                            </div>
                        </div>
                        
                        <!-- 右侧课程表 -->
                        <div class="lg:col-span-2">
                            <h3 class="text-lg font-bold mb-4 text-gray-700">课程表</h3>
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-4" id="scheduleContainer">
                                <!-- 周次卡片将通过JavaScript动态生成 -->
                            </div>
                        </div>
                    </div>
                </section>

                <!-- 班费管理页面 -->
                <section id="finances" class="page-content hidden">
                    <div class="mb-6">
                        <h2 class="text-2xl font-bold text-gray-800 mb-4">班费管理</h2>
                        <p class="text-gray-600">管理班级财务,记录收入和支出。</p>
                    </div>
                    
                    <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
                        <!-- 左侧财务概览 -->
                        <div class="bg-white rounded-lg shadow-md p-6">
                            <h3 class="text-lg font-bold mb-4 text-gray-700">财务概览</h3>
                            <div class="space-y-4">
                                <div class="flex justify-between items-center">
                                    <span class="text-gray-600">当前余额:</span>
                                    <span id="currentBalance" class="text-xl font-bold text-green-600">0元</span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-gray-600">总收入:</span>
                                    <span id="totalIncome" class="font-medium text-green-600">0元</span>
                                </div>
                                <div class="flex justify-between">
                                    <span class="text-gray-600">总支出:</span>
                                    <span id="totalExpense" class="font-medium text-red-600">0元</span>
                                </div>
                                <div class="border-t my-2"></div>
                                <div>
                                    <h4 class="font-medium mb-2">快速操作</h4>
                                    <div class="space-y-2">
                                        <button id="collectFeeBtn" class="w-full bg-green-500 hover:bg-green-600 text-white py-2 px-4 rounded-lg transition-all flex items-center justify-center">
                                            <i class="fa fa-plus-circle mr-2"></i>
                                            收取班费
                                        </button>
                                        <button id="addExpenseBtn" class="w-full bg-red-500 hover:bg-red-600 text-white py-2 px-4 rounded-lg transition-all flex items-center justify-center">
                                            <i class="fa fa-minus-circle mr-2"></i>
                                            添加支出
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <!-- 右侧财务记录 -->
                        <div class="lg:col-span-2 bg-white rounded-lg shadow-md p-6">
                            <h3 class="text-lg font-bold mb-4 text-gray-700">财务记录</h3>
                            <div class="overflow-x-auto">
                                <table class="min-w-full divide-y divide-gray-200">
                                    <thead>
                                        <tr>
                                            <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">日期</th>
                                            <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">类型</th>
                                            <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">描述</th>
                                            <th class="px-6 py-3 bg-gray-50 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">金额</th>
                                        </tr>
                                    </thead>
                                    <tbody id="financeRecords" class="bg-white divide-y divide-gray-200">
                                        <!-- 财务记录将通过JavaScript动态生成 -->
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- 事件记录页面 -->
                <section id="events" class="page-content hidden">
                    <div class="mb-6">
                        <h2 class="text-2xl font-bold text-gray-800 mb-4">事件记录</h2>
                        <p class="text-gray-600">查看班级发生的重要事件记录。</p>
                    </div>
                    
                    <div class="bg-white rounded-lg shadow-md p-6">
                        <div class="space-y-4" id="eventsContainer">
                            <!-- 事件记录将通过JavaScript动态生成 -->
                        </div>
                    </div>
                </section>
            </main>
        </div>
    </div>

    <!-- 成就弹窗 -->
    <div id="achievementModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-lg shadow-xl p-6 max-w-2xl w-full max-h-[80vh] overflow-y-auto animate-fade-in">
            <div class="flex justify-between items-center mb-6">
                <h2 class="text-2xl font-bold text-yellow-600 flex items-center">
                    <i class="fa fa-trophy mr-2"></i>
                    成就系统
                </h2>
                <button id="closeAchievementBtn" class="text-gray-500 hover:text-gray-700">
                    <i class="fa fa-times text-xl"></i>
                </button>
            </div>
            
            <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4" id="achievementsContainer">
                <!-- 成就将通过JavaScript动态生成 -->
            </div>
        </div>
    </div>

    <!-- 收取班费弹窗 -->
    <div id="collectFeeModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-lg shadow-xl p-6 max-w-md w-full animate-fade-in">
            <h2 class="text-xl font-bold mb-4 text-gray-800">收取班费</h2>
            <div class="space-y-4">
                <div>
                    <label class="block text-gray-700 mb-2">金额 (元)</label>
                    <input type="number" id="feeAmount" class="w-full border rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary" min="1" max="100" value="20">
                </div>
                <div>
                    <label class="block text-gray-700 mb-2">说明</label>
                    <input type="text" id="feeDescription" class="w-full border rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary" placeholder="例如:购买班级用品">
                </div>
                <div class="flex justify-end space-x-3 pt-4">
                    <button id="cancelCollectFeeBtn" class="px-4 py-2 border rounded-lg hover:bg-gray-100 transition-all">取消</button>
                    <button id="confirmCollectFeeBtn" class="px-4 py-2 bg-green-500 hover:bg-green-600 text-white rounded-lg transition-all">确认</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 添加支出弹窗 -->
    <div id="addExpenseModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-lg shadow-xl p-6 max-w-md w-full animate-fade-in">
            <h2 class="text-xl font-bold mb-4 text-gray-800">添加支出</h2>
            <div class="space-y-4">
                <div>
                    <label class="block text-gray-700 mb-2">金额 (元)</label>
                    <input type="number" id="expenseAmount" class="w-full border rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary" min="1" value="50">
                </div>
                <div>
                    <label class="block text-gray-700 mb-2">用途</label>
                    <input type="text" id="expenseDescription" class="w-full border rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary" placeholder="例如:购买教学材料">
                </div>
                <div class="flex justify-end space-x-3 pt-4">
                    <button id="cancelAddExpenseBtn" class="px-4 py-2 border rounded-lg hover:bg-gray-100 transition-all">取消</button>
                    <button id="confirmAddExpenseBtn" class="px-4 py-2 bg-red-500 hover:bg-red-600 text-white rounded-lg transition-all">确认</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 随机事件弹窗 -->
    <div id="eventModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-lg shadow-xl p-6 max-w-md w-full animate-fade-in">
            <div class="flex items-center mb-4">
                <div id="eventIcon" class="w-12 h-12 bg-yellow-500 rounded-full flex items-center justify-center text-white mr-4">
                    <i class="fa fa-exclamation-triangle text-xl"></i>
                </div>
                <h2 id="eventTitle" class="text-xl font-bold text-gray-800">事件标题</h2>
            </div>
            <p id="eventDescription" class="text-gray-600 mb-6">事件描述内容...</p>
            <div id="eventOptions" class="space-y-3">
                <!-- 事件选项将通过JavaScript动态生成 -->
            </div>
        </div>
    </div>

    <!-- 通知组件 -->
    <div id="notification" class="notification">
        <div class="bg-white rounded-lg shadow-lg p-4 max-w-sm">
            <div class="flex items-start">
                <div id="notificationIcon" class="w-8 h-8 rounded-full flex items-center justify-center mr-3">
                    <i id="notificationIconI" class="fa"></i>
                </div>
                <div class="flex-1">
                    <h3 id="notificationTitle" class="font-bold text-gray-800"></h3>
                    <p id="notificationMessage" class="text-sm text-gray-600"></p>
                </div>
                <button id="closeNotification" class="text-gray-400 hover:text-gray-600">
                    <i class="fa fa-times"></i>
                </button>
            </div>
        </div>
    </div>

    <!-- Chart.js -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.8/dist/chart.umd.min.js"></script>

    <script>
        // 游戏状态
        let gameState = {
            region: null,
            currentWeek: 1,
            classFund: 0,
            students: [],
            schedule: [],
            financeRecords: [],
            events: [],
            achievements: [],
            classStatus: {
                pressure: 0,
                satisfaction: 50
            },
            isGameOver: false
        };
        
        // 地区配置
        const regions = {
            city: {
                name: "城市学校",
                initialFund: 1000,
                studentCount: 40,
                description: "资源丰富,家长期望高,学生竞争压力大",
                pressureModifier: 1.2,
                fundModifier: 1.5
            },
            suburb: {
                name: "郊区学校",
                initialFund: 700,
                studentCount: 35,
                description: "资源适中,家长配合度高,学生压力中等",
                pressureModifier: 1.0,
                fundModifier: 1.0
            },
            rural: {
                name: "乡村学校",
                initialFund: 400,
                studentCount: 30,
                description: "资源有限,学生基础参差不齐,需要更多耐心",
                pressureModifier: 0.8,
                fundModifier: 0.7
            }
        };
        
        // 活动配置
        const activities = {
            regularClass: {
                name: "常规上课",
                description: "进行正常的教学活动",
                cost: 0,
                pressureEffect: 10,
                satisfactionEffect: 0,
                fundEffect: 0,
                icon: "fa-book",
                color: "bg-blue-500",
                category: "teaching"
            },
            exam: {
                name: "考试周",
                description: "进行班级测验和考试",
                cost: 50,
                pressureEffect: 30,
                satisfactionEffect: -15,
                fundEffect: 0,
                icon: "fa-pencil-square-o",
                color: "bg-red-500",
                category: "assessment"
            },
            fieldTrip: {
                name: "研学旅行",
                description: "组织学生进行户外学习活动",
                cost: 200,
                pressureEffect: -20,
                satisfactionEffect: 25,
                fundEffect: -200,
                icon: "fa-bus",
                color: "bg-green-500",
                category: "activity"
            },
            holiday: {
                name: "放假休息",
                description: "给学生一周的休息时间",
                cost: 0,
                pressureEffect: -30,
                satisfactionEffect: 10,
                fundEffect: 0,
                icon: "fa-sun-o",
                color: "bg-yellow-500",
                category: "break"
            },
            competition: {
                name: "学科竞赛",
                description: "组织学生参加学科竞赛",
                cost: 100,
                pressureEffect: 20,
                satisfactionEffect: 15,
                fundEffect: 100,
                icon: "fa-trophy",
                color: "bg-purple-500",
                category: "competition"
            },
            clubActivity: {
                name: "社团活动",
                description: "开展丰富多彩的社团活动",
                cost: 80,
                pressureEffect: -15,
                satisfactionEffect: 20,
                fundEffect: 0,
                icon: "fa-users",
                color: "bg-pink-500",
                category: "activity"
            },
            parentMeeting: {
                name: "家长会",
                description: "与家长沟通学生学习情况",
                cost: 30,
                pressureEffect: 5,
                satisfactionEffect: 10,
                fundEffect: 50,
                icon: "fa-comments",
                color: "bg-indigo-500",
                category: "communication"
            },
            charity: {
                name: "公益活动",
                description: "组织学生参与社会公益",
                cost: 60,
                pressureEffect: -10,
                satisfactionEffect: 15,
                fundEffect: 0,
                icon: "fa-heart",
                color: "bg-red-400",
                category: "activity"
            }
        };
        
        // 随机事件配置
        const randomEvents = [
            {
                id: "studentConflict",
                title: "学生冲突",
                description: "两名学生在课堂上发生了激烈争执,需要你介入处理。",
                icon: "fa-exclamation-triangle",
                iconColor: "bg-red-500",
                options: [
                    {
                        text: "严厉批评双方",
                        effects: {
                            pressure: 15,
                            satisfaction: -10,
                            fund: 0
                        },
                        result: "你严厉批评了冲突的学生,课堂秩序得到恢复,但学生们的压力有所增加。"
                    },
                    {
                        text: "耐心调解,了解原因",
                        effects: {
                            pressure: -5,
                            satisfaction: 5,
                            fund: 0
                        },
                        result: "你耐心地了解了冲突原因并成功调解,学生们对你的处理方式表示认可。"
                    },
                    {
                        text: "让他们课后自行解决",
                        effects: {
                            pressure: 10,
                            satisfaction: -5,
                            fund: 0
                        },
                        result: "你决定让学生课后自行解决,但冲突没有得到很好的解决,班级氛围受到了一些影响。"
                    }
                ]
            },
            {
                id: "parentComplaint",
                title: "家长投诉",
                description: "一位家长对你的教学方法提出了投诉,认为作业量过大。",
                icon: "fa-user-times",
                iconColor: "bg-orange-500",
                options: [
                    {
                        text: "接受建议,减少作业量",
                        effects: {
                            pressure: -10,
                            satisfaction: 5,
                            fund: 0
                        },
                        result: "你接受了家长的建议,适当减少了作业量,学生们的压力有所缓解。"
                    },
                    {
                        text: "解释教学理念,坚持原则",
                        effects: {
                            pressure: 5,
                            satisfaction: -5,
                            fund: 0
                        },
                        result: "你向家长解释了你的教学理念,但坚持了原有的作业量,部分家长对此仍有不满。"
                    },
                    {
                        text: "组织家长会详细说明",
                        effects: {
                            pressure: 0,
                            satisfaction: 10,
                            fund: -50
                        },
                        result: "你组织了一次家长会,详细说明了教学计划和作业安排的目的,获得了大多数家长的理解和支持。"
                    }
                ]
            },
            {
                id: "teachingInspection",
                title: "教学检查",
                description: "学校将进行教学检查,需要准备公开课展示。",
                icon: "fa-search",
                iconColor: "bg-blue-500",
                options: [
                    {
                        text: "精心准备,展示最佳状态",
                        effects: {
                            pressure: 10,
                            satisfaction: 15,
                            fund: -100
                        },
                        result: "你花费大量时间和精力准备公开课,展示了精彩的教学内容,获得了领导的高度评价。"
                    },
                    {
                        text: "正常教学,不特意准备",
                        effects: {
                            pressure: 5,
                            satisfaction: -5,
                            fund: 0
                        },
                        result: "你选择以平常的教学状态迎接检查,虽然没有特别突出,但也展示了真实的教学水平。"
                    },
                    {
                        text: "与学生一起准备特别活动",
                        effects: {
                            pressure: -5,
                            satisfaction: 20,
                            fund: -50
                        },
                        result: "你与学生一起策划了一个特别的教学活动,既展示了教学成果,又增强了班级凝聚力。"
                    }
                ]
            },
            {
                id: "studentAchievement",
                title: "学生成就",
                description: "你的学生在市级比赛中获得了优异成绩!",
                icon: "fa-trophy",
                iconColor: "bg-yellow-500",
                options: [
                    {
                        text: "在班级中表扬并奖励学生",
                        effects: {
                            pressure: -5,
                            satisfaction: 15,
                            fund: -50
                        },
                        result: "你在班级中隆重表扬了获奖学生,并给予了适当奖励,激发了其他学生的学习热情。"
                    },
                    {
                        text: "组织经验分享会",
                        effects: {
                            pressure: 0,
                            satisfaction: 10,
                            fund: -30
                        },
                        result: "你组织了一次经验分享会,让获奖学生分享学习心得,促进了班级整体进步。"
                    },
                    {
                        text: "向家长和学校汇报这一喜讯",
                        effects: {
                            pressure: 0,
                            satisfaction: 5,
                            fund: 100
                        },
                        result: "你及时向家长和学校汇报了这一喜讯,学校给予了班级一定的奖励。"
                    }
                ]
            },
            {
                id: "equipmentFailure",
                title: "设备故障",
                description: "教室的多媒体设备出现了故障,影响正常教学。",
                icon: "fa-exclamation-circle",
                iconColor: "bg-gray-500",
                options: [
                    {
                        text: "临时调整教学计划,使用传统教学方式",
                        effects: {
                            pressure: 5,
                            satisfaction: 0,
                            fund: 0
                        },
                        result: "你灵活调整了教学计划,使用传统的教学方式完成了课程,学生们适应良好。"
                    },
                    {
                        text: "联系维修人员紧急修复",
                        effects: {
                            pressure: -5,
                            satisfaction: 5,
                            fund: -100
                        },
                        result: "你立即联系了维修人员,设备很快得到了修复,教学活动得以顺利进行。"
                    },
                    {
                        text: "组织学生进行户外教学",
                        effects: {
                            pressure: -10,
                            satisfaction: 15,
                            fund: -30
                        },
                        result: "你决定将课堂移至户外,进行了一次别开生面的教学活动,学生们非常喜欢这种方式。"
                    }
                ]
            }
        ];
        
        // 成就配置
        const achievements = [
            {
                id: "firstWeek",
                title: "新的开始",
                description: "完成第一周的教学工作",
                icon: "fa-star",
                iconColor: "bg-yellow-500",
                condition: (state) => state.currentWeek >= 2,
                reward: {
                    fund: 100
                },
                unlocked: false
            },
            {
                id: "pressureControl",
                title: "压力管理大师",
                description: "将班级平均压力保持在30%以下连续4周",
                icon: "fa-heartbeat",
                iconColor: "bg-green-500",
                condition: (state) => {
                    // 检查最近4周的压力记录
                    if (state.events.length < 4) return false;
                    
                    let recentEvents = state.events.slice(-4);
                    let validWeeks = 0;
                    
                    for (let event of recentEvents) {
                        if (event.type === "weekEnd" && event.data && event.data.avgPressure <= 30) {
                            validWeeks++;
                        }
                    }
                    
                    return validWeeks >= 4;
                },
                reward: {
                    fund: 200
                },
                unlocked: false
            },
            {
                id: "financeMaster",
                title: "理财高手",
                description: "班费余额达到2000元",
                icon: "fa-money",
                iconColor: "bg-green-600",
                condition: (state) => state.classFund >= 2000,
                reward: {
                    fund: 300
                },
                unlocked: false
            },
            {
                id: "eventHandler",
                title: "事件处理专家",
                description: "成功处理10个随机事件",
                icon: "fa-exclamation-triangle",
                iconColor: "bg-orange-500",
                condition: (state) => {
                    let eventCount = 0;
                    for (let event of state.events) {
                        if (event.type === "randomEvent") {
                            eventCount++;
                        }
                    }
                    return eventCount >= 10;
                },
                reward: {
                    fund: 250
                },
                unlocked: false
            },
            {
                id: "studentSatisfaction",
                title: "学生喜爱的老师",
                description: "班级满意度达到80%以上",
                icon: "fa-smile-o",
                iconColor: "bg-blue-500",
                condition: (state) => state.classStatus.satisfaction >= 80,
                reward: {
                    fund: 150
                },
                unlocked: false
            },
            {
                id: "seasonedTeacher",
                title: "资深教师",
                description: "完成20周的教学工作",
                icon: "fa-graduation-cap",
                iconColor: "bg-purple-500",
                condition: (state) => state.currentWeek >= 21,
                reward: {
                    fund: 500
                },
                unlocked: false
            }
        ];
        
        // DOM元素
        const setupModal = document.getElementById('setupModal');
        const gameContainer = document.getElementById('gameContainer');
        const regionCards = document.querySelectorAll('.region-card');
        const startGameBtn = document.getElementById('startGame');
        const navButtons = document.querySelectorAll('.nav-btn');
        const pageContents = document.querySelectorAll('.page-content');
        const nextWeekBtn = document.getElementById('nextWeekBtn');
        const saveGameBtn = document.getElementById('saveGameBtn');
        const restartGameBtn = document.getElementById('restartGameBtn');
        const achievementBtn = document.getElementById('achievementBtn');
        const achievementModal = document.getElementById('achievementModal');
        const closeAchievementBtn = document.getElementById('closeAchievementBtn');
        const collectFeeBtn = document.getElementById('collectFeeBtn');
        const collectFeeModal = document.getElementById('collectFeeModal');
        const cancelCollectFeeBtn = document.getElementById('cancelCollectFeeBtn');
        const confirmCollectFeeBtn = document.getElementById('confirmCollectFeeBtn');
        const addExpenseBtn = document.getElementById('addExpenseBtn');
        const addExpenseModal = document.getElementById('addExpenseModal');
        const cancelAddExpenseBtn = document.getElementById('cancelAddExpenseBtn');
        const confirmAddExpenseBtn = document.getElementById('confirmAddExpenseBtn');
        const eventModal = document.getElementById('eventModal');
        const notification = document.getElementById('notification');
        const closeNotification = document.getElementById('closeNotification');
        const studentSearch = document.getElementById('studentSearch');
        const studentFilter = document.getElementById('studentFilter');
        
        // 初始化游戏
        function initGame() {
            // 地区选择
            regionCards.forEach(card => {
                card.addEventListener('click', () => {
                    // 移除其他卡片的选中状态
                    regionCards.forEach(c => c.classList.remove('bg-blue-100', 'border-primary'));
                    
                    // 添加当前卡片的选中状态
                    card.classList.add('bg-blue-100', 'border-primary');
                    
                    // 获取选中的地区
                    const region = card.getAttribute('data-region');
                    gameState.region = region;
                    
                    // 启用开始游戏按钮
                    startGameBtn.disabled = false;
                });
            });
            
            // 开始游戏按钮
            startGameBtn.addEventListener('click', () => {
                if (!gameState.region) return;
                
                // 初始化游戏状态
                initializeGameState();
                
                // 隐藏设置弹窗,显示游戏界面
                setupModal.classList.add('hidden');
                gameContainer.classList.remove('hidden');
                
                // 更新UI
                updateUI();
                
                // 生成学生
                generateStudents();
                
                // 初始化课程表
                initializeSchedule();
                
                // 初始化财务记录
                initializeFinanceRecords();
                
                // 显示欢迎通知
                showNotification('欢迎来到教师模拟器!', 'info', '你已成功创建班级,开始你的教师生涯吧!');
            });
            
            // 导航按钮
            navButtons.forEach(button => {
                button.addEventListener('click', () => {
                    // 移除所有按钮的激活状态
                    navButtons.forEach(btn => btn.classList.remove('active', 'bg-blue-50', 'text-primary'));
                    
                    // 添加当前按钮的激活状态
                    button.classList.add('active', 'bg-blue-50', 'text-primary');
                    
                    // 获取目标页面
                    const target = button.getAttribute('data-target');
                    
                    // 隐藏所有页面
                    pageContents.forEach(page => page.classList.add('hidden'));
                    
                    // 显示目标页面
                    document.getElementById(target).classList.remove('hidden');
                    
                    // 如果是学生页面,更新学生列表
                    if (target === 'students') {
                        renderStudents();
                    }
                    
                    // 如果是课程安排页面,更新课程表
                    if (target === 'schedule') {
                        renderSchedule();
                        renderActivities();
                    }
                    
                    // 如果是财务页面,更新财务记录
                    if (target === 'finances') {
                        renderFinanceRecords();
                    }
                    
                    // 如果是事件页面,更新事件记录
                    if (target === 'events') {
                        renderEvents();
                    }
                });
            });
            
            // 进入下一周按钮
            nextWeekBtn.addEventListener('click', () => {
                // 检查是否已安排活动
                const currentWeekSchedule = gameState.schedule.find(s => s.week === gameState.currentWeek);
                
                if (!currentWeekSchedule) {
                    showNotification('无法进入下一周', 'error', '请先为当前周安排活动');
                    return;
                }
                
                // 处理当前周活动效果
                processWeekActivity(currentWeekSchedule.activity);
                
                // 增加周数
                gameState.currentWeek++;
                
                // 更新UI
                updateUI();
                
                // 检查并触发随机事件
                checkRandomEvent();
                
                // 检查成就
                checkAchievements();
                
                // 检查游戏结束条件
                checkGameOver();
            });
            
            // 保存游戏按钮
            saveGameBtn.addEventListener('click', () => {
                // 保存游戏状态到localStorage
                localStorage.setItem('teacherSimulatorSave', JSON.stringify(gameState));
                
                showNotification('游戏已保存', 'success', '你的游戏进度已成功保存');
            });
            
            // 重新开始按钮
            restartGameBtn.addEventListener('click', () => {
                if (confirm('确定要重新开始游戏吗?当前进度将会丢失。')) {
                    // 重置游戏状态
                    gameState = {
                        region: null,
                        currentWeek: 1,
                        classFund: 0,
                        students: [],
                        schedule: [],
                        financeRecords: [],
                        events: [],
                        achievements: [],
                        classStatus: {
                            pressure: 0,
                            satisfaction: 50
                        },
                        isGameOver: false
                    };
                    
                    // 显示设置弹窗,隐藏游戏界面
                    setupModal.classList.remove('hidden');
                    gameContainer.classList.add('hidden');
                    
                    // 移除地区选择
                    regionCards.forEach(c => c.classList.remove('bg-blue-100', 'border-primary'));
                    
                    // 禁用开始游戏按钮
                    startGameBtn.disabled = true;
                }
            });
            
            // 成就按钮
            achievementBtn.addEventListener('click', () => {
                renderAchievements();
                achievementModal.classList.remove('hidden');
            });
            
            // 关闭成就弹窗
            closeAchievementBtn.addEventListener('click', () => {
                achievementModal.classList.add('hidden');
            });
            
            // 收取班费按钮
            collectFeeBtn.addEventListener('click', () => {
                collectFeeModal.classList.remove('hidden');
            });
            
            // 取消收取班费
            cancelCollectFeeBtn.addEventListener('click', () => {
                collectFeeModal.classList.add('hidden');
            });
            
            // 确认收取班费
            confirmCollectFeeBtn.addEventListener('click', () => {
                const amount = parseInt(document.getElementById('feeAmount').value);
                const description = document.getElementById('feeDescription').value || '收取班费';
                
                if (isNaN(amount) || amount <= 0) {
                    showNotification('输入错误', 'error', '请输入有效的金额');
                    return;
                }
                
                // 添加财务记录
                addFinanceRecord('income', description, amount);
                
                // 更新班费
                gameState.classFund += amount;
                
                // 添加事件
                addEvent('finance', `${description} (${amount}元)`, {
                    type: 'income',
                    amount: amount,
                    description: description
                });
                
                // 更新UI
                updateUI();
                
                // 关闭弹窗
                collectFeeModal.classList.add('hidden');
                
                // 显示通知
                showNotification('班费收取成功', 'success', `已收取班费 ${amount} 元`);
            });
            
            // 添加支出按钮
            addExpenseBtn.addEventListener('click', () => {
                addExpenseModal.classList.remove('hidden');
            });
            
            // 取消添加支出
            cancelAddExpenseBtn.addEventListener('click', () => {
                addExpenseModal.classList.add('hidden');
            });
            
            // 确认添加支出
            confirmAddExpenseBtn.addEventListener('click', () => {
                const amount = parseInt(document.getElementById('expenseAmount').value);
                const description = document.getElementById('expenseDescription').value || '班级支出';
                
                if (isNaN(amount) || amount <= 0) {
                    showNotification('输入错误', 'error', '请输入有效的金额');
                    return;
                }
                
                if (amount > gameState.classFund) {
                    showNotification('余额不足', 'error', '班费余额不足,无法完成支出');
                    return;
                }
                
                // 添加财务记录
                addFinanceRecord('expense', description, amount);
                
                // 更新班费
                gameState.classFund -= amount;
                
                // 添加事件
                addEvent('finance', `${description} (${amount}元)`, {
                    type: 'expense',
                    amount: amount,
                    description: description
                });
                
                // 更新UI
                updateUI();
                
                // 关闭弹窗
                addExpenseModal.classList.add('hidden');
                
                // 显示通知
                showNotification('支出记录成功', 'success', `已记录支出 ${amount} 元`);
            });
            
            // 关闭通知
            closeNotification.addEventListener('click', () => {
                notification.classList.remove('show');
            });
            
            // 学生搜索
            studentSearch.addEventListener('input', () => {
                renderStudents();
            });
            
            // 学生筛选
            studentFilter.addEventListener('change', () => {
                renderStudents();
            });
            
            // 尝试加载保存的游戏
            loadSavedGame();
        }
        
        // 初始化游戏状态
        function initializeGameState() {
            const region = regions[gameState.region];
            
            gameState.classFund = region.initialFund;
            gameState.currentWeek = 1;
            gameState.students = [];
            gameState.schedule = [];
            gameState.financeRecords = [];
            gameState.events = [];
            gameState.achievements = [];
            gameState.classStatus = {
                pressure: 0,
                satisfaction: 50
            };
            gameState.isGameOver = false;
            
            // 添加初始财务记录
            addFinanceRecord('income', '初始班费', region.initialFund);
            
            // 添加初始事件
            addEvent('system', `在${region.name}开始教学工作`, {
                region: gameState.region
            });
        }
        
        // 生成学生
        function generateStudents() {
            const region = regions[gameState.region];
            const studentCount = region.studentCount;
            
            // 学生名字池
            const firstNames = [
                "张", "李", "王", "刘", "陈", "杨", "赵", "黄", "周", "吴",
                "徐", "孙", "胡", "朱", "高", "林", "何", "郭", "马", "罗"
            ];
            
            const lastNames = [
                "伟", "芳", "娜", "秀英", "敏", "静", "丽", "强", "磊", "军",
                "洋", "勇", "艳", "杰", "娟", "涛", "明", "超", "秀兰", "霞"
            ];
            
            // 学生性格特点
            const personalities = [
                { name: "勤奋", pressureModifier: 0.8, performanceModifier: 1.2 },
                { name: "懒惰", pressureModifier: 1.2, performanceModifier: 0.8 },
                { name: "开朗", pressureModifier: 0.9, performanceModifier: 1.0 },
                { name: "内向", pressureModifier: 1.1, performanceModifier: 1.0 },
                { name: "聪明", pressureModifier: 0.9, performanceModifier: 1.3 },
                { name: "普通", pressureModifier: 1.0, performanceModifier: 1.0 },
                { name: "调皮", pressureModifier: 0.8, performanceModifier: 0.9 },
                { name: "安静", pressureModifier: 1.0, performanceModifier: 1.1 }
            ];
            
            // 生成学生
            for (let i = 0; i < studentCount; i++) {
                const firstName = firstNames[Math.floor(Math.random() * firstNames.length)];
                const lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
                const personality = personalities[Math.floor(Math.random() * personalities.length)];
                
                // 随机生成基础属性
                const basePressure = Math.floor(Math.random() * 30) + 20; // 20-50
                const basePerformance = Math.floor(Math.random() * 40) + 30; // 30-70
                const pressureThreshold = Math.floor(Math.random() * 30) + 70; // 70-100
                
                // 应用性格修正
                const pressure = Math.min(100, Math.floor(basePressure * personality.pressureModifier * region.pressureModifier));
                const performance = Math.min(100, Math.floor(basePerformance * personality.performanceModifier));
                
                // 生成学生对象
                const student = {
                    id: i + 1,
                    name: firstName + lastName,
                    gender: Math.random() > 0.5 ? "男" : "女",
                    age: Math.floor(Math.random() * 3) + 13, // 13-15岁
                    pressure: pressure,
                    performance: performance,
                    pressureThreshold: pressureThreshold,
                    personality: personality.name,
                    pressureHistory: [pressure],
                    performanceHistory: [performance]
                };
                
                gameState.students.push(student);
            }
            
            // 计算初始班级压力
            calculateClassPressure();
        }
        
        // 初始化课程表
        function initializeSchedule() {
            // 预生成未来4周的课程表
            for (let i = 1; i <= 4; i++) {
                gameState.schedule.push({
                    week: i,
                    activity: null
                });
            }
        }
        
        // 初始化财务记录
        function initializeFinanceRecords() {
            // 已在initializeGameState中添加初始记录
        }
        
        // 更新UI
        function updateUI() {
            // 更新顶部状态栏
            document.getElementById('currentWeek').textContent = gameState.currentWeek;
            document.getElementById('classFund').textContent = gameState.classFund;
            
            // 更新班级概览
            document.getElementById('regionDisplay').textContent = regions[gameState.region].name;
            document.getElementById('studentCount').textContent = gameState.students.length;
            
            // 更新平均压力
            const avgPressure = calculateClassPressure();
            document.getElementById('avgPressureBar').style.width = `${avgPressure}%`;
            document.getElementById('avgPressureValue').textContent = `${Math.round(avgPressure)}%`;
            
            // 更新满意度
            document.getElementById('satisfactionBar').style.width = `${gameState.classStatus.satisfaction}%`;
            document.getElementById('satisfactionValue').textContent = `${Math.round(gameState.classStatus.satisfaction)}%`;
            
            // 更新班级状态
            updateClassStatus();
            
            // 更新本周活动显示
            updateWeeklyActivityDisplay();
            
            // 更新最近事件
            updateRecentEvents();
            
            // 更新压力图表
            updatePressureChart();
            
            // 更新本周建议
            updateWeeklySuggestion();
        }
        
        // 计算班级平均压力
        function calculateClassPressure() {
            if (gameState.students.length === 0) return 0;
            
            let totalPressure = 0;
            for (const student of gameState.students) {
                totalPressure += student.pressure;
            }
            
            const avgPressure = totalPressure / gameState.students.length;
            gameState.classStatus.pressure = avgPressure;
            
            return avgPressure;
        }
        
        // 更新班级状态
        function updateClassStatus() {
            const statusElement = document.getElementById('classStatus');
            const pressure = gameState.classStatus.pressure;
            const satisfaction = gameState.classStatus.satisfaction;
            
            // 根据压力和满意度综合评估班级状态
            if (pressure > 80 || satisfaction < 20) {
                statusElement.textContent = "危机";
                statusElement.className = "ml-1 px-2 py-1 rounded-full text-xs font-medium bg-red-100 text-red-800";
            } else if (pressure > 60 || satisfaction < 40) {
                statusElement.textContent = "不佳";
                statusElement.className = "ml-1 px-2 py-1 rounded-full text-xs font-medium bg-orange-100 text-orange-800";
            } else if (pressure > 40 || satisfaction < 60) {
                statusElement.textContent = "一般";
                statusElement.className = "ml-1 px-2 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800";
            } else {
                statusElement.textContent = "良好";
                statusElement.className = "ml-1 px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800";
            }
        }
        
        // 更新本周活动显示
        function updateWeeklyActivityDisplay() {
            const weeklyActivityElement = document.getElementById('weeklyActivity');
            const currentWeekSchedule = gameState.schedule.find(s => s.week === gameState.currentWeek);
            
            if (currentWeekSchedule && currentWeekSchedule.activity) {
                const activity = activities[currentWeekSchedule.activity];
                weeklyActivityElement.innerHTML = `
                    <div class="flex items-center justify-center">
                        <div class="w-10 h-10 ${activity.color} rounded-full flex items-center justify-center text-white mr-3">
                            <i class="fa ${activity.icon}"></i>
                        </div>
                        <div class="text-left">
                            <h4 class="font-bold">${activity.name}</h4>
                            <p class="text-sm text-gray-500">${activity.description}</p>
                        </div>
                    </div>
                `;
            } else {
                weeklyActivityElement.innerHTML = `
                    <div class="flex flex-col items-center justify-center">
                        <i class="fa fa-calendar-times-o text-gray-400 text-3xl mb-2"></i>
                        <p>尚未安排活动</p>
                        <button id="goToScheduleBtn" class="mt-2 text-primary hover:underline text-sm">去安排</button>
                    </div>
                `;
                
                // 添加按钮事件
                document.getElementById('goToScheduleBtn').addEventListener('click', () => {
                    // 切换到课程安排页面
                    navButtons.forEach(btn => btn.classList.remove('active', 'bg-blue-50', 'text-primary'));
                    document.querySelector('[data-target="schedule"]').classList.add('active', 'bg-blue-50', 'text-primary');
                    
                    pageContents.forEach(page => page.classList.add('hidden'));
                    document.getElementById('schedule').classList.remove('hidden');
                    
                    // 更新课程表
                    renderSchedule();
                    renderActivities();
                });
            }
        }
        
        // 更新最近事件
        function updateRecentEvents() {
            const recentEventsElement = document.getElementById('recentEvents');
            
            if (gameState.events.length === 0) {
                recentEventsElement.innerHTML = `
                    <div class="text-center py-4 text-gray-500">
                        暂无事件记录
                    </div>
                `;
                return;
            }
            
            // 获取最近5个事件
            const recentEvents = gameState.events.slice(-5).reverse();
            
            let html = '';
            for (const event of recentEvents) {
                let icon = 'fa-info-circle';
                let iconColor = 'text-blue-500';
                
                switch (event.type) {
                    case 'system':
                        icon = 'fa-cog';
                        iconColor = 'text-gray-500';
                        break;
                    case 'weekEnd':
                        icon = 'fa-calendar-check-o';
                        iconColor = 'text-green-500';
                        break;
                    case 'randomEvent':
                        icon = 'fa-exclamation-triangle';
                        iconColor = 'text-yellow-500';
                        break;
                    case 'finance':
                        icon = event.data && event.data.type === 'income' ? 'fa-plus-circle' : 'fa-minus-circle';
                        iconColor = event.data && event.data.type === 'income' ? 'text-green-500' : 'text-red-500';
                        break;
                    case 'activity':
                        icon = 'fa-calendar';
                        iconColor = 'text-purple-500';
                        break;
                }
                
                html += `
                    <div class="flex items-start">
                        <i class="fa ${icon} ${iconColor} mt-1 mr-2"></i>
                        <div>
                            <p class="text-sm font-medium">${event.title}</p>
                            <p class="text-xs text-gray-500">第${event.week}周</p>
                        </div>
                    </div>
                `;
            }
            
            recentEventsElement.innerHTML = html;
        }
        
        // 更新压力图表
        function updatePressureChart() {
            const ctx = document.getElementById('pressureChart').getContext('2d');
            
            // 销毁旧图表
            if (window.pressureChart) {
                window.pressureChart.destroy();
            }
            
            // 准备数据
            const labels = [];
            const pressureData = [];
            const performanceData = [];
            
            // 获取最近8周的数据,如果有的话
            const weeksToShow = Math.min(8, gameState.currentWeek);
            
            for (let i = Math.max(1, gameState.currentWeek - weeksToShow + 1); i <= gameState.currentWeek; i++) {
                labels.push(`第${i}周`);
                
                // 查找该周的压力数据
                let weekEvent = gameState.events.find(e => e.type === 'weekEnd' && e.week === i);
                
                if (weekEvent && weekEvent.data) {
                    pressureData.push(weekEvent.data.avgPressure);
                    performanceData.push(weekEvent.data.avgPerformance);
                } else {
                    // 如果没有数据,使用当前数据
                    if (i === gameState.currentWeek) {
                        pressureData.push(calculateClassPressure());
                        
                        // 计算平均表现
                        let totalPerformance = 0;
                        for (const student of gameState.students) {
                            totalPerformance += student.performance;
                        }
                        performanceData.push(totalPerformance / gameState.students.length);
                    } else {
                        pressureData.push(null);
                        performanceData.push(null);
                    }
                }
            }
            
            // 创建图表
            window.pressureChart = new Chart(ctx, {
                type: 'line',
                data: {
                    labels: labels,
                    datasets: [
                        {
                            label: '平均压力',
                            data: pressureData,
                            borderColor: '#ef4444',
                            backgroundColor: 'rgba(239, 68, 68, 0.1)',
                            tension: 0.3,
                            fill: true
                        },
                        {
                            label: '平均表现',
                            data: performanceData,
                            borderColor: '#10b981',
                            backgroundColor: 'rgba(16, 185, 129, 0.1)',
                            tension: 0.3,
                            fill: true
                        }
                    ]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    scales: {
                        y: {
                            beginAtZero: true,
                            max: 100,
                            title: {
                                display: true,
                                text: '百分比 (%)'
                            }
                        }
                    },
                    plugins: {
                        legend: {
                            position: 'top',
                        },
                        tooltip: {
                            mode: 'index',
                            intersect: false
                        }
                    }
                }
            });
        }
        
        // 更新本周建议
        function updateWeeklySuggestion() {
            const suggestionElement = document.getElementById('weeklySuggestion');
            const pressure = gameState.classStatus.pressure;
            const satisfaction = gameState.classStatus.satisfaction;
            
            let suggestion = "";
            
            if (pressure > 70) {
                suggestion = "班级压力过高!建议本周安排放假或轻松的活动,如社团活动或公益活动,帮助学生缓解压力。";
            } else if (pressure > 50) {
                suggestion = "班级压力略高,建议减少考试和作业量,增加一些互动性强的教学活动。";
            } else if (satisfaction < 40) {
                suggestion = "班级满意度较低,建议增加与学生的沟通,了解他们的需求和意见,组织一些集体活动增强班级凝聚力。";
            } else if (gameState.classFund < 200) {
                suggestion = "班费余额较低,建议适当收取班费或减少不必要的开支,确保班级活动的正常开展。";
            } else {
                suggestion = "班级状态良好!可以考虑组织一次研学旅行或学科竞赛,进一步提升学生的学习兴趣和班级凝聚力。";
            }
            
            suggestionElement.textContent = suggestion;
        }
        
        // 渲染学生列表
        function renderStudents() {
            const container = document.getElementById('studentsContainer');
            const searchTerm = studentSearch.value.toLowerCase();
            const filter = studentFilter.value;
            
            // 筛选学生
            let filteredStudents = gameState.students;
            
            // 应用搜索
            if (searchTerm) {
                filteredStudents = filteredStudents.filter(student => 
                    student.name.toLowerCase().includes(searchTerm)
                );
            }
            
            // 应用筛选
            if (filter !== 'all') {
                switch (filter) {
                    case 'high-pressure':
                        filteredStudents = filteredStudents.filter(student => student.pressure > 70);
                        break;
                    case 'medium-pressure':
                        filteredStudents = filteredStudents.filter(student => student.pressure >= 40 && student.pressure <= 70);
                        break;
                    case 'low-pressure':
                        filteredStudents = filteredStudents.filter(student => student.pressure < 40);
                        break;
                }
            }
            
            // 渲染学生卡片
            if (filteredStudents.length === 0) {
                container.innerHTML = `
                    <div class="col-span-full text-center py-8 text-gray-500">
                        <i class="fa fa-search text-4xl mb-3"></i>
                        <p>没有找到匹配的学生</p>
                    </div>
                `;
                return;
            }
            
            let html = '';
            for (const student of filteredStudents) {
                // 确定压力等级和颜色
                let pressureLevel = "低";
                let pressureColor = "bg-green-500";
                
                if (student.pressure > 70) {
                    pressureLevel = "高";
                    pressureColor = "bg-red-500";
                } else if (student.pressure > 40) {
                    pressureLevel = "中";
                    pressureColor = "bg-yellow-500";
                }
                
                // 确定表现等级和颜色
                let performanceLevel = "差";
                let performanceColor = "bg-red-500";
                
                if (student.performance >= 80) {
                    performanceLevel = "优";
                    performanceColor = "bg-green-500";
                } else if (student.performance >= 60) {
                    performanceLevel = "良";
                    performanceColor = "bg-blue-500";
                } else if (student.performance >= 40) {
                    performanceLevel = "中";
                    performanceColor = "bg-yellow-500";
                }
                
                html += `
                    <div class="student-card bg-white rounded-lg shadow-md p-4 hover:shadow-lg transition-all cursor-pointer" data-student-id="${student.id}">
                        <div class="flex justify-between items-start mb-3">
                            <div>
                                <h3 class="font-bold text-gray-800">${student.name}</h3>
                                <p class="text-sm text-gray-500">${student.gender} | ${student.age}岁</p>
                            </div>
                            <div class="w-10 h-10 rounded-full bg-gray-200 flex items-center justify-center text-gray-600">
                                <i class="fa fa-user"></i>
                            </div>
                        </div>
                        
                        <div class="space-y-2">
                            <div>
                                <div class="flex justify-between text-xs mb-1">
                                    <span>压力值</span>
                                    <span>${Math.round(student.pressure)}% (${pressureLevel})</span>
                                </div>
                                <div class="w-full bg-gray-200 rounded-full h-2">
                                    <div class="pressure-bar ${pressureColor} h-2 rounded-full" style="width: ${student.pressure}%"></div>
                                </div>
                            </div>
                            
                            <div>
                                <div class="flex justify-between text-xs mb-1">
                                    <span>学习表现</span>
                                    <span>${Math.round(student.performance)}% (${performanceLevel})</span>
                                </div>
                                <div class="w-full bg-gray-200 rounded-full h-2">
                                    <div class="pressure-bar ${performanceColor} h-2 rounded-full" style="width: ${student.performance}%"></div>
                                </div>
                            </div>
                        </div>
                        
                        <div class="mt-3 pt-3 border-t">
                            <div class="flex justify-between text-xs">
                                <span class="text-gray-600">性格特点</span>
                                <span class="font-medium">${student.personality}</span>
                            </div>
                        </div>
                    </div>
                `;
            }
            
            container.innerHTML = html;
            
            // 添加学生卡片点击事件
            document.querySelectorAll('.student-card').forEach(card => {
                card.addEventListener('click', () => {
                    const studentId = parseInt(card.getAttribute('data-student-id'));
                    showStudentDetail(studentId);
                });
            });
        }
        
        // 显示学生详情
        function showStudentDetail(studentId) {
            const student = gameState.students.find(s => s.id === studentId);
            
            if (!student) return;
            
            // 创建弹窗内容
            const modalContent = `
                <div class="bg-white rounded-lg shadow-xl p-6 max-w-md w-full animate-fade-in">
                    <div class="flex justify-between items-center mb-4">
                        <h2 class="text-xl font-bold text-gray-800">学生详情</h2>
                        <button id="closeStudentDetailBtn" class="text-gray-500 hover:text-gray-700">
                            <i class="fa fa-times"></i>
                        </button>
                    </div>
                    
                    <div class="flex items-center mb-6">
                        <div class="w-16 h-16 rounded-full bg-gray-200 flex items-center justify-center text-gray-600 mr-4">
                            <i class="fa fa-user text-2xl"></i>
                        </div>
                        <div>
                            <h3 class="font-bold text-lg">${student.name}</h3>
                            <p class="text-gray-600">${student.gender} | ${student.age}岁</p>
                        </div>
                    </div>
                    
                    <div class="space-y-4">
                        <div>
                            <div class="flex justify-between text-sm mb-1">
                                <span class="text-gray-600">压力值</span>
                                <span>${Math.round(student.pressure)}%</span>
                            </div>
                            <div class="w-full bg-gray-200 rounded-full h-2">
                                <div class="pressure-bar ${student.pressure > 70 ? 'bg-red-500' : student.pressure > 40 ? 'bg-yellow-500' : 'bg-green-500'} h-2 rounded-full" style="width: ${student.pressure}%"></div>
                            </div>
                        </div>
                        
                        <div>
                            <div class="flex justify-between text-sm mb-1">
                                <span class="text-gray-600">学习表现</span>
                                <span>${Math.round(student.performance)}%</span>
                            </div>
                            <div class="w-full bg-gray-200 rounded-full h-2">
                                <div class="pressure-bar ${student.performance >= 80 ? 'bg-green-500' : student.performance >= 60 ? 'bg-blue-500' : student.performance >= 40 ? 'bg-yellow-500' : 'bg-red-500'} h-2 rounded-full" style="width: ${student.performance}%"></div>
                            </div>
                        </div>
                        
                        <div class="grid grid-cols-2 gap-4">
                            <div>
                                <p class="text-sm text-gray-600 mb-1">性格特点</p>
                                <p class="font-medium">${student.personality}</p>
                            </div>
                            <div>
                                <p class="text-sm text-gray-600 mb-1">压力阈值</p>
                                <p class="font-medium">${student.pressureThreshold}%</p>
                            </div>
                        </div>
                        
                        <div class="pt-4 border-t">
                            <h4 class="font-medium mb-2">压力历史</h4>
                            <div class="h-32">
                                <canvas id="studentPressureChart"></canvas>
                            </div>
                        </div>
                    </div>
                    
                    <div class="mt-6 flex justify-end">
                        <button id="counselStudentBtn" class="px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-all">
                            谈心辅导
                        </button>
                    </div>
                </div>
            `;
            
            // 创建弹窗
            const modal = document.createElement('div');
            modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
            modal.innerHTML = modalContent;
            document.body.appendChild(modal);
            
            // 关闭按钮事件
            document.getElementById('closeStudentDetailBtn').addEventListener('click', () => {
                modal.remove();
            });
            
            // 谈心辅导按钮事件
            document.getElementById('counselStudentBtn').addEventListener('click', () => {
                // 减少学生压力
                student.pressure = Math.max(0, student.pressure - 15);
                
                // 添加事件
                addEvent('student', `与${student.name}进行了谈心辅导`, {
                    studentId: student.id,
                    studentName: student.name,
                    action: 'counsel',
                    pressureReduction: 15
                });
                
                // 更新UI
                updateUI();
                
                // 显示通知
                showNotification('谈心辅导成功', 'success', `${student.name}的压力得到了缓解`);
                
                // 关闭弹窗
                modal.remove();
            });
            
            // 创建学生压力图表
            const ctx = document.getElementById('studentPressureChart').getContext('2d');
            
            // 准备数据
            const labels = [];
            const pressureData = [];
            
            // 获取最近8周的数据
            const weeks = Math.min(8, student.pressureHistory.length);
            
            for (let i = Math.max(0, student.pressureHistory.length - weeks); i < student.pressureHistory.length; i++) {
                labels.push(`第${i + 1}周`);
                pressureData.push(student.pressureHistory[i]);
            }
            
            // 创建图表
            new Chart(ctx, {
                type: 'line',
                data: {
                    labels: labels,
                    datasets: [{
                        label: '压力值',
                        data: pressureData,
                        borderColor: '#ef4444',
                        backgroundColor: 'rgba(239, 68, 68, 0.1)',
                        tension: 0.3,
                        fill: true
                    }]
                },
                options: {
                    responsive: true,
                    maintainAspectRatio: false,
                    scales: {
                        y: {
                            beginAtZero: true,
                            max: 100
                        }
                    }
                }
            });
        }
        
        // 渲染课程表
        function renderSchedule() {
            const container = document.getElementById('scheduleContainer');
            
            // 确保有未来4周的课程表
            ensureScheduleWeeks();
            
            let html = '';
            for (const week of gameState.schedule) {
                // 检查是否是当前周之前的周
                const isPastWeek = week.week < gameState.currentWeek;
                
                // 检查是否已安排活动
                let activityHtml = '';
                if (week.activity) {
                    const activity = activities[week.activity];
                    activityHtml = `
                        <div class="flex items-center">
                            <div class="w-8 h-8 ${activity.color} rounded-full flex items-center justify-center text-white mr-2">
                                <i class="fa ${activity.icon}"></i>
                            </div>
                            <div>
                                <p class="font-medium">${activity.name}</p>
                                <p class="text-xs text-gray-500">${activity.description}</p>
                            </div>
                        </div>
                    `;
                } else {
                    activityHtml = `
                        <div class="text-center py-2 text-gray-500">
                            <p>尚未安排活动</p>
                            ${!isPastWeek ? '<button class="select-activity-btn mt-1 text-blue-500 hover:underline text-xs">选择活动</button>' : ''}
                        </div>
                    `;
                }
                
                html += `
                    <div class="week-card bg-white rounded-lg shadow-md p-4 ${isPastWeek ? 'opacity-70' : ''}" data-week="${week.week}">
                        <div class="flex justify-between items-center mb-3">
                            <h3 class="font-bold text-gray-800">第${week.week}周</h3>
                            ${week.week === gameState.currentWeek ? '<span class="px-2 py-1 bg-blue-100 text-blue-800 text-xs rounded-full">当前周</span>' : ''}
                        </div>
                        
                        <div class="border rounded-lg p-3 min-h-[100px]">
                            ${activityHtml}
                        </div>
                    </div>
                `;
            }
            
            container.innerHTML = html;
            
            // 添加选择活动按钮事件
            document.querySelectorAll('.select-activity-btn').forEach(button => {
                button.addEventListener('click', (e) => {
                    e.stopPropagation();
                    
                    // 获取周数
                    const weekCard = button.closest('.week-card');
                    const week = parseInt(weekCard.getAttribute('data-week'));
                    
                    // 显示活动选择面板
                    document.querySelectorAll('.activity-card').forEach(card => {
                        card.classList.add('cursor-pointer');
                        card.addEventListener('click', function() {
                            selectActivity(week, this.getAttribute('data-activity'));
                        });
                    });
                });
            });
        }
        
        // 确保有未来4周的课程表
        function ensureScheduleWeeks() {
            const currentMaxWeek = Math.max(...gameState.schedule.map(s => s.week), 0);
            const neededWeeks = Math.max(4, gameState.currentWeek + 3);
            
            for (let i = currentMaxWeek + 1; i <= neededWeeks; i++) {
                gameState.schedule.push({
                    week: i,
                    activity: null
                });
            }
        }
        
        // 渲染活动列表
        function renderActivities() {
            const container = document.getElementById('activitiesList');
            
            let html = '';
            for (const [key, activity] of Object.entries(activities)) {
                html += `
                    <div class="activity-card p-3 border rounded-lg hover:bg-blue-50 transition-all" data-activity="${key}">
                        <div class="flex items-center">
                            <div class="w-10 h-10 ${activity.color} rounded-full flex items-center justify-center text-white mr-3">
                                <i class="fa ${activity.icon}"></i>
                            </div>
                            <div class="flex-1">
                                <h4 class="font-medium">${activity.name}</h4>
                                <p class="text-xs text-gray-600">${activity.description}</p>
                            </div>
                        </div>
                        
                        <div class="mt-2 grid grid-cols-2 gap-2 text-xs">
                            <div class="flex items-center">
                                <i class="fa fa-money text-green-500 mr-1"></i>
                                <span>${activity.cost > 0 ? `花费: ${activity.cost}元` : '免费'}</span>
                            </div>
                            <div class="flex items-center">
                                <i class="fa fa-heartbeat ${activity.pressureEffect > 0 ? 'text-red-500' : 'text-green-500'} mr-1"></i>
                                <span>压力: ${activity.pressureEffect > 0 ? '+' : ''}${activity.pressureEffect}%</span>
                            </div>
                        </div>
                    </div>
                `;
            }
            
            container.innerHTML = html;
        }
        
        // 选择活动
        function selectActivity(week, activityKey) {
            const activity = activities[activityKey];
            
            // 检查是否是过去的周
            if (week < gameState.currentWeek) {
                showNotification('无法安排', 'error', '不能为过去的周安排活动');
                return;
            }
            
            // 检查是否有足够的班费
            if (activity.cost > gameState.classFund) {
                showNotification('班费不足', 'error', `班费不足,需要${activity.cost}元`);
                return;
            }
            
            // 更新课程表
            const weekSchedule = gameState.schedule.find(s => s.week === week);
            if (weekSchedule) {
                weekSchedule.activity = activityKey;
                
                // 如果是当前周,立即应用效果
                if (week === gameState.currentWeek) {
                    // 扣除费用
                    if (activity.cost > 0) {
                        gameState.classFund -= activity.cost;
                        
                        // 添加财务记录
                        addFinanceRecord('expense', `${activity.name}费用`, activity.cost);
                    }
                    
                    // 添加事件
                    addEvent('activity', `安排了${activity.name}活动`, {
                        activity: activityKey
                    });
                    
                    // 更新UI
                    updateUI();
                }
                
                // 显示通知
                showNotification('活动安排成功', 'success', `已为第${week}周安排了${activity.name}活动`);
                
                // 重新渲染课程表
                renderSchedule();
            }
        }
        
        // 处理周活动效果
        function processWeekActivity(activityKey) {
            const activity = activities[activityKey];
            
            // 应用压力效果
            for (const student of gameState.students) {
                // 应用活动基础效果
                student.pressure = Math.max(0, Math.min(100, student.pressure + activity.pressureEffect));
                
                // 应用性格修正
                if (student.personality === "内向" && activity.pressureEffect > 0) {
                    student.pressure = Math.min(100, student.pressure + 5);
                } else if (student.personality === "开朗" && activity.pressureEffect < 0) {
                    student.pressure = Math.max(0, student.pressure - 5);
                }
                
                // 记录压力历史
                student.pressureHistory.push(student.pressure);
                
                // 更新学习表现
                // 压力过高或过低都会影响表现
                let performanceChange = 0;
                
                if (student.pressure > 80) {
                    performanceChange = -5; // 压力过高影响表现
                } else if (student.pressure < 20) {
                    performanceChange = -3; // 压力过低缺乏动力
                } else if (student.pressure >= 40 && student.pressure <= 60) {
                    performanceChange = 3; // 适度压力促进表现
                }
                
                // 应用活动效果
                if (activityKey === "exam") {
                    performanceChange += 5; // 考试周促进学习
                } else if (activityKey === "holiday") {
                    performanceChange -= 2; // 放假可能影响学习状态
                }
                
                // 应用性格修正
                if (student.personality === "勤奋") {
                    performanceChange += 2;
                } else if (student.personality === "懒惰") {
                    performanceChange -= 2;
                }
                
                // 更新表现
                student.performance = Math.max(0, Math.min(100, student.performance + performanceChange));
                
                // 记录表现历史
                student.performanceHistory.push(student.performance);
            }
            
            // 应用满意度效果
            gameState.classStatus.satisfaction = Math.max(0, Math.min(100, 
                gameState.classStatus.satisfaction + activity.satisfactionEffect
            ));
            
            // 应用班费效果
            if (activity.fundEffect !== 0) {
                gameState.classFund = Math.max(0, gameState.classFund + activity.fundEffect);
                
                // 添加财务记录
                if (activity.fundEffect > 0) {
                    addFinanceRecord('income', `${activity.name}收入`, activity.fundEffect);
                } else {
                    addFinanceRecord('expense', `${activity.name}额外支出`, -activity.fundEffect);
                }
            }
            
            // 计算平均压力和表现
            let totalPressure = 0;
            let totalPerformance = 0;
            
            for (const student of gameState.students) {
                totalPressure += student.pressure;
                totalPerformance += student.performance;
            }
            
            const avgPressure = totalPressure / gameState.students.length;
            const avgPerformance = totalPerformance / gameState.students.length;
            
            // 添加周结束事件
            addEvent('weekEnd', `第${gameState.currentWeek}周结束,完成了${activity.name}活动`, {
                activity: activityKey,
                avgPressure: avgPressure,
                avgPerformance: avgPerformance
            });
        }
        
        // 渲染财务记录
        function renderFinanceRecords() {
            const container = document.getElementById('financeRecords');
            
            if (gameState.financeRecords.length === 0) {
                container.innerHTML = `
                    <tr>
                        <td colspan="4" class="px-6 py-4 text-center text-gray-500">
                            暂无财务记录
                        </td>
                    </tr>
                `;
                return;
            }
            
            // 按日期排序,最新的在前
            const sortedRecords = [...gameState.financeRecords].sort((a, b) => {
                return new Date(b.date) - new Date(a.date);
            });
            
            let html = '';
            for (const record of sortedRecords) {
                const isIncome = record.type === 'income';
                const amountClass = isIncome ? 'text-green-600' : 'text-red-600';
                const amountSign = isIncome ? '+' : '-';
                
                html += `
                    <tr>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                            ${formatDate(record.date)}
                        </td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
                            <span class="px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${
                                isIncome ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
                            }">
                                ${isIncome ? '收入' : '支出'}
                            </span>
                        </td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
                            ${record.description}
                        </td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm ${amountClass} text-right font-medium">
                            ${amountSign}${record.amount}元
                        </td>
                    </tr>
                `;
            }
            
            container.innerHTML = html;
            
            // 更新财务概览
            document.getElementById('currentBalance').textContent = `${gameState.classFund}元`;
            
            // 计算总收入和支出
            const totalIncome = gameState.financeRecords
                .filter(r => r.type === 'income')
                .reduce((sum, r) => sum + r.amount, 0);
                
            const totalExpense = gameState.financeRecords
                .filter(r => r.type === 'expense')
                .reduce((sum, r) => sum + r.amount, 0);
                
            document.getElementById('totalIncome').textContent = `${totalIncome}元`;
            document.getElementById('totalExpense').textContent = `${totalExpense}元`;
        }
        
        // 添加财务记录
        function addFinanceRecord(type, description, amount) {
            gameState.financeRecords.push({
                type: type,
                description: description,
                amount: amount,
                date: new Date().toISOString()
            });
        }
        
        // 渲染事件记录
        function renderEvents() {
            const container = document.getElementById('eventsContainer');
            
            if (gameState.events.length === 0) {
                container.innerHTML = `
                    <div class="text-center py-8 text-gray-500">
                        <i class="fa fa-calendar-times-o text-4xl mb-3"></i>
                        <p>暂无事件记录</p>
                    </div>
                `;
                return;
            }
            
            // 按周排序,最新的在前
            const sortedEvents = [...gameState.events].sort((a, b) => {
                if (a.week !== b.week) {
                    return b.week - a.week;
                }
                return new Date(b.date) - new Date(a.date);
            });
            
            let html = '';
            let currentWeek = -1;
            
            for (const event of sortedEvents) {
                // 如果是新的一周,添加周标题
                if (event.week !== currentWeek) {
                    if (currentWeek !== -1) {
                        html += `</div></div>`; // 关闭上周的内容
                    }
                    
                    currentWeek = event.week;
                    const isCurrentWeek = event.week === gameState.currentWeek;
                    
                    html += `
                        <div class="mb-6">
                            <h3 class="text-lg font-bold mb-3 flex items-center">
                                <span class="w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center text-white mr-2">
                                    ${event.week}
                                </span>
                                第${event.week}周
                                ${isCurrentWeek ? '<span class="ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 text-xs rounded-full">当前周</span>' : ''}
                            </h3>
                            <div class="space-y-3 pl-10">
                    `;
                }
                
                // 确定事件图标和颜色
                let icon = 'fa-info-circle';
                let iconColor = 'bg-blue-500';
                
                switch (event.type) {
                    case 'system':
                        icon = 'fa-cog';
                        iconColor = 'bg-gray-500';
                        break;
                    case 'weekEnd':
                        icon = 'fa-calendar-check-o';
                        iconColor = 'bg-green-500';
                        break;
                    case 'randomEvent':
                        icon = 'fa-exclamation-triangle';
                        iconColor = 'bg-yellow-500';
                        break;
                    case 'finance':
                        icon = event.data && event.data.type === 'income' ? 'fa-plus-circle' : 'fa-minus-circle';
                        iconColor = event.data && event.data.type === 'income' ? 'bg-green-500' : 'bg-red-500';
                        break;
                    case 'activity':
                        icon = 'fa-calendar';
                        iconColor = 'bg-purple-500';
                        break;
                    case 'student':
                        icon = 'fa-user';
                        iconColor = 'bg-indigo-500';
                        break;
                }
                
                // 添加事件内容
                html += `
                    <div class="flex">
                        <div class="w-6 h-6 ${iconColor} rounded-full flex items-center justify-center text-white text-xs mr-3 mt-0.5">
                            <i class="fa ${icon}"></i>
                        </div>
                        <div class="bg-white rounded-lg shadow-sm p-3 flex-1">
                            <p class="font-medium">${event.title}</p>
                            <p class="text-sm text-gray-500 mt-1">${formatDate(event.date)}</p>
                            
                            ${event.data && event.type === 'weekEnd' ? `
                                <div class="mt-2 pt-2 border-t text-sm">
                                    <div class="flex justify-between">
                                        <span class="text-gray-600">平均压力:</span>
                                        <span>${Math.round(event.data.avgPressure)}%</span>
                                    </div>
                                    <div class="flex justify-between mt-1">
                                        <span class="text-gray-600">平均表现:</span>
                                        <span>${Math.round(event.data.avgPerformance)}%</span>
                                    </div>
                                </div>
                            ` : ''}
                        </div>
                    </div>
                `;
            }
            
            // 关闭最后一周的内容
            if (currentWeek !== -1) {
                html += `</div></div>`;
            }
            
            container.innerHTML = html;
        }
        
        // 添加事件
        function addEvent(type, title, data = {}) {
            gameState.events.push({
                type: type,
                title: title,
                data: data,
                week: gameState.currentWeek,
                date: new Date().toISOString()
            });
        }
        
        // 渲染成就列表
        function renderAchievements() {
            const container = document.getElementById('achievementsContainer');
            
            let html = '';
            for (const achievement of achievements) {
                // 检查成就是否已解锁
                const isUnlocked = gameState.achievements.includes(achievement.id);
                
                html += `
                    <div class="achievement-card bg-white rounded-lg shadow-md p-4 ${isUnlocked ? 'border-2 border-yellow-400' : 'opacity-60'}">
                        <div class="flex items-center mb-3">
                            <div class="w-10 h-10 ${achievement.iconColor} rounded-full flex items-center justify-center text-white mr-3">
                                <i class="fa ${achievement.icon}"></i>
                            </div>
                            <div>
                                <h4 class="font-bold">${achievement.title}</h4>
                                <p class="text-xs text-gray-500">${achievement.description}</p>
                            </div>
                        </div>
                        
                        <div class="flex justify-between items-center">
                            <span class="text-xs text-gray-600">奖励</span>
                            <span class="text-sm font-medium text-green-600">
                                <i class="fa fa-money mr-1"></i>${achievement.reward.fund}元
                            </span>
                        </div>
                        
                        <div class="mt-3 pt-3 border-t">
                            <div class="flex justify-between items-center">
                                <span class="text-xs text-gray-600">状态</span>
                                <span class="text-sm font-medium ${isUnlocked ? 'text-green-600' : 'text-gray-500'}">
                                    ${isUnlocked ? '已解锁' : '未解锁'}
                                </span>
                            </div>
                        </div>
                    </div>
                `;
            }
            
            container.innerHTML = html;
        }
        
        // 检查成就
        function checkAchievements() {
            for (const achievement of achievements) {
                // 如果成就已解锁,跳过
                if (gameState.achievements.includes(achievement.id)) continue;
                
                // 检查成就条件
                if (achievement.condition(gameState)) {
                    // 解锁成就
                    gameState.achievements.push(achievement.id);
                    
                    // 应用奖励
                    if (achievement.reward.fund) {
                        gameState.classFund += achievement.reward.fund;
                        
                        // 添加财务记录
                        addFinanceRecord('income', `成就奖励: ${achievement.title}`, achievement.reward.fund);
                    }
                    
                    // 添加事件
                    addEvent('system', `解锁成就: ${achievement.title}`, {
                        achievement: achievement.id
                    });
                    
                    // 显示成就解锁通知
                    showAchievementNotification(achievement);
                    
                    // 更新UI
                    updateUI();
                }
            }
        }
        
        // 显示成就解锁通知
        function showAchievementNotification(achievement) {
            // 创建成就通知元素
            const notification = document.createElement('div');
            notification.className = 'fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white rounded-lg shadow-xl p-6 z-50 max-w-md w-full achievement-unlock';
            
            notification.innerHTML = `
                <div class="text-center">
                    <div class="w-16 h-16 ${achievement.iconColor} rounded-full flex items-center justify-center text-white mx-auto mb-4">
                        <i class="fa ${achievement.icon} text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-bold text-yellow-600 mb-2">成就解锁!</h3>
                    <h4 class="text-lg font-bold mb-2">${achievement.title}</h4>
                    <p class="text-gray-600 mb-4">${achievement.description}</p>
                    <div class="text-green-600 font-bold mb-4">
                        <i class="fa fa-money mr-2"></i>奖励: ${achievement.reward.fund}元
                    </div>
                    <button id="closeAchievementNotification" class="px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-all">
                        太棒了!
                    </button>
                </div>
            `;
            
            document.body.appendChild(notification);
            
            // 添加关闭按钮事件
            document.getElementById('closeAchievementNotification').addEventListener('click', () => {
                notification.remove();
            });
            
            // 3秒后自动关闭
            setTimeout(() => {
                notification.classList.add('opacity-0', 'scale-95');
                setTimeout(() => {
                    notification.remove();
                }, 300);
            }, 5000);
        }
        
        // 检查随机事件
        function checkRandomEvent() {
            // 30%的概率触发随机事件
            if (Math.random() < 0.3) {
                // 随机选择一个事件
                const event = randomEvents[Math.floor(Math.random() * randomEvents.length)];
                
                // 显示事件弹窗
                showEventModal(event);
            }
        }
        
        // 显示事件弹窗
        function showEventModal(event) {
            // 设置事件内容
            document.getElementById('eventTitle').textContent = event.title;
            document.getElementById('eventDescription').textContent = event.description;
            document.getElementById('eventIcon').className = `w-12 h-12 ${event.iconColor} rounded-full flex items-center justify-center text-white mr-4`;
            document.getElementById('eventIcon').innerHTML = `<i class="fa ${event.icon} text-xl"></i>`;
            
            // 生成选项
            const optionsContainer = document.getElementById('eventOptions');
            let html = '';
            
            for (const option of event.options) {
                html += `
                    <button class="event-option w-full text-left p-3 border rounded-lg hover:bg-blue-50 transition-all" 
                            data-effects='${JSON.stringify(option.effects)}'
                            data-result="${option.result}">
                        <p class="font-medium">${option.text}</p>
                        <div class="mt-2 flex flex-wrap gap-2">
                            ${option.effects.pressure !== 0 ? `
                                <span class="px-2 py-1 bg-${option.effects.pressure > 0 ? 'red' : 'green'}-100 text-${option.effects.pressure > 0 ? 'red' : 'green'}-800 text-xs rounded-full">
                                    压力: ${option.effects.pressure > 0 ? '+' : ''}${option.effects.pressure}%
                                </span>
                            ` : ''}
                            ${option.effects.satisfaction !== 0 ? `
                                <span class="px-2 py-1 bg-${option.effects.satisfaction > 0 ? 'green' : 'red'}-100 text-${option.effects.satisfaction > 0 ? 'green' : 'red'}-800 text-xs rounded-full">
                                    满意度: ${option.effects.satisfaction > 0 ? '+' : ''}${option.effects.satisfaction}%
                                </span>
                            ` : ''}
                            ${option.effects.fund !== 0 ? `
                                <span class="px-2 py-1 bg-${option.effects.fund > 0 ? 'green' : 'red'}-100 text-${option.effects.fund > 0 ? 'green' : 'red'}-800 text-xs rounded-full">
                                    班费: ${option.effects.fund > 0 ? '+' : ''}${option.effects.fund}元
                                </span>
                            ` : ''}
                        </div>
                    </button>
                `;
            }
            
            optionsContainer.innerHTML = html;
            
            // 显示弹窗
            eventModal.classList.remove('hidden');
            
            // 添加选项点击事件
            document.querySelectorAll('.event-option').forEach(option => {
                option.addEventListener('click', () => {
                    const effects = JSON.parse(option.getAttribute('data-effects'));
                    const result = option.getAttribute('data-result');
                    
                    // 应用效果
                    // 压力效果
                    if (effects.pressure) {
                        for (const student of gameState.students) {
                            student.pressure = Math.max(0, Math.min(100, student.pressure + effects.pressure));
                        }
                        calculateClassPressure();
                    }
                    
                    // 满意度效果
                    if (effects.satisfaction) {
                        gameState.classStatus.satisfaction = Math.max(0, Math.min(100, 
                            gameState.classStatus.satisfaction + effects.satisfaction
                        ));
                    }
                    
                    // 班费效果
                    if (effects.fund) {
                        gameState.classFund = Math.max(0, gameState.classFund + effects.fund);
                        
                        // 添加财务记录
                        if (effects.fund > 0) {
                            addFinanceRecord('income', `事件收入: ${event.title}`, effects.fund);
                        } else {
                            addFinanceRecord('expense', `事件支出: ${event.title}`, -effects.fund);
                        }
                    }
                    
                    // 添加事件
                    addEvent('randomEvent', `${event.title} - ${result}`, {
                        eventId: event.id,
                        choice: option.querySelector('p').textContent,
                        result: result,
                        effects: effects
                    });
                    
                    // 更新UI
                    updateUI();
                    
                    // 关闭弹窗
                    eventModal.classList.add('hidden');
                    
                    // 显示通知
                    showNotification('事件处理完成', 'info', result);
                });
            });
        }
        
        // 检查游戏结束条件
        function checkGameOver() {
            // 检查班级满意度是否为0
            if (gameState.classStatus.satisfaction <= 0) {
                gameOver('班级满意度降至0,你被学校解雇了!');
                return;
            }
            
            // 检查是否所有学生压力都超过阈值
            let highPressureCount = 0;
            for (const student of gameState.students) {
                if (student.pressure >= student.pressureThreshold) {
                    highPressureCount++;
                }
            }
            
            if (highPressureCount >= gameState.students.length * 0.8) {
                gameOver('太多学生压力过大,家长投诉导致你被调职!');
                return;
            }
            
            // 检查是否完成24周教学
            if (gameState.currentWeek > 24) {
                gameOver('恭喜你成功完成了一学期的教学工作!', true);
                return;
            }
        }
        
        // 游戏结束
        function gameOver(message, isVictory = false) {
            gameState.isGameOver = true;
            
            // 创建游戏结束弹窗
            const modal = document.createElement('div');
            modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
            
            modal.innerHTML = `
                <div class="bg-white rounded-lg shadow-xl p-8 max-w-md w-full animate-fade-in">
                    <div class="text-center">
                        <div class="w-16 h-16 ${isVictory ? 'bg-green-500' : 'bg-red-500'} rounded-full flex items-center justify-center text-white mx-auto mb-4">
                            <i class="fa ${isVictory ? 'fa-trophy' : 'fa-times-circle'} text-2xl"></i>
                        </div>
                        <h2 class="text-2xl font-bold mb-4">${isVictory ? '游戏胜利!' : '游戏结束'}</h2>
                        <p class="text-gray-600 mb-6">${message}</p>
                        
                        <div class="space-y-3 mb-6">
                            <div class="flex justify-between">
                                <span class="text-gray-600">完成周数:</span>
                                <span class="font-medium">${gameState.currentWeek - 1}周</span>
                            </div>
                            <div class="flex justify-between">
                                <span class="text-gray-600">最终班费:</span>
                                <span class="font-medium">${gameState.classFund}元</span>
                            </div>
                            <div class="flex justify-between">
                                <span class="text-gray-600">解锁成就:</span>
                                <span class="font-medium">${gameState.achievements.length}/${achievements.length}</span>
                            </div>
                            <div class="flex justify-between">
                                <span class="text-gray-600">班级满意度:</span>
                                <span class="font-medium">${Math.round(gameState.classStatus.satisfaction)}%</span>
                            </div>
                        </div>
                        
                        <div class="flex justify-center space-x-4">
                            <button id="restartGameOverBtn" class="px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white rounded-lg transition-all">
                                重新开始
                            </button>
                            <button id="saveGameOverBtn" class="px-4 py-2 bg-green-500 hover:bg-green-600 text-white rounded-lg transition-all">
                                保存游戏
                            </button>
                        </div>
                    </div>
                </div>
            `;
            
            document.body.appendChild(modal);
            
            // 添加按钮事件
            document.getElementById('restartGameOverBtn').addEventListener('click', () => {
                restartGameBtn.click();
            });
            
            document.getElementById('saveGameOverBtn').addEventListener('click', () => {
                saveGameBtn.click();
                showNotification('游戏已保存', 'success', '你的游戏进度已成功保存');
            });
        }
        
        // 显示通知
        function showNotification(title, type, message) {
            // 设置通知内容
            document.getElementById('notificationTitle').textContent = title;
            document.getElementById('notificationMessage').textContent = message;
            
            // 设置图标
            const iconElement = document.getElementById('notificationIcon');
            const iconIElement = document.getElementById('notificationIconI');
            
            iconElement.className = 'w-8 h-8 rounded-full flex items-center justify-center mr-3';
            iconIElement.className = 'fa';
            
            switch (type) {
                case 'success':
                    iconElement.classList.add('bg-green-500', 'text-white');
                    iconIElement.classList.add('fa-check');
                    break;
                case 'error':
                    iconElement.classList.add('bg-red-500', 'text-white');
                    iconIElement.classList.add('fa-times');
                    break;
                case 'warning':
                    iconElement.classList.add('bg-yellow-500', 'text-white');
                    iconIElement.classList.add('fa-exclamation');
                    break;
                default:
                    iconElement.classList.add('bg-blue-500', 'text-white');
                    iconIElement.classList.add('fa-info');
            }
            
            // 显示通知
            notification.classList.add('show');
            
            // 3秒后自动隐藏
            setTimeout(() => {
                notification.classList.remove('show');
            }, 3000);
        }
        
        // 格式化日期
        function formatDate(dateString) {
            const date = new Date(dateString);
            return `${date.getMonth() + 1}月${date.getDate()}日`;
        }
        
        // 加载保存的游戏
        function loadSavedGame() {
            const savedGame = localStorage.getItem('teacherSimulatorSave');
            
            if (savedGame) {
                // 询问是否加载保存的游戏
                if (confirm('检测到保存的游戏进度,是否加载?')) {
                    try {
                        gameState = JSON.parse(savedGame);
                        
                        // 隐藏设置弹窗,显示游戏界面
                        setupModal.classList.add('hidden');
                        gameContainer.classList.remove('hidden');
                        
                        // 更新UI
                        updateUI();
                        
                        // 显示通知
                        showNotification('游戏加载成功', 'success', '已成功加载保存的游戏进度');
                    } catch (error) {
                        console.error('加载游戏失败:', error);
                        showNotification('加载失败', 'error', '无法加载保存的游戏进度');
                    }
                }
            }
        }
        
        // 初始化游戏
        window.addEventListener('DOMContentLoaded', initGame);
    </script>
</body>
</html>