<?php
// 【【【 UI 修复版 v1.5.4 - 仅修改客服链接为系统路径 】】】
ob_start();
session_start();

// 从JSON文件读取功能数据
$feature_categories = [];
if (file_exists('features.json')) {
    $json_data = file_get_contents('features.json');
    $feature_categories = json_decode($json_data, true);
}

// --- Configuration ---
$page_title_login = "TY助手 - 登录";
$page_title_main = "TY助手 - 功能配置";
$version = "v1.5.4"; 
$main_app_header_image_url = "tupian.jpg";
$main_app_announcement = "助手后台已经更新，优化防风，细节优化，优化底层逻辑。(9月26日)";
$login_placeholder = "请输入您的卡密";
$login_button_text = "登录";
$login_info_1 = "1. 请您检查前后是否有空格，是否输入正确，请您再次核对 卡密重新输入。";
$login_info_2 = "2. 已退款的卡密将会回收后台会关闭所有功能，所有功能将会失效！";
$login_info_highlight = "卡密首次登录成功后将自动激活，时间开始消耗，到期后卡密将无法继续使用，默认本机登录，请您知悉！";

// --- 访问记录逻辑 ---
if (!isset($_SESSION['visitor_has_been_recorded'])) {
    $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
    $api_url = $scheme . "://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/map_api.php?action=record";
    @file_get_contents($api_url);
    $_SESSION['visitor_has_been_recorded'] = true;
}

// --- Logout Logic ---
if (isset($_GET['logout'])) {
    session_unset();
    session_destroy();
    header("Location: " . $_SERVER['PHP_SELF']);
    exit;
}

// =================== 登录验证逻辑 (完全不动) ===================
$login_error_message = '';
if ($_SERVER["REQUEST_METHOD"] == "POST" && !isset($_SESSION['logged_in'])) {
    if (isset($_POST['kami_code']) && !empty(trim($_POST['kami_code']))){
        try {
            require_once __DIR__ . '/db.php';
            $pdo = getDatabaseConnection();
        } catch (PDOException $e) {
            $login_error_message = "系统错误：无法连接到验证服务器。";
        }

        if (isset($pdo)) {
            $submitted_kami = trim($_POST['kami_code']);
            $sql = "SELECT id, kami_code, status, activation_date, duration_days FROM kami WHERE kami_code = :kami_code LIMIT 1";
            $stmt = $pdo->prepare($sql);
            $stmt->execute([':kami_code' => $submitted_kami]);
            $key_data = $stmt->fetch(PDO::FETCH_ASSOC);

            if ($key_data) {
                if ($key_data['status'] === 'banned') {
                    $login_error_message = "此卡密已被封禁。";
                } else {
                    $is_expired = false;
                    if ($key_data['status'] === 'active' && $key_data['activation_date'] !== null) {
                        $activationDate = new DateTime($key_data['activation_date']);
                        $expiryDate = $activationDate->modify("+" . $key_data['duration_days'] . " days");
                        $now = new DateTime();
                        if ($now > $expiryDate) $is_expired = true;
                    } elseif ($key_data['status'] === 'expired') {
                        $is_expired = true;
                    }
                    
                    if ($is_expired) {
                        $update_sql = "UPDATE kami SET status = 'expired' WHERE id = :id AND status != 'expired'";
                        $update_stmt = $pdo->prepare($update_sql);
                        $update_stmt->execute([':id' => $key_data['id']]);
                        $login_error_message = "此卡密已过期。";
                    } else {
                        $_SESSION['logged_in'] = true;
                        $_SESSION['kami_code'] = $key_data['kami_code'];
                        $activationDate = new DateTime($key_data['activation_date'] ?? 'now');
                        $expiryDate = $activationDate->modify("+" . $key_data['duration_days'] . " days");
                        $_SESSION['expiry_date'] = $expiryDate->format('Y-m-d H:i:s');

                        if ($key_data['status'] === 'unused') {
                            $update_sql = "UPDATE kami SET status = 'active', activation_date = NOW() WHERE id = :id";
                            $update_stmt = $pdo->prepare($update_sql);
                            $update_stmt->execute([':id' => $key_data['id']]);
                            $now = new DateTime();
                            $expiryDate = $now->modify("+" . $key_data['duration_days'] . " days");
                            $_SESSION['expiry_date'] = $expiryDate->format('Y-m-d H:i:s');
                        }
                        header("Location: " . $_SERVER['PHP_SELF']);
                        exit();
                    }
                }
            } else {
                $login_error_message = "卡密错误或不存在，请重试。";
            }
        }
    } else {
        $login_error_message = "请输入卡密进行验证。";
    }
}

