跳到正文

休闲·娱乐

奶龙快跑运营模拟器 [源码(.html)]

_auto_约 127 分钟
原文
文章信息与版本

文章信息

发布
2026年3月16日
收录
2026年3月16日
更新
2026年8月8日
篇幅
约 127 分钟

版本

  1. v4当前
  2. v3
  3. v2
  4. v1

直接点上方的“复制原文”然后把多余内容删了即可

HTML
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>奶龙快跑运营模拟器</title>
    <style>
        * {
            box-sizing: border-box;
            font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
        }
        body {
            background: linear-gradient(145deg, #0b1a2e 0%, #1a2f3f 100%);
            min-height: 100vh;
            margin: 0;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .simulator-panel {
            max-width: 1200px;
            width: 100%;
            background: rgba(18, 30, 41, 0.85);
            backdrop-filter: blur(8px);
            border-radius: 40px;
            padding: 28px 32px;
            box-shadow: 0 25px 40px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(120, 200, 255, 0.15) inset;
            border: 1px solid #3d5e78;
        }
        h1 {
            margin: 0 0 8px 0;
            font-weight: 500;
            font-size: 2.1rem;
            letter-spacing: 2px;
            color: #c2e5ff;
            text-shadow: 0 2px 5px #005b8f;
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
        }
        h1 small {
            font-size: 0.9rem;
            background: #2d4b62;
            padding: 5px 12px;
            border-radius: 40px;
            color: #b3e4ff;
            font-weight: 300;
            letter-spacing: 0.5px;
            border: 1px solid #5f8db0;
        }
        .mode-section {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-left: auto;
        }
        .mode-badge {
            background: #1e3f55;
            padding: 6px 20px;
            border-radius: 40px;
            font-size: 1.1rem;
            font-weight: 600;
            color: #ffdb9f;
            border: 1px solid #f7b731;
            box-shadow: 0 2px 0 #0f2a36;
        }
        .mode-btn {
            background: #2d4b62;
            border: none;
            border-bottom: 3px solid #0f2d3c;
            color: white;
            font-weight: 600;
            padding: 6px 16px;
            border-radius: 40px;
            cursor: pointer;
            font-size: 0.9rem;
            transition: all 0.08s linear;
            box-shadow: 0 3px 0 #0b1f29;
        }
        .mode-btn:active {
            transform: translateY(3px);
            border-bottom-width: 1px;
        }
        .mode-btn.active {
            background: #5fa3c7;
            border-bottom-color: #2f637f;
        }
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 18px;
            margin: 20px 0 22px;
        }
        .stat-card {
            background: #142b39;
            border-radius: 28px;
            padding: 18px 16px;
            border: 1px solid #2f5570;
            box-shadow: 0 8px 0 #0b1a24;
            transition: transform 0.1s ease;
        }
        .stat-label {
            font-size: 0.85rem;
            text-transform: uppercase;
            letter-spacing: 1.5px;
            font-weight: 400;
            color: #8bbcdb;
            margin-bottom: 8px;
        }
        .stat-value {
            font-size: 2.1rem;
            font-weight: 600;
            color: #f0f9ff;
            line-height: 1.2;
            display: flex;
            align-items: baseline;
            gap: 6px;
        }
        .stat-unit {
            font-size: 0.9rem;
            color: #79b8d7;
            font-weight: 300;
        }
        .progress-section {
            background: #0f202b;
            border-radius: 40px;
            padding: 16px 24px;
            margin: 20px 0 24px;
            border: 1px solid #376480;
        }
        .progress-item {
            display: flex;
            align-items: center;
            gap: 16px;
            margin: 10px 0;
        }
        .progress-label {
            width: 100px;
            color: #c0def5;
            font-weight: 400;
            font-size: 1rem;
        }
        .progress-bar-bg {
            flex: 1;
            height: 22px;
            background: #1f3e4f;
            border-radius: 40px;
            overflow: hidden;
            box-shadow: inset 0 3px 6px #0c1c26;
            border: 1px solid #2e5b77;
        }
        .progress-fill {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg, #5dc9ff, #2f8ec0);
            border-radius: 40px;
            transition: width 0.2s ease;
            box-shadow: 0 0 8px #60c0ff;
        }
        .progress-fill.warning {
            background: linear-gradient(90deg, #ffb45e, #d4600f);
        }
        .progress-number {
            min-width: 70px;
            text-align: right;
            color: #d3ecff;
            font-weight: 500;
        }
        .version-panel {
            background: #0f202b;
            border-radius: 40px;
            padding: 20px 24px;
            margin: 20px 0 24px;
            border: 1px solid #3e7a9c;
            box-shadow: 0 4px 0 #0a1f2a;
        }
        .version-row {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 20px;
            margin-bottom: 18px;
        }
        .version-badge {
            background: #1a4157;
            border-radius: 60px;
            padding: 8px 20px;
            font-weight: 600;
            font-size: 1.3rem;
            color: #c9edff;
            border: 1px solid #5195be;
            box-shadow: inset 0 -2px 0 #0d3142;
        }
        .planned-box {
            background: #1c3341;
            border-radius: 40px;
            padding: 8px 24px;
            color: #b3defa;
            font-size: 1.1rem;
            border: 1px solid #40728f;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .planned-value {
            font-weight: 700;
            color: #ffdb9f;
            background: #2d4f62;
            padding: 4px 18px;
            border-radius: 50px;
        }
        .version-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            align-items: center;
            margin-top: 6px;
        }
        .strength-control {
            margin-top: 20px;
            padding: 15px 20px;
            background: #1c3341;
            border-radius: 50px;
            border: 1px solid #3c789b;
            display: flex;
            flex-direction: column;
            gap: 15px;
        }
        .name-row, .slider-row {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 15px;
        }
        .name-label, .strength-label {
            color: #c9ecff;
            font-weight: 500;
            min-width: 80px;
        }
        .name-input {
            flex: 2;
            min-width: 200px;
            background: #0d3142;
            border: 2px solid #3c789b;
            border-radius: 40px;
            padding: 10px 20px;
            color: #ffdb9f;
            font-size: 1rem;
            outline: none;
        }
        .name-input:focus {
            border-color: #7fc8ff;
        }
        .strength-slider {
            flex: 2;
            min-width: 200px;
            height: 8px;
            background: #2b5068;
            border-radius: 10px;
            -webkit-appearance: none;
        }
        .strength-slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 22px;
            height: 22px;
            background: #7fc8ff;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid #c2e5ff;
            box-shadow: 0 2px 8px black;
        }
        .strength-value {
            background: #0d3142;
            padding: 5px 18px;
            border-radius: 40px;
            color: #ffdb9f;
            font-weight: 700;
            font-size: 1.2rem;
            min-width: 60px;
            text-align: center;
        }
        .strength-hint {
            color: #b0d4ed;
            font-size: 0.9rem;
            background: #143a4b;
            padding: 8px 16px;
            border-radius: 30px;
            margin-top: 8px;
            border-left: 4px solid #f7b731;
        }
        .gallery-section {
            background: #0f202b;
            border-radius: 40px;
            padding: 16px 24px;
            margin: 20px 0 24px;
            border: 1px solid #3e7a9c;
        }
        .gallery-header {
            display: flex;
            justify-content: space-between;
            color: #b0dcff;
            font-weight: 500;
            letter-spacing: 1px;
            margin-bottom: 12px;
            font-size: 1.1rem;
        }
        .gallery-list {
            max-height: 120px;
            overflow-y: auto;
            background: #142b39;
            border-radius: 30px;
            padding: 10px 15px;
            border: 1px solid #2f5570;
        }
        .gallery-item {
            display: flex;
            justify-content: space-between;
            padding: 6px 10px;
            border-bottom: 1px dashed #2f5570;
            color: #c9ecff;
        }
        .gallery-item:last-child {
            border: none;
        }
        .gallery-name {
            font-weight: 600;
            color: #ffdb9f;
        }
        .gallery-strength {
            background: #1f3e4f;
            padding: 2px 15px;
            border-radius: 30px;
        }
        .buff-bar {
            background: #1e3a4b;
            border-radius: 30px;
            padding: 8px 24px;
            margin: 10px 0 20px;
            border: 1px solid #4f8eb0;
            display: flex;
            align-items: center;
            gap: 15px;
            color: #b0dcff;
            font-size: 1rem;
            flex-wrap: wrap;
        }
        .buff-icon {
            font-size: 1.3rem;
        }
        .buff-value {
            background: #2d5b77;
            padding: 3px 16px;
            border-radius: 30px;
            color: #ffdb9f;
            font-weight: 600;
        }
        .rankings-row {
            display: flex;
            gap: 20px;
            margin: 20px 0 30px;
        }
        .ranking-card {
            flex: 1;
            background: #0f202b;
            border-radius: 40px;
            padding: 18px 20px;
            border: 1px solid #3e7a9c;
            box-shadow: 0 4px 0 #0a1f2a;
        }
        .ranking-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 16px;
            color: #ffdb9f;
            font-size: 1.3rem;
            font-weight: 600;
            border-bottom: 2px solid #2f5e7a;
            padding-bottom: 8px;
        }
        .ranking-list {
            list-style: none;
            margin: 0;
            padding: 0;
            max-height: 300px;
            overflow-y: auto;
        }
        .ranking-item {
            display: flex;
            justify-content: space-between;
            padding: 8px 10px;
            border-bottom: 1px solid #2a4a60;
            color: #c0def5;
            font-size: 0.95rem;
        }
        .ranking-item:last-child {
            border: none;
        }
        .ranking-name {
            font-weight: 500;
            color: #b3e0ff;
        }
        .ranking-value {
            background: #1f3f52;
            padding: 2px 12px;
            border-radius: 30px;
            color: #ffdb9f;
        }
        .ranking-highlight {
            background: #2b5e7c;
            border-left: 4px solid #f7b731;
        }
        .shill-tag {
            background: #b8860b;
            color: black;
            font-size: 0.7rem;
            padding: 2px 6px;
            border-radius: 20px;
            margin-left: 8px;
            font-weight: bold;
        }
        .ad-row {
            display: flex;
            gap: 15px;
            margin: 20px 0 15px;
            justify-content: center;
            flex-wrap: wrap;
        }
        .ad-btn {
            background: #2d4f64;
            border: none;
            border-bottom: 4px solid #123440;
            color: white;
            font-weight: 600;
            padding: 12px 20px;
            border-radius: 60px;
            min-width: 140px;
            cursor: pointer;
            transition: all 0.08s linear;
            box-shadow: 0 6px 0 #0b1f29;
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            line-height: 1.3;
        }
        .ad-btn:active {
            transform: translateY(4px);
            border-bottom-width: 2px;
        }
        .ad-btn:disabled {
            opacity: 0.45;
            transform: translateY(2px);
            border-bottom-width: 2px;
            pointer-events: none;
        }
        .ad-cost {
            font-size: 0.9rem;
            color: #b3e4ff;
        }
        .shill-panel {
            background: #1c3341;
            border-radius: 40px;
            padding: 18px 24px;
            margin: 20px 0 20px;
            border: 1px solid #b8860b;
            box-shadow: 0 4px 0 #7a5d0b;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: space-between;
            gap: 20px;
        }
        .shill-label {
            color: #ffdb9f;
            font-weight: 600;
            font-size: 1.2rem;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .shill-input-group {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }
        .shill-input {
            background: #0d3142;
            border: 2px solid #b8860b;
            border-radius: 40px;
            padding: 10px 20px;
            color: #ffdb9f;
            font-size: 1rem;
            width: 150px;
            outline: none;
        }
        .shill-input:focus {
            border-color: #ffc107;
        }
        .shill-btn {
            background: #b8860b;
            border: none;
            border-bottom: 4px solid #6b4d0a;
            color: white;
            font-weight: 700;
            padding: 12px 28px;
            border-radius: 60px;
            cursor: pointer;
            transition: all 0.08s linear;
            box-shadow: 0 6px 0 #4d3808;
            font-size: 1rem;
        }
        .shill-btn:active {
            transform: translateY(4px);
            border-bottom-width: 2px;
        }
        .shill-btn:disabled {
            opacity: 0.45;
            transform: translateY(2px);
            border-bottom-width: 2px;
            pointer-events: none;
        }
        .shill-hint {
            color: #b0d4ed;
            font-size: 0.9rem;
            background: #143a4b;
            padding: 5px 15px;
            border-radius: 30px;
        }

        /* 银行模块 */
        .bank-panel {
            background: #1c3c4b;
            border-radius: 40px;
            padding: 18px 24px;
            margin: 15px 0 20px;
            border: 1px solid #3fa3d0;
            box-shadow: 0 4px 0 #146a8f;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: space-between;
            gap: 20px;
            color: #e7f3ff;
        }
        .bank-info {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 25px;
        }
        .bank-item {
            background: #0f3142;
            padding: 8px 18px;
            border-radius: 40px;
            border: 1px solid #4790b5;
        }
        .bank-actions {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
        }
        .bank-input {
            background: #0d3142;
            border: 2px solid #3fa3d0;
            border-radius: 40px;
            padding: 10px 20px;
            color: #ffdb9f;
            font-size: 1rem;
            width: 140px;
            outline: none;
        }
        .bank-btn {
            background: #2d7894;
            border: none;
            border-bottom: 4px solid #124c63;
            color: white;
            font-weight: 600;
            padding: 10px 20px;
            border-radius: 60px;
            cursor: pointer;
            transition: all 0.08s linear;
            box-shadow: 0 5px 0 #0e3b4b;
        }
        .bank-btn:active {
            transform: translateY(4px);
            border-bottom-width: 2px;
        }
        .bank-btn:disabled {
            opacity: 0.45;
            transform: translateY(2px);
            border-bottom-width: 2px;
            pointer-events: none;
        }

        /* 新手教程 + 摆烂区域 */
        .extra-row {
            display: flex;
            gap: 20px;
            margin: 15px 0 25px;
            align-items: flex-start;
            flex-wrap: wrap;
        }
        .tutorial-box {
            flex: 2;
            min-width: 280px;
            background: #1c3341;
            border-radius: 30px;
            padding: 0;
            border: 1px solid #3e7a9c;
            overflow: hidden;
        }
        .tutorial-summary {
            background: #24495d;
            padding: 12px 20px;
            color: #ffdb9f;
            font-weight: 600;
            font-size: 1.1rem;
            cursor: pointer;
            list-style: none;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .tutorial-summary::-webkit-details-marker {
            display: none;
        }
        .tutorial-content {
            padding: 15px 20px;
            background: #0f202b;
            color: #c9ecff;
            font-size: 0.95rem;
            border-top: 1px solid #3e7a9c;
        }
        .tutorial-content p {
            margin: 8px 0;
        }
        .bailan-btn {
            flex: 0 0 auto;
            background: #8b3d3d;
            border: none;
            border-bottom: 4px solid #521f1f;
            color: white;
            font-weight: 700;
            padding: 12px 30px;
            border-radius: 60px;
            cursor: pointer;
            font-size: 1.2rem;
            box-shadow: 0 6px 0 #3d1717;
            transition: all 0.08s linear;
            align-self: center;
        }
        .bailan-btn:active {
            transform: translateY(4px);
            border-bottom-width: 2px;
        }

        .btn {
            background: #24495d;
            border: none;
            border-bottom: 4px solid #0f2d3c;
            color: white;
            font-weight: 600;
            font-size: 1rem;
            padding: 12px 24px;
            border-radius: 60px;
            letter-spacing: 1px;
            cursor: pointer;
            transition: all 0.08s linear;
            box-shadow: 0 6px 0 #0f222e, 0 4px 12px black;
            flex: 0 1 auto;
            min-width: 130px;
            display: inline-flex;
            justify-content: center;
            align-items: center;
            gap: 8px;
        }
        .btn.small {
            padding: 8px 18px;
            font-size: 0.9rem;
            min-width: auto;
        }
        .btn:active {
            transform: translateY(4px);
            border-bottom-width: 2px;
        }
        .btn:disabled {
            opacity: 0.45;
            transform: translateY(2px);
            border-bottom-width: 2px;
            pointer-events: none;
            filter: grayscale(0.5);
        }
        .btn.primary {
            background: #3d7b9c;
            border-bottom-color: #1b4965;
        }
        .btn.active {
            background: #5fa3c7;
            border-bottom-color: #2f637f;
            box-shadow: 0 0 15px #7fc8ff;
        }
        .log-section {
            background: #0c1d28;
            border-radius: 28px;
            padding: 18px 22px;
            border: 1px solid #38658a;
        }
        .log-header {
            display: flex;
            justify-content: space-between;
            color: #b0dcff;
            text-transform: uppercase;
            letter-spacing: 2px;
            font-weight: 400;
            margin-bottom: 14px;
        }
        .log-list {
            list-style: none;
            margin: 0;
            padding: 0;
            max-height: 140px;
            overflow-y: auto;
            font-size: 0.9rem;
            color: #bdd8ec;
            scrollbar-width: thin;
            scrollbar-color: #3e6f8f #0d2a38;
        }
        .log-list li {
            padding: 8px 10px;
            border-bottom: 1px solid #1f4155;
            font-family: 'JetBrains Mono', monospace;
        }
        .log-list li:last-child {
            border: none;
        }
        .reset-area {
            display: flex;
            justify-content: flex-end;
            margin-top: 16px;
        }
        .cash-negative {
            color: #ff8a7a;
        }
    </style>
</head>
<body>
    <div class="simulator-panel" id="app">
        <h1>
            🎮 奶龙快跑运营模拟器
            <small>顶富</small>
            <div class="mode-section">
                <span class="mode-badge" id="modeDisplay">简单模式</span>
                <button class="mode-btn" id="easyModeBtn">简单</button>
                <button class="mode-btn" id="hardModeBtn">困难</button>
            </div>
        </h1>
        <!-- 核心指标卡片 -->
        <div class="stats-grid">
            <div class="stat-card">
                <div class="stat-label">👥 当前玩家</div>
                <div class="stat-value" id="playersDisplay">0</div>
            </div>
            <div class="stat-card">
                <div class="stat-label">😊 满意度</div>
                <div class="stat-value" id="satisfactionDisplay">0%</div>
            </div>
            <div class="stat-card">
                <div class="stat-label">💰 现金</div>
                <div class="stat-value" id="cashDisplay">$0</div>
            </div>
            <div class="stat-card">
                <div class="stat-label">📊 综合流水</div>
                <div class="stat-value" id="totalRevenueDisplay">$0</div>
            </div>
        </div>

        <!-- 进度条:满意度 -->
        <div class="progress-section">
            <div class="progress-item">
                <span class="progress-label">满意度</span>
                <div class="progress-bar-bg">
                    <div class="progress-fill" id="satisfactionBar" style="width:0%"></div>
                </div>
                <span class="progress-number" id="satisfactionPercent">0%</span>
            </div>
        </div>

        <!-- 消费加成状态栏 -->
        <div class="buff-bar" id="buffBar">
            <span class="buff-icon">🔥</span>
            <span>消费加成:</span>
            <span class="buff-value" id="buffMultiplier">1.0x</span>
            <span>剩余</span>
            <span class="buff-value" id="buffDays">0</span>
            <span>天</span>
        </div>

        <!-- 排行榜双栏 -->
        <div class="rankings-row">
            <div class="ranking-card">
                <div class="ranking-header">
                    <span>💰 游戏氪金榜</span>
                    <span style="font-size:0.9rem;">(本游戏内)</span>
                </div>
                <ul class="ranking-list" id="spenderList"></ul>
            </div>
            <div class="ranking-card">
                <div class="ranking-header">
                    <span>📈 游戏流水榜</span>
                    <span style="font-size:0.9rem;">(全市场)</span>
                </div>
                <ul class="ranking-list" id="revenueRankList"></ul>
            </div>
        </div>

        <!-- 游戏托功能面板 -->
        <div class="shill-panel">
            <div class="shill-label">
                <span>🎭 游戏托操作</span>
                <span class="shill-hint">费用 = 托金额/100 </span>
            </div>
            <div class="shill-input-group">
                <input type="number" id="shillAmount" class="shill-input" min="100" max="10000" value="1000" step="100">
                <button class="shill-btn" id="hireShillBtn">雇佣游戏托</button>
            </div>
        </div>

        <!-- 银行功能模块 -->
        <div class="bank-panel">
            <div class="bank-info">
                <span class="bank-item">🏦 贷款余额: <strong id="loanAmountDisplay">$0</strong></span>
                <span class="bank-item">⏳ 还款期限: <strong id="loanDueDisplay">-</strong></span>
            </div>
            <div class="bank-actions">
                <input type="number" id="borrowAmount" class="bank-input" min="0" max="20000" value="5000" step="100">
                <button class="bank-btn" id="borrowBtn">借款 (10%利息)</button>
                <button class="bank-btn" id="repayBtn">偿还贷款</button>
            </div>
        </div>

        <!-- 新手教程 + 摆烂按钮  (内嵌图形界面) -->
        <div class="extra-row">
            <details class="tutorial-box" open>
                <summary class="tutorial-summary">📘 新手教程 (点击折叠)</summary>
                <div class="tutorial-content">
                    <p><strong>🎯 目标:</strong> 让你的游戏登顶流水榜,避免破产或逃债。</p>
                    <p><strong>📅 每天:</strong> 发布版本推进一天,随机事件影响玩家/满意度。</p>
                    <p><strong>🌟 新角色:</strong> 强度影响流水/满意度,需命名且不重复。</p>
                    <p><strong>🎭 游戏托:</strong> 花钱雇托刺激消费,但可能降低满意度。</p>
                    <p><strong>🏦 银行:</strong> 可借最多20000,15天内需还本息(10%)。</p>
                    <p><strong>💔 结局:</strong> 现金<300破产;贷款逾期逃债;登顶顶富;点击“摆烂”直接结束。</p>
                </div>
            </details>
            <button class="bailan-btn" id="bailanBtn">💔 摆烂结局</button>
        </div>

        <!-- 版本周期管理 -->
        <div class="version-panel">
            <div class="version-row">
                <div class="version-badge" id="versionDisplay">v1.0</div>
                <div class="planned-box">
                    <span>📋 下一版本内容 :</span>
                    <span class="planned-value" id="plannedContentDisplay">未选择</span>
                </div>
            </div>
            <div class="version-actions">
                <button class="btn small" id="setRoleBtn">🌟 新角色</button>
                <button class="btn small" id="setEventBtn">🎉 新活动</button>
                <button class="btn small" id="setGameplayBtn">⚙️ 新玩法</button>
                <button class="btn primary" id="publishVersionBtn" style="margin-left:auto;">📦 发布版本 ($300)</button>
            </div>
            <div id="strengthControl" class="strength-control" style="display: none;">
                <div class="name-row">
                    <span class="name-label">📛 角色名</span>
                    <input type="text" id="roleNameInput" class="name-input" placeholder="例如: 奶龙" maxlength="20">
                </div>
                <div class="slider-row">
                    <span class="strength-label">⚡ 强度值</span>
                    <input type="range" id="strengthSlider" class="strength-slider" min="0" max="100" value="50" step="1">
                    <span id="strengthDisplay" class="strength-value">50</span>
                </div>
                <div class="strength-hint">
                    💡 强度低于历史平均 → 流水下降 (现金减少) ; 强度远高于历史平均 → 玩家不满 (满意度下降)
                </div>
            </div>
        </div>

        <!-- 角色图鉴 -->
        <div class="gallery-section">
            <div class="gallery-header">
                <span>📖 角色图鉴</span>
                <span>已收录 <span id="galleryCount">0</span> 位</span>
            </div>
            <div class="gallery-list" id="galleryList"></div>
        </div>

        <!-- 广告活动 -->
        <div class="ad-row">
            <button class="ad-btn" id="adSocialBtn"><span>📱 社交媒体广告</span><span class="ad-cost">$150</span></button>
            <button class="ad-btn" id="adTvBtn"><span>📺 电视广告</span><span class="ad-cost">$400</span></button>
            <button class="ad-btn" id="adInfluencerBtn"><span>🌟 网红合作</span><span class="ad-cost">$300</span></button>
        </div>

        <!-- 事件日志 + 重置 -->
        <div class="log-section">
            <div class="log-header">
                <span>📋 运营日志</span>
                <span>天数 <span id="dayCounter">0</span></span>
            </div>
            <ul class="log-list" id="logContainer">
                <li>✨ 欢迎,版本发布将同时推进一天</li>
            </ul>
            <div class="reset-area">
                <button class="btn small" id="resetBtn">⟲ 重新开始 (保持当前模式)</button>
            </div>
        </div>
    </div>

    <script>
        (function() {
            // ----- 可变常数 -----
            let MAINTENANCE_PER_SERVER = 20;
            let ARPU = 0.4;
            let PATCH_COST = 300;
            let EXTRA_MAINTENANCE_PER_PLAYER = 0.5;
            let PENALTY_FACTOR = 0.8;
            let MAX_UNRELEASED_DAYS = 3;
            let SPENDER_SHARE = 0.2;
            let SHILL_SAT_PENALTY_CHANCE = 0.3;
            let SHILL_SAT_PENALTY_MIN = 1;
            let SHILL_SAT_PENALTY_MAX = 5;
            let SHILL_STIMULATE_FACTOR = 0.5;

            let AD_TYPES = { };
            let CONTENT_EFFECTS = { };
            let autoEvents = [];
            let choiceEvents = [];

            // ----- 当前模式 -----
            let currentMode = 'easy';

            // ----- 难度模式应用函数 -----
            function applyMode(mode) {
                currentMode = mode;
                if (mode === 'hard') {
                    MAINTENANCE_PER_SERVER = 40;
                    ARPU = 0.2;
                    PATCH_COST = 500;
                    EXTRA_MAINTENANCE_PER_PLAYER = 1.0;
                    PENALTY_FACTOR = 0.6;
                    MAX_UNRELEASED_DAYS = 2;
                    SPENDER_SHARE = 0.1;
                    SHILL_SAT_PENALTY_CHANCE = 0.5;
                    SHILL_SAT_PENALTY_MIN = 2;
                    SHILL_SAT_PENALTY_MAX = 8;
                    SHILL_STIMULATE_FACTOR = 0.15;   // 困难模式托收益大幅降低

                    AD_TYPES = {
                        social: { cost: 250, playersMin: 10, playersMax: 30, satEffect: 0, name: '社交媒体广告' },
                        tv: { cost: 600, playersMin: 30, playersMax: 70, satEffect: -4, name: '电视广告' },
                        influencer: { cost: 500, playersMin: 20, playersMax: 50, satEffect: 1, name: '网红合作' }
                    };

                    CONTENT_EFFECTS = {
                        '角色': { incomeMultiplier: 1.2, bonusDays: 2, desc: '🌟新角色' },
                        '活动': { incomeMultiplier: 1.15, bonusDays: 2, desc: '🎉新活动' },
                        '玩法': { playerBase: 80, playerVar: 50, satMin: 3, satMax: 8, desc: '⚙️新玩法' }
                    };

                    autoEvents = [
                        { text: "🎉 游戏主播直播你的游戏,玩家数小幅增加!", apply: (s) => { s.players += Math.floor(Math.random() * 20) + 10; s.satisfaction = Math.min(100, s.satisfaction + 1); } },
                        { text: "💥 服务器遭到攻击,满意度下降。", apply: (s) => { s.satisfaction = Math.max(0, s.satisfaction - 8); s.cash -= 50; } },
                        { text: "👍 玩家社区好评,满意度微升。", apply: (s) => { s.satisfaction = Math.min(100, s.satisfaction + 3); s.players += 8; } },
                        { text: "⚙️ 版本更新出现BUG,部分玩家离开。", apply: (s) => { s.players = Math.max(10, s.players - 35); s.satisfaction = Math.max(0, s.satisfaction - 7); } },
                        { text: "📈 社交媒体话题微热,少量新玩家。", apply: (s) => { s.players += Math.floor(Math.random() * 30) + 15; s.cash += 40; } },
                        { text: "🔧 服务器优化,满意度微增。", apply: (s) => { s.satisfaction = Math.min(100, s.satisfaction + 2); } }
                    ];

                    choiceEvents = [
                        {
                            text: "🍀 玩家反馈发现一个良性Bug:可以刷少量金币。",
                            choices: [
                                { desc: "修复它", effect: (s) => { s.satisfaction = Math.max(0, s.satisfaction - 5); addLog("🛠️ 修复Bug,玩家不满-5"); } },
                                { desc: "不修复", effect: (s) => { s.totalRevenue *= 0.92; s.cash *= 0.92; s.satisfaction = Math.min(100, s.satisfaction + 2); addLog("💰 放任Bug,流水-8%,满意度+2"); } }
                            ]
                        },
                        {
                            text: "💥 玩家反馈发现一个恶性Bug导致存档损坏!",
                            choices: [
                                { desc: "紧急修复", effect: (s) => { s.satisfaction = Math.min(100, s.satisfaction + 1); addLog("🔧 修复,满意度+1"); } },
                                { desc: "拖延不修", effect: (s) => { s.satisfaction = Math.max(0, s.satisfaction - 8); addLog("😡 未修复,满意度-8"); } }
                            ]
                        }
                    ];
                } else {
                    // 简单模式
                    MAINTENANCE_PER_SERVER = 20;
                    ARPU = 0.4;
                    PATCH_COST = 300;
                    EXTRA_MAINTENANCE_PER_PLAYER = 0.5;
                    PENALTY_FACTOR = 0.8;
                    MAX_UNRELEASED_DAYS = 3;
                    SPENDER_SHARE = 0.2;
                    SHILL_SAT_PENALTY_CHANCE = 0.3;
                    SHILL_SAT_PENALTY_MIN = 1;
                    SHILL_SAT_PENALTY_MAX = 5;
                    SHILL_STIMULATE_FACTOR = 0.25;   // 简单模式托收益0.25

                    AD_TYPES = {
                        social: { cost: 150, playersMin: 20, playersMax: 50, satEffect: 1, name: '社交媒体广告' },
                        tv: { cost: 400, playersMin: 60, playersMax: 120, satEffect: -2, name: '电视广告' },
                        influencer: { cost: 300, playersMin: 40, playersMax: 80, satEffect: 3, name: '网红合作' }
                    };

                    CONTENT_EFFECTS = {
                        '角色': { incomeMultiplier: 1.5, bonusDays: 3, desc: '🌟新角色' },
                        '活动': { incomeMultiplier: 1.4, bonusDays: 3, desc: '🎉新活动' },
                        '玩法': { playerBase: 150, playerVar: 100, satMin: 8, satMax: 15, desc: '⚙️新玩法' }
                    };

                    autoEvents = [
                        { text: "🎉 游戏主播直播你的游戏,玩家数增加!", apply: (s) => { s.players += Math.floor(Math.random() * 40) + 20; s.satisfaction = Math.min(100, s.satisfaction + 2); } },
                        { text: "💥 服务器遭到小规模攻击,满意度微降。", apply: (s) => { s.satisfaction = Math.max(0, s.satisfaction - 5); s.cash -= 30; } },
                        { text: "👍 玩家社区好评如潮,满意度上升。", apply: (s) => { s.satisfaction = Math.min(100, s.satisfaction + 6); s.players += 15; } },
                        { text: "⚙️ 版本更新出现小BUG,部分玩家离开。", apply: (s) => { s.players = Math.max(10, s.players - 25); s.satisfaction = Math.max(0, s.satisfaction - 4); } },
                        { text: "📈 社交媒体话题膨胀,新玩家涌入!", apply: (s) => { s.players += Math.floor(Math.random() * 60) + 30; s.cash += 80; } },
                        { text: "🔧 服务器优化,负载压力小幅缓解。", apply: (s) => { s.satisfaction = Math.min(100, s.satisfaction + 3); } }
                    ];

                    choiceEvents = [
                        {
                            text: "🍀 玩家反馈发现一个良性Bug:可以刷少量金币,但不影响平衡。",
                            choices: [
                                { desc: "修复它", effect: (s) => { s.satisfaction = Math.max(0, s.satisfaction - 3); addLog("🛠️ 修复了良性Bug,但部分玩家不满,满意度-3"); } },
                                { desc: "不修复", effect: (s) => { s.totalRevenue *= 0.95; s.cash *= 0.95; s.satisfaction = Math.min(100, s.satisfaction + 3); addLog("💰 放任良性Bug,流水下降5%,但玩家开心,满意度+3"); } }
                            ]
                        },
                        {
                            text: "💥 玩家反馈发现一个恶性Bug:会导致存档损坏!",
                            choices: [
                                { desc: "紧急修复", effect: (s) => { s.satisfaction = Math.min(100, s.satisfaction + 3); addLog("🔧 修复了恶性Bug,玩家赞赏,满意度+3"); } },
                                { desc: "拖延不修", effect: (s) => { s.satisfaction = Math.max(0, s.satisfaction - 5); addLog("😡 未修复恶性Bug,玩家愤怒,满意度-5"); } }
                            ]
                        }
                    ];
                }
                document.getElementById('modeDisplay').innerText = (mode === 'hard' ? '困难模式' : '简单模式');
            }

            // ----- 初始数据生成函数 -----
            function generateInitialSpenders() {
                const names = ['kkksc03', '咋克', '咋氪', 'chen_zhe', 'jiangly', 'apiadu', '我才是奶龙', '方方面代言人', 'M2B', '何意味'];
                return names.map(name => ({ name: name, amount: Math.floor(Math.random() * 5000) + 1000 })).sort((a, b) => b.amount - a.amount);
            }

            function generateCompetitorGames() {
                const gameNames = ['florr', 'OI教练模拟器', 'OI重开模拟器', '肚子的模拟器', 'whk班主任模拟器', 'OJ运维模拟器', '熊二快跑', '原神', '地球online模拟器', 'OI家长群模拟器'];
                return gameNames.map(name => ({ name: name, revenue: Math.floor(Math.random() * 50000) + 20000 }));
            }

            // ----- 状态 -----
            let state = {};

            // DOM 元素
            const strengthControlDiv = document.getElementById('strengthControl');
            const strengthSlider = document.getElementById('strengthSlider');
            const strengthDisplay = document.getElementById('strengthDisplay');
            const roleNameInput = document.getElementById('roleNameInput');
            const buffMultiplierSpan = document.getElementById('buffMultiplier');
            const buffDaysSpan = document.getElementById('buffDays');
            const totalRevenueSpan = document.getElementById('totalRevenueDisplay');
            const shillAmountInput = document.getElementById('shillAmount');
            const hireShillBtn = document.getElementById('hireShillBtn');
            const loanAmountSpan = document.getElementById('loanAmountDisplay');
            const loanDueSpan = document.getElementById('loanDueDisplay');
            const borrowAmountInput = document.getElementById('borrowAmount');
            const borrowBtn = document.getElementById('borrowBtn');
            const repayBtn = document.getElementById('repayBtn');

            strengthSlider.addEventListener('input', function() {
                strengthDisplay.textContent = this.value;
            });

            function addLog(message) {
                state.logs.unshift(message);
                if (state.logs.length > 10) state.logs.pop();
            }

            function isRoleNameExists(name) {
                return state.roleHistory.some(role => role.name === name);
            }

            function updateSpenders(addedAmount) {
                if (addedAmount <= 0) return;
                const idx = Math.floor(Math.random() * state.topSpenders.length);
                state.topSpenders[idx].amount += addedAmount;
                state.topSpenders.sort((a, b) => b.amount - a.amount);
            }

            function updateRevenueRank() {
                const myGame = state.competitorGames.find(g => g.name === '我的游戏');
                if (myGame) myGame.revenue = state.totalRevenue;
                state.competitorGames.sort((a, b) => b.revenue - a.revenue);
            }

            // ----- 结局检测 (不再弹窗后询问模式,直接重置) -----
            function checkGameOver() {
                if (state.cash < 300) {
                    alert(`💔 破产结局!现金仅剩 $${state.cash.toFixed(2)},低于300。游戏结束。`);
                    return true;
                }
                if (state.loanAmount > 0 && state.day > state.loanDueDay) {
                    alert(`🏃 逃债结局!贷款 $${state.loanAmount} 逾期未还 (期限第${state.loanDueDay}天)。游戏结束。`);
                    return true;
                }
                if (state.competitorGames.length > 0 && state.competitorGames[0].name === '我的游戏') {
                    alert(`👑 顶富结局!你的游戏登顶流水榜榜首,富可敌国!`);
                    return true;
                }
                return false;
            }

            function handleGameOver() {
                if (checkGameOver()) {
                    resetGame();      // 结局后重置,保持当前模式
                    return true;
                }
                return false;
            }

            // ----- 日常结算 -----
            function dailySettlement() {
                const oldSat = state.satisfaction;
                const oldPlayers = state.players;

                state.unreleasedRoleDays++;

                let satDelta = (Math.random() * 6 - 3) + (50 - state.satisfaction) * 0.05;
                state.satisfaction += satDelta;
                state.satisfaction = Math.min(100, Math.max(0, state.satisfaction));

                const satEffect = (state.satisfaction - 50) / 100;
                let playerGrowth = satEffect * 0.2 + (Math.random() * 0.06 - 0.03);
                if (state.satisfaction < 30) playerGrowth -= 0.04;
                if (state.satisfaction > 80) playerGrowth += 0.02;
                let newPlayers = state.players * (1 + playerGrowth);
                newPlayers = Math.max(10, Math.round(newPlayers));
                state.players = newPlayers;

                let penalty = 1.0;
                if (state.unreleasedRoleDays > MAX_UNRELEASED_DAYS) {
                    penalty = PENALTY_FACTOR;
                    addLog(`⚠️ 连续${state.unreleasedRoleDays}天未发布新角色,流水下降${(1-PENALTY_FACTOR)*100}%`);
                }
                const revenue = state.players * ARPU * state.incomeMultiplier * penalty;
                state.totalRevenue += revenue;
                const spenderIncrease = revenue * SPENDER_SHARE;
                updateSpenders(spenderIncrease);
                updateRevenueRank();

                const cost = state.servers * MAINTENANCE_PER_SERVER;
                state.cash += (revenue - cost);

                if (Math.random() < 0.7) {
                    const allEvents = [...autoEvents, ...choiceEvents];
                    const randomEvent = allEvents[Math.floor(Math.random() * allEvents.length)];
                    if (randomEvent.choices) {
                        const userChoice = confirm(`${randomEvent.text}\n\n请选择操作:\n确定 = ${randomEvent.choices[0].desc}\n取消 = ${randomEvent.choices[1].desc}`);
                        const choiceIndex = userChoice ? 0 : 1;
                        randomEvent.choices[choiceIndex].effect(state);
                        addLog(`📢 ${randomEvent.text} 你选择了:${randomEvent.choices[choiceIndex].desc}`);
                    } else {
                        randomEvent.apply(state);
                        state.players = Math.max(10, Math.floor(state.players));
                        state.satisfaction = Math.min(100, Math.max(0, state.satisfaction));
                        addLog(`🌩️ 随机事件:${randomEvent.text}`);
                    }
                }

                if (state.incomeBonusDays > 0) {
                    state.incomeBonusDays--;
                    if (state.incomeBonusDays === 0) {
                        state.incomeMultiplier = 1.0;
                        addLog(`📉 消费加成效果结束`);
                    }
                }

                state.day++;

                state.players = Math.floor(state.players);
                state.satisfaction = Math.min(100, Math.max(0, state.satisfaction));
                if (state.players < 0) state.players = 0;

                const satChange = (state.satisfaction - oldSat).toFixed(1);
                const playerChange = state.players - oldPlayers;
                const playerChangeSign = playerChange >= 0 ? `+${playerChange}` : `${playerChange}`;
                addLog(`📅 第${state.day}天结束 | 满意度变化: ${satChange}% | 玩家变化: ${playerChangeSign} | 现金: $${state.cash.toFixed(2)}`);
            }

            // ----- 发布版本 -----
            function publishVersion() {
                if (!state.plannedContent) return;

                const extraCost = state.players * EXTRA_MAINTENANCE_PER_PLAYER;
                const totalCost = PATCH_COST + extraCost;

                if (state.cash < totalCost) {
                    alert(`现金不足!需要 $${totalCost.toFixed(2)} (基础${PATCH_COST} + 维护费 $${extraCost.toFixed(2)})`);
                    return;
                }

                const content = state.plannedContent;

                state.cash -= totalCost;
                addLog(`💰 支付版本维护费 $${extraCost.toFixed(2)} (${state.players} 玩家)`);

                if (content === '角色') {
                    const roleName = roleNameInput.value.trim();
                    if (!roleName) {
                        alert('请输入角色名!');
                        state.cash += totalCost;
                        return;
                    }
                    if (isRoleNameExists(roleName)) {
                        alert(`角色名“${roleName}”已存在,请重新命名。`);
                        state.cash += totalCost;
                        return;
                    }
                    const strength = parseInt(strengthSlider.value, 10);

                    let avgStrength = 50;
                    const strengths = state.roleHistory.map(r => r.strength);
                    if (strengths.length > 0) {
                        const sum = strengths.reduce((a, b) => a + b, 0);
                        avgStrength = sum / strengths.length;
                    }

                    const diff = strength - avgStrength;
                    if (diff < -5) {
                        const penalty = Math.floor(Math.abs(diff) * 3);
                        state.cash -= penalty;
                        addLog(`💸 角色强度低于历史平均,流水下降 $${penalty}`);
                    }
                    if (diff > 10) {
                        const satPenalty = Math.min(15, Math.floor(diff / 2));
                        state.satisfaction = Math.max(0, state.satisfaction - satPenalty);
                        addLog(`😤 角色强度远高于历史平均,玩家不满,满意度 -${satPenalty}%`);
                    }

                    state.roleHistory.push({ name: roleName, strength: strength });
                    addLog(`⚡ 新角色“${roleName}”强度 ${strength} (历史平均 ${avgStrength.toFixed(1)})`);

                    const effect = CONTENT_EFFECTS['角色'];
                    state.incomeMultiplier = effect.incomeMultiplier;
                    state.incomeBonusDays = effect.bonusDays;
                    addLog(`💰 新角色带来消费加成 x${effect.incomeMultiplier},持续${effect.bonusDays}天`);

                    state.unreleasedRoleDays = 0;

                    roleNameInput.value = '';
                    strengthSlider.value = 50;
                    strengthDisplay.textContent = 50;
                }
                else if (content === '活动') {
                    const effect = CONTENT_EFFECTS['活动'];
                    state.incomeMultiplier = effect.incomeMultiplier;
                    state.incomeBonusDays = effect.bonusDays;
                    addLog(`💰 新活动带来消费加成 x${effect.incomeMultiplier},持续${effect.bonusDays}天`);
                }
                else if (content === '玩法') {
                    const effect = CONTENT_EFFECTS['玩法'];
                    const newMajor = Math.floor(state.version) + 1;
                    state.version = newMajor;
                    const playerGain = effect.playerBase + Math.floor(Math.random() * effect.playerVar);
                    state.players += playerGain;
                    const satGain = Math.floor(Math.random() * (effect.satMax - effect.satMin + 1)) + effect.satMin;
                    state.satisfaction = Math.min(100, state.satisfaction + satGain);
                    addLog(`🚀 发布新玩法,大版本升至 v${state.version.toFixed(1)},玩家 +${playerGain},满意度 +${satGain}%`);
                }

                if (content !== '玩法') {
                    state.version = Math.round((state.version + 0.1) * 10) / 10;
                }

                state.plannedContent = null;
                addLog(`⏳ 请为下个版本选择内容 (新角色/活动/玩法)`);

                dailySettlement();
                renderUI();
            }

            // ----- 广告 -----
            function adCampaign(type) {
                const ad = AD_TYPES[type];
                if (!ad) return;
                if (state.cash < ad.cost) {
                    alert(`现金不足!需要 $${ad.cost}`);
                    return;
                }
                state.cash -= ad.cost;
                const gain = Math.floor(Math.random() * (ad.playersMax - ad.playersMin + 1)) + ad.playersMin;
                state.players += gain;
                state.satisfaction = Math.min(100, Math.max(0, state.satisfaction + ad.satEffect));
                let satMsg = '';
                if (ad.satEffect > 0) satMsg = `,满意度 +${ad.satEffect}`;
                else if (ad.satEffect < 0) satMsg = `,满意度 ${ad.satEffect}`;
                addLog(`📢 ${ad.name}:吸引 ${gain} 名新玩家${satMsg}`);
                renderUI();
            }

            // ----- 雇佣游戏托 -----
            function hireShill() {
                let amount = parseFloat(shillAmountInput.value);
                if (isNaN(amount) || amount < 100) {
                    alert('请输入有效的托氪金数(≥100)');
                    return;
                }
                amount = Math.floor(amount);
                const cost = amount / 100;
                if (state.cash < cost) {
                    alert(`现金不足!需要 $${cost.toFixed(2)}`);
                    return;
                }

                state.cash -= cost;
                addLog(`🎭 雇佣游戏托,花费 $${cost.toFixed(2)} (托金额 $${amount})`);

                const shill = { id: state.nextShillId++, amount: amount };
                state.shills.push(shill);

                const stimulateTotal = amount * SHILL_STIMULATE_FACTOR;
                const numAffected = Math.floor(Math.random() * 3) + 1;
                for (let i = 0; i < numAffected; i++) {
                    const share = stimulateTotal / numAffected;
                    const idx = Math.floor(Math.random() * state.topSpenders.length);
                    state.topSpenders[idx].amount += share;
                }
                state.topSpenders.sort((a, b) => b.amount - a.amount);

                state.totalRevenue += stimulateTotal;
                state.cash += stimulateTotal;
                updateRevenueRank();   // 立即更新流水榜
                addLog(`💰 托刺激了 ${numAffected} 名真实玩家,总消费增加 $${stimulateTotal.toFixed(2)} (已加入流水榜)`);

                if (Math.random() < SHILL_SAT_PENALTY_CHANCE) {
                    const penalty = Math.floor(Math.random() * (SHILL_SAT_PENALTY_MAX - SHILL_SAT_PENALTY_MIN + 1)) + SHILL_SAT_PENALTY_MIN;
                    state.satisfaction = Math.max(0, state.satisfaction - penalty);
                    addLog(`😤 玩家发现游戏托,满意度 -${penalty}`);
                }

                renderUI();
            }

            // ----- 银行功能 -----
            function borrowMoney() {
                if (state.loanAmount > 0) {
                    alert('你还有未还清的贷款,不能再次借款。');
                    return;
                }
                let amount = parseFloat(borrowAmountInput.value);
                if (isNaN(amount) || amount <= 0) {
                    alert('请输入有效的借款金额');
                    return;
                }
                if (amount > 20000) {
                    alert('单次借款不得超过20000');
                    return;
                }
                state.cash += amount;
                state.loanAmount = amount;
                state.loanDueDay = state.day + 15;
                addLog(`🏦 向银行借款 $${amount},期限15天,需还本息 $${(amount * 1.1).toFixed(2)}`);
                renderUI();
            }

            function repayLoan() {
                if (state.loanAmount <= 0) {
                    alert('没有未还贷款');
                    return;
                }
                const owed = state.loanAmount * 1.1;
                if (state.cash < owed) {
                    alert(`现金不足!需要 $${owed.toFixed(2)} 才能还清贷款。`);
                    return;
                }
                state.cash -= owed;
                addLog(`💰 偿还贷款本息 $${owed.toFixed(2)},贷款已清。`);
                state.loanAmount = 0;
                state.loanDueDay = 0;
                renderUI();
            }

            // ----- 摆烂结局 -----
            function bailanEnding() {
                alert("💔 摆烂结局:你放弃了运营,游戏彻底凉凉。");
                resetGame();   // 保持当前模式重置
            }

            function setPlannedContent(type) {
                if (type === '角色' || type === '活动' || type === '玩法') {
                    state.plannedContent = type;
                    addLog(`📌 下个版本内容已设定为:${type}`);
                    renderUI();
                }
            }

            // ----- 重置游戏 (使用当前模式常量) -----
            function resetGame() {
                state = {
                    players: 200,
                    satisfaction: 70,
                    servers: 1,
                    cash: 5000,
                    day: 0,
                    version: 1.0,
                    plannedContent: '角色',
                    roleHistory: [],
                    incomeMultiplier: 1.0,
                    incomeBonusDays: 0,
                    totalRevenue: 0,
                    unreleasedRoleDays: 0,
                    topSpenders: generateInitialSpenders(),
                    competitorGames: (() => {
                        const games = generateCompetitorGames();
                        games.push({ name: '奶龙快跑', revenue: 0 });
                        return games.sort((a, b) => b.revenue - a.revenue);
                    })(),
                    shills: [],
                    nextShillId: 1,
                    logs: ["✨ 游戏开服!版本v1.0,已默认选择‘新角色’"],
                    loanAmount: 0,
                    loanDueDay: 0
                };
                roleNameInput.value = '';
                strengthSlider.value = 50;
                strengthDisplay.textContent = 50;
                shillAmountInput.value = 1000;
                borrowAmountInput.value = 5000;
                renderUI();
            }

            // ----- 渲染UI -----
            function renderUI() {
                if (handleGameOver()) return; // 如果触发了结局,resetGame会重新渲染,此处直接返回

                document.getElementById('playersDisplay').innerText = Math.floor(state.players);
                document.getElementById('satisfactionDisplay').innerText = Math.round(state.satisfaction) + '%';
                const cashFormatted = state.cash.toFixed(2);
                const cashElement = document.getElementById('cashDisplay');
                cashElement.innerText = '$' + cashFormatted;
                if (state.cash < 0) cashElement.classList.add('cash-negative');
                else cashElement.classList.remove('cash-negative');

                totalRevenueSpan.innerText = '$' + state.totalRevenue.toFixed(2);

                const satBar = document.getElementById('satisfactionBar');
                const satPercent = document.getElementById('satisfactionPercent');
                satBar.style.width = state.satisfaction + '%';
                satPercent.innerText = Math.round(state.satisfaction) + '%';

                document.getElementById('dayCounter').innerText = state.day;
                document.getElementById('versionDisplay').innerText = 'v' + state.version.toFixed(1);
                const plannedSpan = document.getElementById('plannedContentDisplay');
                plannedSpan.innerText = state.plannedContent || '未选择';

                buffMultiplierSpan.innerText = state.incomeMultiplier.toFixed(1) + 'x';
                buffDaysSpan.innerText = state.incomeBonusDays;

                const roleBtn = document.getElementById('setRoleBtn');
                const eventBtn = document.getElementById('setEventBtn');
                const gameplayBtn = document.getElementById('setGameplayBtn');
                roleBtn.classList.remove('active');
                eventBtn.classList.remove('active');
                gameplayBtn.classList.remove('active');
                if (state.plannedContent === '角色') roleBtn.classList.add('active');
                if (state.plannedContent === '活动') eventBtn.classList.add('active');
                if (state.plannedContent === '玩法') gameplayBtn.classList.add('active');

                if (state.plannedContent === '角色') {
                    strengthControlDiv.style.display = 'flex';
                } else {
                    strengthControlDiv.style.display = 'none';
                }

                const publishBtn = document.getElementById('publishVersionBtn');
                publishBtn.disabled = (state.cash < PATCH_COST) || !state.plannedContent;

                document.getElementById('adSocialBtn').disabled = state.cash < AD_TYPES.social.cost;
                document.getElementById('adTvBtn').disabled = state.cash < AD_TYPES.tv.cost;
                document.getElementById('adInfluencerBtn').disabled = state.cash < AD_TYPES.influencer.cost;

                const inputAmount = parseFloat(shillAmountInput.value) || 0;
                const cost = inputAmount / 100;
                hireShillBtn.disabled = state.cash < cost || inputAmount < 100;

                loanAmountSpan.innerText = '$' + state.loanAmount.toFixed(2);
                if (state.loanAmount > 0) {
                    const daysLeft = state.loanDueDay - state.day;
                    loanDueSpan.innerText = daysLeft + ' 天';
                } else {
                    loanDueSpan.innerText = '无贷款';
                }
                borrowBtn.disabled = state.loanAmount > 0;
                repayBtn.disabled = state.loanAmount <= 0;

                const logUl = document.getElementById('logContainer');
                logUl.innerHTML = '';
                state.logs.forEach(log => {
                    const li = document.createElement('li');
                    li.textContent = log;
                    logUl.appendChild(li);
                });

                const galleryList = document.getElementById('galleryList');
                const galleryCount = document.getElementById('galleryCount');
                galleryList.innerHTML = '';
                if (state.roleHistory.length === 0) {
                    galleryList.innerHTML = '<div class="gallery-item" style="color: #6f8fa5;">暂无角色</div>';
                } else {
                    state.roleHistory.slice().reverse().forEach(role => {
                        const item = document.createElement('div');
                        item.className = 'gallery-item';
                        item.innerHTML = `<span class="gallery-name">${role.name}</span><span class="gallery-strength">⚡ ${role.strength}</span>`;
                        galleryList.appendChild(item);
                    });
                }
                galleryCount.innerText = state.roleHistory.length;

                const allSpenders = [
                    ...state.topSpenders.map(p => ({ ...p, isShill: false })),
                    ...state.shills.map(s => ({ name: `游戏托${s.id}`, amount: s.amount, isShill: true }))
                ];
                allSpenders.sort((a, b) => b.amount - a.amount);

                const spenderList = document.getElementById('spenderList');
                spenderList.innerHTML = '';

                const top10 = allSpenders.slice(0, 10);
                const shillIdsInTop10 = new Set(top10.filter(p => p.isShill).map(p => p.name));

                top10.forEach(spender => {
                    const li = document.createElement('li');
                    li.className = 'ranking-item';
                    if (spender.isShill) li.classList.add('ranking-highlight');
                    let nameDisplay = spender.isShill ? `${spender.name} <span class="shill-tag">托</span>` : spender.name;
                    li.innerHTML = `<span class="ranking-name">${nameDisplay}</span><span class="ranking-value">$${spender.amount.toFixed(2)}</span>`;
                    spenderList.appendChild(li);
                });

                allSpenders.slice(10).filter(p => p.isShill).forEach(spender => {
                    if (!shillIdsInTop10.has(spender.name)) {
                        const li = document.createElement('li');
                        li.className = 'ranking-item ranking-highlight';
                        li.innerHTML = `<span class="ranking-name">${spender.name} (榜外) <span class="shill-tag">托</span></span><span class="ranking-value">$${spender.amount.toFixed(2)}</span>`;
                        spenderList.appendChild(li);
                    }
                });

                const revenueRankList = document.getElementById('revenueRankList');
                revenueRankList.innerHTML = '';
                const top10Revenue = state.competitorGames.slice(0, 10);
                const myGameInTop10 = top10Revenue.some(game => game.name === '奶龙快跑');
                top10Revenue.forEach(game => {
                    const li = document.createElement('li');
                    li.className = 'ranking-item';
                    if (game.name === '奶龙快跑') li.classList.add('ranking-highlight');
                    li.innerHTML = `<span class="ranking-name">${game.name}</span><span class="ranking-value">$${game.revenue.toFixed(2)}</span>`;
                    revenueRankList.appendChild(li);
                });
                if (!myGameInTop10) {
                    const myGame = state.competitorGames.find(game => game.name === '奶龙快跑');
                    if (myGame) {
                        const li = document.createElement('li');
                        li.className = 'ranking-item ranking-highlight';
                        li.innerHTML = `<span class="ranking-name">${myGame.name} (榜外)</span><span class="ranking-value">$${myGame.revenue.toFixed(2)}</span>`;
                        revenueRankList.appendChild(li);
                    }
                }
            }

            // ----- 事件绑定 -----
            document.addEventListener('DOMContentLoaded', () => {
                // 初始默认简单模式
                applyMode('easy');
                resetGame();

                // 模式切换
                document.getElementById('easyModeBtn').addEventListener('click', () => {
                    applyMode('easy');
                    resetGame();
                });
                document.getElementById('hardModeBtn').addEventListener('click', () => {
                    applyMode('hard');
                    resetGame();
                });

                document.getElementById('resetBtn').addEventListener('click', resetGame);

                document.getElementById('setRoleBtn').addEventListener('click', () => setPlannedContent('角色'));
                document.getElementById('setEventBtn').addEventListener('click', () => setPlannedContent('活动'));
                document.getElementById('setGameplayBtn').addEventListener('click', () => setPlannedContent('玩法'));

                document.getElementById('publishVersionBtn').addEventListener('click', publishVersion);

                document.getElementById('adSocialBtn').addEventListener('click', () => adCampaign('social'));
                document.getElementById('adTvBtn').addEventListener('click', () => adCampaign('tv'));
                document.getElementById('adInfluencerBtn').addEventListener('click', () => adCampaign('influencer'));

                document.getElementById('hireShillBtn').addEventListener('click', hireShill);

                document.getElementById('borrowBtn').addEventListener('click', borrowMoney);
                document.getElementById('repayBtn').addEventListener('click', repayLoan);

                document.getElementById('bailanBtn').addEventListener('click', bailanEnding);
            });
        })();
    </script>
</body>
</html>
原文