跳到正文

休闲·娱乐

new AFO:结束?开始? - 文化课学习模拟游戏

qhcKing约 617 分钟
原文
文章信息与版本

文章信息

收录
2026年4月28日
更新
2026年8月1日
篇幅
约 617 分钟

版本

  1. v2当前
  2. v1
C++
<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta name="author" content="wujiahaocoder">
    <meta name="license" content="CC BY-NC-ND 4.0">
    <!-- 或者使用更详细的描述 -->
    <meta name="copyright" content="Copyright (c) 2025-2026 wujiahaocoder">
    <title>AFO:结束?开始?</title>
    <style>
        /* ==================== 全局样式 ==================== */
        :root {
            --primary: #3498db;
            --secondary: #2ecc71;
            --danger: #e74c3c;
            --warning: #f39c12;
            --purple: #9b59b6;
            --pink: #e91e63;
            --cyan: #00bcd4;
            --anxiety: #d35400;
            /* 新增焦虑颜色 */
            --dark: #2c3e50;
            --light: #ecf0f1;
            --bg: #1a1a2e;
            --card-bg: rgba(255, 255, 255, 0.08);
            --border: rgba(255, 255, 255, 0.15);
            --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            --glass: blur(15px);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', 'HarmonyOS Sans', sans-serif;
        }

        body {
            background: linear-gradient(135deg, var(--bg), #0f0c29, #302b63, #24243e);
            color: var(--light);
            min-height: 100vh;
            padding: 15px;
            overflow-x: hidden;
            position: relative;
        }

            body::before {
                content: '';
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: radial-gradient(circle at 10% 20%, rgba(52, 152, 219, 0.1) 0%, transparent 20%), radial-gradient(circle at 90% 80%, rgba(46, 204, 113, 0.1) 0%, transparent 20%);
                pointer-events: none;
                z-index: -1;
            }

        /* ==================== 布局系统 ==================== */
        .container {
            max-width: 1600px;
            margin: 0 auto;
            display: grid;
            grid-template-columns: 300px 1fr 320px;
            gap: 15px;
            grid-template-areas:
                "header header header"
                "stats main events"
                "schedule actions achievements"
                "footer footer footer";
        }

        /* ==================== 头部 ==================== */
        header {
            grid-area: header;
            background: var(--card-bg);
            backdrop-filter: var(--glass);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 20px;
            text-align: center;
            box-shadow: var(--shadow);
            position: relative;
            overflow: hidden;
        }

            header::before {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
                transition: left 0.5s;
            }

            header:hover::before {
                left: 100%;
            }

        h1 {
            font-size: 2.5rem;
            margin-bottom: 8px;
            background: linear-gradient(90deg, var(--primary), var(--secondary), var(--purple));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            text-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
            letter-spacing: 1px;
        }

        .subtitle {
            font-size: 1.1rem;
            opacity: 0.85;
            margin-bottom: 10px;
            font-style: italic;
        }

        .license-info {
            font-size: 0.75rem;
            opacity: 0.6;
            margin-top: 8px;
            display: flex;
            justify-content: center;
            gap: 15px;
            flex-wrap: wrap;
        }

            .license-info a {
                color: var(--light);
                text-decoration: none;
                border-bottom: 1px dotted var(--border);
            }

                .license-info a:hover {
                    opacity: 1;
                    border-bottom-color: var(--primary);
                }

        /* ==================== 统计面板 ==================== */
        .stats {
            grid-area: stats;
            background: var(--card-bg);
            backdrop-filter: var(--glass);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 15px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            max-height: 650px;
            overflow-y: auto;
        }

        .stat-section-title {
            font-size: 0.9rem;
            font-weight: bold;
            color: var(--primary);
            margin-top: 10px;
            margin-bottom: 5px;
            padding-bottom: 3px;
            border-bottom: 1px solid var(--border);
        }

        .stat-card {
            background: rgba(0, 0, 0, 0.2);
            padding: 10px;
            border-radius: 8px;
            border-left: 4px solid var(--primary);
            transition: all 0.3s ease;
            position: relative;
        }

            .stat-card:hover {
                transform: translateX(5px);
                background: rgba(0, 0, 0, 0.3);
            }

            .stat-card h3 {
                font-size: 0.9rem;
                margin-bottom: 6px;
                display: flex;
                justify-content: space-between;
                align-items: center;
            }

        .stat-value {
            font-weight: bold;
            color: var(--secondary);
            font-size: 0.95rem;
        }

        .progress-bar {
            height: 8px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            overflow: hidden;
            margin-top: 4px;
            position: relative;
        }

        .progress-fill {
            height: 100%;
            background: var(--primary);
            border-radius: 4px;
            transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
            position: relative;
            overflow: hidden;
        }

            .progress-fill::after {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
                animation: shimmer 2s infinite;
            }

        @keyframes shimmer {
            0% {
                left: -100%;
            }

            100% {
                left: 100%;
            }
        }

        .progress-fill.energy {
            background: var(--secondary);
        }

        .progress-fill.stress {
            background: var(--danger);
        }

        .progress-fill.health {
            background: var(--warning);
        }

        .progress-fill.relationship {
            background: var(--purple);
        }

        .progress-fill.economy {
            background: var(--cyan);
        }

        .progress-fill.mental {
            background: var(--pink);
        }

        /* 新增焦虑样式 */
        .progress-fill.anxiety {
            background: var(--anxiety);
        }

        .relationship-bar {
            height: 6px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
            overflow: hidden;
            margin-top: 4px;
        }

        .relationship-fill {
            height: 100%;
            background: var(--purple);
            border-radius: 3px;
            transition: width 0.5s ease;
        }

        /* ==================== 主区域 ==================== */
        .main {
            grid-area: main;
            background: var(--card-bg);
            backdrop-filter: var(--glass);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 15px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            max-height: 650px;
        }

        .time-info {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--border);
            flex-wrap: wrap;
            gap: 8px;
        }

        .time-display {
            font-size: 1.1rem;
            font-weight: bold;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .time-badge {
            background: rgba(52, 152, 219, 0.3);
            padding: 4px 8px;
            border-radius: 6px;
            font-size: 0.85rem;
        }

        .season-indicator {
            font-size: 1.2rem;
            padding: 4px 8px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 6px;
        }

        .event-log {
            flex-grow: 1;
            overflow-y: auto;
            padding-right: 8px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .event-item {
            background: rgba(0, 0, 0, 0.2);
            padding: 8px 10px;
            border-radius: 6px;
            border-left: 3px solid var(--primary);
            animation: fadeIn 0.4s ease;
            font-size: 0.9rem;
            line-height: 1.35;
            position: relative;
        }

            .event-item::before {
                content: '•';
                position: absolute;
                left: -2px;
                color: var(--primary);
                font-weight: bold;
            }

            .event-item.good {
                border-left-color: var(--secondary);
                background: rgba(46, 204, 113, 0.15);
            }

            .event-item.bad {
                border-left-color: var(--danger);
                background: rgba(231, 76, 60, 0.15);
            }

            .event-item.neutral {
                border-left-color: var(--warning);
                background: rgba(243, 156, 18, 0.15);
            }

            .event-item.story {
                border-left-color: var(--purple);
                background: rgba(155, 89, 182, 0.2);
            }

            .event-item.important {
                border-left-color: var(--pink);
                background: rgba(233, 30, 99, 0.2);
                font-weight: bold;
            }

            .event-item .timestamp {
                font-size: 0.7rem;
                opacity: 0.6;
                margin-right: 6px;
                font-family: monospace;
            }

        /* ==================== 课程表 ==================== */
        .schedule {
            grid-area: schedule;
            background: var(--card-bg);
            backdrop-filter: var(--glass);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 15px;
            max-height: 300px;
            overflow-y: auto;
        }

            .schedule h3 {
                font-size: 1rem;
                margin-bottom: 10px;
                color: var(--cyan);
            }

        .schedule-item {
            background: rgba(0, 0, 0, 0.2);
            padding: 8px;
            margin-bottom: 6px;
            border-radius: 6px;
            border-left: 3px solid var(--cyan);
            font-size: 0.85rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

            .schedule-item.completed {
                opacity: 0.5;
                text-decoration: line-through;
                border-left-color: var(--secondary);
            }

            .schedule-item.missed {
                border-left-color: var(--danger);
                background: rgba(231, 76, 60, 0.2);
            }

            .schedule-item .time {
                font-weight: bold;
                color: var(--cyan);
            }

        /* ==================== 事件区域 ==================== */
        .events {
            grid-area: events;
            background: var(--card-bg);
            backdrop-filter: var(--glass);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 15px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            max-height: 650px;
            overflow-y: auto;
        }

        .event-card {
            background: rgba(0, 0, 0, 0.2);
            padding: 12px;
            border-radius: 8px;
            border-top: 3px solid var(--warning);
            transition: all 0.3s ease;
        }

            .event-card:hover {
                transform: translateY(-2px);
                box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            }

            .event-card h3 {
                font-size: 0.95rem;
                margin-bottom: 8px;
                display: flex;
                align-items: center;
                gap: 8px;
            }

            .event-card p {
                font-size: 0.85rem;
                line-height: 1.4;
                opacity: 0.9;
            }

            .event-card.relationship {
                border-top-color: var(--purple);
            }

            .event-card.achievement {
                border-top-color: var(--secondary);
            }

            .event-card.economy {
                border-top-color: var(--cyan);
            }

            .event-card.mental {
                border-top-color: var(--pink);
            }

            /* 焦虑状态卡片 */
            .event-card.anxiety-status {
                border-top-color: var(--anxiety);
            }

            .event-card .progress-bar {
                height: 6px;
                margin-top: 8px;
            }

        /* ==================== 操作区域 ==================== */
        .actions {
            grid-area: actions;
            background: var(--card-bg);
            backdrop-filter: var(--glass);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 15px;
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 10px;
            max-height: 300px;
            overflow-y: auto;
        }

        .action-btn {
            background: rgba(52, 152, 219, 0.2);
            border: 1px solid var(--primary);
            color: var(--light);
            padding: 12px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s ease;
            font-weight: 600;
            text-align: center;
            font-size: 0.9rem;
            position: relative;
            overflow: hidden;
        }

            .action-btn::before {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
                transition: left 0.4s;
            }

            .action-btn:hover::before {
                left: 100%;
            }

            .action-btn:hover {
                background: rgba(52, 152, 219, 0.4);
                transform: translateY(-2px);
                box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
            }

            .action-btn:active {
                transform: translateY(0);
            }

            .action-btn.primary {
                background: rgba(46, 204, 113, 0.2);
                border-color: var(--secondary);
            }

                .action-btn.primary:hover {
                    background: rgba(46, 204, 113, 0.4);
                }

            .action-btn.danger {
                background: rgba(231, 76, 60, 0.2);
                border-color: var(--danger);
            }

                .action-btn.danger:hover {
                    background: rgba(231, 76, 60, 0.4);
                }

            .action-btn.warning {
                background: rgba(243, 156, 18, 0.2);
                border-color: var(--warning);
            }

            .action-btn.purple {
                background: rgba(155, 89, 182, 0.2);
                border-color: var(--purple);
            }

            .action-btn.cyan {
                background: rgba(0, 188, 212, 0.2);
                border-color: var(--cyan);
            }

            .action-btn:disabled {
                opacity: 0.4;
                cursor: not-allowed;
                transform: none !important;
            }

                .action-btn:disabled::before {
                    display: none;
                }

            .action-btn .hotkey {
                font-size: 0.7rem;
                opacity: 0.6;
                margin-left: 4px;
            }

        /* ==================== 成就区域 ==================== */
        .achievements {
            grid-area: achievements;
            background: var(--card-bg);
            backdrop-filter: var(--glass);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 15px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            max-height: 300px;
            overflow-y: auto;
        }

            .achievements h3 {
                font-size: 1rem;
                margin-bottom: 5px;
                color: var(--secondary);
                display: flex;
                justify-content: space-between;
                align-items: center;
            }

        .achievement-list {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
        }

        .achievement-badge {
            background: rgba(46, 204, 113, 0.2);
            border: 1px solid var(--secondary);
            padding: 5px 8px;
            border-radius: 15px;
            font-size: 0.75rem;
            opacity: 0.4;
            transition: all 0.3s ease;
            cursor: help;
            white-space: nowrap;
        }

            .achievement-badge.unlocked {
                opacity: 1;
                background: rgba(46, 204, 113, 0.4);
                box-shadow: 0 0 10px rgba(46, 204, 113, 0.3);
                animation: popIn 0.3s ease;
            }

            .achievement-badge.hidden {
                background: rgba(255, 255, 255, 0.1);
                border-color: var(--border);
                color: transparent;
                cursor: default;
            }

                .achievement-badge.hidden.unlocked {
                    color: var(--light);
                    background: rgba(155, 89, 182, 0.4);
                    border-color: var(--purple);
                }

        @keyframes popIn {
            0% {
                transform: scale(0.8);
                opacity: 0;
            }

            50% {
                transform: scale(1.1);
            }

            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        /* ==================== 页脚 ==================== */
        .footer {
            grid-area: footer;
            background: var(--card-bg);
            backdrop-filter: var(--glass);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 10px;
            text-align: center;
            font-size: 0.8rem;
            opacity: 0.7;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
        }

            .footer .save-status {
                color: var(--secondary);
                font-weight: bold;
            }

                .footer .save-status.error {
                    color: var(--danger);
                }

        /* ==================== 模态框 ==================== */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 100;
            justify-content: center;
            align-items: center;
            backdrop-filter: blur(5px);
        }

        .modal-content {
            background: #1a1a2e;
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 25px;
            max-width: 700px;
            width: 90%;
            max-height: 85vh;
            overflow-y: auto;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
            animation: modalSlideIn 0.3s ease;
        }

        @keyframes modalSlideIn {
            from {
                transform: translateY(-50px) scale(0.95);
                opacity: 0;
            }

            to {
                transform: translateY(0) scale(1);
                opacity: 1;
            }
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--border);
        }

            .modal-header h2 {
                font-size: 1.4rem;
                color: var(--primary);
                display: flex;
                align-items: center;
                gap: 8px;
            }

        .close-btn {
            background: none;
            border: none;
            color: var(--light);
            font-size: 1.8rem;
            cursor: pointer;
            opacity: 0.7;
            transition: all 0.2s ease;
            width: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
        }

            .close-btn:hover {
                opacity: 1;
                background: rgba(255, 255, 255, 0.1);
                transform: rotate(90deg);
            }

        .modal-body {
            line-height: 1.6;
        }

        .modal-footer {
            margin-top: 15px;
            padding-top: 15px;
            border-top: 1px solid var(--border);
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }

        /* 学习模态框 */
        .study-options {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 10px;
            margin-top: 15px;
        }

        .study-btn {
            background: rgba(52, 152, 219, 0.2);
            border: 1px solid var(--primary);
            color: var(--light);
            padding: 12px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s ease;
            text-align: center;
            font-size: 0.9rem;
            font-weight: 600;
            position: relative;
            overflow: hidden;
        }

            .study-btn::before {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
                transition: left 0.4s;
            }

            .study-btn:hover::before {
                left: 100%;
            }

            .study-btn:hover {
                background: rgba(52, 152, 219, 0.4);
                transform: translateY(-2px);
            }

            .study-btn small {
                display: block;
                font-size: 0.75rem;
                opacity: 0.7;
                margin-top: 4px;
                font-weight: normal;
            }

            .study-btn.special {
                background: rgba(155, 89, 182, 0.2);
                border-color: var(--purple);
            }

                .study-btn.special:hover {
                    background: rgba(155, 89, 182, 0.4);
                }

            .study-btn:disabled {
                opacity: 0.4;
                cursor: not-allowed;
            }

        /* 故事模态框 */
        .story-modal {
            background: linear-gradient(135deg, #1a1a2e, #2d1b3d);
        }

        .story-content {
            font-size: 1.05rem;
            line-height: 1.8;
            padding: 15px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 8px;
            margin: 15px 0;
            border-left: 3px solid var(--purple);
            font-family: 'Georgia', serif;
        }

        .story-choices {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-top: 15px;
        }

        .story-choice-btn {
            background: rgba(155, 89, 182, 0.2);
            border: 1px solid var(--purple);
            color: var(--light);
            padding: 12px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s ease;
            text-align: left;
            font-size: 0.95rem;
            position: relative;
        }

            .story-choice-btn:hover {
                background: rgba(155, 89, 182, 0.4);
                transform: translateX(5px);
            }

        .choice-preview {
            font-size: 0.8rem;
            opacity: 0.8;
            margin-top: 5px;
            font-style: italic;
            color: var(--warning);
        }

        /* 结束画面 */
        .end-screen {
            text-align: center;
            padding: 30px;
            background: linear-gradient(135deg, rgba(0, 0, 0, 0.5), rgba(155, 89, 182, 0.2));
            border-radius: 12px;
            border: 1px solid var(--border);
        }

            .end-screen h2 {
                font-size: 2.5rem;
                margin-bottom: 20px;
                background: linear-gradient(90deg, var(--secondary), var(--primary));
                -webkit-background-clip: text;
                background-clip: text;
                color: transparent;
            }

            .end-screen .final-score {
                font-size: 3.5rem;
                font-weight: bold;
                margin: 15px 0;
                color: var(--secondary);
                text-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
            }

            .end-screen .ending-text {
                font-size: 1.1rem;
                line-height: 1.8;
                margin: 20px 0;
                opacity: 0.9;
                font-family: 'Georgia', serif;
            }

            .end-screen .stats-summary {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
                gap: 10px;
                margin: 20px 0;
                font-size: 0.9rem;
            }

        .stat-box {
            background: rgba(0, 0, 0, 0.3);
            padding: 10px;
            border-radius: 6px;
            border: 1px solid var(--border);
        }

            .stat-box .label {
                font-size: 0.75rem;
                opacity: 0.7;
            }

            .stat-box .value {
                font-size: 1.2rem;
                font-weight: bold;
                color: var(--secondary);
            }

        .restart-btn {
            background: linear-gradient(135deg, var(--secondary), var(--primary));
            color: white;
            border: none;
            padding: 15px 30px;
            border-radius: 10px;
            font-size: 1.1rem;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: bold;
            margin-top: 15px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }

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

        /* ==================== 通知系统 ==================== */
        .notification {
            position: fixed;
            top: 20px;
            right: 20px;
            background: var(--card-bg);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 15px 20px;
            max-width: 380px;
            z-index: 200;
            transform: translateX(120%);
            transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
            font-size: 0.95rem;
            line-height: 1.4;
        }

            .notification.show {
                transform: translateX(0);
            }

            .notification.good {
                border-left: 4px solid var(--secondary);
            }

            .notification.bad {
                border-left: 4px solid var(--danger);
            }

            .notification.neutral {
                border-left: 4px solid var(--warning);
            }

            .notification.story {
                border-left: 4px solid var(--purple);
            }

            .notification.important {
                border-left: 4px solid var(--pink);
            }

        /* ==================== 工具提示 ==================== */
        .tooltip {
            position: relative;
            display: inline-block;
            cursor: help;
            border-bottom: 1px dotted var(--light);
        }

            .tooltip .tooltiptext {
                visibility: hidden;
                width: 240px;
                background-color: rgba(0, 0, 0, 0.95);
                color: #fff;
                text-align: center;
                border-radius: 6px;
                padding: 10px;
                position: absolute;
                z-index: 1;
                bottom: 125%;
                left: 50%;
                margin-left: -120px;
                opacity: 0;
                transition: opacity 0.3s;
                font-size: 0.85rem;
                line-height: 1.4;
                border: 1px solid var(--border);
            }

            .tooltip:hover .tooltiptext {
                visibility: visible;
                opacity: 1;
            }

        /* ==================== 动画 ==================== */
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(10px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes pulse {
            0% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.05);
            }

            100% {
                transform: scale(1);
            }
        }

        .pulse {
            animation: pulse 2s infinite;
        }

        /* ==================== 滚动条 ==================== */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

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

        ::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.2);
            border-radius: 4px;
        }

            ::-webkit-scrollbar-thumb:hover {
                background: rgba(255, 255, 255, 0.3);
            }

        /* ==================== 响应式设计 ==================== */
        @media (max-width: 1200px) {
            .container {
                grid-template-columns: 1fr 1fr;
                grid-template-areas:
                    "header header"
                    "stats main"
                    "events events"
                    "schedule actions"
                    "achievements achievements"
                    "footer footer";
            }
        }

        @media (max-width: 768px) {
            .container {
                grid-template-columns: 1fr;
                grid-template-areas:
                    "header"
                    "stats"
                    "main"
                    "events"
                    "schedule"
                    "actions"
                    "achievements"
                    "footer";
            }

            h1 {
                font-size: 1.8rem;
            }

            .study-options {
                grid-template-columns: 1fr;
            }

            .actions {
                grid-template-columns: 1fr;
            }

            .notification {
                max-width: 90%;
                right: 5%;
            }
        }

        /* ==================== 特殊状态指示器 ==================== */
        .status-indicator {
            display: inline-block;
            padding: 3px 6px;
            border-radius: 4px;
            font-size: 0.75rem;
            font-weight: bold;
            margin-left: 6px;
            border: 1px solid currentColor;
        }

        .status-good {
            background: rgba(46, 204, 113, 0.3);
            color: var(--secondary);
        }

        .status-bad {
            background: rgba(231, 76, 60, 0.3);
            color: var(--danger);
        }

        .status-normal {
            background: rgba(52, 152, 219, 0.3);
            color: var(--primary);
        }

        /* ==================== 快捷键提示 ==================== */
        .hotkey-hint {
            position: fixed;
            bottom: 20px;
            left: 20px;
            background: rgba(0, 0, 0, 0.7);
            padding: 10px;
            border-radius: 8px;
            font-size: 0.8rem;
            opacity: 0;
            transition: opacity 0.3s;
            pointer-events: none;
            z-index: 50;
        }

            .hotkey-hint.show {
                opacity: 1;
            }

            .hotkey-hint kbd {
                background: rgba(255, 255, 255, 0.2);
                padding: 2px 6px;
                border-radius: 4px;
                font-family: monospace;
                margin: 0 2px;
            }

        /* ==================== 操作计数器 ==================== */
        .action-counter {
            position: fixed;
            top: 20px;
            left: 20px;
            background: rgba(0, 0, 0, 0.7);
            padding: 10px 15px;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: bold;
            z-index: 50;
            border: 2px solid var(--secondary);
            color: var(--secondary);
        }

            .action-counter.warning {
                border-color: var(--warning);
                color: var(--warning);
            }

            .action-counter.danger {
                border-color: var(--danger);
                color: var(--danger);
                animation: pulse 1s infinite;
            }

        /* ==================== 启动弹窗(捐助) ==================== */
        .donation-modal {
            background: linear-gradient(135deg, #1a1a2e, #2d1b3d);
        }

        .donation-content {
            text-align: center;
            padding: 20px;
        }

            .donation-content h3 {
                color: var(--primary);
                margin-bottom: 15px;
                font-size: 1.3rem;
            }

            .donation-content p {
                margin-bottom: 15px;
                line-height: 1.6;
                opacity: 0.9;
            }

        .donation-qr {
            width: 200px;
            height: 200px;
            margin: 15px auto;
            border: 2px solid var(--border);
            border-radius: 8px;
            overflow: hidden;
            background: white;
        }

            .donation-qr img {
                width: 100%;
                height: 100%;
                object-fit: contain;
            }

        .donation-link {
            display: inline-block;
            margin-top: 10px;
            color: var(--cyan);
            text-decoration: none;
            font-size: 0.9rem;
            border-bottom: 1px dotted var(--cyan);
        }

            .donation-link:hover {
                opacity: 0.8;
            }

        .donation-buttons {
            display: flex;
            gap: 10px;
            justify-content: center;
            margin-top: 20px;
        }

        .donation-btn {
            padding: 10px 20px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: rgba(255, 255, 255, 0.1);
            color: var(--light);
            cursor: pointer;
            transition: all 0.2s ease;
            font-weight: 600;
        }

            .donation-btn:hover {
                background: rgba(255, 255, 255, 0.2);
                transform: translateY(-2px);
            }

            .donation-btn.primary {
                background: var(--primary);
                border-color: var(--primary);
            }

                .donation-btn.primary:hover {
                    background: #2980b9;
                }

        /* ==================== 阶段目标弹窗 ==================== */
        .goal-modal {
            background: linear-gradient(135deg, #1a1a2e, #2d1b3d);
        }

        .goal-content {
            padding: 15px;
        }

        .goal-item {
            background: rgba(0, 0, 0, 0.2);
            padding: 12px;
            margin-bottom: 10px;
            border-radius: 8px;
            border-left: 4px solid var(--warning);
        }

            .goal-item.achieved {
                border-left-color: var(--secondary);
                background: rgba(46, 204, 113, 0.15);
            }

            .goal-item.failed {
                border-left-color: var(--danger);
                background: rgba(231, 76, 60, 0.15);
            }

            .goal-item h4 {
                margin-bottom: 5px;
                font-size: 1rem;
            }

            .goal-item p {
                font-size: 0.85rem;
                opacity: 0.8;
                margin-bottom: 5px;
            }

        .goal-progress {
            font-size: 0.8rem;
            font-weight: bold;
            margin-top: 5px;
        }

            .goal-progress.achieved {
                color: var(--secondary);
            }

            .goal-progress.failed {
                color: var(--danger);
            }

        /* ==================== 成就详情弹窗 ==================== */
        .achievement-detail-modal {
            background: linear-gradient(135deg, #1a1a2e, #2d1b3d);
        }

        .achievement-detail-content {
            padding: 15px;
            max-height: 400px;
            overflow-y: auto;
        }

        .achievement-detail-item {
            background: rgba(0, 0, 0, 0.2);
            padding: 10px;
            margin-bottom: 8px;
            border-radius: 6px;
            border-left: 3px solid var(--secondary);
            font-size: 0.9rem;
        }

            .achievement-detail-item.hidden {
                border-left-color: var(--purple);
                opacity: 0.6;
            }

            .achievement-detail-item .name {
                font-weight: bold;
                color: var(--secondary);
            }

            .achievement-detail-item.hidden .name {
                color: var(--purple);
            }

            .achievement-detail-item .desc {
                font-size: 0.8rem;
                opacity: 0.8;
            }
    </style>
</head>

<body>
    <!-- 操作计数器 -->
    <div class="action-counter" id="actionCounter">
        本周操作: 0/3
    </div>

    <!-- 快捷键提示 -->
    <div class="hotkey-hint" id="hotkeyHint">
        快捷键: 1学习 2休息 3锻炼 4社交 5回忆 6模考 7作业 8活动 9经济 0结束
    </div>

    <div class="container">
        <!-- 头部 -->
        <header>
            <h1>AFO:结束?开始?</h1>
            <div class="subtitle">"从代码到考卷,这是一场关于成长与救赎的史诗旅程"</div>
            <div class="license-info">
                <span>
                    <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode.zh-Hans" target="_blank"
                       style="color: rgb(196, 196, 196)">
                        CC
                        BY-NC-ND 4.0
                    </a>
                </span>
                <span>作者: wujiahaocoder</span>
                <a href="https://github.com/wujiahaocoder/AFO-Simulator" target="_blank">GitHub</a>
                <span>v2.0.1</span>
            </div>
            <div id="game-status" style="margin-top: 10px; font-size: 0.9rem; opacity: 0.8;">准备开始你的文化课之旅...</div>
        </header>

        <!-- 统计面板 -->
        <div class="stats">
            <div class="stat-section-title">📊 核心状态</div>
            <div class="stat-card">
                <h3>精力值 <span class="stat-value" id="energy-value">80/100</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill energy" id="energy-bar" style="width: 80%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>压力值 <span class="stat-value" id="stress-value">20/100</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill stress" id="stress-bar" style="width: 20%"></div>
                </div>
            </div>
            <!-- 新增焦虑值显示 -->
            <div class="stat-card">
                <h3>焦虑值 <span class="stat-value" id="anxiety-value">0/100</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill anxiety" id="anxiety-bar" style="width: 0%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>健康值 <span class="stat-value" id="health-value">85/100</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill health" id="health-bar" style="width: 85%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>心理值 <span class="stat-value" id="mental-value">75/100</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill mental" id="mental-bar" style="width: 75%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>经济值 <span class="stat-value" id="money-value">500元</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill economy" id="money-bar" style="width: 50%"></div>
                </div>
            </div>

            <div class="stat-section-title">📚 学科能力</div>
            <div class="stat-card">
                <h3>语文 <span class="stat-value" id="chinese-value">10/100</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill" id="chinese-bar" style="width: 10%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>数学 <span class="stat-value" id="math-value">15/100</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill" id="math-bar" style="width: 15%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>英语 <span class="stat-value" id="english-value">8/100</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill" id="english-bar" style="width: 8%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>物理 <span class="stat-value" id="physics-value">20/100</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill" id="physics-bar" style="width: 20%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>化学 <span class="stat-value" id="chemistry-value">12/100</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill" id="chemistry-bar" style="width: 12%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>生物 <span class="stat-value" id="biology-value">10/100</span></h3>
                <div class="progress-bar">
                    <div class="progress-fill" id="biology-bar" style="width: 10%"></div>
                </div>
            </div>

            <div class="stat-section-title">👥 人际关系</div>
            <div class="stat-card">
                <h3>班主任 <span class="stat-value" id="teacher-value">50</span></h3>
                <div class="relationship-bar">
                    <div class="relationship-fill" id="teacher-bar" style="width: 50%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>数学老师 <span class="stat-value" id="math-teacher-value">50</span></h3>
                <div class="relationship-bar">
                    <div class="relationship-fill" id="math-teacher-bar" style="width: 50%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>语文老师 <span class="stat-value" id="chinese-teacher-value">50</span></h3>
                <div class="relationship-bar">
                    <div class="relationship-fill" id="chinese-teacher-bar" style="width: 50%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>英语老师 <span class="stat-value" id="english-teacher-value">50</span></h3>
                <div class="relationship-bar">
                    <div class="relationship-fill" id="english-teacher-bar" style="width: 50%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>同学A <span class="stat-value" id="classmate-a-value">50</span></h3>
                <div class="relationship-bar">
                    <div class="relationship-fill" id="classmate-a-bar" style="width: 50%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>同学B <span class="stat-value" id="classmate-b-value">50</span></h3>
                <div class="relationship-bar">
                    <div class="relationship-fill" id="classmate-b-bar" style="width: 50%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>父母 <span class="stat-value" id="parents-value">50</span></h3>
                <div class="relationship-bar">
                    <div class="relationship-fill" id="parents-bar" style="width: 50%"></div>
                </div>
            </div>
            <div class="stat-card">
                <h3>crush <span class="stat-value" id="crush-value">0</span></h3>
                <div class="relationship-bar">
                    <div class="relationship-fill" id="crush-bar" style="width: 0%"></div>
                </div>
            </div>
        </div>

        <!-- 主区域 -->
        <div class="main">
            <div class="time-info">
                <div class="time-display">
                    <span class="time-badge">第 <span id="week">1</span> 周</span>
                    <span class="time-badge" id="day">周一</span>
                    <span class="time-badge" id="period">早晨</span>
                </div>
                <div class="season-indicator" id="season">🌸 春季</div>
            </div>
            <div style="font-size: 0.9rem; opacity: 0.8; margin-bottom: 5px;">
                距离高考: <span id="days-left">365</span> 天 |
                剩余假期: <span id="vacation-days">0</span> 天
            </div>
            <div class="event-log" id="event-log">
                <!-- 动态生成 -->
            </div>
        </div>

        <!-- 课程表 -->
        <div class="schedule">
            <h3>📅 本周课程表</h3>
            <div id="schedule-list">
                <!-- 动态生成 -->
            </div>
            <div style="margin-top: 10px; font-size: 0.8rem; opacity: 0.7;">
                作业: <span id="homework-count">0</span> 未完成 |
                本周活动: <span id="week-activities">0</span>
            </div>
        </div>

        <!-- 事件区域 -->
        <div class="events">
            <div class="event-card">
                <h3>🎯 当前状态</h3>
                <p id="current-status">一切正常,准备开始学习。</p>
            </div>
            <div class="event-card relationship">
                <h3>👥 关系动态</h3>
                <p id="relationship-status">与老师关系良好,同学关系一般。</p>
            </div>
            <div class="event-card economy">
                <h3>💰 经济状况</h3>
                <p id="economy-status">零花钱充足,可以购买资料。</p>
            </div>
            <div class="event-card mental">
                <h3>💭 心理状态</h3>
                <p id="mental-status">情绪稳定,心理良好。</p>
            </div>
            <!-- 新增焦虑描述 -->
            <div class="event-card anxiety-status">
                <h3>😰 焦虑状态</h3>
                <p id="anxiety-status">心态平和,暂无焦虑。</p>
            </div>
            <div class="event-card">
                <h3>🎯 当前阶段目标</h3>
                <p id="current-goal">暂无目标</p>
                <div class="progress-bar">
                    <div class="progress-fill" id="goal-progress" style="width: 0%; background: var(--warning)"></div>
                </div>
            </div>
            <div class="event-card">
                <h3>🎲 随机事件</h3>
                <p id="random-event">暂无事件</p>
            </div>
        </div>

        <!-- 操作区域 -->
        <div class="actions">
            <button class="action-btn primary" id="study-btn">📚 学习 <span class="hotkey">1</span></button>
            <button class="action-btn" id="rest-btn">💤 休息 <span class="hotkey">2</span></button>
            <button class="action-btn" id="exercise-btn">🏃 锻炼 <span class="hotkey">3</span></button>
            <button class="action-btn" id="social-btn">👥 社交 <span class="hotkey">4</span></button>
            <button class="action-btn purple" id="memory-btn">💭 回忆 <span class="hotkey">5</span></button>
            <button class="action-btn warning" id="exam-btn">📝 模考 <span class="hotkey">6</span></button>
            <button class="action-btn cyan" id="homework-btn">✏️ 作业 <span class="hotkey">7</span></button>
            <button class="action-btn" id="activity-btn">🎉 活动 <span class="hotkey">8</span></button>
            <button class="action-btn" id="economy-btn">💰 经济 <span class="hotkey">9</span></button>
            <button class="action-btn danger" id="end-btn">🌙 结束本周 <span class="hotkey">0</span></button>
        </div>

        <!-- 成就区域(已隐藏) -->
        <div class="achievements" style="display: none;">
            <h3>🏆 成就进度 <span id="achievement-count">0</span>/60</h3>
            <div class="achievement-list" id="achievement-list">
                <!-- 动态生成 -->
            </div>
        </div>

        <!-- 页脚 -->
        <div class="footer">
            <span>💡 提示:按住Shift显示快捷键提示</span>
            <span>
                <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode.zh-Hans" target="_blank"
                   style="color: rgb(196, 196, 196)">
                    CC
                    BY-NC-ND 4.0
                </a> | wujiahaocoder | 仓库:https://github.com/wujiahaocoder/AFO-Simulator
            </span>
            <button class="donation-btn" onclick="showAchievementDetail()"
                    style="padding: 5px 10px; font-size: 0.75rem;">
                查看成就
            </button>

        </div>
    </div>

    <!-- ==================== 模态框系统 ==================== -->
    <!-- 启动弹窗(捐助+介绍) -->
    <div class="modal" id="welcome-modal" style="display: flex;">
        <div class="modal-content donation-modal">
            <div class="modal-header">
                <h2>🎉 欢迎来到 AFO:结束?开始?</h2>
            </div>
            <div class="modal-body donation-content">
                <h3>游戏介绍</h3>
                <p>这是一个AFO后进行文化学习的模拟游戏。你将扮演一位退役OI选手,在52周的时间内,通过策略性的选择,平衡学习、休息、社交、经济等多维度状态,最终在高考中取得理想成绩。</p>
                <div style="margin-top: 20px; font-size: 0.85rem; opacity: 0.7; text-align: left; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 6px;">
                    <p><strong>更新日志 </strong>2026.2.10 v2.0.1</p>
                    <p><strong>数值平衡性调整:</strong>增加了学习操作的压力加成和焦虑加成,提升了技能的提升量。</p>

                </div>

                <h3 style="margin-top: 20px;">❤️ 支持开发</h3>
                <p>
                    本游戏完全免费,采用<a href="https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode.zh-Hans"
                                 target="_blank" style="color: rgb(196, 196, 196)">
                        CC BY-NC-ND
                        4.0
                    </a>协议。如果你喜欢这个游戏,欢迎请我喝杯咖啡,支持后续开发!
                </p>

                <div class="donation-qr">
                    <img src="https://github.com/wujiahaocoder/English_word_learner/blob/master/image.png?raw=true"
                         alt="捐助二维码"
                         onerror="this.style.display='none';this.parentElement.innerHTML='<div style=\'padding:20px;color:#666;font-size:0.8rem;\'>二维码加载失败<br>请访问GitHub支持</div>'">
                </div>

                <a href="https://github.com/wujiahaocoder/English_word_learner/blob/master/image.png" target="_blank"
                   class="donation-link">或点击这里查看高清二维码</a>

                <!-- <div
                    style="margin-top: 20px; font-size: 0.85rem; opacity: 0.7; text-align: left; background: rgba(0,0,0,0.2); padding: 10px; border-radius: 6px;">
                    <strong>游戏特色:</strong><br>
                    • 52周完整学年,每周3次操作限制<br>
                    • 50+随机事件,15+故事剧情<br>
                    • 60+成就,10+结局<br>
                    • 多维度属性联动系统 (新增焦虑机制)<br>
                    • 策略性资源管理
                </div> -->
            </div>
            <div class="donation-buttons">
                <button class="donation-btn" onclick="closeModal('welcome-modal')">我已支持,立刻开始</button>
                <!-- <button class="donation-btn primary"
                    onclick="window.open('https://github.com/wujiahaocoder/English_word_learner/blob/master/image.png', '_blank')">
                    支持开发者
                </button> -->
            </div>
        </div>
    </div>

    <!-- 学习模态框 -->
    <div class="modal" id="study-modal">
        <div class="modal-content">
            <div class="modal-header">
                <h2>📚 选择学习科目</h2>
                <button class="close-btn" onclick="closeModal('study-modal')">&times;</button>
            </div>
            <div class="modal-body">
                <p>选择要重点学习的科目。不同科目消耗精力不同,提升效果也不同。竞赛背景让你在数理化上有额外加成。</p>
                <div class="study-options">
                    <button class="study-btn" onclick="study('chinese')">
                        语文
                        <small>消耗中等精力</small>
                    </button>
                    <button class="study-btn" onclick="study('math')">
                        数学
                        <small>消耗大量精力</small>
                    </button>
                    <button class="study-btn" onclick="study('english')">
                        英语
                        <small>消耗中等精力</small>
                    </button>
                    <button class="study-btn" onclick="study('physics')">
                        物理
                        <small>消耗大量精力</small>
                    </button>
                    <button class="study-btn" onclick="study('chemistry')">
                        化学
                        <small>消耗较少精力</small>
                    </button>
                    <button class="study-btn" onclick="study('biology')">
                        生物
                        <small>消耗较少精力</small>
                    </button>
                </div>
                <div style="margin-top: 15px; font-size: 0.85rem; opacity: 0.8;">
                    💡 提示:数学和物理有竞赛基础,提升更快但消耗更大。心理状态会影响学习效率!高焦虑会降低效率。
                </div>
            </div>
        </div>
    </div>

    <!-- 休息模态框 -->
    <div class="modal" id="rest-modal">
        <div class="modal-content">
            <div class="modal-header">
                <h2>💤 休息方式</h2>
                <button class="close-btn" onclick="closeModal('rest-modal')">&times;</button>
            </div>
            <div class="modal-body">
                <p>选择适当的休息方式。过度劳累会影响健康,合理休息才能保持最佳状态。</p>
                <div class="study-options">
                    <button class="study-btn" onclick="rest('sleep')">
                        深度睡眠
                        <small>恢复30精力 | 降低10压力</small>
                    </button>
                    <button class="study-btn" onclick="rest('nap')">
                        午睡
                        <small>恢复15精力 | 降低5压力</small>
                    </button>
                    <button class="study-btn" onclick="rest('relax')">
                        放松娱乐
                        <small>恢复10精力 | 焦虑-5</small>
                    </button>
                    <button class="study-btn" onclick="rest('music')">
                        听音乐
                        <small>恢复5精力 | 焦虑-2</small>
                    </button>
                    <button class="study-btn special" onclick="rest('counseling')">
                        心理咨询
                        <small>消耗100元 | 恢复20心理 | 焦虑-25</small>
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- 经济模态框 -->
    <div class="modal" id="economy-modal">
        <div class="modal-content">
            <div class="modal-header">
                <h2>💰 经济管理</h2>
                <button class="close-btn" onclick="closeModal('economy-modal')">&times;</button>
            </div>
            <div class="modal-body">
                <p>管理你的零花钱和支出。合理规划经济,购买学习资料。</p>
                <div class="study-options">
                    <button class="study-btn" onclick="economy('part-time')">
                        兼职家教
                        <small>获得200元 | 增加压力</small>
                    </button>
                    <button class="study-btn" onclick="economy('buy-books')">
                        购买资料
                        <small>消耗1000元 | 全科+1 | 提升效率</small>
                    </button>
                    <button class="study-btn" onclick="economy('buy-course')">
                        网课补习
                        <small>消耗300元 | 指定科目+3 | 消耗精力</small>
                    </button>
                    <!-- <button class="study-btn" onclick="economy('save')">
                        存钱
                        <small>无消耗 | 增加存款 | 无直接收益</small>
                    </button> -->
                    <button class="study-btn" onclick="economy('parents')">
                        向父母要钱
                        <small>消耗关系 | 获得150元 | 增加压力</small>
                    </button>
                </div>
                <div style="margin-top: 10px; font-size: 0.85rem;">
                    当前存款: <span id="current-money">500</span> 元
                </div>
            </div>
        </div>
    </div>

    <!-- 活动模态框 -->
    <div class="modal" id="activity-modal">
        <div class="modal-content">
            <div class="modal-header">
                <h2>🎉 课外活动</h2>
                <button class="close-btn" onclick="closeModal('activity-modal')">&times;</button>
            </div>
            <div class="modal-body">
                <p>参加课外活动可以丰富经历,但也会消耗时间和精力。</p>
                <div class="study-options">
                    <button class="study-btn" onclick="activity('club')">
                        社团活动
                        <small>同学关系+5 | 压力-5</small>
                    </button>
                    <button class="study-btn" onclick="activity('volunteer')">
                        志愿者
                        <small>心理+3</small>
                    </button>
                    <button class="study-btn" onclick="activity('lecture')">
                        听讲座
                        <small>随机科目+1 | 压力-3</small>
                    </button>
                    <button class="study-btn" onclick="activity('competition')">
                        知识竞赛
                        <small>压力+10</small>
                    </button>
                    <button class="study-btn special" onclick="activity('oi-meetup')">
                        OI聚会
                        <small>压力-10 | 回忆+1</small>
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- 作业模态框 -->
    <div class="modal" id="homework-modal">
        <div class="modal-content">
            <div class="modal-header">
                <h2>✏️ 作业管理</h2>
                <button class="close-btn" onclick="closeModal('homework-modal')">&times;</button>
            </div>
            <div class="modal-body">
                <p>完成作业可以巩固知识,但也会消耗精力。拖欠作业会影响老师关系。</p>
                <div id="homework-list" style="margin-bottom: 15px;">
                    <!-- 动态生成 -->
                </div>
                <div class="study-options">
                    <button class="study-btn" onclick="homework('complete-all')">
                        完成所有作业
                        <small>消耗30精力 | 全科+0.5 | 老师关系+3</small>
                    </button>
                    <button class="study-btn" onclick="homework('complete-one')">
                        完成一项作业
                        <small>消耗10精力 | 随机科目+0.3 | 老师关系+1</small>
                    </button>
                    <button class="study-btn danger" onclick="homework('skip')">
                        拖欠作业
                        <small>无消耗 | 老师关系-5 | 压力+5</small>
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- 故事/回忆模态框 -->
    <div class="modal" id="story-modal">
        <div class="modal-content story-modal">
            <div class="modal-header">
                <h2>📖 <span id="story-title">故事事件</span></h2>
                <button class="close-btn" onclick="closeModal('story-modal')">&times;</button>
            </div>
            <div class="modal-body">
                <div class="story-content" id="story-content">
                    <!-- 动态内容 -->
                </div>
                <div class="story-choices" id="story-choices">
                    <!-- 动态选择 -->
                </div>
            </div>
        </div>
    </div>

    <!-- 阶段目标弹窗 -->
    <div class="modal" id="goal-modal">
        <div class="modal-content goal-modal">
            <div class="modal-header">
                <h2>🎯 阶段目标更新</h2>
                <button class="close-btn" onclick="closeModal('goal-modal')">&times;</button>
            </div>
            <div class="modal-body">
                <div class="goal-content" id="goal-content">
                    <!-- 动态生成 -->
                </div>
            </div>
            <div class="modal-footer">
                <button class="donation-btn primary" onclick="closeModal('goal-modal')">明白了</button>
            </div>
        </div>

    </div>

    <!-- 成就详情弹窗 -->
    <div class="modal" id="achievement-modal">
        <div class="modal-content achievement-detail-modal">
            <div class="modal-header">
                <h2>🏆 成就详情</h2>
                <button class="close-btn" onclick="closeModal('achievement-modal')">&times;</button>
            </div>
            <div class="modal-body">
                <div class="achievement-detail-content" id="achievement-detail-content">
                    <!-- 动态生成 -->
                </div>
            </div>
        </div>
    </div>

    <!-- 通知 -->
    <div class="notification" id="notification">
        <div id="notification-text"></div>
    </div>

    <script>
        // ==================== 游戏状态 ====================
        const gameState = {
            // 时间系统
            week: 1,
            dayOfWeek: 0, // 0=周一, 6=周日
            period: 0, // 0=早晨, 1=上午, 2=下午, 3=晚上
            daysLeft: 365,
            vacationDays: 0,
            season: 0, // 0=春, 1=夏, 2=秋, 3=冬

            // 核心状态
            energy: 100,
            stress: 20,
            health: 85,
            mental: 75,
            money: 500,
            anxiety: 10, // 新增焦虑值

            // 学科能力
            subjects: {
                chinese: 10,
                math: 15,
                english: 8,
                physics: 20,
                chemistry: 12,
                biology: 10
            },

            // 人际关系(8个角色)
            relationships: {
                teacher: 50,        // 班主任
                mathTeacher: 50,    // 数学老师
                chineseTeacher: 50, // 语文老师
                englishTeacher: 50, // 英语老师
                classmateA: 50,     // 同学A
                classmateB: 50,     // 同学B
                parents: 50,        // 父母
                crush: 0            // crush
            },

            // 作业系统
            homework: {
                chinese: false,
                math: false,
                english: false,
                physics: false,
                chemistry: false,
                biology: false
            },

            // 课程表(每周)
            schedule: [],

            // 活动记录
            weekActivities: 0,
            totalActivities: 0,

            // 专精系统
            specialization: null, // 'literature', 'science', 'all-rounder'

            // 游戏进度
            events: [], // 已触发的故事事件ID
            achievements: new Set(),
            storyProgress: 0,
            examCount: 0,
            memoryCount: 0,
            perfectWeeks: 0,

            // 统计
            totalStudyHours: 0,
            totalRestHours: 0,
            totalExerciseHours: 0,
            totalSocialHours: 0,

            // 操作限制
            actionsThisWeek: 0,
            maxActionsPerWeek: 3,

            // 阶段目标
            currentGoal: null,
            goalProgress: 0,

            // 游戏状态
            gameOver: false,
            lastAction: null,
            studyStreak: 0,

            // 天气
            weather: '☀️',
            currentWeather: { type: '☀️', name: '晴天', mood: 1, efficiency: 1.1 }
        };

        // ==================== 数据库 ====================

        // 季节系统
        const seasons = [
            { name: '春季', emoji: '🌸', mood: 1, events: ['开学', '春游', '期中考试'] },
            { name: '夏季', emoji: '☀️', mood: 0, events: ['期末考试', '暑假', '毕业'] },
            { name: '秋季', emoji: '🍂', mood: -1, events: ['开学', '运动会', '期中考试'] },
            { name: '冬季', emoji: '❄️', mood: -2, events: ['期末考试', '寒假', '春节'] }
        ];

        // 天气系统
        const weathers = [
            { type: '☀️', name: '晴天', mood: 1, efficiency: 1.1 },
            { type: '☁️', name: '阴天', mood: 0, efficiency: 1.0 },
            { type: '🌧️', name: '雨天', mood: -1, efficiency: 0.9 },
            { type: '⛈️', name: '雷雨', mood: -2, efficiency: 0.8 },
            //{ type: '❄️', name: '雪天', mood: -1, efficiency: 0.85 },
            { type: '🌫️', name: '雾霾', mood: -1, efficiency: 0.85 }
        ];

        // 假期系统
        const holidays = {
            1: { name: '国庆', days: 7, week: 1, effect: { stress: -10 } },
            2: { name: '元旦', days: 3, week: 20, effect: { stress: -5 } },
            3: { name: '寒假', days: 21, week: 25, effect: { stress: -20, health: 5 } },
            4: { name: '春节', days: 7, week: 26, effect: { parents: 10, stress: -15 } },
            5: { name: '清明', days: 3, week: 35, effect: { mental: 5 } },
            6: { name: '五一', days: 5, week: 40, effect: { stress: -8 } },
            7: { name: '端午', days: 3, week: 45, effect: { stress: -5 } }
        };

        // 阶段目标系统
        const stageGoals = {
            5: {
                title: "适应期目标(第5周)",
                desc: "全科平均达到20分,压力低于40,健康保持80以上",
                check: (s) => {
                    const avg = Object.values(s.subjects).reduce((a, b) => a + b, 0) / 6;
                    return avg >= 20 && s.stress < 40 && s.health >= 80;
                },
                reward: { energy: 10, stress: -5 }
            },
            10: {
                title: "提升期目标(第10周)",
                desc: "至少两科达到40分,与老师关系良好(>60),经济状况正常(>300元)",
                check: (s) => {
                    const highCount = Object.values(s.subjects).filter(v => v >= 40).length;
                    return highCount >= 2 && s.relationships.teacher >= 60 && s.money >= 300;
                },
                reward: { mental: 5, money: 100 }
            },
            15: {
                title: "稳定期目标(第15周)",
                desc: "全科平均达到50分,压力低于30,完成至少5次作业",
                check: (s) => {
                    const avg = Object.values(s.subjects).reduce((a, b) => a + b, 0) / 6;
                    const homeworkCount = Object.values(s.homework).filter(v => v).length;
                    return avg >= 50 && s.stress < 30 && homeworkCount >= 5;
                },
                reward: { health: 5, stress: -10 }
            },
            25: {
                title: "冲刺期目标(第25周)",
                desc: "全科平均达到65分,至少一科达到70分,crush关系>30",
                check: (s) => {
                    const avg = Object.values(s.subjects).reduce((a, b) => a + b, 0) / 6;
                    const has70 = Object.values(s.subjects).some(v => v >= 70);
                    return avg >= 65 && has70 && s.relationships.crush >= 30;
                },
                reward: { energy: 15, mental: 10 }
            },
            35: {
                title: "决战期目标(第35周)",
                desc: "全科平均达到75分,心理值>70,完成至少3次模考",
                check: (s) => {
                    const avg = Object.values(s.subjects).reduce((a, b) => a + b, 0) / 6;
                    return avg >= 75 && s.mental > 70 && s.examCount >= 3;
                },
                reward: { stress: -15, health: 10 }
            },
            45: {
                title: "最终目标(第45周)",
                desc: "全科平均达到85分,所有关系>60,压力<20",
                check: (s) => {
                    const avg = Object.values(s.subjects).reduce((a, b) => a + b, 0) / 6;
                    const allRel = Object.values(s.relationships).every(v => v >= 60);
                    return avg >= 85 && allRel && s.stress < 20;
                },
                reward: { energy: 20, mental: 15 }
            }
        };

        // 随机事件库
        const randomEvents = {
            // -------------------- 学习类事件(60项) --------------------
            study: [
                // 正面事件(20项)
                {
                    text: "在旧书店淘到绝版教辅,如获至宝",
                    type: "good",
                    weight: 8,
                    condition: s => s.money > 50 && s.week > 5,
                    effect: {
                        money: -80,
                        math: 2,
                        physics: 1
                    }
                },

                {
                    text: "数学压轴题突然开窍,竞赛思维派上用场",
                    type: "good",
                    weight: 10,
                    condition: s => s.subjects.math > 40,
                    effect: {
                        math: 3,
                        stress: -3
                    }
                },

                {
                    text: "英语阅读理解全对,找到语感",
                    type: "good",
                    weight: 10,
                    condition: s => s.subjects.english < 60,
                    effect: {
                        english: 2,
                        mental: 3
                    }
                },

                {
                    text: "生物遗传题画出完美系谱图,被老师当范本",
                    type: "good",
                    weight: 8,
                    condition: s => s.subjects.biology > 30,
                    effect: {
                        biology: 2,
                        teacher: 3
                    }
                },

                {
                    text: "化学方程式配平速度突破,找到窍门",
                    type: "good",
                    weight: 9,
                    condition: s => s.subjects.chemistry > 25,
                    effect: {
                        chemistry: 2,
                        energy: 5
                    }
                },

                {
                    text: "语文作文被年级组传阅,文采斐然",
                    type: "good",
                    weight: 7,
                    condition: s => s.subjects.chinese > 50,
                    effect: {
                        chinese: 3,
                        chineseTeacher: 5
                    }
                },

                {
                    text: "用物理竞赛的矢量分析法解高考题,又快又准",
                    type: "good",
                    weight: 9,
                    condition: s => s.subjects.physics > 60,
                    effect: {
                        physics: 2,
                        stress: -2
                    }
                },

                {
                    text: "发现番茄工作法适合自己,效率倍增",
                    type: "good",
                    weight: 10,
                    condition: s => s.week > 3,
                    effect: { energy: 10 }
                },

                {
                    text: "制定了完美的错题整理系统,复习效果拔群",
                    type: "good",
                    weight: 8,
                    condition: s => s.week > 10,
                    effect: { mental: 3 }
                },

                {
                    text: "发现一款高效的背单词APP,词汇量暴涨",
                    type: "good",
                    weight: 9,
                    condition: s => s.subjects.english < 50,
                    effect: {
                        english: 3,
                        money: -30
                    }
                },

                {
                    text: "和同桌结成学习小组,互相讲题进步飞快",
                    type: "good",
                    weight: 10,
                    condition: s => s.relationships.classmateA > 40,
                    effect: {
                        math: 1,
                        physics: 1,
                        classmateA: 3
                    }
                },

                {
                    text: "周测进步20名,班主任在班会上点名表扬",
                    type: "good",
                    weight: 6,
                    condition: s => s.week > 5,
                    effect: {
                        stress: -5,
                        teacher: 5,
                        mental: 5
                    }
                },

                {
                    text: "深夜刷题时突然进入心流状态,酣畅淋漓",
                    type: "good",
                    weight: 8,
                    condition: s => s.energy < 30,
                    effect: {
                        math: 2,
                        physics: 2,
                        energy: -10
                    }
                },

                {
                    text: "发现数学和物理的共通性,建立知识体系",
                    type: "good",
                    weight: 7,
                    condition: s => s.subjects.math > 50 && s.subjects.physics > 50,
                    effect: {
                        math: 1.5,
                        physics: 1.5,
                        mental: 3
                    }
                },

                {
                    text: "发现白噪音能提升专注力,学习效率提升",
                    type: "good",
                    weight: 10,
                    condition: s => s.mental > 40,
                    effect: {
                        energy: 5,
                        anxiety: -2
                    }
                },

                {
                    text: "练字时顿悟语文答题套路,字迹和思路都变清晰",
                    type: "good",
                    weight: 8,
                    condition: s => s.subjects.chinese < 70,
                    effect: {
                        chinese: 2,
                        mental: 2
                    }
                },

                {
                    text: "整理笔记时发现知识盲点,及时补救",
                    type: "good",
                    weight: 10,
                    condition: s => s.week > 8,
                    effect: { stress: -2 }
                },

                {
                    text: "图书馆占到最后一个安静角落,学习效率极高",
                    type: "good",
                    weight: 9,
                    condition: s => s.week > 2,
                    effect: { energy: 5 }
                },

                {
                    text: "营养跟上后记忆力明显提升,背单词变快",
                    type: "good",
                    weight: 7,
                    condition: s => s.health > 70,
                    effect: {
                        english: 2,
                        biology: 1
                    }
                },

                {
                    text: "向学霸请教后掌握高级解题技巧",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.classmateA > 60,
                    effect: {
                        math: 2,
                        classmateA: 2
                    }
                },


                // 负面事件(25项)
                {
                    text: "遇到瓶颈期,无论怎么学分数都不涨",
                    type: "bad",
                    weight: 10,
                    condition: s => s.week > 15 && s.week < 40,
                    effect: {
                        stress: 8,
                        anxiety: 5,
                        mental: -3
                    }
                },

                {
                    text: "数学压轴题看答案都看不懂,挫败感强烈",
                    type: "bad",
                    weight: 10,
                    condition: s => s.subjects.math > 60,
                    effect: {
                        stress: 10,
                        anxiety: 8,
                        math: -1
                    }
                },

                {
                    text: "熬夜学习导致白天上课昏睡,错过重点",
                    type: "bad",
                    weight: 12,
                    condition: s => s.energy < 30,
                    effect: {
                        energy: -10,
                        health: -3
                    }
                },

                {
                    text: "控制不住刷手机,本来只想查资料却刷了半小时短视频",
                    type: "bad",
                    weight: 15,
                    condition: s => s.mental < 70,
                    effect: {
                        stress: 5,
                        anxiety: 3,
                        energy: -5
                    }
                },

                {
                    text: "考试焦虑症发作,模拟考时大脑一片空白",
                    type: "bad",
                    weight: 8,
                    condition: s => s.anxiety > 50 && s.examCount > 0,
                    effect: {
                        mental: -5,
                        stress: 10
                    }
                },

                {
                    text: "长时间低头颈椎痛,影响学习状态",
                    type: "bad",
                    weight: 9,
                    condition: s => s.totalStudyHours > 50 && s.health < 60,
                    effect: {
                        health: -5,
                        energy: -5
                    }
                },

                {
                    text: "偏科严重,弱势科目拖后腿严重",
                    type: "bad",
                    weight: 10,
                    condition: s => {
                        const vals = Object.values(s.subjects);
                        return Math.max(...vals) - Math.min(...vals) > 40;
                    },
                    effect: {
                        stress: 7,
                        anxiety: 5
                    }
                },

                {
                    text: "语文作文跑题,分数惨不忍睹",
                    type: "bad",
                    weight: 8,
                    condition: s => s.subjects.chinese > 40,
                    effect: {
                        chinese: -2,
                        chineseTeacher: -3,
                        stress: 5
                    }
                },

                {
                    text: "计算粗心导致整道题错误,后悔不已",
                    type: "bad",
                    weight: 11,
                    condition: s => s.stress > 40,
                    effect: {
                        stress: 3,
                        anxiety: 2,
                        mental: -2
                    }
                },

                {
                    text: "近视度数加深,看不清黑板,必须换眼镜",
                    type: "bad",
                    weight: 7,
                    condition: s => s.totalStudyHours > 80,
                    effect: {
                        money: -300,
                        health: -3,
                        stress: 3
                    }
                },

                {
                    text: "背单词背到恶心,产生生理性抗拒",
                    type: "bad",
                    weight: 8,
                    condition: s => s.subjects.english < 40 && s.week > 10,
                    effect: {
                        english: -1,
                        stress: 5,
                        mental: -3
                    }
                },

                {
                    text: "化学方程式总是记混,越背越乱",
                    type: "bad",
                    weight: 8,
                    condition: s => s.subjects.chemistry < 50,
                    effect: {
                        chemistry: -1,
                        anxiety: 4
                    }
                },

                {
                    text: "生物遗传概率算错,怀疑自己的智商",
                    type: "bad",
                    weight: 8,
                    condition: s => s.subjects.biology < 45,
                    effect: {
                        biology: -1,
                        mental: -4,
                        stress: 3
                    }
                },

                {
                    text: "成绩波动大,上次考好这次考砸,心态崩了",
                    type: "bad",
                    weight: 9,
                    condition: s => s.examCount >= 2,
                    effect: {
                        anxiety: 8,
                        mental: -5,
                        stress: 6
                    }
                },

                {
                    text: "上课走神被老师点名,尴尬得想钻地缝",
                    type: "bad",
                    weight: 10,
                    condition: s => s.energy < 40,
                    effect: {
                        teacher: -3,
                        stress: 5,
                        energy: -3
                    }
                },

                {
                    text: "作业太多写不完,只能抄答案应付",
                    type: "bad",
                    weight: 9,
                    condition: s => s.stress > 60,
                    effect: {
                        teacher: -5,
                        mental: -3,
                        stress: 2
                    }
                },

                {
                    text: "感觉大脑饱和,再也塞不进新知识",
                    type: "bad",
                    weight: 8,
                    condition: s => s.totalStudyHours > 100,
                    effect: {
                        mental: -5,
                        energy: -8
                    }
                },

                {
                    text: "努力很久但排名没提升,怀疑努力的意义",
                    type: "bad",
                    weight: 9,
                    condition: s => s.week > 20 && s.stress > 50,
                    effect: {
                        mental: -6,
                        anxiety: 6,
                        stress: 4
                    }
                },

                {
                    text: "教辅资料买错版本,内容不匹配浪费钱",
                    type: "bad",
                    weight: 6,
                    condition: s => s.money > 100,
                    effect: {
                        money: -100,
                        stress: 3
                    }
                },

                {
                    text: "耳机坏了,无法在嘈杂环境学习",
                    type: "bad",
                    weight: 7,
                    condition: s => s.money > 50,
                    effect: {
                        money: -80,
                        mental: -2
                    }
                },

                {
                    text: "季节性过敏,头晕脑胀无法集中",
                    type: "bad",
                    weight: 6,
                    condition: s => s.season === 1 || s.season === 3,
                    effect: {
                        health: -5,
                        energy: -5
                    }
                },

                {
                    text: "发现之前学的知识全忘了,白学一场",
                    type: "bad",
                    weight: 7,
                    condition: s => s.week > 30,
                    effect: {
                        stress: 8,
                        anxiety: 5,
                        mental: -4
                    }
                },

                {
                    text: "遇到竞赛级别的超纲题,打击自信心",
                    type: "bad",
                    weight: 8,
                    condition: s => s.subjects.math > 75,
                    effect: {
                        stress: 6,
                        anxiety: 4,
                        math: -0.5
                    }
                },

                {
                    text: "午睡睡过头,错过重要课程",
                    type: "bad",
                    weight: 7,
                    condition: s => s.energy < 50,
                    effect: {
                        teacher: -4,
                        stress: 4
                    }
                },

                {
                    text: "咖啡喝太多心悸,无法专注",
                    type: "bad",
                    weight: 7,
                    condition: s => s.energy < 30,
                    effect: {
                        health: -3,
                        anxiety: 4,
                        energy: -5
                    }
                },


                // 中性事件(15项)
                {
                    text: "尝试新的学习方法,效果尚待观察",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.week > 5,
                    effect: {
                        mental: 2,
                        energy: -2
                    }
                },

                {
                    text: "整理书架,发现很多买了没做的题",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.money < 500,
                    effect: { stress: 2 }
                },

                {
                    text: "思考高考后的人生规划,短暂走神",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.week > 30,
                    effect: {
                        mental: 3,
                        anxiety: -2,
                        energy: -3
                    }
                },

                {
                    text: "换了个新书包,心情稍微变好",
                    type: "neutral",
                    weight: 6,
                    condition: s => s.money > 100,
                    effect: {
                        money: -120,
                        mental: 2
                    }
                },

                {
                    text: "笔记从纸质转为电子,适应期中",
                    type: "neutral",
                    weight: 7,
                    condition: s => s.week > 10,
                    effect: {
                        energy: -3,
                        mental: 1
                    }
                },

                {
                    text: "戒掉了咖啡,改喝浓茶,口味变了",
                    type: "neutral",
                    weight: 8,
                    condition: s => s.health < 70,
                    effect: {
                        health: 2,
                        energy: -2
                    }
                },

                {
                    text: "换了新的学习BGM列表,新鲜感",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.mental > 40,
                    effect: { mental: 1 }
                },

                {
                    text: "开始用计时器记录学习时长,仪式感",
                    type: "neutral",
                    weight: 9,
                    condition: s => s.week > 8,
                    effect: {
                        stress: 1,
                        mental: 2
                    }
                },

                {
                    text: "把课本从头到尾翻了一遍,建立框架",
                    type: "neutral",
                    weight: 8,
                    condition: s => s.week < 20,
                    effect: { energy: -5 }
                },

                {
                    text: "大扫除学习环境,清理书桌",
                    type: "neutral",
                    weight: 9,
                    condition: s => s.stress > 40,
                    effect: {
                        stress: -2,
                        energy: -3
                    }
                },

                {
                    text: "和同学交换笔记,互相参考",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.relationships.classmateA > 30,
                    effect: {
                        classmateA: 2,
                        mental: 1
                    }
                },

                {
                    text: "删除了所有游戏,断舍离",
                    type: "neutral",
                    weight: 7,
                    condition: s => s.mental < 60,
                    effect: {
                        mental: 5,
                        stress: 3
                    }
                },

                {
                    text: "根据天气调整学习计划,灵活应变",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.week > 6,
                    effect: { energy: 2 }
                },

                {
                    text: "开始用不同颜色笔标注重点,视觉化",
                    type: "neutral",
                    weight: 8,
                    condition: s => s.money > 30,
                    effect: {
                        money: -30,
                        mental: 2
                    }
                },

                {
                    text: "调整学习计划,放弃完美主义",
                    type: "neutral",
                    weight: 9,
                    condition: s => s.stress > 60,
                    effect: {
                        stress: -3,
                        anxiety: -2
                    }
                }
            ],


            // -------------------- 关系类事件(60项) --------------------
            relationship: [
                // 班主任相关(10项)
                {
                    text: "班主任课间找你谈话,鼓励你保持节奏",
                    type: "good",
                    weight: 10,
                    condition: s => s.relationships.teacher > 40,
                    effect: {
                        teacher: 5,
                        stress: -3,
                        mental: 3
                    }
                },

                {
                    text: "班主任让你负责班级学习资料整理,信任你",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.teacher > 60,
                    effect: {
                        teacher: 3,
                        energy: -3,
                        mental: 2
                    }
                },

                {
                    text: "班主任在家长会上表扬你的进步",
                    type: "good",
                    weight: 7,
                    condition: s => s.week > 10,
                    effect: {
                        teacher: 5,
                        parents: 5,
                        stress: -2
                    }
                },

                {
                    text: "班主任建议你参加强基计划,看好你",
                    type: "good",
                    weight: 6,
                    condition: s => s.subjects.physics > 80 || s.subjects.math > 80,
                    effect: {
                        teacher: 4,
                        anxiety: 3,
                        stress: 2
                    }
                },

                {
                    text: "上课走神被老师点名,尴尬得想钻地缝",
                    type: "bad",
                    weight: 8,
                    condition: s => s.energy < 40,
                    effect: {
                        teacher: -5,
                        stress: 5,
                        mental: -3
                    }
                },

                {
                    text: "成绩下滑被班主任叫去办公室谈话,压力大",
                    type: "bad",
                    weight: 9,
                    condition: s => s.stress > 60,
                    effect: {
                        teacher: -3,
                        anxiety: 5,
                        stress: 4
                    }
                },

                {
                    text: "迟到被班主任抓到,印象分降低",
                    type: "bad",
                    weight: 7,
                    condition: s => s.energy < 30,
                    effect: {
                        teacher: -4,
                        stress: 3
                    }
                },

                {
                    text: "班主任调解你和同学的矛盾,公正处理",
                    type: "neutral",
                    weight: 6,
                    condition: s => s.relationships.classmateA < 30,
                    effect: {
                        teacher: 2,
                        classmateA: 3
                    }
                },

                {
                    text: "班主任的期望让你感到压力山大",
                    type: "bad",
                    weight: 8,
                    condition: s => s.relationships.teacher > 70,
                    effect: {
                        stress: 4,
                        anxiety: 3
                    }
                },

                {
                    text: "班主任分享高考经验,你受益匪浅",
                    type: "good",
                    weight: 9,
                    condition: s => s.week > 40,
                    effect: {
                        mental: 3,
                        anxiety: -3
                    }
                },


                // 科任老师(15项)
                {
                    text: "数学老师赞赏你的解题思路,虽然和标准答案不同",
                    type: "good",
                    weight: 9,
                    condition: s => s.subjects.math > 50,
                    effect: {
                        mathTeacher: 5,
                        math: 1,
                        mental: 2
                    }
                },

                {
                    text: "语文老师发现你的作文有深度,面批指导",
                    type: "good",
                    weight: 8,
                    condition: s => s.subjects.chinese > 40,
                    effect: {
                        chineseTeacher: 5,
                        chinese: 2
                    }
                },

                {
                    text: "物理老师借给你竞赛难度的拓展题,器重你",
                    type: "good",
                    weight: 7,
                    condition: s => s.subjects.physics > 60,
                    effect: {
                        physics: 2,
                        stress: 2
                    }
                },

                {
                    text: "化学老师注意到你实验报告写得认真,鼓励你",
                    type: "good",
                    weight: 8,
                    condition: s => s.subjects.chemistry > 30,
                    effect: { chemistry: 1 }
                },

                {
                    text: "英语老师给你推荐英文原著,提升语感",
                    type: "good",
                    weight: 8,
                    condition: s => s.subjects.english > 30,
                    effect: {
                        englishTeacher: 4,
                        english: 1,
                        money: -50
                    }
                },

                {
                    text: "上课走神没回答出提问,老师失望地摇头",
                    type: "bad",
                    weight: 10,
                    condition: s => s.energy < 50,
                    effect: {
                        teacher: -2,
                        stress: 3
                    }
                },

                {
                    text: "数学老师发现你作业是抄的,严厉批评",
                    type: "bad",
                    weight: 6,
                    condition: s => s.stress > 70,
                    effect: {
                        mathTeacher: -6,
                        stress: 8,
                        anxiety: 4
                    }
                },

                {
                    text: "作文跑题被语文老师念出来当反面教材",
                    type: "bad",
                    weight: 7,
                    condition: s => s.subjects.chinese < 50,
                    effect: {
                        chineseTeacher: -5,
                        mental: -5,
                        stress: 5
                    }
                },

                {
                    text: "化学实验操作失误,被老师警告",
                    type: "bad",
                    weight: 6,
                    condition: s => s.subjects.chemistry < 40,
                    effect: { stress: 3 }
                },

                {
                    text: "向老师请教问题,获得耐心解答",
                    type: "good",
                    weight: 12,
                    condition: s => s.relationships.teacher > 30,
                    effect: { teacher: 2 }
                },

                {
                    text: "老师分享高考经验,你受益匪浅",
                    type: "good",
                    weight: 9,
                    condition: s => s.week > 40,
                    effect: {
                        mental: 3,
                        anxiety: -3
                    }
                },

                {
                    text: "被质疑'AFO选手文化课不行',老师护短",
                    type: "good",
                    weight: 6,
                    condition: s => s.relationships.teacher > 50,
                    effect: {
                        teacher: 3,
                        mental: 3,
                        stress: -2
                    }
                },

                {
                    text: "老师借给你珍贵的内部资料",
                    type: "good",
                    weight: 7,
                    condition: s => s.relationships.mathTeacher > 60,
                    effect: {
                        math: 2,
                        mathTeacher: 2
                    }
                },

                {
                    text: "发现英语老师也追星,有了共同话题",
                    type: "good",
                    weight: 6,
                    condition: s => s.relationships.englishTeacher > 40,
                    effect: {
                        englishTeacher: 4,
                        mental: 2
                    }
                },

                {
                    text: "物理老师和你就某道题争论,亦师亦友",
                    type: "good",
                    weight: 7,
                    condition: s => s.subjects.physics > 70,
                    effect: { physics: 1 }
                },


                // 同学A/B(15项)
                {
                    text: "同桌分享他的独家笔记,非常详细",
                    type: "good",
                    weight: 10,
                    condition: s => s.relationships.classmateA > 50,
                    effect: { classmateA: 3 }
                },

                {
                    text: "同学B中午帮你带饭,节省排队时间学习",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.classmateB > 40,
                    effect: {
                        classmateB: 3,
                        energy: 5,
                        money: -15
                    }
                },

                {
                    text: "和同学A组成学习小组,互补短板",
                    type: "good",
                    weight: 9,
                    condition: s => s.relationships.classmateA > 30,
                    effect: {
                        classmateA: 4,
                        english: 1,
                        math: 1
                    }
                },

                {
                    text: "同学B生日邀请你,增进友谊",
                    type: "good",
                    weight: 7,
                    condition: s => s.relationships.classmateB > 30,
                    effect: {
                        classmateB: 5,
                        mental: 3,
                        money: -50
                    }
                },

                {
                    text: "你帮同学A讲题,教学相长",
                    type: "good",
                    weight: 10,
                    condition: s => s.subjects.math > 60,
                    effect: {
                        classmateA: 3,
                        math: 1,
                        mental: 2
                    }
                },

                {
                    text: "和同学A因学习方法争执,冷战一周",
                    type: "bad",
                    weight: 7,
                    condition: s => s.stress > 60,
                    effect: {
                        classmateA: -8,
                        stress: 5,
                        mental: -3
                    }
                },

                {
                    text: "同学B背后说你'AFO还装学霸',关系破裂",
                    type: "bad",
                    weight: 6,
                    condition: s => s.relationships.classmateB < 50 && s.subjects.math > 70,
                    effect: {
                        classmateB: -10,
                        mental: -5,
                        anxiety: 5
                    }
                },

                {
                    text: "同学A问你问题但你也不会,尴尬",
                    type: "neutral",
                    weight: 8,
                    condition: s => s.subjects.math < 60,
                    effect: {
                        classmateA: -2,
                        stress: 2
                    }
                },

                {
                    text: "借给同学B笔记,但他弄丢了",
                    type: "bad",
                    weight: 6,
                    condition: s => s.relationships.classmateB > 20,
                    effect: {
                        classmateB: -3,
                        stress: 3
                    }
                },

                {
                    text: "和同学A和解,关系更进一步",
                    type: "good",
                    weight: 7,
                    condition: s => s.relationships.classmateA < 40,
                    effect: {
                        classmateA: 8,
                        mental: 4
                    }
                },

                {
                    text: "被同学B拉去打游戏,耽误学习时间",
                    type: "bad",
                    weight: 8,
                    condition: s => s.mental < 60,
                    effect: {
                        energy: -5,
                        stress: 3,
                        classmateB: 2
                    }
                },

                {
                    text: "发现同学A也在偷偷刷竞赛题,志同道合",
                    type: "good",
                    weight: 5,
                    condition: s => s.memoryCount > 0,
                    effect: {
                        classmateA: 5,
                        mental: 3
                    }
                },

                {
                    text: "同学B总是借东西不还,有点烦",
                    type: "neutral",
                    weight: 7,
                    condition: s => s.relationships.classmateB > 30,
                    effect: {
                        classmateB: -2,
                        stress: 2
                    }
                },

                {
                    text: "和同学A一起跑步锻炼,友谊升温",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.classmateA > 40,
                    effect: {
                        classmateA: 3,
                        health: 3,
                        energy: 5
                    }
                },

                {
                    text: "同学B分享小道消息(考试范围),真假未知",
                    type: "neutral",
                    weight: 6,
                    condition: s => s.relationships.classmateB > 50,
                    effect: {
                        anxiety: 2,
                        stress: -2
                    }
                },


                // 父母(10项)
                {
                    text: "母亲炖了鸡汤给你补身体,暖暖的",
                    type: "good",
                    weight: 10,
                    condition: s => s.health < 80,
                    effect: {
                        health: 5,
                        parents: 3,
                        stress: -2
                    }
                },

                {
                    text: "父亲悄悄塞给你零花钱,让你买资料",
                    type: "good",
                    weight: 8,
                    condition: s => s.money < 200,
                    effect: {
                        money: 200,
                        parents: 4
                    }
                },

                {
                    text: "父母周末带你去公园散心,不谈学习",
                    type: "good",
                    weight: 7,
                    condition: s => s.stress > 60,
                    effect: {
                        stress: -8,
                        mental: 5,
                        parents: 3
                    }
                },

                {
                    text: "和父母深入交流,他们理解了AFO的痛苦",
                    type: "good",
                    weight: 6,
                    condition: s => s.relationships.parents > 50 && s.memoryCount > 2,
                    effect: {
                        parents: 5,
                        mental: 5,
                        anxiety: -5
                    }
                },

                {
                    text: "父母为你创造了安静的学习环境,很感动",
                    type: "good",
                    weight: 9,
                    condition: s => s.week > 5,
                    effect: {
                        parents: 3,
                        mental: 2,
                        energy: 3
                    }
                },

                {
                    text: "父亲拿你和'别人家的孩子'比较,争吵",
                    type: "bad",
                    weight: 10,
                    condition: s => s.relationships.parents < 60,
                    effect: {
                        parents: -5,
                        stress: 8,
                        anxiety: 5
                    }
                },

                {
                    text: "成绩下滑被父母发现,家庭气氛紧张",
                    type: "bad",
                    weight: 9,
                    condition: s => s.stress > 70,
                    effect: {
                        parents: -4,
                        stress: 6,
                        mental: -3
                    }
                },

                {
                    text: "家里经济紧张,你不敢要钱买资料",
                    type: "bad",
                    weight: 7,
                    condition: s => s.money < 100,
                    effect: {
                        stress: 5,
                        anxiety: 4,
                        parents: -2
                    }
                },

                {
                    text: "父母过度关心给你压力,'考不上怎么办'",
                    type: "bad",
                    weight: 8,
                    condition: s => s.week > 40,
                    effect: {
                        anxiety: 6,
                        stress: 5,
                        parents: -1
                    }
                },

                {
                    text: "和父母达成约定:你努力学习,他们不过度干涉",
                    type: "good",
                    weight: 6,
                    condition: s => s.relationships.parents > 40,
                    effect: {
                        parents: 4,
                        stress: -3,
                        mental: 3
                    }
                },


                // Crush(10项)
                {
                    text: "她主动问你数学题,近距离接触心跳加速",
                    type: "good",
                    weight: 10,
                    condition: s => s.relationships.crush > 20 && s.subjects.math > 50,
                    effect: {
                        crush: 5,
                        math: 1,
                        mental: 2
                    }
                },

                {
                    text: "收到她的鼓励纸条,动力满满",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.crush > 40,
                    effect: {
                        crush: 3,
                        energy: 10,
                        stress: -3
                    }
                },

                {
                    text: "放学路上偶遇,一起走了一段",
                    type: "good",
                    weight: 9,
                    condition: s => s.relationships.crush > 30,
                    effect: {
                        crush: 4,
                        mental: 3,
                        stress: -2
                    }
                },

                {
                    text: "送她生日礼物,她很开心",
                    type: "good",
                    weight: 7,
                    condition: s => s.money > 100 && s.relationships.crush > 50,
                    effect: {
                        crush: 6,
                        money: -100,
                        mental: 4
                    }
                },

                {
                    text: "和她约定考同一所大学,共同目标",
                    type: "good",
                    weight: 6,
                    condition: s => s.relationships.crush > 60 && s.week > 30,
                    effect: {
                        crush: 5,
                        stress: 3,
                        energy: 5
                    }
                },

                {
                    text: "看到她和其他男生说话,吃醋分心",
                    type: "bad",
                    weight: 9,
                    condition: s => s.relationships.crush > 40 && s.mental < 70,
                    effect: {
                        stress: 5,
                        anxiety: 4,
                        mental: -3
                    }
                },

                {
                    text: "表白被婉拒,心情跌入谷底",
                    type: "bad",
                    weight: 5,
                    condition: s => s.relationships.crush > 70,
                    effect: {
                        crush: -20,
                        mental: -10,
                        stress: 10,
                        energy: -10
                    }
                },

                {
                    text: "在她面前出丑(摔倒/说错话),尴尬",
                    type: "bad",
                    weight: 8,
                    condition: s => s.relationships.crush > 30,
                    effect: {
                        crush: -3,
                        stress: 4,
                        mental: -2
                    }
                },

                {
                    text: "暗恋被发现,同学起哄,她避而不见",
                    type: "bad",
                    weight: 6,
                    condition: s => s.relationships.crush > 50,
                    effect: {
                        crush: -5,
                        stress: 6,
                        anxiety: 5
                    }
                },

                {
                    text: "为她分心导致成绩下滑,恶性循环",
                    type: "bad",
                    weight: 7,
                    condition: s => s.relationships.crush > 60 && s.stress > 50,
                    effect: {
                        math: -1,
                        stress: 3,
                        anxiety: 3
                    }
                }
            ],


            // -------------------- 健康类事件(60项) --------------------
            health: [
                // 正面(20项)
                {
                    text: "晨跑发现体力变好,神清气爽",
                    type: "good",
                    weight: 10,
                    condition: s => s.totalExerciseHours > 10,
                    effect: {
                        health: 3,
                        energy: 5,
                        stress: -2
                    }
                },

                {
                    text: "坚持吃健康餐,肠胃负担减轻",
                    type: "good",
                    weight: 9,
                    condition: s => s.money > 100,
                    effect: {
                        health: 4,
                        money: -50,
                        mental: 2
                    }
                },

                {
                    text: "调整了作息,早睡早起精神好",
                    type: "good",
                    weight: 10,
                    condition: s => s.energy > 60,
                    effect: {
                        health: 3,
                        energy: 8,
                        mental: 2
                    }
                },

                {
                    text: "做眼保健操,视力疲劳缓解",
                    type: "good",
                    weight: 11,
                    condition: s => s.totalStudyHours > 30,
                    effect: {
                        health: 2,
                        energy: 2
                    }
                },

                {
                    text: "戒掉了碳酸饮料,改喝白开水",
                    type: "good",
                    weight: 8,
                    condition: s => s.health < 80,
                    effect: {
                        health: 3,
                        money: -10
                    }
                },

                {
                    text: "母亲做的蔬菜多吃,营养均衡",
                    type: "good",
                    weight: 9,
                    condition: s => s.relationships.parents > 40,
                    effect: {
                        health: 2,
                        parents: 1
                    }
                },

                {
                    text: "体育课打羽毛球,运动快乐",
                    type: "good",
                    weight: 10,
                    condition: s => s.energy > 40,
                    effect: {
                        health: 2,
                        energy: 3,
                        stress: -3
                    }
                },

                {
                    text: "午休质量高,下午不犯困",
                    type: "good",
                    weight: 10,
                    condition: s => s.stress < 60,
                    effect: {
                        energy: 10,
                        health: 1
                    }
                },

                {
                    text: "晴天晒被子,睡眠环境变好",
                    type: "good",
                    weight: 7,
                    condition: s => s.currentWeather.type === 'sun',
                    effect: {
                        health: 2,
                        energy: 3
                    }
                },

                {
                    text: "注意保暖,成功躲过流感",
                    type: "good",
                    weight: 8,
                    condition: s => s.season === 3,
                    effect: { health: 3 }
                },

                {
                    text: "及时补充维生素,免疫力提升",
                    type: "good",
                    weight: 7,
                    condition: s => s.money > 50,
                    effect: {
                        health: 3,
                        money: -40
                    }
                },

                {
                    text: "课间走动,不一直坐着,腰背舒服",
                    type: "good",
                    weight: 12,
                    condition: s => s.health < 90,
                    effect: {
                        health: 1,
                        energy: 2
                    }
                },

                {
                    text: "尝试冥想,睡眠质量提升",
                    type: "good",
                    weight: 8,
                    condition: s => s.mental > 50,
                    effect: {
                        health: 2,
                        mental: 3,
                        anxiety: -3
                    }
                },

                {
                    text: "周末游泳,全身放松",
                    type: "good",
                    weight: 6,
                    condition: s => s.money > 80 && s.week > 10,
                    effect: {
                        health: 4,
                        stress: -5,
                        money: -60
                    }
                },

                {
                    text: "难得深度睡眠,醒来充满活力",
                    type: "good",
                    weight: 9,
                    condition: s => s.anxiety < 40,
                    effect: {
                        energy: 15,
                        health: 2
                    }
                },

                {
                    text: "发现午休20分钟刚刚好,不昏沉",
                    type: "good",
                    weight: 10,
                    condition: s => s.energy < 60,
                    effect: {
                        energy: 8,
                        health: 1
                    }
                },

                {
                    text: "戒掉了熬夜,皮肤变好",
                    type: "good",
                    weight: 8,
                    condition: s => s.health > 70,
                    effect: {
                        health: 2,
                        mental: 2
                    }
                },

                {
                    text: "体育课认真运动,体质增强",
                    type: "good",
                    weight: 9,
                    condition: s => s.energy > 50,
                    effect: {
                        health: 3,
                        energy: 2
                    }
                },

                {
                    text: "注意用眼卫生,视力稳定",
                    type: "good",
                    weight: 10,
                    condition: s => s.totalStudyHours > 60,
                    effect: { health: 1 }
                },

                {
                    text: "喝足够的水,代谢正常",
                    type: "good",
                    weight: 10,
                    condition: s => s.health < 85,
                    effect: { health: 1 }
                },


                // 负面(25项)
                {
                    text: "换季感冒,头晕脑胀无法学习",
                    type: "bad",
                    weight: 10,
                    condition: s => s.health < 70 && (s.season === 1 || s.season === 3),
                    effect: {
                        health: -8,
                        energy: -10
                    }
                },

                {
                    text: "发烧了,不得不请假休息一天",
                    type: "bad",
                    weight: 7,
                    condition: s => s.health < 60,
                    effect: {
                        health: -5,
                        energy: -15,
                        stress: 5
                    }
                },

                {
                    text: "眼睛干涩疼痛,可能干眼症",
                    type: "bad",
                    weight: 11,
                    condition: s => s.totalStudyHours > 60,
                    effect: {
                        health: -4,
                        energy: -3
                    }
                },

                {
                    text: "偏头痛发作,无法集中注意力",
                    type: "bad",
                    weight: 9,
                    condition: s => s.stress > 70,
                    effect: {
                        health: -5,
                        mental: -3,
                        energy: -5
                    }
                },

                {
                    text: "牙疼不是病,疼起来要人命",
                    type: "bad",
                    weight: 6,
                    condition: s => s.health < 75,
                    effect: {
                        health: -3,
                        stress: 5,
                        money: -200
                    }
                },

                {
                    text: "低血糖晕倒,被送去医务室",
                    type: "bad",
                    weight: 5,
                    condition: s => s.energy < 20 && s.health < 60,
                    effect: {
                        health: -6,
                        energy: -10,
                        stress: 8
                    }
                },

                {
                    text: "吃坏肚子,频繁跑厕所",
                    type: "bad",
                    weight: 8,
                    condition: s => s.money < 100,
                    effect: {
                        health: -4,
                        energy: -5
                    }
                },

                {
                    text: "严重失眠,整夜睡不着",
                    type: "bad",
                    weight: 9,
                    condition: s => s.anxiety > 70,
                    effect: {
                        health: -4,
                        energy: -15,
                        mental: -4
                    }
                },

                {
                    text: "鼻炎发作,呼吸困难",
                    type: "bad",
                    weight: 7,
                    condition: s => s.season === 1,
                    effect: {
                        health: -3,
                        energy: -3
                    }
                },

                {
                    text: "心悸胸闷,可能是压力太大",
                    type: "bad",
                    weight: 8,
                    condition: s => s.stress > 80 && s.anxiety > 60,
                    effect: {
                        health: -5,
                        anxiety: 3
                    }
                },

                {
                    text: "久坐导致腰椎间盘不适",
                    type: "bad",
                    weight: 9,
                    condition: s => s.totalStudyHours > 80 && s.health < 70,
                    effect: {
                        health: -4,
                        energy: -3
                    }
                },

                {
                    text: "恶心呕吐,肠胃炎",
                    type: "bad",
                    weight: 6,
                    condition: s => s.health < 65,
                    effect: {
                        health: -6,
                        energy: -8
                    }
                },

                {
                    text: "崴脚了,行动不便",
                    type: "bad",
                    weight: 5,
                    condition: s => s.energy < 40,
                    effect: {
                        health: -3,
                        energy: -5
                    }
                },

                {
                    text: "中暑了,头晕恶心",
                    type: "bad",
                    weight: 6,
                    condition: s => s.season === 1 && s.currentWeather.type === 'sun',
                    effect: {
                        health: -5,
                        energy: -8
                    }
                },

                {
                    text: "过敏季,皮肤瘙痒",
                    type: "bad",
                    weight: 7,
                    condition: s => s.season === 0,
                    effect: {
                        health: -3,
                        mental: -2
                    }
                },

                {
                    text: "长智齿,牙龈肿痛",
                    type: "bad",
                    weight: 5,
                    condition: s => s.week > 30,
                    effect: {
                        health: -4,
                        stress: 3
                    }
                },

                {
                    text: "近视度数加深,必须换眼镜",
                    type: "bad",
                    weight: 8,
                    condition: s => s.totalStudyHours > 100,
                    effect: {
                        money: -400,
                        health: -2
                    }
                },

                {
                    text: "贫血头晕,站起来眼前发黑",
                    type: "bad",
                    weight: 6,
                    condition: s => s.health < 60 && s.energy < 40,
                    effect: {
                        health: -4,
                        energy: -5
                    }
                },

                {
                    text: "咳嗽不止,影响自己和同学",
                    type: "bad",
                    weight: 8,
                    condition: s => s.health < 70,
                    effect: {
                        health: -3,
                        classmateA: -2,
                        stress: 3
                    }
                },

                {
                    text: "做噩梦惊醒,睡眠质量极差",
                    type: "bad",
                    weight: 9,
                    condition: s => s.anxiety > 60,
                    effect: {
                        energy: -8,
                        mental: -3
                    }
                },

                {
                    text: "肩膀僵硬,颈椎病前兆",
                    type: "bad",
                    weight: 8,
                    condition: s => s.totalStudyHours > 90,
                    effect: {
                        health: -3,
                        energy: -2
                    }
                },

                {
                    text: "口腔溃疡,吃饭都疼",
                    type: "bad",
                    weight: 7,
                    condition: s => s.health < 80 && s.stress > 60,
                    effect: {
                        health: -2,
                        stress: 2
                    }
                },

                {
                    text: "体重暴增,体检超重",
                    type: "bad",
                    weight: 6,
                    condition: s => s.totalExerciseHours < 10 && s.week > 20,
                    effect: {
                        health: -3,
                        mental: -2
                    }
                },

                {
                    text: "体重骤降,营养不良",
                    type: "bad",
                    weight: 5,
                    condition: s => s.money < 150 && s.week > 30,
                    effect: {
                        health: -4,
                        energy: -5
                    }
                },

                {
                    text: "耳鸣,可能是压力导致",
                    type: "bad",
                    weight: 6,
                    condition: s => s.anxiety > 75,
                    effect: {
                        health: -2,
                        mental: -3
                    }
                },


                // 中性(15项)
                {
                    text: "小擦伤,贴个创可贴就好",
                    type: "neutral",
                    weight: 8,
                    condition: s => s.health > 80,
                    effect: { health: -1 }
                },

                {
                    text: "打了个哈欠,有点困",
                    type: "neutral",
                    weight: 15,
                    condition: s => s.energy < 60,
                    effect: { energy: -2 }
                },

                {
                    text: "打了个喷嚏,虚惊一场",
                    type: "neutral",
                    weight: 12,
                    condition: s => s.health > 70,
                    effect: {}
                },

                {
                    text: "量体温,正常,放心",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.stress > 50,
                    effect: { anxiety: -2 }
                },

                {
                    text: "今天喝水很多,代谢好",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.health < 90,
                    effect: { health: 1 }
                },

                {
                    text: "爬楼梯代替电梯,小锻炼",
                    type: "neutral",
                    weight: 11,
                    condition: s => s.energy > 50,
                    effect: {
                        health: 1,
                        energy: -2
                    }
                },

                {
                    text: "涂了防晒霜,保护皮肤",
                    type: "neutral",
                    weight: 7,
                    condition: s => s.season === 1,
                    effect: { health: 1 }
                },

                {
                    text: "泡了个热水脚,舒服",
                    type: "neutral",
                    weight: 9,
                    condition: s => s.energy < 50,
                    effect: {
                        energy: 3,
                        health: 1
                    }
                },

                {
                    text: "做眼保健操时偷看窗外",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.mental > 40,
                    effect: { mental: 1 }
                },

                {
                    text: "今天吃水果了吗?想不起来",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.week > 5,
                    effect: {}
                },

                {
                    text: "洗牙后发现牙齿很干净",
                    type: "neutral",
                    weight: 6,
                    condition: s => s.money > 100,
                    effect: {
                        money: -100,
                        health: 1
                    }
                },

                {
                    text: "室友感冒,你祈祷不要被传染",
                    type: "neutral",
                    weight: 8,
                    condition: s => s.health < 80,
                    effect: { anxiety: 2 }
                },

                {
                    text: "天气变化,增减衣服",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.week > 2,
                    effect: { health: 1 }
                },

                {
                    text: "尝试新的坐姿,还在适应",
                    type: "neutral",
                    weight: 9,
                    condition: s => s.health < 85,
                    effect: { health: 1 }
                },

                {
                    text: "喝了奶茶,罪恶但快乐",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.money > 20,
                    effect: {
                        money: -25,
                        mental: 2,
                        health: -1
                    }
                }
            ],


            // -------------------- 回忆/心理类事件(60项) --------------------
            memory: [
                // OI往事(20项)
                {
                    text: "路过机房,听到熟悉的键盘声,恍如隔世",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.memoryCount < 5,
                    effect: {
                        mental: -2,
                        memoryCount: 1
                    }
                },

                {
                    text: "想起第一次AC的喜悦,那种纯粹的快乐",
                    type: "good",
                    weight: 8,
                    condition: s => s.memoryCount > 0,
                    effect: {
                        mental: 3,
                        stress: -3,
                        energy: 3
                    }
                },

                {
                    text: "想起省选失利的那一夜,泪水模糊了视线",
                    type: "bad",
                    weight: 9,
                    condition: s => s.mental < 70,
                    effect: {
                        mental: -5,
                        stress: 5,
                        anxiety: 3
                    }
                },

                {
                    text: "想起和队友一起熬夜刷题的凌晨, camaraderie",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.classmateA < 70,
                    effect: {
                        classmateA: 3,
                        mental: 2
                    }
                },

                {
                    text: "思考如果当初没退役,现在会在哪里",
                    type: "neutral",
                    weight: 12,
                    condition: s => s.week < 30,
                    effect: {
                        mental: -1,
                        anxiety: 2
                    }
                },

                {
                    text: "想起OI教会我的:永不放弃的精神",
                    type: "good",
                    weight: 9,
                    condition: s => s.stress > 60,
                    effect: {
                        stress: -5,
                        mental: 4,
                        energy: 2
                    }
                },

                {
                    text: "想起退役时教练惋惜的眼神",
                    type: "bad",
                    weight: 8,
                    condition: s => s.mental < 60,
                    effect: {
                        mental: -4,
                        anxiety: 3
                    }
                },

                {
                    text: "想起拿到省一的瞬间,证明自己不笨",
                    type: "good",
                    weight: 7,
                    condition: s => s.subjects.math < 60,
                    effect: {
                        mental: 5,
                        math: 1
                    }
                },

                {
                    text: "发现OI的算法思维帮助理解文化课",
                    type: "good",
                    weight: 10,
                    condition: s => s.subjects.physics > 50,
                    effect: {
                        physics: 1,
                        mental: 2
                    }
                },

                {
                    text: "想起曾经梦想的大学(THU/PKU CS)",
                    type: "bad",
                    weight: 9,
                    condition: s => s.anxiety > 50,
                    effect: {
                        anxiety: 4,
                        stress: 3
                    }
                },

                {
                    text: "想起和队友的告别,'文化课加油'",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.week < 20,
                    effect: {
                        mental: 2,
                        stress: -2
                    }
                },

                {
                    text: "想起比赛时最后一分钟AC的惊险",
                    type: "good",
                    weight: 7,
                    condition: s => s.energy < 40,
                    effect: {
                        energy: 5,
                        mental: 3
                    }
                },

                {
                    text: "想起因为竞赛错过的初中生活",
                    type: "bad",
                    weight: 8,
                    condition: s => s.mental < 70,
                    effect: {
                        mental: -3,
                        stress: 2
                    }
                },

                {
                    text: "想起竞赛时互帮互助的氛围,温暖",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.classmateA < 50,
                    effect: {
                        classmateA: 2,
                        mental: 2
                    }
                },

                {
                    text: "想起'抱灵'(0分)的那场比赛,阴影",
                    type: "bad",
                    weight: 6,
                    condition: s => s.examCount > 0,
                    effect: {
                        stress: 5,
                        anxiety: 4,
                        mental: -3
                    }
                },

                {
                    text: "想到可以用动态规划思路安排复习",
                    type: "good",
                    weight: 8,
                    condition: s => s.week > 15,
                    effect: {
                        mental: 3,
                        energy: 3
                    }
                },

                {
                    text: "想起OI冬令营的雪地跑步,锻炼身体",
                    type: "good",
                    weight: 6,
                    condition: s => s.health < 80,
                    effect: {
                        health: 2,
                        energy: 2
                    }
                },

                {
                    text: "想起集训时一起点外卖的快乐",
                    type: "neutral",
                    weight: 8,
                    condition: s => s.money > 50,
                    effect: {
                        mental: 1,
                        money: -30
                    }
                },

                {
                    text: "想起被淘汰的队友现在过得不错,释然",
                    type: "good",
                    weight: 7,
                    condition: s => s.mental > 60,
                    effect: {
                        mental: 4,
                        anxiety: -3
                    }
                },

                {
                    text: "想起无数个调试到深夜的晚上",
                    type: "neutral",
                    weight: 9,
                    condition: s => s.energy < 50,
                    effect: {
                        energy: -3,
                        mental: 1
                    }
                },


                // 文化课适应(20项)
                {
                    text: "发现文化课和OI完全不同,需要死记硬背",
                    type: "bad",
                    weight: 11,
                    condition: s => s.week < 10,
                    effect: {
                        stress: 5,
                        mental: -2
                    }
                },

                {
                    text: "发现数学思维可以迁移,感到欣慰",
                    type: "good",
                    weight: 10,
                    condition: s => s.subjects.math > 40,
                    effect: {
                        math: 1,
                        mental: 2
                    }
                },

                {
                    text: "害怕被同学发现曾经是竞赛生,怕他们期待太高",
                    type: "bad",
                    weight: 9,
                    condition: s => s.week < 15,
                    effect: {
                        anxiety: 5,
                        stress: 3
                    }
                },

                {
                    text: "逐渐接受'AFO'的身份,与自己和解",
                    type: "good",
                    weight: 8,
                    condition: s => s.week > 20 && s.mental > 60,
                    effect: {
                        mental: 5,
                        anxiety: -5
                    }
                },

                {
                    text: "在文化课班级找到新的定位,不再是'那个竞赛的'",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.classmateA > 50,
                    effect: {
                        mental: 3,
                        classmateA: 2
                    }
                },

                {
                    text: "怀疑自己的智商,'我是不是变笨了'",
                    type: "bad",
                    weight: 10,
                    condition: s => s.subjects.chinese < 40 && s.subjects.english < 40,
                    effect: {
                        mental: -4,
                        anxiety: 4
                    }
                },

                {
                    text: "证明自己不仅竞赛强,文化课也能学好",
                    type: "good",
                    weight: 9,
                    condition: s => s.subjects.math > 80,
                    effect: {
                        mental: 4,
                        stress: -2
                    }
                },

                {
                    text: "帮助同学用竞赛思维解题,获得认可",
                    type: "good",
                    weight: 9,
                    condition: s => s.subjects.physics > 60,
                    effect: {
                        classmateA: 3,
                        mental: 3
                    }
                },

                {
                    text: "感到孤独,没有人理解OIer的骄傲与痛苦",
                    type: "bad",
                    weight: 10,
                    condition: s => s.mental < 60 && s.relationships.classmateA < 40,
                    effect: {
                        mental: -5,
                        anxiety: 3
                    }
                },

                {
                    text: "发现语文也有逻辑美,古诗意境深远",
                    type: "good",
                    weight: 8,
                    condition: s => s.subjects.chinese > 50,
                    effect: {
                        chinese: 1,
                        mental: 2
                    }
                },

                {
                    text: "发现英语是了解世界的窗口,不只是考试",
                    type: "good",
                    weight: 8,
                    condition: s => s.subjects.english > 50,
                    effect: {
                        english: 1,
                        mental: 2
                    }
                },

                {
                    text: "化学实验比OI的输出调试更有趣",
                    type: "good",
                    weight: 7,
                    condition: s => s.subjects.chemistry > 50,
                    effect: {
                        chemistry: 1,
                        mental: 2
                    }
                },

                {
                    text: "生物的遗传规律像代码一样美",
                    type: "good",
                    weight: 7,
                    condition: s => s.subjects.biology > 50,
                    effect: {
                        biology: 1,
                        mental: 2
                    }
                },

                {
                    text: "感到时间不够用,后悔浪费的竞赛时光",
                    type: "bad",
                    weight: 9,
                    condition: s => s.daysLeft < 200,
                    effect: {
                        anxiety: 5,
                        stress: 4
                    }
                },

                {
                    text: "接受'每一条走过的路都算数',释然",
                    type: "good",
                    weight: 8,
                    condition: s => s.mental > 70,
                    effect: {
                        mental: 3,
                        anxiety: -3
                    }
                },

                {
                    text: "思考大学专业,发现选择比竞赛时更多",
                    type: "neutral",
                    weight: 9,
                    condition: s => s.week > 30,
                    effect: {
                        mental: 2,
                        anxiety: 2
                    }
                },

                {
                    text: "梦见自己还在机房打比赛,醒来怅然",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.memoryCount < 3,
                    effect: {
                        mental: -2,
                        memoryCount: 1
                    }
                },

                {
                    text: "对比竞赛和文化课,发现都需要坚持",
                    type: "good",
                    weight: 9,
                    condition: s => s.week > 15,
                    effect: {
                        mental: 3,
                        stress: -2
                    }
                },

                {
                    text: "思考如果高考失败是否还有退路",
                    type: "bad",
                    weight: 8,
                    condition: s => s.anxiety > 60,
                    effect: {
                        anxiety: 4,
                        mental: -2
                    }
                },

                {
                    text: "感到文化课也有其独特的魅力",
                    type: "good",
                    weight: 8,
                    condition: s => s.subjects.chinese > 60 && s.subjects.english > 60,
                    effect: {
                        mental: 4,
                        anxiety: -2
                    }
                },


                // 心理调节(20项)
                {
                    text: "意识到焦虑是正常的,接纳它",
                    type: "good",
                    weight: 10,
                    condition: s => s.anxiety > 50,
                    effect: {
                        anxiety: -3,
                        mental: 2
                    }
                },

                {
                    text: "写日记梳理情绪,心情平复",
                    type: "good",
                    weight: 9,
                    condition: s => s.mental < 80,
                    effect: {
                        mental: 3,
                        stress: -2
                    }
                },

                {
                    text: "涂鸦放松,发现艺术天赋",
                    type: "good",
                    weight: 7,
                    condition: s => s.mental < 70,
                    effect: {
                        mental: 3,
                        anxiety: -2
                    }
                },

                {
                    text: "听轻音乐,心跳逐渐平稳",
                    type: "good",
                    weight: 11,
                    condition: s => s.anxiety > 40,
                    effect: {
                        anxiety: -4,
                        mental: 2
                    }
                },

                {
                    text: "观察窗外的树,感到宁静",
                    type: "good",
                    weight: 10,
                    condition: s => s.stress > 50,
                    effect: {
                        stress: -3,
                        mental: 2
                    }
                },

                {
                    text: "意识到自己比想象中坚强",
                    type: "good",
                    weight: 9,
                    condition: s => s.week > 20,
                    effect: {
                        mental: 4,
                        anxiety: -3
                    }
                },

                {
                    text: "自我鼓励,给自己打气",
                    type: "good",
                    weight: 8,
                    condition: s => s.mental < 60,
                    effect: {
                        mental: 3,
                        stress: -2
                    }
                },

                {
                    text: "练习正念呼吸,回到当下",
                    type: "good",
                    weight: 9,
                    condition: s => s.anxiety > 60,
                    effect: {
                        anxiety: -5,
                        mental: 2
                    }
                },

                {
                    text: "完美主义作祟,对自己太苛刻",
                    type: "bad",
                    weight: 10,
                    condition: s => s.stress > 70,
                    effect: {
                        mental: -3,
                        anxiety: 3
                    }
                },

                {
                    text: "冒名顶替综合征:我不配",
                    type: "bad",
                    weight: 9,
                    condition: s => s.subjects.math > 80,
                    effect: {
                        mental: -4,
                        anxiety: 4
                    }
                },

                {
                    text: "学会平衡竞争与合作,心态成熟",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.classmateA > 60,
                    effect: {
                        mental: 3,
                        classmateA: 2
                    }
                },

                {
                    text: "情绪波动大,像坐过山车",
                    type: "bad",
                    weight: 9,
                    condition: s => s.mental < 60,
                    effect: {
                        mental: -2,
                        stress: 3
                    }
                },

                {
                    text: "设定合理目标,不再好高骛远",
                    type: "good",
                    weight: 9,
                    condition: s => s.week > 25,
                    effect: {
                        mental: 3,
                        anxiety: -4
                    }
                },

                {
                    text: "停止自我攻击,允许自己犯错",
                    type: "good",
                    weight: 8,
                    condition: s => s.stress > 60,
                    effect: {
                        stress: -5,
                        mental: 3
                    }
                },

                {
                    text: "过度分析别人的眼神,疑神疑鬼",
                    type: "bad",
                    weight: 8,
                    condition: s => s.anxiety > 60,
                    effect: {
                        anxiety: 3,
                        mental: -2
                    }
                },

                {
                    text: "感到'存在主义危机':学习的意义?",
                    type: "bad",
                    weight: 7,
                    condition: s => s.week > 35,
                    effect: {
                        mental: -3,
                        anxiety: 3
                    }
                },

                {
                    text: "找到内在动力,不为父母不为老师",
                    type: "good",
                    weight: 7,
                    condition: s => s.mental > 70,
                    effect: {
                        mental: 4,
                        energy: 3
                    }
                },

                {
                    text: "学会与不确定性共处",
                    type: "good",
                    weight: 8,
                    condition: s => s.anxiety > 70,
                    effect: {
                        anxiety: -5,
                        mental: 3
                    }
                },

                {
                    text: "惊恐发作,呼吸急促",
                    type: "bad",
                    weight: 5,
                    condition: s => s.anxiety > 85,
                    effect: {
                        mental: -5,
                        health: -3,
                        energy: -5
                    }
                },

                {
                    text: "感到自我价值的重构,成长",
                    type: "good",
                    weight: 7,
                    condition: s => s.week > 40,
                    effect: {
                        mental: 5,
                        anxiety: -3
                    }
                }
            ],


            // -------------------- 经济类事件(60项) --------------------
            economy: [
                // 收入(20项)
                {
                    text: "压岁钱到账,小金库充裕",
                    type: "good",
                    weight: 6,
                    condition: s => s.week <= 5 || s.week >= 25,
                    effect: {
                        money: 500,
                        stress: -3
                    }
                },

                {
                    text: "亲戚给的学习鼓励红包",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.parents > 60,
                    effect: {
                        money: 200,
                        parents: 2
                    }
                },

                {
                    text: "周末做家教,收入稳定",
                    type: "good",
                    weight: 10,
                    condition: s => s.subjects.math > 60 && s.energy > 40,
                    effect: {
                        money: 150,
                        energy: -15,
                        stress: 3
                    }
                },

                {
                    text: "学校奖学金发放,努力有回报",
                    type: "good",
                    weight: 7,
                    condition: s => s.week > 20,
                    effect: {
                        money: 300,
                        mental: 3
                    }
                },

                {
                    text: "帮同学修电脑,获得报酬",
                    type: "good",
                    weight: 8,
                    condition: s => s.memoryCount > 0,
                    effect: {
                        money: 50,
                        classmateA: 2
                    }
                },

                {
                    text: "卖掉闲置教辅,回血",
                    type: "good",
                    weight: 9,
                    condition: s => s.money < 300,
                    effect: { money: 80 }
                },

                {
                    text: "抽奖中了学习用品,省下笔钱",
                    type: "good",
                    weight: 5,
                    condition: s => s.mental > 50,
                    effect: {
                        money: 100,
                        mental: 2
                    }
                },

                {
                    text: "竞赛奖金(之前的)终于到账",
                    type: "good",
                    weight: 4,
                    condition: s => s.memoryCount > 0 && s.week < 10,
                    effect: {
                        money: 400,
                        memoryCount: 1
                    }
                },

                {
                    text: "祖父母给的营养费",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.parents > 50,
                    effect: { money: 150 }
                },

                {
                    text: "二手平台卖掉旧手机",
                    type: "good",
                    weight: 6,
                    condition: s => s.money < 200,
                    effect: { money: 300 }
                },

                {
                    text: "帮老师整理试卷,获得补贴",
                    type: "good",
                    weight: 7,
                    condition: s => s.relationships.teacher > 60,
                    effect: {
                        money: 100,
                        teacher: 2
                    }
                },

                {
                    text: "发现食堂有免费汤,省钱",
                    type: "good",
                    weight: 10,
                    condition: s => s.money < 100,
                    effect: {
                        money: 30,
                        health: 1
                    }
                },

                {
                    text: "父母涨零花钱,经济自由",
                    type: "good",
                    weight: 6,
                    condition: s => s.relationships.parents > 70,
                    effect: { money: 200 }
                },

                {
                    text: "知识竞赛获奖,奖金丰厚",
                    type: "good",
                    weight: 5,
                    condition: s => s.subjects.physics > 70,
                    effect: {
                        money: 250,
                        stress: -3
                    }
                },

                {
                    text: "画头像接单(兴趣变现)",
                    type: "good",
                    weight: 4,
                    condition: s => s.mental > 70,
                    effect: {
                        money: 80,
                        mental: 2
                    }
                },

                {
                    text: "春节红包(如果是在假期)",
                    type: "good",
                    weight: 3,
                    condition: s => s.vacationDays > 0,
                    effect: {
                        money: 1000,
                        stress: -5
                    }
                },

                {
                    text: "买彩票中20块,保本小赚",
                    type: "good",
                    weight: 4,
                    condition: s => s.mental > 50,
                    effect: { money: 10 }
                },

                {
                    text: "班级收班费多收的部分退回",
                    type: "good",
                    weight: 6,
                    condition: s => s.week > 10,
                    effect: { money: 50 }
                },

                {
                    text: "奶茶店的积分兑换,免费一杯",
                    type: "good",
                    weight: 8,
                    condition: s => s.money > 0,
                    effect: {
                        money: 15,
                        mental: 2
                    }
                },

                {
                    text: "发现公交卡还有余额,省交通费",
                    type: "good",
                    weight: 9,
                    condition: s => s.money < 200,
                    effect: { money: 20 }
                },


                // 支出(25项)
                {
                    text: "教辅资料涨价,被迫高价购买",
                    type: "bad",
                    weight: 10,
                    condition: s => s.money > 200,
                    effect: {
                        money: -150,
                        stress: 2
                    }
                },

                {
                    text: "牙疼看医生,治疗费昂贵",
                    type: "bad",
                    weight: 7,
                    condition: s => s.health < 80,
                    effect: {
                        money: -400,
                        health: 5,
                        stress: 3
                    }
                },

                {
                    text: "眼镜片碎裂,必须更换",
                    type: "bad",
                    weight: 8,
                    condition: s => s.totalStudyHours > 80,
                    effect: {
                        money: -500,
                        stress: 5
                    }
                },

                {
                    text: "手机碎屏,维修大出血",
                    type: "bad",
                    weight: 9,
                    condition: s => s.money > 300,
                    effect: {
                        money: -350,
                        stress: 4
                    }
                },

                {
                    text: "书包拉链坏了,买个新的",
                    type: "bad",
                    weight: 8,
                    condition: s => s.week > 20,
                    effect: { money: -120 }
                },

                {
                    text: "买保健品补脑(被广告忽悠)",
                    type: "bad",
                    weight: 7,
                    condition: s => s.anxiety > 60,
                    effect: {
                        money: -200,
                        mental: 1
                    }
                },

                {
                    text: "赶时间打车,花钱如流水",
                    type: "bad",
                    weight: 9,
                    condition: s => s.energy < 30,
                    effect: {
                        money: -50,
                        energy: 5
                    }
                },

                {
                    text: "外卖点太多,浪费食物浪费钱",
                    type: "bad",
                    weight: 10,
                    condition: s => s.money > 100,
                    effect: {
                        money: -60,
                        health: -2
                    }
                },

                {
                    text: "冲动消费买了不用的文具",
                    type: "bad",
                    weight: 9,
                    condition: s => s.mental < 70,
                    effect: {
                        money: -80,
                        stress: 2
                    }
                },

                {
                    text: "体检发现小问题,买药预防",
                    type: "bad",
                    weight: 8,
                    condition: s => s.health < 75,
                    effect: {
                        money: -150,
                        health: 3
                    }
                },

                {
                    text: "网课续费,自动扣款心疼",
                    type: "bad",
                    weight: 7,
                    condition: s => s.money > 250,
                    effect: { money: -250 }
                },

                {
                    text: "crush生日,不得不买礼物",
                    type: "bad",
                    weight: 8,
                    condition: s => s.relationships.crush > 50,
                    effect: {
                        money: -150,
                        crush: 3
                    }
                },

                {
                    text: "班级聚会AA,社恐但不得不去",
                    type: "bad",
                    weight: 8,
                    condition: s => s.relationships.classmateA > 40,
                    effect: {
                        money: -100,
                        classmateA: 2
                    }
                },

                {
                    text: "换季买衣服,高三也要形象",
                    type: "bad",
                    weight: 7,
                    condition: s => s.season === 1 || s.season === 3,
                    effect: { money: -300 }
                },

                {
                    text: "咖啡成瘾,每天一杯拿铁 factor",
                    type: "bad",
                    weight: 11,
                    condition: s => s.energy < 50,
                    effect: {
                        money: -20,
                        energy: 3
                    }
                },

                {
                    text: "打印资料累积,积少成多",
                    type: "bad",
                    weight: 10,
                    condition: s => s.week > 10,
                    effect: { money: -30 }
                },

                {
                    text: "公交卡丢失,补办费+余额损失",
                    type: "bad",
                    weight: 6,
                    condition: s => s.stress > 60,
                    effect: {
                        money: -50,
                        stress: 3
                    }
                },

                {
                    text: "食堂涨价,生活费不够",
                    type: "bad",
                    weight: 9,
                    condition: s => s.money < 300,
                    effect: {
                        money: -100,
                        stress: 3
                    }
                },

                {
                    text: "网购退货失败,被迫留下",
                    type: "bad",
                    weight: 7,
                    condition: s => s.money > 100,
                    effect: { money: -80 }
                },

                {
                    text: "鞋子磨损严重,必须换新",
                    type: "bad",
                    weight: 6,
                    condition: s => s.week > 30,
                    effect: { money: -200 }
                },

                {
                    text: "被'学霸笔记'广告骗,买了没用的资料",
                    type: "bad",
                    weight: 7,
                    condition: s => s.anxiety > 60,
                    effect: {
                        money: -180,
                        stress: 3
                    }
                },

                {
                    text: "没忍住氪金,后悔莫及",
                    type: "bad",
                    weight: 6,
                    condition: s => s.mental < 60,
                    effect: {
                        money: -200,
                        mental: -3
                    }
                },

                {
                    text: "感冒发烧打针,医药费",
                    type: "bad",
                    weight: 8,
                    condition: s => s.health < 70,
                    effect: {
                        money: -200,
                        health: 3
                    }
                },

                {
                    text: "话费超支,流量用太多",
                    type: "bad",
                    weight: 9,
                    condition: s => s.week > 10,
                    effect: { money: -50 }
                },

                {
                    text: "笔袋丢失,重新买文具",
                    type: "bad",
                    weight: 8,
                    condition: s => s.stress > 70,
                    effect: {
                        money: -50,
                        stress: 2
                    }
                },


                // 经济观念/中性(15项)
                {
                    text: "思考金钱观:省钱还是投资自己?",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.week > 15,
                    effect: { mental: 2 }
                },

                {
                    text: "记账发现开销太大,决心节省",
                    type: "neutral",
                    weight: 9,
                    condition: s => s.money < 200,
                    effect: {
                        mental: 1,
                        stress: 2
                    }
                },

                {
                    text: "意识到父母的钱来之不易",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.relationships.parents > 50,
                    effect: {
                        parents: 2,
                        stress: 1
                    }
                },

                {
                    text: "制定预算,学会理财第一步",
                    type: "good",
                    weight: 8,
                    condition: s => s.mental > 60,
                    effect: {
                        mental: 2,
                        anxiety: -1
                    }
                },

                {
                    text: "发现省钱的小技巧,开心",
                    type: "neutral",
                    weight: 10,
                    condition: s => s.money > 0,
                    effect: { mental: 1 }
                },

                {
                    text: "纠结是否要买昂贵的网课",
                    type: "neutral",
                    weight: 9,
                    condition: s => s.money > 300,
                    effect: { anxiety: 2 }
                },

                {
                    text: "意识到贫穷限制了选择",
                    type: "bad",
                    weight: 8,
                    condition: s => s.money < 100,
                    effect: {
                        anxiety: 3,
                        stress: 2
                    }
                },

                {
                    text: "花钱买了教训(被骗),成长",
                    type: "bad",
                    weight: 7,
                    condition: s => s.mental > 50,
                    effect: {
                        money: -50,
                        mental: 3
                    }
                },

                {
                    text: "收到学习资料作为礼物,省下一笔",
                    type: "good",
                    weight: 7,
                    condition: s => s.relationships.parents > 60,
                    effect: {
                        money: 100,
                        parents: 2
                    }
                },

                {
                    text: "思考高考后的经济独立",
                    type: "neutral",
                    weight: 8,
                    condition: s => s.week > 45,
                    effect: {
                        anxiety: 2,
                        mental: 1
                    }
                },

                {
                    text: "图书馆借书代替购买,节流",
                    type: "neutral",
                    weight: 9,
                    condition: s => s.money < 150,
                    effect: { mental: 1 }
                },

                {
                    text: "为知识付费,认为值得",
                    type: "neutral",
                    weight: 8,
                    condition: s => s.subjects.math > 60 && s.subjects.english > 60,
                    effect: {
                        money: -50,
                        mental: 2
                    }
                },

                {
                    text: "开始带饭,省钱又健康",
                    type: "good",
                    weight: 8,
                    condition: s => s.relationships.parents > 50,
                    effect: {
                        money: 50,
                        health: 2
                    }
                },

                {
                    text: "发现兼职影响学习,权衡利弊",
                    type: "neutral",
                    weight: 7,
                    condition: s => s.totalStudyHours > 80,
                    effect: {
                        mental: 2,
                        stress: 1
                    }
                },

                {
                    text: "经济压力转化为学习动力",
                    type: "good",
                    weight: 8,
                    condition: s => s.money < 100,
                    effect: {
                        energy: 3,
                        stress: 1
                    }
                }
            ],


            // -------------------- 特殊事件(60项) --------------------
            special: [
                // 天气相关(10项)
                {
                    text: "雨天路滑,差点摔跤,心情受影响",
                    type: "bad",
                    weight: 8,
                    condition: s => s.currentWeather.type === 'rain',
                    effect: {
                        stress: 2,
                        energy: -3
                    }
                },

                {
                    text: "阳光明媚,心情大好",
                    type: "good",
                    weight: 10,
                    condition: s => s.currentWeather.type === 'sun',
                    effect: {
                        mental: 2,
                        energy: 2
                    }
                },

                {
                    text: "雾霾严重,呼吸困难,健康受损",
                    type: "bad",
                    weight: 8,
                    condition: s => s.currentWeather.type === 'fog',
                    effect: {
                        health: -3,
                        energy: -2
                    }
                },

                {
                    text: "雷雨夜,无法入睡,思考人生",
                    type: "neutral",
                    weight: 7,
                    condition: s => s.currentWeather.type === 'thunder',
                    effect: {
                        mental: 2,
                        energy: -5
                    }
                },

                {
                    text: "初雪,感到浪漫(虽然高三不配)",
                    type: "good",
                    weight: 6,
                    condition: s => s.season === 3 && s.week > 40,
                    effect: {
                        mental: 3,
                        stress: -2
                    }
                },

                {
                    text: "雨后彩虹,难得的放松",
                    type: "good",
                    weight: 5,
                    condition: s => s.currentWeather.type === 'rain',
                    effect: {
                        mental: 3,
                        anxiety: -2
                    }
                },

                {
                    text: "大风天,伞被吹坏,倒霉",
                    type: "bad",
                    weight: 6,
                    condition: s => s.currentWeather.name === '大风',
                    effect: {
                        money: -30,
                        stress: 3
                    }
                },

                {
                    text: "阴天适合学习,不犯困",
                    type: "good",
                    weight: 10,
                    condition: s => s.currentWeather.type === 'cloud',
                    effect: { energy: 3 }
                },

                {
                    text: "降温太猛,衣服穿少了,发抖",
                    type: "bad",
                    weight: 8,
                    condition: s => s.season === 3 && s.health < 80,
                    effect: {
                        health: -3,
                        energy: -3
                    }
                },

                {
                    text: "天气闷热,烦躁",
                    type: "bad",
                    weight: 9,
                    condition: s => s.season === 1 && s.currentWeather.type === 'sun',
                    effect: {
                        stress: 3,
                        energy: -3
                    }
                },


                // 节日/特殊日期(15项)
                {
                    text: "生日,收到祝福,许愿高考顺利",
                    type: "good",
                    weight: 5,
                    condition: s => s.week % 10 === 0,
                    effect: {
                        mental: 5,
                        stress: -3
                    }
                },

                {
                    text: "圣诞节,同学互送苹果",
                    type: "good",
                    weight: 6,
                    condition: s => s.week >= 24 && s.week <= 26,
                    effect: {
                        classmateA: 3,
                        mental: 2
                    }
                },

                {
                    text: "春节,短暂放松但焦虑未来",
                    type: "neutral",
                    weight: 5,
                    condition: s => s.vacationDays > 0 && s.season === 3,
                    effect: {
                        stress: -5,
                        anxiety: 3
                    }
                },

                {
                    text: "情人节,单身狗受暴击",
                    type: "bad",
                    weight: 7,
                    condition: s => s.relationships.crush < 30 && s.week === 7,
                    effect: {
                        mental: -3,
                        stress: 2
                    }
                },

                {
                    text: "万圣节,短暂忘却高考压力",
                    type: "good",
                    weight: 5,
                    condition: s => s.week === 18,
                    effect: {
                        stress: -3,
                        energy: 3
                    }
                },

                {
                    text: "百日誓师,热血沸腾",
                    type: "good",
                    weight: 4,
                    condition: s => s.daysLeft <= 100 && s.daysLeft > 95,
                    effect: {
                        energy: 10,
                        stress: 5
                    }
                },

                {
                    text: "毕业典礼(提前),感伤",
                    type: "neutral",
                    weight: 3,
                    condition: s => s.week > 50,
                    effect: {
                        mental: 3,
                        anxiety: -2
                    }
                },

                {
                    text: "一模/二模/三模时间节点,紧张",
                    type: "bad",
                    weight: 10,
                    condition: s => s.week === 20 || s.week === 35 || s.week === 45,
                    effect: {
                        anxiety: 5,
                        stress: 5
                    }
                },

                {
                    text: "元旦,新年新希望",
                    type: "good",
                    weight: 5,
                    condition: s => s.week === 20,
                    effect: {
                        mental: 3,
                        stress: -3
                    }
                },

                {
                    text: "劳动节,劳动最光荣(但高三不放假)",
                    type: "neutral",
                    weight: 6,
                    condition: s => s.week === 40,
                    effect: { energy: 3 }
                },

                {
                    text: "世界读书日,多读一本课外书",
                    type: "good",
                    weight: 5,
                    condition: s => s.week === 16,
                    effect: {
                        chinese: 1,
                        mental: 2
                    }
                },

                {
                    text: "植树节,感到生机",
                    type: "good",
                    weight: 5,
                    condition: s => s.week === 11,
                    effect: {
                        mental: 2,
                        health: 1
                    }
                },

                {
                    text: "清明节,思念祖先,思考生命意义",
                    type: "neutral",
                    weight: 5,
                    condition: s => s.week === 35,
                    effect: {
                        mental: 2,
                        anxiety: 1
                    }
                },

                {
                    text: "端午节,吃粽子,短暂温馨",
                    type: "good",
                    weight: 5,
                    condition: s => s.week === 45,
                    effect: {
                        health: 2,
                        stress: -2
                    }
                },

                {
                    text: "中秋节,想家",
                    type: "neutral",
                    weight: 5,
                    condition: s => s.week === 38,
                    effect: {
                        parents: 2,
                        stress: 1
                    }
                },


                // 稀有/彩蛋(15项)
                {
                    text: "在学校遇到流浪猫,撸猫解压",
                    type: "good",
                    weight: 5,
                    condition: s => s.stress > 50,
                    effect: {
                        stress: -5,
                        mental: 3,
                        anxiety: -2
                    }
                },

                {
                    text: "看到流星,许愿",
                    type: "good",
                    weight: 2,
                    condition: s => s.energy < 30,
                    effect: {
                        mental: 3,
                        energy: 5
                    }
                },

                {
                    text: "发现四叶草,好运",
                    type: "good",
                    weight: 3,
                    condition: s => s.mental > 40,
                    effect: { mental: 2 }
                },

                {
                    text: "收到陌生号码的鼓励短信(发错了?)",
                    type: "neutral",
                    weight: 4,
                    condition: s => s.mental < 70,
                    effect: { mental: 1 }
                },

                {
                    text: "广播站放了喜欢的歌",
                    type: "good",
                    weight: 6,
                    condition: s => s.mental > 50,
                    effect: {
                        mental: 2,
                        stress: -2
                    }
                },

                {
                    text: "双彩虹,极度幸运",
                    type: "good",
                    weight: 1,
                    condition: s => s.stress > 60,
                    effect: {
                        stress: -10,
                        mental: 5,
                        anxiety: -5
                    }
                },

                {
                    text: "教室里飞进蝴蝶,生机",
                    type: "good",
                    weight: 4,
                    condition: s => s.season === 1,
                    effect: { mental: 2 }
                },

                {
                    text: "看到鸽子,和平的象征",
                    type: "neutral",
                    weight: 5,
                    condition: s => s.mental > 40,
                    effect: { mental: 1 }
                },

                {
                    text: "发现学校某个角落的秘密基地",
                    type: "good",
                    weight: 3,
                    condition: s => s.week > 20,
                    effect: {
                        mental: 3,
                        anxiety: -2
                    }
                },

                {
                    text: "在旧书发现前主人的笔记,时空对话",
                    type: "neutral",
                    weight: 5,
                    condition: s => s.money < 200,
                    effect: { mental: 2 }
                },

                {
                    text: "在黑板上发现好看的涂鸦",
                    type: "good",
                    weight: 5,
                    condition: s => s.mental > 50,
                    effect: { mental: 1 }
                },

                {
                    text: "听到有人在练钢琴,悠扬",
                    type: "good",
                    weight: 4,
                    condition: s => s.stress > 50,
                    effect: {
                        stress: -3,
                        mental: 2
                    }
                },

                {
                    text: "向日葵开了,向着阳光",
                    type: "good",
                    weight: 4,
                    condition: s => s.season === 1,
                    effect: {
                        mental: 2,
                        energy: 2
                    }
                },

                {
                    text: "看到月食,罕见",
                    type: "good",
                    weight: 2,
                    condition: s => s.energy < 40,
                    effect: { mental: 3 }
                },

                {
                    text: "远处放烟花,短暂美好",
                    type: "good",
                    weight: 3,
                    condition: s => s.week > 50,
                    effect: {
                        mental: 2,
                        stress: -2
                    }
                },


                // 综合/连锁(20项)
                {
                    text: "全面爆发:学习状态极佳,诸事顺利",
                    type: "good",
                    weight: 3,
                    condition: s => s.mental > 80 && s.health > 80 && s.energy > 80,
                    effect: {
                        energy: 5,
                        stress: -5
                    }
                },

                {
                    text: "全面崩溃:生病+压力大+没钱",
                    type: "bad",
                    weight: 3,
                    condition: s => s.health < 50 && s.stress > 80 && s.money < 100,
                    effect: {
                        health: -5,
                        mental: -5,
                        anxiety: 5
                    }
                },

                {
                    text: "祸福相依:考试考砸了但因此发现漏洞",
                    type: "neutral",
                    weight: 6,
                    condition: s => s.examCount > 0,
                    effect: { stress: 5 }
                },

                {
                    text: "情绪过山车:极度高兴后极度低落",
                    type: "bad",
                    weight: 5,
                    condition: s => s.mental < 60,
                    effect: {
                        mental: -3,
                        anxiety: 3
                    }
                },

                {
                    text: "天时地利人和:天气好+状态佳+关系好",
                    type: "good",
                    weight: 2,
                    condition: s => s.currentWeather.type === 'sun' && s.energy > 70 && s.relationships.teacher > 60,
                    effect: { mental: 3 }
                },

                {
                    text: "水逆:诸事不顺",
                    type: "bad",
                    weight: 4,
                    condition: s => s.mental < 50 && s.health < 70,
                    effect: {
                        money: -50,
                        energy: -5,
                        stress: 3
                    }
                },

                {
                    text: "蝴蝶效应:一个小决定带来大改变",
                    type: "neutral",
                    weight: 5,
                    condition: s => s.week > 25,
                    effect: { mental: 2 }
                },

                {
                    text: "时间过得飞快,感到恐慌",
                    type: "bad",
                    weight: 10,
                    condition: s => s.daysLeft < 100,
                    effect: {
                        anxiety: 5,
                        stress: 3
                    }
                },

                {
                    text: "意外之喜:收到匿名礼物",
                    type: "good",
                    weight: 4,
                    condition: s => s.relationships.crush > 50,
                    effect: {
                        mental: 4,
                        crush: 2
                    }
                },

                {
                    text: "潮起潮落:接受状态的自然波动",
                    type: "good",
                    weight: 6,
                    condition: s => s.mental > 70,
                    effect: {
                        mental: 2,
                        anxiety: -3
                    }
                },

                {
                    text: "角色转换:从学生到老师(给同学讲题)",
                    type: "good",
                    weight: 7,
                    condition: s => s.subjects.math > 70,
                    effect: {
                        mental: 3,
                        classmateA: 2
                    }
                },

                {
                    text: "循环:感觉每天都在重复,厌倦",
                    type: "bad",
                    weight: 9,
                    condition: s => s.week > 30,
                    effect: {
                        mental: -3,
                        stress: 2
                    }
                },

                {
                    text: "顿悟:突然明白了学习的真谛",
                    type: "good",
                    weight: 4,
                    condition: s => s.totalStudyHours > 100,
                    effect: {
                        mental: 5,
                        anxiety: -5,
                        stress: -3
                    }
                },

                {
                    text: "肾上腺素:极限状态下发挥超常",
                    type: "good",
                    weight: 5,
                    condition: s => s.stress > 80 && s.anxiety > 70,
                    effect: { energy: 10 }
                },

                {
                    text: "跌入谷底:绝望后重生",
                    type: "good",
                    weight: 3,
                    condition: s => s.mental < 40 && s.week > 40,
                    effect: {
                        mental: 5,
                        anxiety: -5
                    }
                },

                {
                    text: "桥梁:过去(OI)与现在(高考)的连接",
                    type: "good",
                    weight: 5,
                    condition: s => s.memoryCount > 3 && s.week > 20,
                    effect: {
                        mental: 3,
                        stress: -2
                    }
                },

                {
                    text: "随机数:今天的一切看运气",
                    type: "neutral",
                    weight: 6,
                    condition: s => s.mental > 50,
                    effect: {}
                },

                {
                    text: "预感:感觉明天会考好/考砸",
                    type: "neutral",
                    weight: 7,
                    condition: s => s.examCount > 0,
                    effect: { anxiety: 2 }
                },

                {
                    text: "面具:摘下面具,做真实的自己",
                    type: "good",
                    weight: 5,
                    condition: s => s.mental > 70,
                    effect: {
                        mental: 4,
                        anxiety: -3
                    }
                },

                {
                    text: "渺小感:在宇宙中个人烦恼微不足道",
                    type: "good",
                    weight: 4,
                    condition: s => s.anxiety > 80,
                    effect: {
                        anxiety: -5,
                        mental: 2
                    }
                }
            ]
        };



        const storyEvents = [
            {
                id: 1,
                week: 1,
                day: 0,
                title: "AFO第一天",
                content: "你站在教室门口,深吸一口气。曾经的OI队友在隔壁班,听说他还在坚持竞赛。你握紧书包带,走进了新班级。",
                choices: [
                    { text: "找个角落坐下,低调开始", effect: { stress: 0.5 }, next: 2 },
                    { text: "主动和同桌打招呼", effect: { classmateA: 5, stress: -3 }, next: 2 }
                ]
            },
            {
                id: 2,
                week: 2,
                day: 2,
                title: "作业",
                content:
                    "数学老师布置了20道题,你发现大部分都是竞赛难度。你熬夜到凌晨,终于完成。",
                choices: [
                    { text: "按时交作业,展示实力", effect: { math: 2, mathTeacher: 5, energy: -10, stress: 0.5 }, next: 3 },
                    { text: "只做一半,保留实力", effect: { stress: 3, mathTeacher: -5 }, next: 3 }
                ]
            },
            {
                id: 3,
                week: 3,
                day: 2,
                title: "化学课",
                content: "化学老师走进教室,你惊讶地发现他竟是曾经带过竞赛集训的助教。他看到你时眼神微微一亮,却没有特别表示。下课时,他在你桌边停顿了一下。",
                choices: [
                    { text: "主动上前相认", effect: { chemistryTeacher: 5, stress: -3 }, next: 4 },
                    { text: "低头装作没看见", effect: { stress: 2, chemistryTeacher: -5 }, next: 4 },
                    { text: "课后去办公室找他", effect: { chemistryTeacher: 5, stress: 5 }, next: 4 }
                ]
            },
            {
                id: 4,
                week: 3,
                day: 4,
                title: "父母的期望",
                content: "父亲在饭桌上说:'听说XXX家的孩子这次考了班级第一,你以前搞竞赛,现在不能落后啊。'你握着筷子的手紧了紧。",
                choices: [
                    { text: "沉默不语,默默承受", effect: { stress: 8, parents: -2 }, next: 5 },
                    { text: "解释说需要时间适应", effect: { parents: 2, stress: 2 }, next: 5 },
                    { text: "发脾气说'你们懂什么!'", effect: { parents: -10, stress: 10, health: -5 }, next: 5 }
                ]
            },
            {
                id: 5,
                week: 4,
                day: 1,
                title: "旧友重逢",
                content: "在走廊遇到以前集训的队友。他问:'怎么退竞了?'你不知如何回答。他拍拍你的肩:'文化课也不容易,加油。'",
                choices: [
                    { text: "感到失落,怀疑选择", effect: { stress: 10 }, next: 6 },
                    { text: "释然一笑,各自有路", effect: { stress: -3 }, next: 6 },
                    { text: "暗下决心,要证明自己", effect: { energy: 5, stress: 5 }, next: 6 }
                ]
            },
            {
                id: 6,
                week: 5,
                day: 3,
                title: "暗恋的悸动",
                content: "她转过头问你物理题,发梢的香味让你心跳加速。你发现她也在努力学习,笔记本上密密麻麻。原来大家都在为未来拼命。",
                choices: [
                    { text: "认真讲题,展示实力", effect: { crush: 7, physics: 1 }, next: 7 },
                    { text: "紧张结巴,发挥失常", effect: { crush: -5, stress: 3 }, next: 7 },
                    { text: "讲完后邀请一起学习", effect: { crush: 12, stress: -10, subjects: { all: 2 } }, next: 7 }
                ]
            },
            {
                id: 7,
                week: 6,
                day: 3,
                title: "模式的碰撞",
                content: "物理课讲到一个复杂模型,你下意识地用竞赛的思维去拆解,很快找到了关键。但解题步骤却和标准答案大相径庭。老师看着你的草稿纸,若有所思。",
                choices: [
                    { text: "向老师解释你的思路", effect: { teacher: 5, stress: -2, physics: 1 }, next: 8 },
                    { text: "默默擦掉,按课本方法重做", effect: { stress: 3 }, next: 8 },
                    { text: "课后和同学讨论你的方法", effect: { classmateA: 3, physics: 2 }, next: 8 }
                ]
            },
            {
                id: 8,
                week: 7,
                day: 5,
                title: "周末的图书馆",
                content: "你选择去图书馆自习,却偶遇了也在那里的她。你们默契地坐到了角落的同一张桌子,整整一个下午,只有翻书声和偶尔低声的讨论。",
                choices: [
                    { text: "专注学习,偶尔交流", effect: { crush: 3, subjects: { all: 1 }, stress: 5 }, next: 9 },
                    { text: "分心关注她,效率降低", effect: { crush: 5, energy: -5 }, next: 9 },
                    { text: "提前离开,避免紧张", effect: { stress: -3, crush: -5 }, next: 9 }
                ]
            },
            {
                id: 9,
                week: 8,
                day: 4,
                title: "第一次月考",
                content: "成绩出来了,你进步了许多。老师在全班面前表扬你:'XXX同学从竞赛转文化课,适应得很快。'你看到父母眼中的欣慰。",
                choices: [
                    { text: "继续保持,冲击更高分数", effect: { energy: 5, stress: -5, teacher: 5 }, next: 10 },
                    { text: "松懈下来,想休息几天", effect: { energy: 10, stress: -10 }, next: 10 },
                    { text: "感到迷茫,不知道意义何在", effect: { stress: 8 }, next: 10 }
                ]
            },
            {
                id: 10,
                week: 9,
                day: 1,
                title: "班委竞选",
                content: "班主任建议你竞选学习委员,说你的竞赛经历能帮助同学。你犹豫了,这会不会占用太多学习时间?",
                choices: [
                    { text: "接受挑战,参加竞选", effect: { teacher: 5, classmateA: 3, classmateB: 3, stress: 5, energy: -10 }, next: 11 },
                    { text: "婉拒,说明要专注学习", effect: { stress: -3, teacher: -2 }, next: 11 },
                    { text: "折中,只做科代表", effect: { teacher: 2, stress: 2 }, next: 11 }
                ]
            },
            {
                id: 11,
                week: 10,
                day: 5,
                title: "意外的盟友",
                content: "放学时下雨了,你没带伞。那个总在埋头刷题的'卷王'同桌默默把伞往你这边挪了挪。'一起走吧,顺便问你上午那道题的另一种解法。'",
                choices: [
                    { text: "感激接受,路上热烈讨论", effect: { classmateA: 8, stress: -5, math: 1 }, next: 12 },
                    { text: "婉拒,说想自己静静", effect: { stress: 2, energy: 5, health: -5 }, next: 12 },
                    { text: "接受,但一路沉默", effect: { classmateA: -2, stress: 5 }, next: 12 }
                ]
            },
            {
                id: 12,
                week: 11,
                day: 4,
                title: "物理竞赛题",
                content: "物理老师上课时讲到了一道改编自竞赛的题目,全班只有你和另一名同学举手表示会做。老师让你们各自上台讲解。",
                choices: [
                    { text: "用简洁的竞赛思路讲解", effect: { teacher: 1, physics: 2, stress: -3 }, next: 13 },
                    { text: "按常规课本方法讲解", effect: { stress: -2 }, next: 13 },
                    { text: "谦让,让同学先讲", effect: { classmateA: 3, teacher: 1 }, next: 13 }
                ]
            },
            {
                id: 13,
                week: 12,
                day: 6,
                title: "深夜的对话",
                content: "母亲深夜端来牛奶:'其实我们不求你考多好,只希望你别后悔。'你第一次和父母聊起竞赛的日子,聊起那些熬夜刷题的时光。",
                choices: [
                    { text: "感动落泪,压力释放", effect: { parents: 10, stress: -15 }, next: 14 },
                    { text: "表面平静,内心温暖", effect: { parents: 5, stress: -8 }, next: 14 },
                    { text: "觉得唠叨,不耐烦", effect: { parents: -5, stress: 3 }, next: 14 }
                ]
            },
            {
                id: 14,
                week: 13,
                day: 0,
                title: "母亲的早餐",
                content: "连续一周,你发现早餐盒里多了张便签。今天写着:'记得吃鸡蛋,补充蛋白质。别太拼,身体要紧。'字迹是母亲的。",
                choices: [
                    { text: "给母亲发短信感谢", effect: { parents: 5, stress: -5 }, next: 15 },
                    { text: "把便签小心收起来", effect: { parents: 3, stress: -3 }, next: 15 },
                    { text: "觉得难为情,扔掉便签", effect: { stress: 2 }, next: 15 }
                ]
            },
            {
                id: 15,
                week: 14,
                day: 0,
                title: "瓶颈期",
                content: "最近几次周测成绩像卡住了一样,不进不退。你看着那些反复出错的题型,第一次对'努力就有回报'产生了怀疑。深夜,台灯的光显得格外刺眼。",
                choices: [
                    { text: "更疯狂刷题,突破瓶颈", effect: { energy: -15, stress: 10, math: 1 }, next: 16 },
                    { text: "停下来,重新分析错题本", effect: { stress: -3, subjects: { all: 1 } }, next: 16 },
                    { text: "暂时放下,去操场跑步", effect: { energy: 10, stress: -8 }, next: 16 }
                ]
            },
            {
                id: 16,
                week: 15,
                day: 3,
                title: "同桌的求助",
                content: "'卷王'同桌罕见地找你求助:'这道数学压轴题,你的解法比我简洁多了,能教我吗?'你们花了整个午休时间一起钻研。",
                choices: [
                    { text: "耐心讲解,分享思路", effect: { classmateA: 8, math: 1, stress: -3 }, next: 17 },
                    { text: "匆匆讲完,继续刷题", effect: { classmateA: 2 }, next: 17 },
                    { text: "借此机会讨论更多难题", effect: { classmateA: 5, math: 2, energy: -5 }, next: 17 }
                ]
            },
            {
                id: 17,
                week: 16,
                day: 2,
                title: "回响",
                content: "收到曾经OI教练的邮件:'听说你转文化课了,无论选择什么,都要像解题一样,找到最优解。'你突然明白,竞赛教会你的不只是算法,更是思维方式。",
                choices: [
                    { text: "重拾信心,应用算法思维", effect: { math: 3, physics: 2, stress: -5 }, next: 18 },
                    { text: "感到遗憾,回不去了", effect: { stress: 8 }, next: 18 },
                    { text: "释然,感谢那段经历", effect: { stress: -8, energy: 5 }, next: 18 }
                ]
            },
            {
                id: 18,
                week: 17,
                day: 6,
                title: "周日的篮球场",
                content: "父亲难得休息,问你要不要去打球。你已经很久没摸篮球了,上一次还是竞赛集训前。",
                choices: [
                    { text: "放下书本,去打一场", effect: { parents: 5, energy: 10, stress: -8 }, next: 19 },
                    { text: "拒绝,说作业太多", effect: { parents: -2, stress: 3 }, next: 19 },
                    { text: "折中,只打半小时", effect: { parents: 3, energy: 5, stress: -3 }, next: 19 }
                ]
            },
            {
                id: 19,
                week: 18,
                day: 4,
                title: "父亲的书房",
                content: "你找资料时,无意看到父亲抽屉里一个旧笔记本。里面竟记录着他年轻时自学无线电的电路图,还有一行小字:'给未来的儿子:找到你的频率。'",
                choices: [
                    { text: "深受触动,与父亲深夜长谈", effect: { parents: 5, stress: -10, energy: 5 }, next: 20 },
                    { text: "默默放回,但内心泛起波澜", effect: { parents: 2, stress: -5 }, next: 20 },
                    { text: "觉得无关,继续自己的焦虑", effect: { stress: 10 }, next: 20 }
                ]
            },
            {
                id: 20,
                week: 19,
                day: 2,
                title: "英语演讲",
                content: "英语课要求每人做三分钟演讲。你选择了'算法与人生'这个题目,用计算机术语比喻学习过程。讲完后,同学们若有所思。",
                choices: [
                    { text: "感到自信,收获掌声", effect: { english: 2, stress: -5, teacher: 3 }, next: 21 },
                    { text: "紧张过度,发挥不佳", effect: { stress: 5 }, next: 21 },
                    { text: "平淡完成,但内心满足", effect: { stress: -3 }, next: 21 }
                ]
            },
            {
                id: 21,
                week: 20,
                day: 1,
                title: "回应",
                content: "她递来一张纸条:'谢谢你一直帮我...。我们一起努力,考同一所大学吧!'",
                choices: [
                    { text: "开心接受,动力满满", effect: { crush: 15, stress: -10, energy: 30 }, next: 22 },
                    { text: "紧张不知所措", effect: { stress: 10 }, next: 22 },
                    { text: "拒绝,说要专心学习", effect: { crush: -20, stress: 5 }, next: 22 }
                ]
            },
            {
                id: 22,
                week: 21,
                day: 5,
                title: "晚自习的停电",
                content: "晚自习时突然停电,教室陷入黑暗和短暂的骚动。有人打开了手机手电筒,微光中,你看到她正就着光继续看书。",
                choices: [
                    { text: "也打开手机,继续学习", effect: { crush: 1, stress: -2 }, next: 23 },
                    { text: "提议大家休息聊天", effect: { classmateA: 5, stress: -8 }, next: 23 },
                    { text: "默默看着窗外,思考", effect: { stress: -5 }, next: 23 }
                ]
            },
            {
                id: 23,
                week: 22,
                day: 2,
                title: "她的生日",
                content: "你听说今天是她的生日。犹豫再三,你在她常问问题的那本物理习题集扉页,用铅笔轻轻写下'Happy Birthday'。",
                choices: [
                    { text: "鼓起勇气,当面送给她并祝她生日快乐", effect: { crush: 5, stress: 5 }, next: 24 },
                    { text: "趁她不注意,悄悄放回她书桌", effect: { crush: 2, stress: -2 }, next: 24 },
                    { text: "最终擦掉,没有行动", effect: { stress: 3, crush: -5 }, next: 24 }
                ]
            },
            {
                id: 24,
                week: 23,
                day: 1,
                title: "模拟志愿填报",
                content: "学校组织模拟填报志愿。你看着那些曾经梦想的计算机强校,又看了看自己现在的成绩,在理想与现实间犹豫。",
                choices: [
                    { text: "坚持梦想,填报强校", effect: { energy: 10, stress: 8 }, next: 25 },
                    { text: "务实选择,保证录取", effect: { stress: -5 }, next: 25 },
                    { text: "征求老师和父母意见", effect: { parents: 3, teacher: 3, stress: -3 }, next: 25 }
                ]
            },
            {
                id: 25,
                week: 24,
                day: 3,
                title: "寒假前夜",
                content: "期末考试结束,你考进了班级前10。寒假来临,但你知道,真正的冲刺才刚刚开始。",
                choices: [
                    { text: "制定寒假计划,全力冲刺", effect: { energy: 5, stress: -5 }, next: 26 },
                    { text: "先放松几天,再学习", effect: { energy: 10, stress: -10 }, next: 26 },
                    { text: "感到疲惫,想放弃", effect: { stress: 10 }, next: 26 }
                ]
            },
            {
                id: 26,
                week: 26,
                day: 6,
                title: "寒假自习室",
                content: "你发现'卷王'同桌和几个同学组了个线上自习室,互相监督。她也在里面。犹豫了一下,你发送了加入申请。",
                choices: [
                    { text: "打开摄像头,沉浸学习", effect: { energy: 5, crush: 3, classmateA: 5 }, next: 27 },
                    { text: "只开麦,偶尔讨论问题", effect: { stress: -3, subjects: { all: 1 } }, next: 27 },
                    { text: "潜水中,感受氛围", effect: { stress: -5 }, next: 27 }
                ]
            },
            {
                id: 27,
                week: 30,
                day: 5,
                title: "感悟",
                content: "亲戚们问起你的成绩,父母骄傲地说:'进步很大!'你突然意识到,自己的努力不仅是为了自己,也为了不辜负他们的期望。",
                choices: [
                    { text: "感到责任重大", effect: { parents: 5, stress: 5 }, next: 28 },
                    { text: "感到温暖和支持", effect: { parents: 8, stress: -5 }, next: 28 },
                    { text: "感到压力倍增", effect: { stress: 10 }, next: 28 }
                ]
            },
            {
                id: 28,
                week: 32,
                day: 1,
                title: "二模之后",
                content: "第二次模拟考排名稳中有进,但离梦想学校还有距离。老师在分析试卷时说:'有些人的潜力,会在最后两个月才真正爆发。'你感觉他在看你。",
                choices: [
                    { text: "备受鼓舞,细化每日计划", effect: { energy: 10, teacher: 5, stress: 3 }, next: 29 },
                    { text: "压力倍增,害怕辜负期望", effect: { stress: 10 }, next: 29 },
                    { text: "平静分析,查漏补缺", effect: { stress: -2, subjects: { all: 1 } }, next: 29 }
                ]
            },
            {
                id: 29,
                week: 35,
                day: 2,
                title: "倒计时100天",
                content: "黑板上的数字变成100。教室里弥漫着紧张的气氛,但你感到一种奇怪的平静。两年竞赛,一年WHK,你已经准备好了。",
                choices: [
                    { text: "充满信心,迎接挑战", effect: { stress: 10, energy: 20 }, next: 30 },
                    { text: "按部就班,保持节奏", effect: { stress: 5 }, next: 30 },
                    { text: "紧张不安,难以入眠", effect: { stress: 10, energy: -5 }, next: 30 }
                ]
            },
            {
                id: 30,
                week: 38,
                day: 5,
                title: "战友的约定",
                content: "'卷王'同桌在放学后叫住你:'最后几十天了,比比看谁下次周考数学高?输了请喝奶茶。'你看到他眼里的认真,不只是玩笑。",
                choices: [
                    { text: "欣然应战,击掌为誓", effect: { classmateA: 10, energy: 8, stress: -3 }, next: 31 },
                    { text: "苦笑说压力好大,但接受", effect: { stress: 5, classmateA: 5 }, next: 31 },
                    { text: "拒绝,说不想分心", effect: { stress: -2, classmateA: -3 }, next: 31 }
                ]
            },


            {
                id: 31,
                week: 40,
                day: 4,
                title: "最后的冲刺",
                content: "小假期,你拒绝了所有邀约,每天学习16小时。虽然辛苦,但你知道,这是最后的冲刺。",
                choices: [
                    { text: "坚持到底,不放弃", effect: { energy: -10, stress: 5, subjects: { all: 2 }, health: -5 }, next: 32 },
                    { text: "适当休息,劳逸结合", effect: { energy: 5, stress: -5 }, next: 32 },
                    { text: "感到崩溃,想放弃", effect: { stress: 15, energy: -15 }, next: 32 }
                ]
            },
            {
                id: 32,
                week: 42,
                day: 0,
                title: "一场重感冒",
                content: "连日的疲劳积累,你终于病倒了。高烧时迷迷糊糊,想起以前竞赛前也总这样。母亲守在床边,用湿毛巾给你敷额头,就像小时候一样。",
                choices: [
                    { text: "愧疚又温暖,乖乖休息", effect: { parents: 8, energy: 15, stress: -10 }, next: 33 },
                    { text: "心急如焚,想爬起来看书", effect: { energy: -10, stress: 10, parents: -2, health: -30 }, next: 33 },
                    { text: "昏昏沉沉,只想睡觉", effect: { energy: 20, stress: -5 }, next: 33 }
                ]
            },
            {
                id: 33,
                week: 45,
                day: 1,
                title: "最后的告别",
                content: "高考前60天,你整理书桌,翻出那张合影。照片背面写着:'To be continued...'你笑了笑,把它收进抽屉。是的,故事还在继续。",
                choices: [
                    { text: "充满期待,迎接挑战", effect: { stress: -10, energy: 10 }, next: 34 },
                    { text: "平静接受,顺其自然", effect: { stress: -5 }, next: 34 },
                    { text: "紧张不安,难以入眠", effect: { stress: 10, energy: -5, health: -10 }, next: 34 }
                ]
            },
            {
                id: 34,
                week: 48,
                day: 3,
                title: "最后的答疑",
                content: "放学后,你鼓起勇气向暗恋的她问了道一直没弄懂的语文古诗鉴赏题。她讲得很仔细,夕阳把两个人的影子拉得很长。讲完后,两人都沉默了一会儿。",
                choices: [
                    { text: "轻声说'谢谢,一起加油'", effect: { crush: 5, stress: -8, energy: 5 }, next: 35 },
                    { text: "开玩笑缓解气氛'考完再谢你'", effect: { crush: 3, stress: -5 }, next: 35 },
                    { text: "点点头,匆忙收拾书包离开", effect: { stress: 3, crush: -3 }, next: 35 }
                ]
            },
            {
                id: 35,
                week: 50,
                day: 6,
                title: "高考前夜",
                content: "你躺在床上,回想这一年。从迷茫到坚定,从失落到希望。无论结果如何,你都已经成长。马上就是检验的时刻。",
                choices: [
                    { text: "充满信心,安然入睡", effect: { stress: -10, energy: 5 }, next: 36 },
                    { text: "平静接受,顺其自然", effect: { stress: -5 }, next: 36 },
                    { text: "紧张复习,最后冲刺", effect: { energy: -10, stress: 10 }, next: 36 }
                ]
            },
            {
                id: 36,
                week: 51,
                day: 6,
                title: "承诺",
                content: "她找到你:'高考加油!我们......'",
                choices: [
                    { text: "相约考后,共赴山海", effect: { stress: 5, energy: 5, crush: 10 }, next: null },
                    { text: "默默点头,转身离去", effect: { stress: 10, energy: 5, crush: 5 }, next: null },
                    { text: "心乱如麻,无言以对", effect: { energy: -10, stress: 10, crush: -2 }, next: null }
                ]
            },
        ];





        // 隐藏剧情(特殊条件触发)
        const hiddenEvents = [
            {
                id: 'h1',
                condition: (state) => state.relationships.crush >= 60 && state.week >= 20,
                title: "秘密基地",
                content: "她带你来到学校天台,说这是她的秘密基地。你们靠在一起一起看夕阳,聊未来。这是你AFO后最放松的时刻。",
                effect: { crush: 5, stress: -15, energy: 5 }
            },
            {
                id: 'h2',
                condition: (state) => state.memoryCount >= 5 && state.week >= 15,
                title: "教练的电话",
                content: "OI教练打来电话:'无论选择什么,都要做到最好,加油!'",
                effect: { stress: -10, energy: 5, mental: 5 }
            },
            {
                id: 'h3',
                condition: (state) => state.relationships.parents >= 80 && state.week >= 10,
                title: "父母的信",
                content: "你在书包里发现父母写的一封信:'孩子,我们为你骄傲。不是因为成绩,而是因为你的坚持。'",
                effect: { parents: 10, stress: -15, mental: 10 }
            },
            {
                id: 'h4',
                condition: (state) => state.subjects.math >= 90 && state.subjects.physics >= 90,
                title: "数学竞赛邀请",
                content: "数学老师邀请你参加一个数学竞赛,说:'虽然你AFO了,但你的天赋不该浪费。'",
                choices: [
                    { text: "参加比赛,证明自己", effect: { stress: 10, math: 3, teacher: 5 } },
                    { text: "拒绝,专心高考", effect: { stress: -5, teacher: -2 } }
                ]
            },
            {
                id: 'h5',
                condition: (state) => state.week === 26 && state.season === 3,
                title: "春节的礼物",
                content: "春节,爷爷给你一个红包,说:'这是我这几个月攒下的,给你买复习资料。'你感动得说不出话。",
                effect: { money: 1000, parents: 5, stress: -10 }
            },
            {
                id: 'h6',
                condition: (state) => state.week === 45 && state.subjects.math >= 90 && state.subjects.physics >= 90 && state.subjects.biology >= 90 && state.subjects.chemistry >= 90 && state.subjects.english <= 20 && state.subjects.chinese <= 20,
                title: "开小灶",
                content: "高考在即,但是你的语文和英语严重拖累了你的总分,学校决定给你的语文和英语开小灶",
                effect:

                    { chinese: 20, english: 20 }
            }
        ];

        // 成就系统(60个成就)
        const achievements = {
            // 基础成就
            'first-week': { name: '第一周', desc: '完成第一周', hidden: false },
            'first-month': { name: '第一个月', desc: '完成第一个月', hidden: false },
            'study-100': { name: '书山有路', desc: '累计学习100小时', hidden: false },
            'rest-50': { name: '劳逸结合', desc: '累计休息50小时', hidden: false },
            'exercise-30': { name: '强身健体', desc: '累计锻炼30小时', hidden: false },
            'social-20': { name: '社交达人', desc: '累计社交20小时', hidden: false },

            // 状态成就
            'energy-100': { name: '精力充沛', desc: '精力达到100', hidden: false },
            'stress-0': { name: '零压力', desc: '压力降为0', hidden: false },
            'health-100': { name: '身体健康', desc: '健康达到100', hidden: false },
            'mental-100': { name: '心理强大', desc: '心理达到100', hidden: false },
            'money-1000': { name: '小有积蓄', desc: '存款达到1000元', hidden: false },
            'money-0': { name: '月光族', desc: '存款为0', hidden: false },

            // 学科成就
            'chinese-80': { name: '文采飞扬', desc: '语文达到80', hidden: false },
            'math-90': { name: '数学大师', desc: '数学达到90', hidden: false },
            'english-80': { name: '英语流利', desc: '英语达到80', hidden: false },
            'physics-90': { name: '物理之神', desc: '物理达到90', hidden: false },
            'chemistry-80': { name: '化学专家', desc: '化学达到80', hidden: false },
            'biology-80': { name: '生物达人', desc: '生物达到80', hidden: false },
            'all-85': { name: '全科高手', desc: '全科达到85', hidden: false },
            'all-95': { name: '六边形战士', desc: '全科达到95', hidden: true },

            // 关系成就
            'teacher-90': { name: '班主任宠儿', desc: '班主任关系90', hidden: false },
            'math-teacher-90': { name: '数学老师喜爱', desc: '数学老师关系90', hidden: false },
            'parents-90': { name: '家庭和睦', desc: '父母关系90', hidden: false },
            'crush-60': { name: '暗恋成功', desc: 'crush关系60', hidden: false },
            'classmate-90': { name: '同学领袖', desc: '同学关系90', hidden: false },

            // 活动成就
            'exam-5': { name: '考试战士', desc: '参加5次模考', hidden: false },
            'homework-100': { name: '作业达人', desc: '完成100次作业', hidden: false },
            'activity-20': { name: '活动家', desc: '参加20次活动', hidden: false },
            'memory-10': { name: '回忆大师', desc: '回忆10次', hidden: false },

            // 特殊成就
            'perfect-week': { name: '完美一周', desc: '一周无负面事件', hidden: false },
            'stress-management': { name: '压力管理', desc: '压力低于10持续10周', hidden: false },
            'early-bird': { name: '早起鸟', desc: '精力保持90+持续5周', hidden: false },
            'night-owl': { name: '夜猫子', desc: '精力低于10', hidden: false },
            'money-maker': { name: '赚钱能手', desc: '通过兼职赚500元', hidden: false },
            'specialization': { name: '专精之路', desc: '选择专精方向', hidden: false },

            // 故事成就
            'story-5': { name: '故事开始', desc: '完成5个故事事件', hidden: false },
            'story-10': { name: '故事大师', desc: '完成10个故事事件', hidden: false },
            'story-15': { name: '史诗旅程', desc: '完成所有故事事件', hidden: false },
            'hidden-1': { name: '隐藏剧情1', desc: '触发隐藏剧情', hidden: true },
            'hidden-2': { name: '隐藏剧情2', desc: '触发隐藏剧情', hidden: true },
            'hidden-3': { name: '隐藏剧情3', desc: '触发隐藏剧情', hidden: true },

            // 结局成就(12个)
            'ending-1': { name: '结局:顶尖大学', desc: '考入顶尖大学', hidden: false },
            'ending-2': { name: '结局:重点大学', desc: '考入重点大学', hidden: false },
            'ending-3': { name: '结局:一本大学', desc: '考入一本大学', hidden: false },
            'ending-4': { name: '结局:二本大学', desc: '考入二本大学', hidden: false },
            'ending-5': { name: '结局:未能如愿', desc: '高考失利', hidden: false },
            'ending-6': { name: '结局:竞赛回归', desc: '重返信息学', hidden: false },
            'ending-7': { name: '结局:创业之路', desc: '选择创业', hidden: false },
            'ending-8': { name: '结局:艺术特长', desc: '艺术发展', hidden: false },
            'ending-9': { name: '结局:体育特招', desc: '体育发展', hidden: false },
            'ending-10': { name: '结局:出国深造', desc: '出国留学', hidden: false },
            'ending-11': { name: '结局:间隔年', desc: '选择间隔年', hidden: false },
            'ending-12': { name: '结局:平凡之路', desc: '平凡生活', hidden: false },

            // 隐藏结局
            'ending-hidden-1': { name: '结局:爱情与学业', desc: '和crush一起成功', hidden: true },
            'ending-hidden-2': { name: '结局:家庭和解', desc: '与父母达成理解', hidden: true },
            'ending-hidden-3': { name: '结局:自我救赎', desc: '找到人生意义', hidden: true }
        };

        // ==================== 游戏逻辑 ====================

        // DOM 元素缓存
        const elements = {
            week: document.getElementById('week'),
            day: document.getElementById('day'),
            period: document.getElementById('period'),
            season: document.getElementById('season'),
            daysLeft: document.getElementById('days-left'),
            vacationDays: document.getElementById('vacation-days'),

            energyBar: document.getElementById('energy-bar'),
            energyValue: document.getElementById('energy-value'),
            stressBar: document.getElementById('stress-bar'),
            stressValue: document.getElementById('stress-value'),
            healthBar: document.getElementById('health-bar'),
            healthValue: document.getElementById('health-value'),
            mentalBar: document.getElementById('mental-bar'),
            mentalValue: document.getElementById('mental-value'),
            moneyBar: document.getElementById('money-bar'),
            moneyValue: document.getElementById('money-value'),
            anxietyBar: document.getElementById('anxiety-bar'), // 新增焦虑元素
            anxietyValue: document.getElementById('anxiety-value'), // 新增焦虑元素

            chineseBar: document.getElementById('chinese-bar'),
            chineseValue: document.getElementById('chinese-value'),
            mathBar: document.getElementById('math-bar'),
            mathValue: document.getElementById('math-value'),
            englishBar: document.getElementById('english-bar'),
            englishValue: document.getElementById('english-value'),
            physicsBar: document.getElementById('physics-bar'),
            physicsValue: document.getElementById('physics-value'),
            chemistryBar: document.getElementById('chemistry-bar'),
            chemistryValue: document.getElementById('chemistry-value'),
            biologyBar: document.getElementById('biology-bar'),
            biologyValue: document.getElementById('biology-value'),

            teacherBar: document.getElementById('teacher-bar'),
            teacherValue: document.getElementById('teacher-value'),
            mathTeacherBar: document.getElementById('math-teacher-bar'),
            mathTeacherValue: document.getElementById('math-teacher-value'),
            chineseTeacherBar: document.getElementById('chinese-teacher-bar'),
            chineseTeacherValue: document.getElementById('chinese-teacher-value'),
            englishTeacherBar: document.getElementById('english-teacher-bar'),
            englishTeacherValue: document.getElementById('english-teacher-value'),
            classmateABar: document.getElementById('classmate-a-bar'),
            classmateAValue: document.getElementById('classmate-a-value'),
            classmateBBar: document.getElementById('classmate-b-bar'),
            classmateBValue: document.getElementById('classmate-b-value'),
            parentsBar: document.getElementById('parents-bar'),
            parentsValue: document.getElementById('parents-value'),
            crushBar: document.getElementById('crush-bar'),
            crushValue: document.getElementById('crush-value'),

            eventLog: document.getElementById('event-log'),
            currentStatus: document.getElementById('current-status'),
            randomEvent: document.getElementById('random-event'),
            relationshipStatus: document.getElementById('relationship-status'),
            economyStatus: document.getElementById('economy-status'),
            mentalStatus: document.getElementById('mental-status'),
            anxietyStatus: document.getElementById('anxiety-status'), // 新增焦虑文本
            currentGoal: document.getElementById('current-goal'),
            goalProgress: document.getElementById('goal-progress'),

            scheduleList: document.getElementById('schedule-list'),
            homeworkCount: document.getElementById('homework-count'),
            weekActivities: document.getElementById('week-activities'),

            notification: document.getElementById('notification'),
            notificationText: document.getElementById('notification-text'),

            gameStatus: document.getElementById('game-status'),

            actionCounter: document.getElementById('actionCounter'),
            hotkeyHint: document.getElementById('hotkeyHint'),

            achievementCount: document.getElementById('achievement-count'),
            achievementList: document.getElementById('achievement-list'),

            currentMoney: document.getElementById('current-money'),
            homeworkList: document.getElementById('homework-list'),
            storyTitle: document.getElementById('story-title'),
            storyContent: document.getElementById('story-content'),
            storyChoices: document.getElementById('story-choices'),
            goalContent: document.getElementById('goal-content'),
            achievementDetailContent: document.getElementById('achievement-detail-content')
        };

        // ==================== 核心游戏函数 ====================

        // 初始化游戏
        function initGame() {
            // 显示启动弹窗(捐助+介绍)
            document.getElementById('welcome-modal').style.display = 'flex';

            // 生成第一周课程表
            generateSchedule();
            addToLog("游戏开始!你从信息学竞赛中退役,开始了文化课的备战。", "story");
            addToLog("班主任找你谈话:'竞赛的思维是优势,但要适应新的节奏。'", "neutral");

            // 随机初始天气
            changeWeather();

            // 检查特殊日期
            checkSpecialDay();

            // 更新UI
            updateUI();
        }

        // 生成课程表
        function generateSchedule() {
            const subjects = ['语文', '数学', '英语', '物理', '化学', '生物'];
            const times = ['8:00', '9:00', '10:00', '11:00', '14:00', '15:00', '16:00'];

            gameState.schedule = [];

            // 每周6天课程(周一到周六)
            for (let day = 0; day < 6; day++) {
                const dayName = ['周一', '周二', '周三', '周四', '周五', '周六'][day];
                const numClasses = 3 + Math.floor(Math.random() * 3); // 3-5节课

                for (let i = 0; i < numClasses; i++) {
                    const subject = subjects[Math.floor(Math.random() * subjects.length)];
                    const time = times[i];

                    gameState.schedule.push({
                        day: day,
                        dayName: dayName,
                        time: time,
                        subject: subject,
                        completed: false
                    });
                }
            }

            // 周日休息
            updateScheduleUI();
        }

        // 更新课程表UI
        function updateScheduleUI() {
            elements.scheduleList.innerHTML = '';

            if (gameState.schedule.length === 0) {
                elements.scheduleList.innerHTML = '<div style="opacity:0.6;font-size:0.85rem;">本周无课程安排</div>';
                return;
            }

            // 只显示本周未完成的课程
            const upcoming = gameState.schedule.filter(s => !s.completed).slice(0, 8);

            upcoming.forEach(item => {
                const div = document.createElement('div');
                div.className = 'schedule-item';
                if (item.completed) div.classList.add('completed');

                div.innerHTML = `
                                                                                                                                                                                                                                                                                                                                                <span>${item.dayName} ${item.time}</span>
                                                                                                                                                                                                                                                                                                                                                <span class="time">${item.subject}</span>
                                                                                                                                                                                                                                                                                                                                            `;

                elements.scheduleList.appendChild(div);
            });

            if (upcoming.length === 0) {
                elements.scheduleList.innerHTML = '<div style="opacity:0.6;font-size:0.85rem;">本周课程已完成!</div>';
            }
        }

        // 更新UI
        function updateUI() {
            // 时间显示
            elements.week.textContent = gameState.week;
            elements.day.textContent = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'][gameState.dayOfWeek];
            elements.period.textContent = ['早晨', '上午', '下午', '晚上'][gameState.period];
            elements.season.textContent = `${seasons[gameState.season].emoji} ${seasons[gameState.season].name}`;
            elements.daysLeft.textContent = gameState.daysLeft;
            elements.vacationDays.textContent = gameState.vacationDays;

            // 核心状态
            elements.energyBar.style.width = `${gameState.energy}%`;
            elements.energyValue.textContent = `${Math.round(gameState.energy)}/100`;

            elements.stressBar.style.width = `${gameState.stress}%`;
            elements.stressValue.textContent = `${Math.round(gameState.stress)}/100`;

            // 焦虑更新
            elements.anxietyBar.style.width = `${gameState.anxiety}%`;
            elements.anxietyValue.textContent = `${Math.round(gameState.anxiety)}/100`;

            elements.healthBar.style.width = `${gameState.health}%`;
            elements.healthValue.textContent = `${Math.round(gameState.health)}/100`;

            elements.mentalBar.style.width = `${gameState.mental}%`;
            elements.mentalValue.textContent = `${Math.round(gameState.mental)}/100`;

            elements.moneyBar.style.width = `${Math.min(100, gameState.money / 10)}%`;
            elements.moneyValue.textContent = `${gameState.money}元`;

            // 学科进度
            for (const subject in gameState.subjects) {
                const bar = document.getElementById(`${subject}-bar`);
                const value = document.getElementById(`${subject}-value`);
                if (bar && value) {
                    bar.style.width = `${gameState.subjects[subject]}%`;
                    value.textContent = `${Math.round(gameState.subjects[subject])}/100`;
                }
            }

            // 人际关系
            const relMap = {
                teacher: { bar: elements.teacherBar, value: elements.teacherValue },
                mathTeacher: { bar: elements.mathTeacherBar, value: elements.mathTeacherValue },
                chineseTeacher: { bar: elements.chineseTeacherBar, value: elements.chineseTeacherValue },
                englishTeacher: { bar: elements.englishTeacherBar, value: elements.englishTeacherValue },
                classmateA: { bar: elements.classmateABar, value: elements.classmateAValue },
                classmateB: { bar: elements.classmateBBar, value: elements.classmateBValue },
                parents: { bar: elements.parentsBar, value: elements.parentsValue },
                crush: { bar: elements.crushBar, value: elements.crushValue }
            };

            for (const key in relMap) {
                const val = gameState.relationships[key];
                relMap[key].bar.style.width = `${val}%`;
                relMap[key].value.textContent = Math.round(val);
            }

            // 作业计数
            const homeworkCount = Object.values(gameState.homework).filter(v => !v).length;
            elements.homeworkCount.textContent = homeworkCount;

            // 活动计数
            elements.weekActivities.textContent = gameState.weekActivities;

            // 操作计数器
            updateActionCounter();

            // 更新状态文本
            updateStatusText();
            updateRelationshipText();
            updateEconomyText();
            updateMentalText();
            updateAnxietyText(); // 新增焦虑文本更新
            updateGoalText();

            // 更新课程表
            if (gameState.schedule.length > 0) {
                updateScheduleUI();
            }
        }

        // 更新操作计数器
        function updateActionCounter() {
            const counter = elements.actionCounter;
            const used = gameState.actionsThisWeek;
            const max = gameState.maxActionsPerWeek;
            const remaining = max - used;

            counter.textContent = `本周操作: ${used}/${max} | 剩余: ${remaining}`;

            // 根据剩余操作数改变颜色
            counter.className = 'action-counter';
            if (remaining === 1) counter.classList.add('warning');
            if (remaining === 0) counter.classList.add('danger');
        }

        // 更新状态文本
        function updateStatusText() {
            let status = "";
            const energy = gameState.energy;
            const stress = gameState.stress;
            const health = gameState.health;
            const mental = gameState.mental;

            if (health < 40) {
                status = "⚠️ 身体不适!健康状况堪忧,需要立即休息。";
            } else if (stress > 80) {
                status = "🔥 压力爆表!濒临崩溃,急需释放!";
            } else if (energy < 20) {
                status = "😴 精力枯竭,学习效率极低。";
            } else if (mental < 40) {
                status = "💭 心理状态不佳,需要关注情绪。";
            } else if (energy > 80 && stress < 30 && health > 80 && mental > 80) {
                status = "✨ 状态巅峰!正是学习的好时机!";
            } else if (energy > 60 && stress < 50) {
                status = "📚 状态良好,保持节奏。";
            } else {
                status = "🔄 需要平衡学习与休息。";
            }

            elements.currentStatus.textContent = status;
        }

        // 更新关系文本
        function updateRelationshipText() {
            const t = gameState.relationships.teacher;
            const mt = gameState.relationships.mathTeacher;
            const ct = gameState.relationships.chineseTeacher;
            const et = gameState.relationships.englishTeacher;
            const ca = gameState.relationships.classmateA;
            const cb = gameState.relationships.classmateB;
            const p = gameState.relationships.parents;
            const cr = gameState.relationships.crush;

            let text = "";

            if (t > 70) text += "老师很器重你。";
            else if (t < 30) text += "老师对你有些失望。";
            else text += "与老师关系正常。";

            if (ca > 70 || cb > 70) text += " 同学们很认可你。";
            else if (ca < 30 && cb < 30) text += " 与同学有些疏远。";
            else text += " 同学关系一般。";

            if (p > 70) text += " 父母很支持。";
            else if (p < 30) text += " 父母不太理解。";
            else text += " 父母关系正常。";

            if (cr > 50) text += " crush对你有好感!";
            else if (cr > 20) text += " crush注意到你了。";

            elements.relationshipStatus.textContent = text;
        }

        // 更新经济文本
        function updateEconomyText() {
            const money = gameState.money;
            let text = "";

            if (money > 800) text = "经济宽裕,可以购买任何资料。";
            else if (money > 400) text = "经济状况良好,足够日常开销。";
            else if (money > 100) text = "经济一般,需要精打细算。";
            else text = "经济紧张,可能需要向父母求助。";

            elements.economyStatus.textContent = text;
        }

        // 更新心理文本
        function updateMentalText() {
            const mental = gameState.mental;
            const stress = gameState.stress;
            let text = "";

            if (mental > 80 && stress < 30) text = "心理状态非常健康,情绪稳定。";
            else if (mental > 60) text = "心理状态良好,能够应对压力。";
            else if (mental > 40) text = "心理状态一般,需要多关注自己。";
            else text = "心理状态不佳,建议寻求帮助。";

            elements.mentalStatus.textContent = text;
        }

        // 更新焦虑文本
        function updateAnxietyText() {
            const anxiety = gameState.anxiety;
            let text = "";

            if (anxiety > 80) text = "😰 极度焦虑!心神不宁,无法集中注意力。急需心理辅导!";
            else if (anxiety > 50) text = "😟 感到焦虑,常常担心未来,学习效率下降。";
            else if (anxiety > 20) text = "😐 偶尔感到不安,但整体可控。";
            else text = "😌 心态平和,专注于当下。";

            elements.anxietyStatus.textContent = text;
        }

        // 更新目标文本
        function updateGoalText() {
            if (!gameState.currentGoal) {
                elements.currentGoal.textContent = "暂无目标";
                elements.goalProgress.style.width = '0%';
                return;
            }

            const goal = gameState.currentGoal;
            elements.currentGoal.textContent = goal.desc;

            // 计算进度(0-100)
            let progress = 0;
            if (goal.check(gameState)) {
                progress = 100;
                elements.goalProgress.style.background = 'var(--secondary)';
            } else {
                // 根据接近程度计算进度
                const avg = Object.values(gameState.subjects).reduce((a, b) => a + b, 0) / 6;
                const targetAvg = goal.desc.includes('20分') ? 20 : goal.desc.includes('40分') ? 40 : goal.desc.includes('50分') ? 50 : goal.desc.includes('65分') ? 65 : goal.desc.includes('75分') ? 75 : 85;
                const avgProgress = Math.min(100, (avg / targetAvg) * 50);

                let otherProgress = 0;
                if (goal.desc.includes('压力')) {
                    const targetStress = goal.desc.includes('低于40') ? 40 : goal.desc.includes('低于30') ? 30 : 20;
                    otherProgress += Math.max(0, 100 - (gameState.stress / targetStress) * 50);
                }
                if (goal.desc.includes('健康')) {
                    otherProgress += Math.min(50, (gameState.health / 80) * 50);
                }
                if (goal.desc.includes('作业')) {
                    const homeworkCount = Object.values(gameState.homework).filter(v => v).length;
                    otherProgress += Math.min(50, (homeworkCount / 5) * 50);
                }
                if (goal.desc.includes('模考')) {
                    otherProgress += Math.min(50, (gameState.examCount / 3) * 50);
                }

                progress = Math.min(100, avgProgress + otherProgress);
                elements.goalProgress.style.background = 'var(--warning)';
            }

            elements.goalProgress.style.width = `${progress}%`;
        }

        // 显示通知
        function showNotification(text, type = "neutral") {
            elements.notificationText.textContent = text;
            elements.notification.className = `notification ${type} show`;

            setTimeout(() => {
                elements.notification.classList.remove('show');
            }, 4000);
        }

        // 添加事件到日志
        function addToLog(text, type = "neutral") {
            const eventItem = document.createElement('div');
            eventItem.className = `event-item ${type}`;

            const timestamp = document.createElement('span');
            timestamp.className = 'timestamp';
            timestamp.textContent = `W${gameState.week} ${['一', '二', '三', '四', '五', '六', '日'][gameState.dayOfWeek]}`;
            eventItem.appendChild(timestamp);

            const content = document.createTextNode(text);
            eventItem.appendChild(content);

            elements.eventLog.insertBefore(eventItem, elements.eventLog.firstChild);

            // 限制日志条目数量
            while (elements.eventLog.children.length > 20) {
                elements.eventLog.removeChild(elements.eventLog.lastChild);
            }

            // 滚动到顶部
            elements.eventLog.scrollTop = 0;
        }

        // ==================== 操作函数 ====================

        // 检查操作限制
        function checkActionLimit() {
            if (gameState.actionsThisWeek >= gameState.maxActionsPerWeek) {
                showNotification("本周操作次数已用完,请结束本周!", "bad");
                return false;
            }
            return true;
        }

        // 记录操作
        function recordAction() {
            gameState.actionsThisWeek++;
            updateActionCounter();
        }

        // 计算学习效率(受心理、关系、状态、焦虑影响)
        // function calculateStudyEfficiency() {
        //     let efficiency = 1.0;

        //     // 心理状态影响(30%)
        //     const mentalFactor = gameState.mental / 100;
        //     efficiency *= (0.7 + mentalFactor * 0.3);

        //     // 压力影响(20%)
        //     const stressFactor = Math.max(0.5, 1 - gameState.stress / 100);
        //     efficiency *= stressFactor;

        //     // 焦虑影响(新增):焦虑越高效率越低
        //     const anxietyFactor = Math.max(0.6, 1 - (gameState.anxiety / 200)); // 最高影响20%
        //     efficiency *= anxietyFactor;

        //     // 健康影响(15%)
        //     const healthFactor = gameState.health / 100;
        //     efficiency *= (0.85 + healthFactor * 0.15);

        //     // 精力影响(15%)
        //     const energyFactor = gameState.energy / 100;
        //     efficiency *= (0.85 + energyFactor * 0.15);

        //     // 关系影响(10%)
        //     const relFactor = (gameState.relationships.teacher + gameState.relationships.mathTeacher + gameState.relationships.chineseTeacher + gameState.relationships.englishTeacher) / 400;
        //     efficiency *= (0.9 + relFactor * 0.1);

        //     // 天气影响(10%)
        //     efficiency *= gameState.currentWeather.efficiency;

        //     return efficiency;
        // }
        function calculateStudyEfficiency() {
            let efficiency = 1.0;

            // 心理影响(30%)
            efficiency *= (0.7 + (gameState.mental / 100) * 0.3);

            // 压力影响(非线性)
            if (gameState.stress > 70) efficiency *= 0.65;
            else if (gameState.stress > 50) efficiency *= 0.8;
            else efficiency *= (1 - gameState.stress / 200);

            // 焦虑影响(关键调整:高焦虑严重惩罚)
            const anxietyFactor = Math.max(0.5, 1 - (gameState.anxiety / 80));
            efficiency *= anxietyFactor;

            // 健康影响
            if (gameState.health < 40) efficiency *= 0.6;
            else if (gameState.health < 65) efficiency *= 0.85;

            // 精力影响
            efficiency *= (0.6 + gameState.energy / 250);

            // 关系影响(老师平均好感度)
            const teacherAvg = (gameState.relationships.teacher +
                gameState.relationships.mathTeacher +
                gameState.relationships.chineseTeacher +
                gameState.relationships.englishTeacher) / 4;
            efficiency *= (0.85 + teacherAvg / 300);

            // 天气影响
            efficiency *= gameState.currentWeather.efficiency;

            return Math.max(0.3, efficiency);
        }

        // 学习功能
        function study(subject) {
            if (!checkActionLimit()) return;
            if (gameState.energy < 15) {
                showNotification("精力不足,无法学习!", "bad");
                return;
            }
            if (gameState.health < 30) {
                showNotification("身体不适,先休息吧!", "bad");
                return;
            }

            const config = {
                chinese: { cost: 25, baseGain: [2, 3], name: "语文" },
                math: { cost: 35, baseGain: [3, 6], name: "数学" },
                english: { cost: 25, baseGain: [2, 3], name: "英语" },
                physics: { cost: 35, baseGain: [3, 6], name: "物理" },
                chemistry: { cost: 20, baseGain: [2, 4], name: "化学" },
                biology: { cost: 20, baseGain: [2, 4], name: "生物" }
            };

            const cfg = config[subject];

            // 消耗资源
            gameState.energy -= cfg.cost;
            gameState.stress += (Math.random() * 10);
            gameState.health -= 2;
            gameState.totalStudyHours++;

            // 学习略微增加焦虑
            gameState.anxiety = Math.min(100, gameState.anxiety + (Math.random() * 5));

            // 计算增益
            let gain = 3 * (Math.random() * (cfg.baseGain[1] - cfg.baseGain[0]) + cfg.baseGain[0]);

            // 竞赛背景加成
            if (subject === 'math' || subject === 'physics') {
                gain *= 1.4; // 40%加成
            }

            // 当前水平影响(越高越难提升)
            const currentLevel = gameState.subjects[subject];
            gain *= (1 - currentLevel / 200);

            // 综合效率计算
            const efficiency = calculateStudyEfficiency();
            gain *= efficiency;

            // 随机波动
            gain *= (0.8 + Math.random() * 0.4);

            // 应用增益
            gameState.subjects[subject] = Math.min(100, currentLevel + gain);

            // 添加日志
            addToLog(`学习了${cfg.name},能力提升了${gain.toFixed(1)}点`, "good");

            // 焦虑高提示
            if (gameState.anxiety > 60 && efficiency < 0.8) {
                showNotification("由于焦虑,学习效率有所下降...", "bad");
            }

            // 随机事件
            if (Math.random() < 0.4) {
                triggerRandomEvent();
            }

            closeModal('study-modal');
            recordAction();
            advanceTime();
            updateUI();

            // 检查精力耗尽
            if (gameState.energy <= 0) {
                addToLog("精力耗尽,被迫休息!", "bad");
                gameState.energy = 0;
                gameState.health -= 5;
            }
        }

        // 休息功能
        function rest(type) {
            if (!checkActionLimit()) return;

            let energyGain = 0;
            let stressReduction = 0;
            let anxietyReduction = 0; // 焦虑降低
            let mentalGain = 0;
            let healthChange = 0;
            let moneyCost = 0;
            let text = "";

            switch (type) {
                case 'sleep':
                    energyGain = 30;
                    stressReduction = 10;
                    anxietyReduction = 1; // 睡眠也微量降低焦虑
                    healthChange = 2;
                    text = "深度睡眠恢复了精力";
                    break;
                case 'nap':
                    energyGain = 15;
                    stressReduction = 5;
                    healthChange = 1;
                    text = "午睡帮助恢复了部分精力";
                    break;
                case 'relax':
                    energyGain = 10;
                    stressReduction = 15;
                    anxietyReduction = 5; // 放松明显降低焦虑
                    text = "放松娱乐减轻了压力和焦虑";
                    break;
                case 'music':
                    energyGain = 5;
                    stressReduction = 8;
                    anxietyReduction = 2;
                    text = "听音乐放松了心情";
                    break;
                case 'counseling':
                    if (gameState.money < 100) {
                        showNotification("心理咨询需要100元,钱不够!", "bad");
                        return;
                    }
                    moneyCost = 100;
                    mentalGain = 20;
                    stressReduction = 15;
                    anxietyReduction = 25; // 心理咨询大幅降低焦虑
                    text = "心理咨询帮助很大,焦虑感大幅减轻";
                    break;
            }

            gameState.energy = Math.min(100, gameState.energy + energyGain);
            gameState.stress = Math.max(0, gameState.stress - stressReduction);
            gameState.anxiety = Math.max(0, gameState.anxiety - anxietyReduction);
            gameState.health = Math.min(100, gameState.health + healthChange);
            gameState.mental = Math.min(100, gameState.mental + mentalGain);
            gameState.money -= moneyCost;
            gameState.totalRestHours++;

            addToLog(text, "good");
            showNotification(`${text},精力+${energyGain},焦虑-${anxietyReduction}`, "good");

            closeModal('rest-modal');
            recordAction();
            advanceTime();
            updateUI();
        }

        // 锻炼功能
        function exercise() {
            if (!checkActionLimit()) return;
            if (gameState.energy < 25) {
                showNotification("太累了,无法锻炼!", "bad");
                return;
            }
            if (gameState.health < 40) {
                showNotification("身体不适,不宜剧烈运动!", "bad");
                return;
            }

            gameState.energy -= 25;
            gameState.stress = Math.max(0, gameState.stress - 18);
            gameState.anxiety = Math.max(0, gameState.anxiety - 3); // 运动微量减少焦虑
            gameState.health = Math.min(100, gameState.health + 3);
            gameState.energy = Math.min(100, gameState.energy + 12);
            gameState.totalExerciseHours++;

            addToLog("体育锻炼释放了压力,身体更健康了", "good");
            showNotification("锻炼效果显著!压力-18,健康+3", "good");

            if (Math.random() < 0.25) {
                addToLog("锻炼时遇到了同学,交流了学习心得", "neutral");
                gameState.relationships.classmateA += 3;
            }

            if (Math.random() < 0.15) {
                addToLog("运动过度,肌肉酸痛", "bad");
                gameState.health -= 2;
            }

            recordAction();
            advanceTime();
            updateUI();
        }

        // 社交功能
        function social() {
            if (!checkActionLimit()) return;
            if (gameState.energy < 15) {
                showNotification("太累了,无法社交!", "bad");
                return;
            }
            if (gameState.health < 50) {
                showNotification("身体状态不佳,改天吧!", "bad");
                return;
            }

            gameState.energy -= 15;
            gameState.stress = Math.max(0, gameState.stress - 10);
            gameState.anxiety = Math.max(0, gameState.anxiety - 5); // 社交减少焦虑
            gameState.relationships.classmateA = Math.min(100, gameState.relationships.classmateA + 5);
            gameState.totalSocialHours++;

            // 随机社交事件
            const socialEvents = [
                { text: "与同学交流学习方法,互相鼓励", effect: { classmates: 5, stress: -5 } },
                { text: "听同学倾诉烦恼,成为知心朋友", effect: { classmates: 8, stress: -3 } },
                { text: "讨论竞赛往事,感慨万千", effect: { stress: 5, classmates: 3 } },
                { text: "一起吐槽作业太多,笑出眼泪", effect: { stress: -8, classmates: 4 } }
            ];

            const event = socialEvents[Math.floor(Math.random() * socialEvents.length)];
            addToLog(event.text, "good");

            // 应用效果
            if (event.effect.classmates) gameState.relationships.classmateA += event.effect.classmates;
            if (event.effect.stress) gameState.stress = Math.max(0, Math.min(100, gameState.stress + event.effect.stress));

            showNotification("社交活动愉快!焦虑-5", "good");
            recordAction();
            advanceTime();
            updateUI();
        }

        // 回忆功能
        function memory() {
            if (!checkActionLimit()) return;
            if (gameState.memoryCount >= 3) {
                showNotification("回忆太多会沉溺过去,向前看吧!", "neutral");
                return;
            }
            if (gameState.energy < 10) {
                showNotification("太累了,无法回忆往事", "bad");
                return;
            }

            gameState.memoryCount++;
            gameState.energy -= 10;
            gameState.anxiety = Math.max(0, gameState.anxiety - 2); // 回忆微量减少焦虑(或者增加?)

            // 随机回忆
            const memories = [
                {
                    title: "第一次获奖",
                    content: "你想起自己小学第一次拿到CSP-J一等时的场景。那时你意气风发,以为未来尽在掌握。现在想来,那时的自信既珍贵又天真。",
                    choices: [
                        { text: "怀念那时的自己", effect: { stress: 5, energy: 3 } },
                        { text: "感慨时光飞逝", effect: { stress: 3 } },
                        { text: "觉得现在也不错", effect: { stress: -3, energy: 5 } }
                    ]
                },
                {
                    title: "集训的日子",
                    content: "暑假集训,每天刷题到凌晨。虽然辛苦,但和队友们一起奋斗的日子真的很开心。现在,大家各奔东西。",
                    choices: [
                        { text: "感到孤独", effect: { stress: 8 } },
                        { text: "充满动力", effect: { energy: 5, stress: -5 } },
                        { text: "释然一笑", effect: { stress: -3 } }
                    ]
                },
                {
                    title: "放弃的瞬间",
                    content: "你想起决定退役的那一刻。是成绩下滑?是父母的期望?还是自己的迷茫?那个决定,改变了你的人生轨迹。",
                    choices: [
                        { text: "不后悔", effect: { stress: -5 } },
                        { text: "有些遗憾", effect: { stress: 5 } },
                        { text: "必须证明选择没错", effect: { energy: 5, stress: 5 } }
                    ]
                },
                {
                    title: "队友的告别",
                    content: "最后一位队友发来消息:'我拿到国集了,你呢?'你盯着屏幕很久,回复:'我AFO了,祝你顺利。'",
                    choices: [
                        { text: "感到失落", effect: { stress: 10 } },
                        { text: "真心祝福", effect: { stress: -5 } },
                        { text: "暗下决心", effect: { energy: 5 } }
                    ]
                }
            ];

            const memory = memories[Math.floor(Math.random() * memories.length)];

            // 显示回忆模态框
            const modal = document.getElementById('story-modal');
            elements.storyTitle.textContent = `回忆:${memory.title}`;
            elements.storyContent.innerHTML = memory.content;
            elements.storyChoices.innerHTML = '';

            memory.choices.forEach((choice, index) => {
                const btn = document.createElement('button');
                btn.className = 'story-choice-btn';
                btn.textContent = choice.text;
                btn.onclick = () => {
                    // 应用效果
                    for (const key in choice.effect) {
                        if (key === 'stress') gameState.stress = Math.max(0, Math.min(100, gameState.stress + choice.effect[key]));
                        else if (key === 'energy') gameState.energy = Math.max(0, Math.min(100, gameState.energy + choice.effect[key]));
                    }

                    addToLog(`回忆:${memory.title} - ${choice.text}`, "neutral");
                    closeModal('story-modal');
                    recordAction();
                    advanceTime();
                    updateUI();
                };
                elements.storyChoices.appendChild(btn);
            });

            modal.style.display = 'flex';
            showNotification("回忆往事,心情复杂...", "neutral");
        }

        // 参加模考
        function takeExam() {
            if (!checkActionLimit()) return;
            if (gameState.examCount >= 5) {
                showNotification("已经参加太多模考了,专注学习吧!", "neutral");
                return;
            }
            if (gameState.energy < 40) {
                showNotification("精力不足,无法参加考试!", "bad");
                return;
            }
            if (gameState.health < 60) {
                showNotification("身体状态不佳,建议休息后再考", "bad");
                return;
            }

            gameState.energy -= 40;
            gameState.stress += 8;
            gameState.examCount++;

            // 计算总分(加入当前能力值权重,避免低分高排名)
            let totalScore = 0;
            let subjectScores = {};
            const avgAbility = Object.values(gameState.subjects).reduce((a, b) => a + b, 0) / 6;

            for (const subject in gameState.subjects) {
                // 基础分 = 当前能力值 * 随机系数(0.85-1.15)
                const randomFactor = 0.85 + Math.random() * 0.3;
                let score = gameState.subjects[subject] * randomFactor;

                // 心理状态影响(心理差可能发挥失常)
                if (gameState.mental < 50 && Math.random() < 0.3) {
                    score *= 0.7; // 发挥失常
                    addToLog("心理紧张,考试发挥失常", "bad");
                }

                // 焦虑影响(高焦虑大幅降低发挥)
                if (gameState.anxiety > 70) {
                    score *= 0.8;
                }

                // 关系影响(老师关系好可能有额外加分)
                if (gameState.relationships.teacher > 70 && Math.random() < 0.2) {
                    score += 5;
                    addToLog("老师鼓励下,考试超常发挥", "good");
                }

                subjectScores[subject] = Math.round(score);
                totalScore += score;
            }
            totalScore = Math.round(totalScore / 6);

            // 根据表现给出反馈
            let result = "";
            let type = "neutral";
            let effect = {};

            if (totalScore >= 90) {
                result = "太棒了!成绩优异,班级前5名!";
                type = "good";
                effect = { stress: -15, anxiety: -10, teacher: 10, parents: 10, classmates: 5 }; // 成绩好降焦虑
            } else if (totalScore >= 80) {
                result = "不错,有进步,保持住!";
                type = "good";
                effect = { stress: -5, anxiety: -5, teacher: 5, parents: 5 };
            } else if (totalScore >= 70) {
                result = "成绩稳定,还需努力。";
                type = "neutral";
                effect = { stress: 3, anxiety: 2, teacher: 2 }; // 成绩一般略增焦虑
            } else if (totalScore >= 60) {
                result = "成绩一般,找出薄弱环节。";
                type = "neutral";
                effect = { stress: 8, anxiety: 5 };
            } else {
                result = "成绩不理想,需要加强学习了。";
                type = "bad";
                effect = { stress: 15, anxiety: 15, teacher: -5, parents: -5 }; // 成绩差大幅增加焦虑
            }

            // 应用效果
            for (const key in effect) {
                if (key === 'stress') {
                    gameState.stress = Math.max(0, Math.min(100, gameState.stress + effect[key]));
                } else if (key === 'anxiety') {
                    gameState.anxiety = Math.max(0, Math.min(100, gameState.anxiety + effect[key]));
                } else if (key === 'teacher') {
                    gameState.relationships.teacher = Math.max(0, Math.min(100, gameState.relationships.teacher + effect[key]));
                } else if (key === 'parents') {
                    gameState.relationships.parents = Math.max(0, Math.min(100, gameState.relationships.parents + effect[key]));
                } else if (key === 'classmates') {
                    gameState.relationships.classmateA = Math.max(0, Math.min(100, gameState.relationships.classmateA + effect[key]));
                }
            }

            // 显示详细成绩
            let scoreText = `模考成绩:平均分${totalScore}分\n`;
            for (const subject in subjectScores) {
                const name = { chinese: '语文', math: '数学', english: '英语', physics: '物理', chemistry: '化学', biology: '生物' }[subject];
                scoreText += `${name}: ${subjectScores[subject]}分 `;
            }

            addToLog(scoreText + `\n${result}`, type);
            showNotification(`考试结果:${result}`, type);

            // 检查成就
            if (totalScore >= 90) {
                unlockAchievement('exam-perfect');
                showNotification("🎉 成就解锁:模考满分!", "good");
            }

            // 检查游戏结束
            if (gameState.week >= 52) {
                endGame();
                return;
            }

            recordAction();
            advanceTime();
            updateUI();
        }

        // 作业功能
        function homework(action) {
            if (!checkActionLimit()) return;

            const homeworkList = Object.entries(gameState.homework).filter(([sub, done]) => !done);

            if (action === 'complete-all') {
                if (homeworkList.length === 0) {
                    showNotification("本周作业已完成!", "neutral");
                    return;
                }
                if (gameState.energy < 30) {
                    showNotification("精力不足,无法完成所有作业!", "bad");
                    return;
                }

                gameState.energy -= 30;
                gameState.relationships.teacher += 3;
                gameState.relationships.mathTeacher += 2;
                gameState.relationships.chineseTeacher += 2;
                gameState.relationships.englishTeacher += 2;
                gameState.anxiety = Math.max(0, gameState.anxiety - 2); // 完成作业减少焦虑

                // 全科提升
                for (let sub in gameState.subjects) {
                    gameState.subjects[sub] = Math.min(100, gameState.subjects[sub] + 0.5);
                }

                // 完成所有作业
                for (let sub in gameState.homework) {
                    gameState.homework[sub] = true;
                }

                addToLog("完成了所有作业,老师很满意", "good");
                showNotification("作业完成!全科+0.5,焦虑-2", "good");
            } else if (action === 'complete-one') {
                if (homeworkList.length === 0) {
                    showNotification("本周作业已完成!", "neutral");
                    return;
                }
                if (gameState.energy < 10) {
                    showNotification("精力不足,无法完成作业!", "bad");
                    return;
                }

                const [subject, _] = homeworkList[Math.floor(Math.random() * homeworkList.length)];
                gameState.energy -= 10;
                gameState.subjects[subject] = Math.min(100, gameState.subjects[subject] + 0.3);
                gameState.relationships.teacher += 1;
                gameState.homework[subject] = true;

                const name = { chinese: '语文', math: '数学', english: '英语', physics: '物理', chemistry: '化学', biology: '生物' }[subject];
                addToLog(`完成了${name}作业`, "good");
                showNotification(`${name}作业完成!+0.3点`, "good");
            } else if (action === 'skip') {
                if (homeworkList.length === 0) {
                    showNotification("本周作业已完成!", "neutral");
                    return;
                }

                gameState.relationships.teacher -= 5;
                gameState.relationships.mathTeacher -= 3;
                gameState.relationships.chineseTeacher -= 3;
                gameState.relationships.englishTeacher -= 3;
                gameState.stress += 5;
                gameState.anxiety += 5; // 拖欠作业增加焦虑

                addToLog("拖欠作业,老师很失望", "bad");
                showNotification("拖欠作业!老师关系-5,焦虑+5", "bad");
            }

            closeModal('homework-modal');
            recordAction();
            advanceTime();
            updateUI();
        }

        // 活动功能
        function activity(type) {
            if (!checkActionLimit()) return;
            if (gameState.energy < 20) {
                showNotification("精力不足,无法参加活动!", "bad");
                return;
            }

            let energyCost = 0;
            let stressChange = 0;
            let mentalChange = 0;
            let relChange = 0;
            let subjectChange = 0;
            let text = "";
            let typeLog = "neutral";

            switch (type) {
                case 'club':
                    energyCost = 15;
                    stressChange = -5;
                    relChange = 5;
                    text = "社团活动很有趣,同学关系更好了";
                    break;
                case 'volunteer':
                    energyCost = 25;
                    mentalChange = 3;
                    text = "志愿者活动很有意义,心理状态改善";
                    break;
                case 'lecture':
                    energyCost = 10;
                    subjectChange = 1;
                    stressChange = -3;
                    text = "听讲座收获颇丰,随机科目+1";
                    break;
                case 'competition':
                    energyCost = 35;
                    stressChange = 10;
                    if (Math.random() < 0.3) {
                        text = "知识竞赛获奖了!获得奖金100元";
                        gameState.money += 100;
                        typeLog = "good";
                    } else {
                        text = "知识竞赛未获奖,但积累了经验";
                    }
                    break;
                case 'oi-meetup':
                    energyCost = 20;
                    stressChange = -10;
                    gameState.memoryCount++;
                    text = "聚会,与老友重逢,压力大减";
                    break;
            }

            gameState.energy -= energyCost;
            gameState.stress = Math.max(0, Math.min(100, gameState.stress + stressChange));
            gameState.mental = Math.max(0, Math.min(100, gameState.mental + mentalChange));
            gameState.relationships.classmateA = Math.min(100, gameState.relationships.classmateA + relChange);

            if (subjectChange > 0) {
                const subjects = ['chinese', 'math', 'english', 'physics', 'chemistry', 'biology'];
                const randomSubject = subjects[Math.floor(Math.random() * subjects.length)];
                gameState.subjects[randomSubject] = Math.min(100, gameState.subjects[randomSubject] + subjectChange);
            }

            gameState.weekActivities++;
            gameState.totalActivities++;

            addToLog(text, typeLog);
            showNotification(text, typeLog);

            closeModal('activity-modal');
            recordAction();
            advanceTime();
            updateUI();
        }

        // 经济功能
        function economy(action) {
            if (!checkActionLimit()) return;

            switch (action) {
                case 'part-time':
                    if (gameState.energy < 30) {
                        showNotification("精力不足,无法兼职!", "bad");
                        return;
                    }
                    gameState.energy -= 30;
                    gameState.stress += 5;
                    gameState.money += 200;
                    addToLog("做家教赚了200元,但很累", "good");
                    showNotification("兼职成功!获得200元,压力+5", "good");
                    break;
                case 'buy-books':
                    if (gameState.money < 1000) {
                        showNotification("钱不够!", "bad");
                        return;
                    }
                    gameState.money -= 1000;
                    for (let sub in gameState.subjects) {
                        gameState.subjects[sub] = Math.min(100, gameState.subjects[sub] + 1);
                    }
                    addToLog("购买新资料,全科+1", "good");
                    showNotification("购买资料成功!全科+1", "good");
                    break;
                case 'buy-course':
                    if (gameState.money < 300) {
                        showNotification("钱不够!", "bad");
                        return;
                    }
                    if (gameState.energy < 20) {
                        showNotification("精力不足,无法上网课!", "bad");
                        return;
                    }
                    gameState.money -= 300;
                    gameState.energy -= 20;
                    // 随机提升一个科目3点
                    const subjects = ['chinese', 'math', 'english', 'physics', 'chemistry', 'biology'];
                    const randomSubject = subjects[Math.floor(Math.random() * subjects.length)];
                    gameState.subjects[randomSubject] = Math.min(100, gameState.subjects[randomSubject] + 3);
                    const name = { chinese: '语文', math: '数学', english: '英语', physics: '物理', chemistry: '化学', biology: '生物' }[randomSubject];
                    addToLog(`购买${name}网课,${name}+3`, "good");
                    showNotification(`网课学习完成!${name}+3`, "good");
                    break;
                // case 'save':
                //     addToLog("存钱以备不时之需", "neutral");
                //     showNotification("已存钱,当前存款:" + gameState.money + "元", "neutral");
                //     break;
                case 'parents':
                    if (gameState.relationships.parents < 30) {
                        showNotification("父母关系不好,不好意思要钱!", "bad");
                        return;
                    }
                    gameState.money += 150;
                    gameState.relationships.parents -= 5;
                    gameState.stress += 3;
                    addToLog("向父母要了150元零花钱", "neutral");
                    showNotification("获得150元,但父母关系-5,压力+3", "neutral");
                    break;
            }

            closeModal('economy-modal');
            recordAction();
            advanceTime();
            updateUI();
        }

        // 结束本周
        function endWeek() {
            if (gameState.gameOver) return;

            // 检查是否有未完成的操作
            if (gameState.actionsThisWeek < gameState.maxActionsPerWeek) {
                if (!confirm(`本周还有${gameState.maxActionsPerWeek - gameState.actionsThisWeek}次操作机会,确定要结束本周吗?`)) {
                    return;
                }
            }

            // 检查是否还有未完成的故事
            const currentStory = storyEvents.find(s => s.week === gameState.week && !gameState.events.includes(s.id));
            if (currentStory) {
                showNotification("本周有重要事件发生!", "neutral");
                triggerStoryEvent(currentStory);
                return;
            }

            // 检查隐藏剧情
            checkHiddenEvents();

            // 焦虑机制生效:将焦虑转化为压力,扣除心理值
            const anxietyStressEffect = Math.floor(gameState.anxiety * 0.2);
            const anxietyMentalEffect = Math.floor(gameState.anxiety * 0.1);

            // 自然恢复和消耗 (稍微增加恢复量以平衡焦虑机制)
            gameState.energy = Math.min(100, gameState.energy + 8);

            // 压力计算:自然恢复 - 焦虑带来的增加
            let netStressChange = -5 + anxietyStressEffect;
            if (netStressChange > 0) {
                gameState.stress = Math.min(100, gameState.stress + netStressChange);
                addToLog(`焦虑导致压力增加 ${netStressChange}`, "bad");
            } else {
                gameState.stress = Math.max(0, gameState.stress + netStressChange);
            }

            gameState.health = Math.min(100, gameState.health + 2);
            gameState.mental = Math.min(100, Math.max(0, gameState.mental + 2 - anxietyMentalEffect));

            if (anxietyMentalEffect > 2) {
                addToLog(`焦虑侵蚀了你的心理健康`, "bad");
            }

            // 焦虑自然增长
            gameState.anxiety = Math.min(100, gameState.anxiety + 2);

            // 作业系统:新一周生成新作业
            if (gameState.week < 52) {
                for (let sub in gameState.homework) {
                    gameState.homework[sub] = false; // 重置作业
                }
                addToLog("新一周开始,作业重新布置", "neutral");
            }

            // 随机事件
            if (Math.random() < 0.6) {
                triggerRandomEvent();
            }

            // 检查完美一周
            const hasNegativeEvent = gameState.lastAction === 'bad' || gameState.stress > 50 || gameState.anxiety > 60;
            if (!hasNegativeEvent && gameState.actionsThisWeek > 0) {
                gameState.perfectWeeks++;
                if (gameState.perfectWeeks >= 2) {
                    unlockAchievement('perfect-week');
                    showNotification("🎉 成就解锁:完美一周!", "good");
                }
            }

            // 时间推进
            gameState.week++;
            gameState.dayOfWeek = 0;
            gameState.period = 0;
            gameState.daysLeft -= 7;
            gameState.actionsThisWeek = 0; // 重置操作计数

            // 季节变化
            if (gameState.week <= 13) gameState.season = 0; // 春
            else if (gameState.week <= 26) gameState.season = 1; // 夏
            else if (gameState.week <= 39) gameState.season = 2; // 秋
            else gameState.season = 3; // 冬

            // 检查假期
            checkHolidays();

            // 检查特殊日子
            checkSpecialDay();

            // 检查阶段目标
            checkStageGoals();

            // 检查成就
            checkAchievements();

            // 检查游戏结束
            if (gameState.week > 52 || gameState.daysLeft <= 0) {
                endGame();
                return;
            }

            // 生成新课程表
            generateSchedule();

            // 天气变化
            changeWeather();

            addToLog(`第${gameState.week}周开始,距离高考还有${gameState.daysLeft}天`, "neutral");
            showNotification(`新的一周:${gameState.weather} ${getWeatherName()} | 季节:${seasons[gameState.season].name}`, "neutral");

            updateUI();
        }



        // 推进时间(用于单次活动)
        function advanceTime() {
            gameState.period++;
            if (gameState.period >= 4) {
                gameState.period = 0;
                gameState.dayOfWeek++;
                gameState.daysLeft--;

                if (gameState.dayOfWeek >= 7) {
                    gameState.dayOfWeek = 0;
                    // 周结束自动恢复
                    gameState.energy = Math.min(100, gameState.energy + 3);
                    gameState.stress = Math.max(0, gameState.stress - 3);
                }
            }
        }

        // 改变天气
        function changeWeather() {
            const weather = weathers[Math.floor(Math.random() * weathers.length)];
            gameState.weather = weather.type;
            gameState.currentWeather = weather;

            // 天气影响心情
            if (weather.mood > 0) {
                gameState.stress = Math.max(0, gameState.stress - 2);
            } else if (weather.mood < 0) {
                gameState.stress = Math.min(100, gameState.stress + 2);
            }
        }

        // 获取天气名称
        function getWeatherName() {
            return gameState.currentWeather ? gameState.currentWeather.name : '晴天';
        }

        // 检查假期
        function checkHolidays() {
            for (const key in holidays) {
                const holiday = holidays[key];
                if (gameState.week === holiday.week) {
                    gameState.vacationDays = holiday.days;
                    addToLog(`假期:${holiday.name},共${holiday.days}天`, "important");
                    showNotification(`假期到来:${holiday.name}!`, "important");

                    // 应用假期效果
                    if (holiday.effect.stress) gameState.stress = Math.max(0, gameState.stress + holiday.effect.stress);
                    if (holiday.effect.health) gameState.health = Math.min(100, gameState.health + holiday.effect.health);
                    if (holiday.effect.parents) gameState.relationships.parents = Math.min(100, gameState.relationships.parents + holiday.effect.parents);
                    if (holiday.effect.mental) gameState.mental = Math.min(100, gameState.mental + holiday.effect.mental);
                    // 假期也能缓解焦虑
                    gameState.anxiety = Math.max(0, gameState.anxiety - 10);
                }
            }
        }

        // 触发随机事件
        function triggerRandomEvent() {
            // 合并所有事件
            const allEvents = [
                ...randomEvents.study,
                ...randomEvents.relationship,
                ...randomEvents.health,
                ...randomEvents.memory,
                ...randomEvents.economy,
                ...randomEvents.special
            ];

            // 过滤可用事件(加入条件检查)
            let availableEvents = allEvents.filter(e => {
                if (!e.condition || !e.condition(gameState)) return false;

                // 季节和周数过滤
                if (gameState.season === 3 && e.text.includes('春')) return false;
                if (gameState.season === 0 && e.text.includes('冬')) return false;
                if (gameState.week < 10 && e.text.includes('月考')) return false;
                if (gameState.week > 40 && e.text.includes('讲座')) return false;

                return true;
            });

            if (availableEvents.length === 0) return;

            // 加权随机选择
            const totalWeight = availableEvents.reduce((sum, e) => sum + e.weight, 0);
            let random = Math.random() * totalWeight;
            let selectedEvent = null;

            for (const event of availableEvents) {
                random -= event.weight;
                if (random <= 0) {
                    selectedEvent = event;
                    break;
                }
            }

            if (!selectedEvent) selectedEvent = availableEvents[0];

            addToLog(selectedEvent.text, selectedEvent.type);
            elements.randomEvent.textContent = selectedEvent.text;
            gameState.lastAction = selectedEvent.type;

            // 应用效果
            applyEffect(selectedEvent.effect);

            // 显示通知
            let notificationText = selectedEvent.text;
            if (selectedEvent.type === 'good') {
                notificationText += " (效果:正面)";
            } else if (selectedEvent.type === 'bad') {
                notificationText += " (效果:负面)";
            }
            showNotification(notificationText, selectedEvent.type);
        }

        // 触发故事事件
        function triggerStoryEvent(story) {
            if (gameState.events.includes(story.id)) return;

            const modal = document.getElementById('story-modal');
            elements.storyTitle.textContent = story.title;
            elements.storyContent.innerHTML = story.content;
            elements.storyChoices.innerHTML = '';

            story.choices.forEach((choice, index) => {
                const btn = document.createElement('button');
                btn.className = 'story-choice-btn';
                btn.textContent = choice.text;

                // 显示影响预览
                const preview = document.createElement('div');
                preview.className = 'choice-preview';
                let previewText = "影响:";
                for (const key in choice.effect) {
                    const val = choice.effect[key];
                    const sign = val > 0 ? '+' : '';
                    previewText += `${key}${sign}${val} `;
                }
                preview.textContent = previewText;
                btn.appendChild(preview);

                btn.onclick = () => {
                    // 应用效果
                    applyEffect(choice.effect);

                    addToLog(`故事:${story.title} - ${choice.text}`, "story");
                    gameState.events.push(story.id);
                    gameState.storyProgress++;

                    // 检查故事完成
                    if (gameState.storyProgress >= 5) {
                        unlockAchievement('story-5');
                        showNotification("🎉 成就解锁:故事开始!", "good");
                    }
                    if (gameState.storyProgress >= 10) {
                        unlockAchievement('story-10');
                        showNotification("🎉 成就解锁:故事大师!", "good");
                    }
                    if (gameState.storyProgress >= 15) {
                        unlockAchievement('story-15');
                        showNotification("🎉 成就解锁:史诗旅程!", "good");
                    }

                    // 下一个事件
                    if (choice.next) {
                        const nextStory = storyEvents.find(s => s.id === choice.next);
                        if (nextStory && gameState.week >= nextStory.week) {
                            setTimeout(() => triggerStoryEvent(nextStory), 500);
                        }
                    }

                    closeModal('story-modal');
                    advanceTime();
                    updateUI();
                };

                elements.storyChoices.appendChild(btn);
            });

            modal.style.display = 'flex';
            showNotification("故事事件触发", "story");
        }

        // 检查隐藏剧情
        function checkHiddenEvents() {
            let triggered = 0;
            hiddenEvents.forEach(event => {
                if (!gameState.events.includes(event.id) && event.condition(gameState)) {
                    // 显示隐藏剧情
                    const modal = document.getElementById('story-modal');
                    elements.storyTitle.textContent = `隐藏剧情:${event.title}`;
                    elements.storyContent.innerHTML = event.content;
                    elements.storyChoices.innerHTML = '';

                    if (event.choices) {
                        event.choices.forEach(choice => {
                            const btn = document.createElement('button');
                            btn.className = 'story-choice-btn';
                            btn.textContent = choice.text;
                            btn.onclick = () => {
                                applyEffect(choice.effect);
                                gameState.events.push(event.id);
                                closeModal('story-modal');
                                advanceTime();
                                updateUI();
                                recordAction();
                            };
                            elements.storyChoices.appendChild(btn);
                        });
                    } else {
                        const btn = document.createElement('button');
                        btn.className = 'story-choice-btn';
                        btn.textContent = "继续";
                        btn.onclick = () => {
                            applyEffect(event.effect);
                            gameState.events.push(event.id);
                            closeModal('story-modal');
                            advanceTime();
                            updateUI();
                            recordAction();
                        };
                        elements.storyChoices.appendChild(btn);
                    }

                    modal.style.display = 'flex';
                    showNotification(`隐藏剧情触发:${event.title}`, "important");
                    triggered++;
                }
            });

            if (triggered > 0) {
                if (triggered >= 1) {
                    unlockAchievement('hidden-1');
                    showNotification("🎉 成就解锁:隐藏剧情1!", "good");
                }
                if (triggered >= 2) {
                    unlockAchievement('hidden-2');
                    showNotification("🎉 成就解锁:隐藏剧情2!", "good");
                }
                if (triggered >= 3) {
                    unlockAchievement('hidden-3');
                    showNotification("🎉 成就解锁:隐藏剧情3!", "good");
                }
            }
        }

        // 应用效果
        function applyEffect(effect) {
            for (const key in effect) {
                if (key === 'stress') {
                    gameState.stress = Math.max(0, Math.min(100, gameState.stress + effect[key]));
                } else if (key === 'energy') {
                    gameState.energy = Math.max(0, Math.min(100, gameState.energy + effect[key]));
                } else if (key === 'health') {
                    gameState.health = Math.max(0, Math.min(100, gameState.health + effect[key]));
                } else if (key === 'mental') {
                    gameState.mental = Math.max(0, Math.min(100, gameState.mental + effect[key]));
                } else if (key === 'anxiety') {
                    gameState.anxiety = Math.max(0, Math.min(100, gameState.anxiety + effect[key]));
                } else if (key === 'money') {
                    gameState.money = Math.max(0, gameState.money + effect[key]);
                } else if (gameState.relationships.hasOwnProperty(key)) {
                    gameState.relationships[key] = Math.max(0, Math.min(100, gameState.relationships[key] + effect[key]));
                } else if (gameState.subjects.hasOwnProperty(key)) {
                    gameState.subjects[key] = Math.max(0, Math.min(100, gameState.subjects[key] + effect[key]));
                } else if (key === 'subjects' && typeof effect[key] === 'object') {
                    // 批量科目提升
                    for (const sub in effect[key]) {
                        if (sub === 'all') {
                            for (const s in gameState.subjects) {
                                gameState.subjects[s] = Math.min(100, gameState.subjects[s] + effect[key][sub]);
                            }
                        }
                    }
                }
            }
        }

        // 检查阶段目标
        function checkStageGoals() {
            // 检查当前周数是否有目标
            for (const week in stageGoals) {
                const goal = stageGoals[week];
                // 如果当前周数达到目标周数,且还没检查过
                if (gameState.week === parseInt(week) && !gameState.currentGoal) {
                    gameState.currentGoal = goal;
                    gameState.goalProgress = 0;

                    // 显示目标更新弹窗
                    showGoalModal(goal);
                    return;
                }
            }

            // 检查当前目标是否完成
            if (gameState.currentGoal && gameState.week > parseInt(gameState.currentGoal.desc.match(/\d+/))) {
                const achieved = gameState.currentGoal.check(gameState);

                // 显示目标完成/失败弹窗
                showGoalResultModal(gameState.currentGoal, achieved);

                // 应用奖励
                if (achieved && gameState.currentGoal.reward) {
                    for (const key in gameState.currentGoal.reward) {
                        if (key === 'stress') {
                            gameState.stress = Math.max(0, gameState.stress + gameState.currentGoal.reward[key]);
                        } else if (key === 'energy') {
                            gameState.energy = Math.min(100, gameState.energy + gameState.currentGoal.reward[key]);
                        } else if (key === 'health') {
                            gameState.health = Math.min(100, gameState.health + gameState.currentGoal.reward[key]);
                        } else if (key === 'mental') {
                            gameState.mental = Math.min(100, gameState.mental + gameState.currentGoal.reward[key]);
                        } else if (key === 'money') {
                            gameState.money += gameState.currentGoal.reward[key];
                        }
                    }
                    showNotification("阶段目标达成!获得奖励!", "good");
                } else {
                    showNotification("阶段目标未达成,继续努力!", "bad");
                }

                // 清空当前目标
                gameState.currentGoal = null;
                gameState.goalProgress = 0;
            }
        }

        // 显示目标更新弹窗
        function showGoalModal(goal) {
            const modal = document.getElementById('goal-modal');
            elements.goalContent.innerHTML = `
                                                                                                                                                                                                                                                                                                                                            <div class="goal-item">
                                                                                                                                                                                                                                                                                                                                                <h4>${goal.title}</h4>
                                                                                                                                                                                                                                                                                                                                                <p>${goal.desc}</p>
                                                                                                                                                                                                                                                                                                                                                <p style="color: var(--warning); margin-top: 5px;">⚠️ 请在下个阶段检查点前努力达成!</p>
                                                                                                                                                                                                                                                                                                                                            </div>
                                                                                                                                                                                                                                                                                                                                        `;
            modal.style.display = 'flex';
        }

        // 显示目标结果弹窗
        function showGoalResultModal(goal, achieved) {
            const modal = document.getElementById('goal-modal');
            const className = achieved ? 'achieved' : 'failed';
            const statusText = achieved ? '✅ 已达成' : '❌ 未达成';
            const rewardText = achieved && goal.reward ?
                `<p style="color: var(--secondary); margin-top: 8px;">奖励:${Object.entries(goal.reward).map(([k, v]) => `${k}+${v}`).join('、')}</p>` :
                '';

            elements.goalContent.innerHTML = `
                                                                                                                                                                                                                                                                                                                                            <div class="goal-item ${className}">
                                                                                                                                                                                                                                                                                                                                                <h4>${goal.title} ${statusText}</h4>
                                                                                                                                                                                                                                                                                                                                                <p>${goal.desc}</p>
                                                                                                                                                                                                                                                                                                                                                ${rewardText}
                                                                                                                                                                                                                                                                                                                                            </div>
                                                                                                                                                                                                                                                                                                                                        `;
            modal.style.display = 'flex';
        }

        // 检查特殊日子
        function checkSpecialDay() {
            const week = gameState.week;

            if (week === 1) {
                addToLog("AFO第一天,一切都是新的开始。", "story");
            } else if (week === 4) {
                addToLog("一个月过去了,你已经适应了文化课生活。", "neutral");
            } else if (week === 10) {
                addToLog("百日纪念!你已经坚持了100天!", "good");
                showNotification("百日纪念!继续加油!", "good");
            } else if (week === 18) {
                addToLog("高考倒计时180天誓师大会!", "neutral");
                showNotification("重要里程碑:距离高考还有180天!", "neutral");
            } else if (week === 24) {
                addToLog("进入第二学期,冲刺阶段开始。", "neutral");
            } else if (week === 36) {
                addToLog("最后冲刺阶段!65天倒计时!", "neutral");
                showNotification("冲刺阶段开始!保持状态!", "neutral");
            } else if (week === 48) {
                addToLog("最后4周,调整心态,准备迎接挑战。", "neutral");
            } else if (week === 51) {
                addToLog("高考前夜,你准备好了吗?", "story");
            }

            // 每月1号检查
            if (week % 4 === 0) {
                addToLog(`第${Math.floor(week / 4) + 1}个月开始,总结一下这个月的进步吧。`, "neutral");
            }
        }

        // 成就系统
        function unlockAchievement(achievementId) {
            if (gameState.achievements.has(achievementId)) return;

            gameState.achievements.add(achievementId);
            const achievement = achievements[achievementId];

            if (achievement) {
                // 显示成就详情弹窗(只显示新解锁的)
                showAchievementUnlockModal(achievement);
            }
        }

        // 显示成就解锁弹窗
        function showAchievementUnlockModal(achievement) {
            const modal = document.getElementById('achievement-modal');
            elements.achievementDetailContent.innerHTML = `
                                                                                                                                                                                                                                                                                                                                            <div class="achievement-detail-item">
                                                                                                                                                                                                                                                                                                                                                <div class="name">🏆 ${achievement.name}</div>
                                                                                                                                                                                                                                                                                                                                                <div class="desc">${achievement.desc}</div>
                                                                                                                                                                                                                                                                                                                                            </div>
                                                                                                                                                                                                                                                                                                                                        `;
            modal.style.display = 'flex';
        }

        // 显示成就详情(点击按钮)
        function showAchievementDetail() {
            const modal = document.getElementById('achievement-modal');
            let html = '';

            // 显示所有已解锁成就
            const unlocked = Array.from(gameState.achievements).map(id => ({ id, ...achievements[id] }));
            const hidden = Object.entries(achievements).filter(([id, a]) => a.hidden && !gameState.achievements.has(id));

            if (unlocked.length === 0) {
                html = '<div style="text-align:center;opacity:0.7;">暂无成就</div>';
            } else {
                html += '<div style="margin-bottom:10px;font-weight:bold;color:var(--secondary);">已解锁成就:</div>';
                unlocked.forEach(a => {
                    html += `
                                                                                                                                                                                                                                                                                                                                                    <div class="achievement-detail-item">
                                                                                                                                                                                                                                                                                                                                                        <div class="name">🏆 ${a.name}</div>
                                                                                                                                                                                                                                                                                                                                                        <div class="desc">${a.desc}</div>
                                                                                                                                                                                                                                                                                                                                                    </div>
                                                                                                                                                                                                                                                                                                                                                `;
                });
            }

            if (hidden.length > 0) {
                html += '<div style="margin:15px 0 10px 0;font-weight:bold;color:var(--purple);">未解锁隐藏成就:</div>';
                hidden.forEach(([id, a]) => {
                    html += `
                                                                                                                                                                                                                                                                                                                                                    <div class="achievement-detail-item hidden">
                                                                                                                                                                                                                                                                                                                                                        <div class="name">🔒 ???</div>
                                                                                                                                                                                                                                                                                                                                                        <div class="desc">隐藏成就,需要特殊条件解锁</div>
                                                                                                                                                                                                                                                                                                                                                    </div>
                                                                                                                                                                                                                                                                                                                                                `;
                });
            }

            elements.achievementDetailContent.innerHTML = html;
            modal.style.display = 'flex';
        }

        // 检查成就
        function checkAchievements() {
            // 基础进度
            if (gameState.week === 1) unlockAchievement('first-week');
            if (gameState.week === 4) unlockAchievement('first-month');

            // 累计时长
            if (gameState.totalStudyHours >= 100) unlockAchievement('study-100');
            if (gameState.totalRestHours >= 50) unlockAchievement('rest-50');
            if (gameState.totalExerciseHours >= 30) unlockAchievement('exercise-30');
            if (gameState.totalSocialHours >= 20) unlockAchievement('social-20');

            // 状态
            if (gameState.energy >= 100) unlockAchievement('energy-100');
            if (gameState.stress === 0) unlockAchievement('stress-0');
            if (gameState.health >= 100) unlockAchievement('health-100');
            if (gameState.mental >= 100) unlockAchievement('mental-100');
            if (gameState.money >= 1000) unlockAchievement('money-1000');
            if (gameState.money === 0) unlockAchievement('money-0');

            // 学科
            if (gameState.subjects.chinese >= 80) unlockAchievement('chinese-80');
            if (gameState.subjects.math >= 90) unlockAchievement('math-90');
            if (gameState.subjects.english >= 80) unlockAchievement('english-80');
            if (gameState.subjects.physics >= 90) unlockAchievement('physics-90');
            if (gameState.subjects.chemistry >= 80) unlockAchievement('chemistry-80');
            if (gameState.subjects.biology >= 80) unlockAchievement('biology-80');

            const all85 = Object.values(gameState.subjects).every(s => s >= 85);
            if (all85) unlockAchievement('all-85');

            const all95 = Object.values(gameState.subjects).every(s => s >= 95);
            if (all95) unlockAchievement('all-95');

            // 关系
            if (gameState.relationships.teacher >= 90) unlockAchievement('teacher-90');
            if (gameState.relationships.mathTeacher >= 90) unlockAchievement('math-teacher-90');
            if (gameState.relationships.parents >= 90) unlockAchievement('parents-90');
            if (gameState.relationships.crush >= 60) unlockAchievement('crush-60');
            if (gameState.relationships.classmateA >= 90 || gameState.relationships.classmateB >= 90) unlockAchievement('classmate-90');

            // 活动
            if (gameState.examCount >= 5) unlockAchievement('exam-5');
            const completedHomework = Object.values(gameState.homework).filter(v => v).length;
            if (completedHomework >= 100) unlockAchievement('homework-100');
            if (gameState.totalActivities >= 20) unlockAchievement('activity-20');
            if (gameState.memoryCount >= 10) unlockAchievement('memory-10');

            // 特殊
            if (gameState.stress < 10 && gameState.week >= 10) unlockAchievement('stress-management');
            if (gameState.energy > 90 && gameState.week >= 5) unlockAchievement('early-bird');
            if (gameState.energy < 10) unlockAchievement('night-owl');
            if (gameState.totalStudyHours >= 50 && gameState.money >= 500) unlockAchievement('money-maker');

            // 故事
            if (gameState.storyProgress >= 5) unlockAchievement('story-5');
        }

        // 游戏结束
        function endGame() {
            gameState.gameOver = true;

            // 计算最终成绩
            let totalScore = 0;
            for (const subject in gameState.subjects) {
                totalScore += gameState.subjects[subject];
            }
            totalScore = Math.round(totalScore / 6);

            // 计算最终评价和结局
            let result = "";
            let ending = "";
            let endingId = "";
            let endingType = "neutral";

            // 多维度评估
            const avgScore = totalScore;
            const stressLevel = gameState.stress;
            const anxietyLevel = gameState.anxiety;
            const healthLevel = gameState.health;
            const mentalLevel = gameState.mental;
            const relTotal = gameState.relationships.teacher + gameState.relationships.classmates + gameState.relationships.parents + gameState.relationships.crush;
            const money = gameState.money;

            // 结局分支(25+结局)
            if (avgScore >= 95 && stressLevel < 30 && mentalLevel > 80 && anxietyLevel < 40) {
                result = "顶尖大学 + 心理健康";
                ending = "你以惊人的成绩考入了顶尖大学,更重要的是,你保持了心理健康和人际关系。这段AFO经历让你成为了一个更完整的人。你不仅学会了知识,更学会了如何面对人生。";
                endingId = 'ending-1';
                endingType = "good";
            } else if (avgScore >= 90) {
                result = "顶尖大学";
                ending = "你以优异的成绩考入了理想的顶尖大学,实现了从竞赛生到文化课学霸的华丽转身!你的努力和智慧得到了最好的回报。这段AFO经历让你更加成熟,未来可期。";
                endingId = 'ending-1';
                endingType = "good";
            } else if (avgScore >= 85 && gameState.relationships.crush >= 60) {
                result = "重点大学 + 爱情";
                ending = "你和crush一起考入了重点大学,实现了学业和爱情的双丰收。这段AFO旅程不仅让你成长,还让你收获了珍贵的感情。";
                endingId = 'ending-hidden-1';
                endingType = "good";
            } else if (avgScore >= 80) {
                result = "重点大学";
                ending = "你成功考入了重点大学,证明了自己在文化课上的实力。虽然过程艰辛,但你坚持到了最后。这段经历让你明白,人生不止一条路,每条路都能通向成功。";
                endingId = 'ending-2';
                endingType = "good";
            } else if (avgScore >= 75 && gameState.relationships.parents >= 80) {
                result = "一本大学 + 家庭和睦";
                ending = "你考上了一本大学,更重要的是,你与父母达成了深刻的理解。这段AFO经历让你们的家庭关系更加紧密。父母为你骄傲,不是因为成绩,而是因为你的成长。";
                endingId = 'ending-hidden-2';
                endingType = "good";
            } else if (avgScore >= 70) {
                result = "一本大学";
                ending = "你考上了一本大学,这是一个不错的成绩。虽然可能不是最理想的结果,但你已经尽力了。AFO让你学会了适应和坚持,这比分数更重要。";
                endingId = 'ending-3';
                endingType = "neutral";
            } else if (avgScore >= 65 && gameState.mental >= 80) {
                result = "二本大学 + 自我救赎";
                ending = "虽然成绩只够二本,但你在这个过程中完成了自我救赎。你找到了自己的价值,不再被竞赛的光环或失败的阴影束缚。你学会了接纳自己,这才是最大的成功。";
                endingId = 'ending-hidden-3';
                endingType = "neutral";
            } else if (avgScore >= 60) {
                result = "二本大学";
                ending = "你考上了二本大学。这个结果提醒你,文化课学习需要持续的努力,但至少你迈过了高考这道坎。未来还有无限可能,考研、工作都是新的起点。";
                endingId = 'ending-4';
                endingType = "neutral";
            } else {
                // 特殊结局分支
                if (gameState.relationships.crush >= 60 && gameState.relationships.classmateA >= 80) {
                    result = "爱情与友情";
                    ending = "虽然高考成绩不理想,但你收获了珍贵的友情和爱情。你决定和TA一起复读,或者选择一所能在一起的大学。人生不止考试,还有陪伴。";
                    endingId = 'ending-12';
                    endingType = "neutral";
                } else if (gameState.memoryCount >= 5 && gameState.subjects.math >= 70) {
                    result = "竞赛回归";
                    ending = "高考失利后,你重新回到了信息学的世界。这一次,你带着文化课的沉淀和更成熟的心态,或许能在竞赛路上走得更远。有些热爱,从未熄灭。";
                    endingId = 'ending-6';
                    endingType = "neutral";
                } else if (gameState.relationships.parents < 30) {
                    result = "独立之路";
                    ending = "与父母的期望背道而驰,你选择了一条更自由的路。也许是创业,也许是打工,你决定用自己的方式证明价值。这需要勇气,但你准备好了。";
                    endingId = 'ending-7';
                    endingType = "neutral";
                } else if (gameState.totalActivities >= 15) {
                    result = "艺术特长";
                    ending = "你在各种活动中发现了自己在艺术方面的天赋,决定走艺术特长生的道路。虽然不是传统的成功,但你找到了自己的热爱。";
                    endingId = 'ending-8';
                    endingType = "neutral";
                } else if (gameState.health >= 90 && gameState.totalExerciseHours >= 20) {
                    result = "体育特招";
                    ending = "你的身体素质非常出色,被体育院校特招。虽然放弃了文化课,但你在另一个领域找到了自己的价值。";
                    endingId = 'ending-9';
                    endingType = "neutral";
                } else if (gameState.money >= 1000) {
                    result = "出国深造";
                    ending = "你攒够了钱,决定出国留学。换个环境,重新开始。也许国外的教育更适合你,也许这只是逃避,但无论如何,你选择了新的道路。";
                    endingId = 'ending-10';
                    endingType = "neutral";
                } else if (gameState.stress > 80 || gameState.anxiety > 80) {
                    result = "间隔年";
                    ending = "巨大的压力和焦虑让你不堪重负。你决定给自己一个间隔年,不参加高考,去旅行、去思考、去寻找自己真正想要的。这不是失败,而是为了更好的出发。";
                    endingId = 'ending-11';
                    endingType = "neutral";
                } else {
                    result = "未能如愿";
                    ending = "高考成绩不理想,你未能达到预期的目标。但这不代表失败,AFO只是人生的一个阶段。未来的路还很长,重要的是你学会了面对挫折。";
                    endingId = 'ending-5';
                    endingType = "bad";
                }
            }

            // 解锁结局成就
            unlockAchievement(endingId);

            // 显示结束画面
            const mainDiv = document.querySelector('.main');
            mainDiv.innerHTML = `
<div class="end-screen">
<h2>🎓 高考结束</h2>
<div class="final-score">${totalScore}分</div>
<p>最终平均能力值</p>
<h3>结果:${result}</h3>
<div class="ending-text">${ending}</div>
<div class="stats-summary">
<div class="stat-box">
<div class="label">总学习时长</div>
<div class="value">${gameState.totalStudyHours}h</div>
</div>
<div class="stat-box">
<div class="label">总休息时长</div>
<div class="value">${gameState.totalRestHours}h</div>
</div>
<div class="stat-box">
<div class="label">参加模考</div>
<div class="value">${gameState.examCount}次</div>
</div>
<div class="stat-box">
<div class="label">最终焦虑值</div>
<div class="value">${gameState.anxiety}</div>
</div>
<div class="stat-box">
<div class="label">参加活动</div>
<div class="value">${gameState.totalActivities}次</div>
</div>
<div class="stat-box">
<div class="label">回忆往事</div>
<div class="value">${gameState.memoryCount}次</div>
</div>
</div>
<p style="margin-top: 20px; font-size: 0.9rem; opacity: 0.7;">
你的高中生涯画上了句号。无论结果如何,这段旅程都将成为你人生中宝贵的经历。<br>
感谢游玩!本游戏采用<a href="https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode.zh-Hans"
target="_blank" style="color: rgb(196, 196, 196)">CC BY-NC-ND 4.0</a>协议,作者:wujiahaocoder
</p>
<button class="restart-btn" onclick="location.reload()">🔄 重新开始</button>
</div>`;

            // 隐藏操作按钮和计数器
            document.querySelector('.actions').style.display = 'none';
            document.getElementById('actionCounter').style.display = 'none';

            showNotification(`高考结束!${result}`, endingType);
        }

        // ==================== 模态框控制 ====================

        function openModal(modalId) {
            // 检查操作限制(故事模态框除外)
            if (modalId !== 'story-modal' && modalId !== 'goal-modal' && modalId !== 'achievement-modal' && !checkActionLimit()) {
                return;
            }

            // 特殊处理
            if (modalId === 'homework-modal') {
                updateHomeworkList();
            } else if (modalId === 'economy-modal') {
                elements.currentMoney.textContent = gameState.money;
            }

            document.getElementById(modalId).style.display = 'flex';
        }

        function closeModal(modalId) {
            document.getElementById(modalId).style.display = 'none';
        }

        // 更新作业列表
        function updateHomeworkList() {
            const homeworkList = Object.entries(gameState.homework).filter(([sub, done]) => !done);
            const listDiv = elements.homeworkList;

            if (homeworkList.length === 0) {
                listDiv.innerHTML = '<div style="opacity:0.6;">本周作业已完成!</div>';
                return;
            }

            listDiv.innerHTML = '<div style="margin-bottom:10px;font-weight:bold;">未完成作业:</div>';
            homeworkList.forEach(([subject, _]) => {
                const name = { chinese: '语文', math: '数学', english: '英语', physics: '物理', chemistry: '化学', biology: '生物' }[subject];
                const div = document.createElement('div');
                div.style.padding = '4px 0';
                div.textContent = `• ${name}`;
                listDiv.appendChild(div);
            });
        }

        // ==================== 事件监听器 ====================

        // 按钮事件(添加防抖)
        let buttonCooldown = false;

        function handleButtonClick(action) {
            if (buttonCooldown) return;
            buttonCooldown = true;

            // 执行动作
            action();

            // 1秒后解除冷却
            setTimeout(() => {
                buttonCooldown = false;
            }, 1000);
        }

        document.getElementById('study-btn').addEventListener('click', () => handleButtonClick(() => openModal('study-modal')));
        document.getElementById('rest-btn').addEventListener('click', () => handleButtonClick(() => openModal('rest-modal')));
        document.getElementById('exercise-btn').addEventListener('click', () => handleButtonClick(exercise));
        document.getElementById('social-btn').addEventListener('click', () => handleButtonClick(social));
        document.getElementById('memory-btn').addEventListener('click', () => handleButtonClick(memory));
        document.getElementById('exam-btn').addEventListener('click', () => handleButtonClick(takeExam));
        document.getElementById('homework-btn').addEventListener('click', () => handleButtonClick(() => openModal('homework-modal')));
        document.getElementById('activity-btn').addEventListener('click', () => handleButtonClick(() => openModal('activity-modal')));
        document.getElementById('economy-btn').addEventListener('click', () => handleButtonClick(() => openModal('economy-modal')));
        document.getElementById('end-btn').addEventListener('click', () => handleButtonClick(endWeek));

        // 点击模态框外部关闭
        window.addEventListener('click', (e) => {
            if (e.target.classList.contains('modal')) {
                e.target.style.display = 'none';
            }
        });

        // 键盘快捷键
        document.addEventListener('keydown', (e) => {
            if (gameState.gameOver) return;

            // Shift键显示提示
            if (e.key === 'Shift') {
                elements.hotkeyHint.classList.add('show');
                return;
            }

            // 快捷键(添加防抖)
            if (buttonCooldown) return;
            buttonCooldown = true;

            switch (e.key) {
                case '1': openModal('study-modal'); break;
                case '2': openModal('rest-modal'); break;
                case '3': exercise(); break;
                case '4': social(); break;
                case '5': memory(); break;
                case '6': takeExam(); break;
                case '7': openModal('homework-modal'); break;
                case '8': openModal('activity-modal'); break;
                case '9': openModal('economy-modal'); break;
                case '0': endWeek(); break;
                case 'Escape':
                    document.querySelectorAll('.modal').forEach(m => m.style.display = 'none');
                    break;
            }

            setTimeout(() => {
                buttonCooldown = false;
            }, 1000);
        });

        // Shift键释放隐藏提示
        document.addEventListener('keyup', (e) => {
            if (e.key === 'Shift') {
                elements.hotkeyHint.classList.remove('show');
            }
        });

        // 启动游戏
        window.onload = initGame;
    </script>
</body>

</html>
原文