$is_logged_in = isset($_SESSION['logged_in']) && $_SESSION['logged_in'] === true;
$display_expiry_date = isset($_SESSION['expiry_date']) ? date('Y-m-d', strtotime($_SESSION['expiry_date'])) : ''; 
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <!-- 引入 FontAwesome 图标库 -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <title><?php echo htmlspecialchars($is_logged_in ? $page_title_main : $page_title_login); ?></title>
    
    <style>
        /* ================= 样式区域 (保持美化版不动) ================= */
        :root { 
            --bg-gradient: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
            --glass-bg: rgba(255, 255, 255, 0.05);
            --glass-border: rgba(255, 255, 255, 0.1);
            --primary-accent: #00d2ff;
            --secondary-accent: #bd34fe;
            --text-primary: #ffffff;
            --btn-gradient: linear-gradient(90deg, #00d2ff, #3a7bd5);
        }

        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }
        
        body { 
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; 
            background: var(--bg-gradient); 
            background-attachment: fixed;
            color: var(--text-primary); 
            line-height: 1.6; 
            min-height: 100vh;
            padding-bottom: 100px; 
        }

        .page-container { max-width: 600px; margin: 0 auto; padding: 20px; }

        /* --- 头部样式 --- */
        .header { 
            background: var(--glass-bg);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid var(--glass-border);
            padding: 20px; 
            text-align: center; 
            border-radius: 0 0 20px 20px;
            margin-bottom: 20px;
            position: relative;
            z-index: 10; 
        }
        .header img { width: 100%; border-radius: 12px; margin-bottom: 15px; }
        .header .expiry-date { font-size: 0.9em; color: var(--primary-accent); font-weight: bold; }
        
        .announcement-box {
            background: rgba(255, 165, 2, 0.1);
            border: 1px solid rgba(255, 165, 2, 0.3);
            color: #ff9f43;
            padding: 10px;
            border-radius: 8px;
            font-size: 0.85em;
            text-align: left;
            margin: 10px 0;
            display: flex; align-items: center;
        }

        .text-consult-link { 
            display: block;
            width: 100%;
            background: rgba(0, 210, 255, 0.15);
            padding: 10px;
            border-radius: 50px;
            color: #fff; 
            text-decoration: none; 
            font-size: 0.95em; 
            margin: 15px 0;
            border: 1px solid rgba(0, 210, 255, 0.3);
            cursor: pointer;
            z-index: 20; 
        }
        .text-consult-link:active { transform: scale(0.98); }

        .header-buttons { display: flex; gap: 10px; margin-top: 10px; position: relative; z-index: 20; }
        .header-buttons .btn { 
            flex: 1; 
            background: rgba(255,255,255,0.1); 
            color: #fff; 
            padding: 10px; 
            border: 1px solid var(--glass-border);
            border-radius: 8px; 
            font-size: 0.9em; cursor: pointer; 
        }

        /* 宫格功能区 */
        .content-section { 
            background: var(--glass-bg);
            border: 1px solid var(--glass-border);
            margin: 15px; border-radius: 16px; padding: 15px; 
            backdrop-filter: blur(5px);
            position: relative; z-index: 5;
        }
        .content-section.top-boxes { 
            display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; 
            background: transparent; border: none; padding: 0; 
        }
        .top-box { 
            background: rgba(30, 33, 48, 0.8);
            border: 1px solid var(--glass-border);
            padding: 15px; border-radius: 12px; text-align: center; 
        }
        .top-box .title { font-weight: bold; color: #fff; font-size: 1em; }
        .top-box .description { font-size: 0.75em; color: #aaa; }

        /* 开关样式 */
        .checkbox-item { 
            display: flex; align-items: center; justify-content: space-between;
            margin-bottom: 10px; padding: 12px; 
            background: rgba(0,0,0,0.2); border-radius: 10px;
        }
        .checkbox-item input[type="checkbox"] { display: none; }
        
        .checkbox-item label { 
            flex-grow: 1; color: #fff; cursor: pointer;
            display: flex; justify-content: space-between; align-items: center;
        }
        
        .checkbox-item label::after {
            content: '';
            width: 44px; height: 24px;
            background: #4a4a4a; 
            border-radius: 20px;
            position: relative;
            transition: 0.3s;
        }
        
        .checkbox-item label::before {
            content: '';
            width: 18px; height: 18px;
            background: #fff;
            border-radius: 50%;
            position: absolute;
            right: 40px; 
            margin-top: 1px;
            transition: 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
            z-index: 2;
            pointer-events: none; 
        }

        .checkbox-item input[type="checkbox"]:checked + label::after { background: var(--primary-accent); }
        .checkbox-item input[type="checkbox"]:checked + label::before { transform: translateX(24px); }
        .checkbox-item input[type="checkbox"]:checked + label { color: var(--primary-accent); }

        /* 底部悬浮固定样式 */
        .footer-actions { 
            position: fixed; 
            bottom: 0; 
            left: 0; 
            width: 100%; 
            background: #1e1e2f; 
            padding: 15px 20px; 
            border-top: 1px solid var(--glass-border);
            display: flex; gap: 15px; align-items: center; justify-content: space-between;
            z-index: 990; 
            box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
        }
        
        .footer-actions .btn-logout { 
            width: 30%; background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #aaa;
            padding: 12px; border-radius: 50px; font-size: 0.9em; text-align: center; text-decoration: none;
        }
        
        .footer-actions .btn-start { 
            width: 65%; 
            background: var(--btn-gradient); 
            color: white; 
            display: flex; align-items: center; justify-content: center; gap: 8px; 
            padding: 12px; border-radius: 50px; border: none;
            font-size: 1.1em; font-weight: bold; 
            box-shadow: 0 4px 15px rgba(0, 210, 255, 0.4);
        }

        /* 登录页居中修正 */
        .login-card {
            background: var(--glass-bg); backdrop-filter: blur(10px);
            border: 1px solid var(--glass-border); padding: 40px 30px;
            border-radius: 20px; width: 100%; max-width: 400px; margin-top: 10vh;
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .login-title {
            text-align: center;
            width: 100%;
            margin-bottom: 5px;
            font-size: 2.2em;
            font-weight: 800;
            background: linear-gradient(to right, #fff, #00d2ff);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        .login-version {
            display: block;
            text-align: center;
            width: 100%;
            margin-bottom: 30px;
            color: #aaa;
        }
        .login-form { width: 100%; }
        .login-input { 
            width: 100%; padding: 15px; margin-bottom: 20px; border-radius: 12px; border: none;
            background: rgba(255,255,255,0.1); color: #fff; text-align: center;
        }
        .login-button { 
            width: 100%; padding: 15px; border-radius: 12px; border: none;
            background: var(--btn-gradient); color: white; font-weight: bold; font-size: 1.1em;
        }
        .login-info-box { 
            width: 100%;
            margin-top: 20px; 
            text-align: left; 
            font-size: 0.85em; 
            color: #aaa; 
            background: rgba(0,0,0,0.2);
            padding: 15px;
            border-radius: 10px;
        }

        /* 弹窗通用样式 */
        .modal-overlay { 
            display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.9); z-index: 1000;
            align-items: center; justify-content: center;
            backdrop-filter: blur(5px);
        }
        .modal-content { 
            background: #1e212b; width: 85%; max-width: 320px;
            border-radius: 20px; padding: 25px; position: relative;
            border: 1px solid rgba(255,255,255,0.1); color: #fff;
            text-align: left; 
        }
        .modal-title { font-size: 1.2em; margin-bottom: 15px; color: var(--primary-accent); text-align: center; }
        .modal-text { 
            font-size: 0.9em; line-height: 1.6; color: #ccc; 
            background-color: transparent !important;
            text-shadow: none !important;
        }
        .modal-text p { margin-bottom: 10px; }
        .close-icon { 
            position: absolute; top: 15px; right: 15px; color: #fff; 
            font-size: 24px; cursor: pointer; line-height: 1;
        }
        
        /* iframe 弹窗样式 (用于打开客服) */
        .iframe-modal-overlay { display: none; position: fixed; z-index: 1002; top: 0; left: 0; width: 100%; height: 100%; background-color: #1e1e2f; flex-direction: column; transform: translateX(100%); transition: transform 0.3s ease-out; }
        .iframe-modal-overlay.active { display: flex; transform: translateX(0); }
        .iframe-header { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 10px 15px; background-color: #161621; border-bottom: 1px solid rgba(255,255,255,0.1); }
        .iframe-close-btn { font-size: 1.8em; color: #fff; text-decoration: none; line-height: 1; cursor: pointer; padding: 5px; }
        .iframe-title { font-size: 1.1em; color: #fff; font-weight: bold; }
        #payment-iframe { flex-grow: 1; width: 100%; height: 100%; border: none; }

        .popup-message { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.9); padding: 20px; border-radius: 10px; z-index: 2000; border: 1px solid var(--primary-accent); }
    </style>
    <link rel="stylesheet" href="system.css?v=20260923">
</head>
<body class="<?php echo $is_logged_in ? 'main-app-visible' : 'login-visible'; ?>">

<?php if ($is_logged_in): ?>
    <div class="main-app-container">
        <div class="header">
            <img src="<?php echo htmlspecialchars($main_app_header_image_url); ?>" alt="Header Image">
            <p class="expiry-date"><i class="fas fa-clock"></i> 到期时间：<?php echo htmlspecialchars($display_expiry_date); ?></p>
            <div class="announcement-box">
                <i class="fas fa-bullhorn" style="margin-right: 8px;"></i> 
                <span><?php echo htmlspecialchars($main_app_announcement); ?></span>
            </div>

            <!-- 【重点修改】：调用 openPaymentFrame 打开 kefu/chat.php -->
            <div onclick="openPaymentFrame('kefu/chat.php', '在线咨询')" class="text-consult-link">
                <i class="fas fa-headset"></i> 在线咨询
            </div>

            <div class="header-buttons">
                <div onclick="openModal('ruleModal')" class="btn"><i class="fas fa-book"></i> 使用须知</div>
                <div onclick="openModal('tutorialModal')" class="btn"><i class="fas fa-play-circle"></i> 操作教程</div>
            </div>
        </div>
        
        <div class="content-section top-boxes">
            <div class="top-box" onclick="window.location.href='wxj.php'"> 
                <div class="title"><i class="fas fa-coins" style="color: gold;"></i> 无线能量</div> 
                <div class="description">支持苹果/安卓双端</div> 
            </div>
            <div class="top-box" onclick="window.location.href='wxj.php'"> 
                <div class="title"><i class="fas fa-bolt" style="color: #ff4757;"></i> 全功能强化</div> 
                <div class="description">D牌·天赋·拍卖·效果牌</div> 
            </div>
            <div class="top-box" onclick="window.location.href='wxj.php'"> 
                <div class="title"><i class="fas fa-percentage" style="color: #2ed573;"></i> 100%卡率</div> 
                <div class="description">核心牌·高阶牌疯来</div> 
            </div>
            <div class="top-box" onclick="window.location.href='wxj.php'"> 
                <div class="title"><i class="fas fa-gem" style="color: #bd34fe;"></i>999极限养成</div> 
                <div class="description">觉醒·成长·核心直冲999</div> 
            </div>
        </div>

        <?php if (!empty($feature_categories)): ?>
            <?php foreach ($feature_categories as $category): ?>
            <div class="content-section">
                <h2 class="section-title">
                    <?php echo htmlspecialchars($category['title']); ?>
                    <?php if (!empty($category['subtitle'])): ?>
                        <span><?php echo htmlspecialchars($category['subtitle']); ?></span>
                    <?php endif; ?>
                </h2>
                <ul class="checkbox-list">
                    <?php if (!empty($category['features'])): ?>
                        <?php foreach ($category['features'] as $feature): ?>
                        <li class="checkbox-item">
                            <input type="checkbox" id="<?php echo htmlspecialchars($feature['id']); ?>" name="options[]" value="<?php echo htmlspecialchars($feature['id']); ?>">
                            <label for="<?php echo htmlspecialchars($feature['id']); ?>">
                                <?php echo htmlspecialchars($feature['label']); ?>
                            </label>
                        </li>
                        <?php endforeach; ?>
                    <?php endif; ?>
                </ul>
            </div>
            <?php endforeach; ?>
        <?php endif; ?>

        <div class="footer-actions">
             <a href="index.php?logout=1" class="btn-logout">退出登录</a>
             <button type="button" id="btn-start" class="btn btn-start">
                  <i class="fas fa-power-off"></i> 立即启动
             </button>
        </div>
    </div> 
<?php else: ?>
    <!-- 登录页 -->
    <div class="page-container">
        <div class="login-container">
            <div class="login-card">
                <h1 class="login-title">TY助手</h1>
                <span class="login-version"><?php echo htmlspecialchars($version); ?> PRO</span>
                <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post" class="login-form">
                    <input type="text" id="kami_code" name="kami_code" class="login-input" placeholder="<?php echo htmlspecialchars($login_placeholder); ?>" required>
                    <button type="submit" class="login-button"><?php echo htmlspecialchars($login_button_text); ?></button>
                </form>
                <div class="login-error"><?php echo htmlspecialchars($login_error_message); ?></div>
                <div class="login-info-box">
                    <p><?php echo htmlspecialchars($login_info_1); ?></p>
                    <p><?php echo htmlspecialchars($login_info_2); ?></p>
                    <span style="color: #ff4757; display:block; margin-top:5px; font-weight:bold;"><?php echo htmlspecialchars($login_info_highlight); ?></span>
                </div>
            </div>
        </div>
    </div>
<?php endif; ?>

<!-- ================= 弹窗区域 ================= -->

<!-- 1. 使用须知弹窗 -->
<div id="ruleModal" class="modal-overlay" onclick="closeModal(event, 'ruleModal')"> 
    <div class="modal-content"> 
        <span class="close-icon" onclick="document.getElementById('ruleModal').style.display='none'">&times;</span> 
        <h2 class="modal-title">使用须知</h2> 
        <div class="modal-text"> 
            <p>1.助手更新会在后台更新，不要卸载本助手</p> 
            <p>2.卡密首次登录会自动绑定当前设备,一机一码，不支持多设备使用。</p> 
            <p>3.免责声明:本软件来自互联网等公开合法渠道及软件爱好者收集共享，该软件仅作为研究学习等交流使用，并无任何商业目的。</p> 
        </div> 
    </div> 
</div>

<!-- 2. 操作教程弹窗 -->
<div id="tutorialModal" class="modal-overlay" onclick="closeModal(event, 'tutorialModal')"> 
    <div class="modal-content"> 
        <span class="close-icon" onclick="document.getElementById('tutorialModal').style.display='none'">&times;</span> 
        <h2 class="modal-title">操作教程</h2> 
        <div class="modal-text"> 
            <p>1.打开游戏(游戏就是你自己下载的游戏)</p> 
            <p>2.返回手机桌面，打开本助手，勾选想要的功能，点击启动助手。</p> 
            <p>3.显示启动成功，返回游戏，正常游玩即可。</p> 
            <p>4.助手不用的时候请在后台关闭。</p> 
            <p>5.本助手内置最新防检测，启动成功后将直接生效，助手开启后不会在游戏内有任何显示(无悬浮窗，游戏内不显示增加概率)，可以用于录制视频直播等。</p>
            <p>6.本软件属于超微调型，功能提升效果稳定真实，全新防封检测技术，为您的账号保驾护航，各位可放心长期使用，相信它一定会是您上分的强力伙伴。</p>
            <p>7.所有功能从激活日起即可享有，包更新包售后。</p>
            <p>8.本产品是在游戏原有概率上增加百分之多少概率，并不是百分百概率必出，本产品只是微调概率，确保游戏系统不会检测封号，如果觉得没效果可以多玩几把感受一下</p>
            <p>9.需要效果非常明显玩着很爽，可以去尝试一下（无限能量 100%卡率等） 激活后解锁四款功能，永久使用</p>
            <p>10.有任何问题 可以在线咨询 有人工回消息的  在辅助首页，操作教程上面</p>
        </div> 
    </div> 
</div>

<!-- 3. 客服系统 Iframe 弹窗 -->
<div id="payment-iframe-modal" class="iframe-modal-overlay">
    <div class="iframe-header">
        <span class="iframe-close-btn" onclick="closePaymentFrame()">×</span>
        <span class="iframe-title" id="payment-iframe-title"></span>
        <span style="width: 24px;"></span>
    </div>
    <iframe id="payment-iframe" src="about:blank"></iframe>
</div>

<div id="popup-message" class="popup-message"><i class="fas fa-check-circle"></i> 启动成功 等待10秒进入游戏...</div>

<script>
// 通用弹窗关闭函数
function openModal(id) {
    document.getElementById(id).style.display = 'flex';
}
function closeModal(e, id) {
    if (e.target.id === id) {
        document.getElementById(id).style.display = 'none';
    }
}

// Iframe 弹窗逻辑 (用于打开客服)
const iframeModal = document.getElementById('payment-iframe-modal');
const iframeElement = document.getElementById('payment-iframe');
const iframeTitle = document.getElementById('payment-iframe-title');

function openPaymentFrame(url, title) {
    if (!iframeModal || !iframeElement) return;
    iframeTitle.textContent = title; 
    iframeElement.src = url;
    iframeModal.classList.add('active');
    document.body.style.overflow = 'hidden';
}

function closePaymentFrame() {
    if (!iframeModal || !iframeElement) return;
    iframeModal.classList.remove('active');
    document.body.style.overflow = '';
    iframeElement.src = 'about:blank';
}

// 启动按钮逻辑
document.addEventListener('DOMContentLoaded', function() {
    const startButton = document.getElementById('btn-start');
    const popupMessage = document.getElementById('popup-message');
    const originalSuccessMessage = '<i class="fas fa-check-circle"></i> 启动成功 等待10秒进入游戏...';
    let popupTimer = null;

    if (startButton && popupMessage) {
        startButton.addEventListener('click', () => {
            const checkedCheckboxes = document.querySelectorAll('.content-section input[type="checkbox"]:checked');
            if (checkedCheckboxes.length === 0) {
                popupMessage.innerHTML = '<i class="fas fa-exclamation-circle"></i> 请选择要启动的技能';
                popupMessage.style.display = 'block';
                if (popupTimer) clearTimeout(popupTimer);
                popupTimer = setTimeout(() => { popupMessage.style.display = 'none'; }, 3000);
                return;
            }
            if (startButton.disabled) return;
            
            startButton.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 正在注入...';
            startButton.disabled = true;
            popupMessage.innerHTML = originalSuccessMessage;
            popupMessage.style.display = 'block';
            
            if (popupTimer) clearTimeout(popupTimer);
            popupTimer = setTimeout(() => { popupMessage.style.display = 'none'; }, 3000);
            
            setTimeout(() => {
                 startButton.innerHTML = '<i class="fas fa-check"></i> 运行中';
                 startButton.disabled = false;
            }, 3000);
        });
    }
});
</script>
</body>
</html>
<?php
ob_end_flush();
?>
