<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,minimum-scale=1.0,maximum-scale=1.0,viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <meta name="theme-color" content="#fff7ed">
    <title>粉色超市模拟器下载</title>
    <!-- 移动端检测 -->
    <script>
        (function(){
            var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
            if (!isMobile) {
                document.write('<div style="position:fixed;inset:0;background:#fff7ed;display:flex;align-items:center;justify-content:center;z-index:99999;font-family:sans-serif;padding:20px;text-align:center;">');
                document.write('<div style="background:#fff;padding:40px 30px;border-radius:20px;box-shadow:0 10px 40px rgba(0,0,0,0.08);max-width:400px;">');
                document.write('<div style="font-size:48px;margin-bottom:16px;">📱</div>');
                document.write('<h2 style="color:#2d241c;font-size:20px;margin-bottom:12px;">请使用手机浏览器访问</h2>');
                document.write('<p style="color:#6b5b4d;font-size:15px;line-height:1.6;margin:0;">本页面专为手机端设计，请使用手机浏览器打开此链接</p>');
                document.write('</div></div>');
                document.write('<style>body{overflow:hidden;}</style>');
            }
        })();
    </script>
    <style>
        *{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
        body{font-family:"PingFang SC","Microsoft YaHei",-apple-system,sans-serif;background:#fff7ed;color:#2d241c;line-height:1.65;padding:12px;padding-bottom:calc(12px + env(safe-area-inset-bottom,0px));-webkit-text-size-adjust:100%!important;min-height:100vh;min-height:100dvh;overflow-x:hidden;-webkit-font-smoothing:antialiased}
        .highlight-red,#step2Desc,#step2Example{-webkit-user-select:text;user-select:text}
        .page-wrap{max-width:480px;margin:0 auto;animation:fadeInUp 0.5s ease-out}
        @keyframes fadeInUp{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
        @keyframes scaleIn{from{opacity:0;transform:scale(0.9)}to{opacity:1;transform:scale(1)}}
        @keyframes shimmer{0%{background-position:-200% 0}100%{background-position:200% 0}}
        .main-card{background:#fff;border-radius:22px;box-shadow:0 2px 20px rgba(180,83,9,0.06),0 8px 40px rgba(180,83,9,0.05);overflow:hidden;padding:0 0 4px 0}
        .success-badge{display:block;text-align:center;padding:12px 18px;background:#fff3e6;color:#c2410c;font-size:13px;font-weight:700;letter-spacing:0.02em;border-bottom:1px solid rgba(249,115,22,0.16);animation:scaleIn 0.4s ease-out}
        .hero-card{background:linear-gradient(135deg,#fffaf5,#fff3e6);padding:26px 20px;margin:16px 16px 0;border-radius:18px;border:1px solid rgba(249,115,22,0.16);text-align:center}
        .hero-title{color:#c2410c;font-weight:800;font-size:18px;line-height:1.5}
        .hero-sub{color:#9a8472;font-weight:500;font-size:14px;margin-top:4px;line-height:1.6}
        .step-card{margin:12px 16px 0;padding:18px 16px;background:#fffaf5;border-radius:18px;border:1px solid rgba(249,115,22,0.14)}
        .step-card h2{font-size:15px;font-weight:700;color:#2d241c;margin-bottom:12px;line-height:1.45;display:flex;align-items:flex-start;gap:9px}
        .step-num{display:inline-flex;align-items:center;justify-content:center;width:21px;height:21px;border-radius:50%;background:#f97316;color:#fff;font-size:11px;font-weight:700;flex-shrink:0;margin-top:1px}
        .highlight-red{color:#2d241c;font-weight:500;font-size:14px;padding:12px 14px;background:#fff;border:1px solid rgba(249,115,22,0.14);border-radius:12px;display:block;word-break:break-all;line-height:1.55;transition:all 0.2s ease}
        #textList,#keywordList{list-style:none;padding:0;margin:0}
        #textList li,#keywordList li{display:flex;flex-direction:column;align-items:stretch;margin-bottom:10px;list-style:none;animation:fadeInUp 0.35s ease-out both}
        #textList li:nth-child(1){animation-delay:0.05s}
        #keywordList li:nth-child(1){animation-delay:0.08s}
        #keywordList li:nth-child(2){animation-delay:0.13s}
        #keywordList li:nth-child(3){animation-delay:0.18s}
        #textList li:last-child,#keywordList li:last-child{margin-bottom:0}
        #textList li .highlight-red,#keywordList li .highlight-red{flex:1 1 auto;min-width:0;word-break:break-word;overflow-wrap:anywhere}
        .text-content{margin:10px 0 0;font-size:14px;color:#6b5b4d;line-height:1.65}
        .text-content:empty{display:none}
        #step2Desc,#step2Example{text-align:center;font-size:15px;line-height:1.75;font-weight:600;color:#6b5b4d}
        #step2Desc span{font-weight:700}
        .image-container{margin:14px 16px 0;text-align:center}
        .image-container img{max-width:100%;border-radius:16px;box-shadow:0 2px 12px rgba(180,83,9,0.06);cursor:pointer}
        .image-container img.loaded{animation:scaleIn 0.4s ease-out}
        .img-loading-placeholder{display:flex;align-items:center;justify-content:center;min-height:120px;background:linear-gradient(90deg,#f5ede4 25%,#faf5ef 50%,#f5ede4 75%);background-size:200% 100%;animation:shimmer 1.5s infinite;border-radius:16px;color:#b0a090;font-size:13px}
        .button-container{text-align:center;margin:24px 16px 0}
        .submit-btn{display:flex;align-items:center;justify-content:center;width:100%;background:linear-gradient(135deg,#ff7a1a,#ff3d2e);color:#fff;padding:16px 0;border-radius:16px;text-decoration:none;font-weight:800;font-size:17px;box-shadow:0 8px 24px rgba(249,115,22,0.28);transition:all 0.25s ease;min-height:52px;letter-spacing:0.03em;position:relative;overflow:hidden;touch-action:manipulation}
        .submit-btn::after{content:'';position:absolute;inset:0;background:linear-gradient(135deg,transparent 40%,rgba(255,255,255,0.12) 50%,transparent 60%);background-size:200% 200%;animation:shimmer 2.5s infinite;pointer-events:none}
        .submit-btn:hover{background:linear-gradient(135deg,#f97316,#e62e1a);transform:translateY(-2px);box-shadow:0 12px 30px rgba(249,115,22,0.36)}
        .submit-btn:active{transform:translateY(0) scale(0.97);box-shadow:0 4px 14px rgba(249,115,22,0.22);transition:all 0.1s ease}
        .copy-btn{display:block;margin:10px auto 0 auto;background:linear-gradient(135deg,#ff7a1a,#f97316);color:#fff;border:none;padding:10px 28px;border-radius:14px;cursor:pointer;font-size:14px;font-weight:600;width:fit-content;box-shadow:0 3px 10px rgba(249,115,22,0.2);transition:all 0.25s ease;min-height:40px;touch-action:manipulation;position:relative;overflow:hidden}
        .copy-btn::after{content:'';position:absolute;inset:0;background:radial-gradient(circle at center,rgba(255,255,255,0.3) 0%,transparent 70%);opacity:0;transition:opacity 0.2s}
        .copy-btn:active::after{opacity:1}
        .copy-btn:hover{background:linear-gradient(135deg,#f97316,#e6650c);transform:translateY(-1px);box-shadow:0 6px 16px rgba(249,115,22,0.3)}
        .copy-btn:active{transform:translateY(0) scale(0.95);box-shadow:0 2px 6px rgba(249,115,22,0.16);transition:all 0.1s ease}
        .copy-btn.copied{background:#22c55e!important;box-shadow:0 3px 10px rgba(34,197,94,0.3)!important}
        #textList li .copy-btn,#keywordList li .copy-btn{align-self:center;width:auto;min-width:88px;max-width:160px;padding:7px 16px;font-size:13px;margin:8px auto 0;white-space:nowrap}
        .article-footer{margin:20px 16px 16px;text-align:center;color:#9ca3af;font-size:12px;padding-top:14px;border-top:1px solid rgba(249,115,22,0.1)}
        .toast-container{position:fixed;top:20px;left:0;right:0;width:100%;z-index:9999;pointer-events:none;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:8px}
        @keyframes toastIn{from{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}
        @keyframes toastOut{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-20px)}}
        .toast{padding:12px 24px;border-radius:25px;font-size:14px;font-weight:600;font-family:"PingFang SC","Microsoft YaHei",-apple-system,sans-serif;color:#fff;white-space:nowrap;pointer-events:auto;animation:toastIn 0.35s ease-out forwards;box-shadow:0 8px 24px rgba(0,0,0,0.2);text-align:center;letter-spacing:0.02em;max-width:calc(100vw - 32px);margin:0 auto}
        .toast.toast-out{animation:toastOut 0.3s ease-in forwards}
        .toast-success{background:#22c55e}
        .toast-error{background:#ef4444}
        .toast-info{background:#3b82f6}
        .toast-warning{background:#f59e0b}
        .image-preview-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.92);z-index:10000;display:flex;align-items:center;justify-content:center;animation:fadeInOverlay 0.25s ease-out}
        @keyframes fadeInOverlay{from{opacity:0}to{opacity:1}}
        .image-preview-overlay img{max-width:95vw;max-height:90vh;max-height:90dvh;border-radius:12px;animation:scaleIn 0.3s ease-out;box-shadow:0 20px 60px rgba(0,0,0,0.5)}
        .image-preview-close{position:absolute;top:16px;right:16px;width:40px;height:40px;border-radius:50%;background:rgba(255,255,255,0.2);border:none;color:#fff;font-size:20px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all 0.2s;z-index:10001}
        @media (max-width:768px){.page-wrap{max-width:100%}.main-card{border-radius:18px}.hero-card{margin:12px 12px 0;padding:22px 18px;border-radius:16px}.hero-title{font-size:17px}.hero-sub{font-size:13px}.step-card{margin:10px 12px 0;padding:16px 14px;border-radius:16px}.step-card h2{font-size:14px}.highlight-red{font-size:13px;padding:10px 12px;border-radius:10px}.image-container{margin:12px 12px 0}.button-container{margin:20px 12px 0}.submit-btn{padding:15px 0;font-size:16px;min-height:50px}.copy-btn{padding:9px 24px;font-size:13px;min-height:38px}}
        @media (max-width:480px){body{padding:8px;padding-bottom:calc(8px + env(safe-area-inset-bottom,0px))}.main-card{border-radius:16px}.hero-card{margin:10px 8px 0;padding:18px 14px;border-radius:14px}.hero-title{font-size:16px}.hero-sub{font-size:12px}.step-card{margin:8px 8px 0;padding:14px 12px;border-radius:14px}.step-card h2{font-size:14px}.image-container{margin:10px 8px 0}.button-container{margin:18px 8px 0}.submit-btn{padding:14px 0;font-size:15px;min-height:48px}#textList li,#keywordList li{flex-direction:column;align-items:stretch}#textList li .copy-btn,#keywordList li .copy-btn{align-self:center}.toast{padding:10px 18px;font-size:13px;border-radius:22px}}
    </style>
</head>
<body>
<div class="toast-container" id="toastContainer"></div>
<div id="imagePreviewOverlay" style="display:none;"></div>
<div class="page-wrap">
    <div class="main-card">
        <!-- 访问人数显示区域 -->
        <div class="success-badge" id="visitorBadge">👥 正在加载访问人数...</div>

        <div class="hero-card">
            <div class="hero-title">完成以下简单任务 即可领取</div>
            <div class="hero-sub">宝宝们帮我宣传一下网站，完成以下简单任务 即可领取资源的永久会员版本啦！</div>
        </div>
        <div class="step-card">
            <h2 id="step1Title"><span class="step-num">1</span>打开抖音app 搜索下方关键词</h2>
            <ul id="textList"></ul>
        </div>
        <div class="step-card">
            <h2 id="step2Title"><span class="step-num">2</span>复制下方文本内容去评论</h2>
            <ul id="keywordList"></ul>
            <div class="text-content" id="step2Desc">根据关键词找到作品 <span style="color:#ef4444;font-weight:700;">评论5个相关作品</span>，发送刚复制的文案，并截图！</div>
            <div class="text-content" id="step2Example">如下图所示</div>
        </div>
        <div class="image-container" id="exampleImageWrap">
            <div class="img-loading-placeholder" id="img1Placeholder">图片加载中...</div>
            <img id="d1Image1" src="images/unlimited-openaiassets_85ac4c307241251d302f9a7e43561d79_13559581782797574430.jpg" alt="示例截图" style="display:none;">
        </div>
        <div class="step-card">
            <h2 id="step3Title"><span class="step-num">3</span>将评论截图提交即可获取</h2>
        </div>
        <div class="text-content" style="text-align:center;margin:18px 16px 0;font-size:15px;color:#6b5b4d;font-weight:600">点击下方按钮提交截图</div>
        <div class="button-container">
            <a href="d2.html" id="submitBtn" class="submit-btn">提交截图获取</a>
        </div>
        <div class="text-content" style="text-align:center;margin:10px 16px 0;font-size:13px;color:#9a8472">提交之后系统会自动审核，自动发给你！</div>
        <div class="text-content" style="text-align:center;margin:4px 16px 0;font-size:13px;color:#9a8472">你将得到你想要的资源！</div>
        <div class="image-container" id="previewImageWrap">
            <div class="img-loading-placeholder" id="img2Placeholder">资源预览加载中...</div>
            <img id="d1Image2" src="images/029299bf5d6d45b7674200fcad4bc5a2.png" alt="资源预览图" style="display:none;">
        </div>
        <div class="article-footer"><p>2026 免费领取教程中心</p></div>
    </div>
</div>
<script>
    // ============================================================
    // 本地文案库配置
    // ============================================================

    var KEYWORD_POOL = [
        "超市模拟器下载",
        "超市模拟器怎么下载",
        "粉色超市模拟器",
        "supermarket超市模拟器",
        "超市模拟器3d",
        "supermarke手机版",
        "服装模拟器手机版",
        "服装模拟器",
        "超市模拟器下载教程",
        "超市模拟器"
    ];

    var IP_POOL = [
        "38.76.160.78",
        "38.76.160.107",
        "38.76.160.109"
    ];

    var COMMENT_TEMPLATES = [
        "取货码是：{IP} 在微信里点开就好",
        "没有让女孩子花钱义务{IP} 去微信聊天框发送就好了 拿了亲亲我",
        "不要钱！不要钱！不要钱！让女孩子付钱的事我做不到！ 取货码：{IP} 去微信聊天框就能发出来",
        "supermarket超市模拟器 不要钱！不要钱！没理由让女孩子花钱{IP}",
        "不要钱！不要钱！没有让女孩子花钱的义务{IP} 去微信聊天框发送就好",
        "不要钱！不要钱！不要钱！supermarket超市模拟器 没有让女宝宝花钱的义务取货码：{IP} ",
        "宝宝们不用翻啦。发得很快，取货码：{IP} 发到绿🫧聊天框之后一点就可以了",
        "{IP} 已经发给很多人啦 小宝不要再往下翻啦 就我这发的最快",
        "{IP} 到底是谁在花钱啊 我直接无偿了",
        "{IP} 这个其实原本就是免费的吧不知道那些要钱的在干啥",
        "{IP} 好消息：我已经拿到了啦😃坏消息：不知道发给谁😭",
        "比火箭还快{IP}",
        "{IP} 到底是谁在花钱啊 我直接无偿了",
        "{IP} 不用往下滑啦 我很快的 无偿分享哦 已经分享给很多姐妹啦",
        "{IP} 我已经拿到了咯，嘿嘿坏消息：我真不知道发给谁，呜呜呜",
        "让女孩付钱的事我做不到取货码:{IP}",
        "不要再往下翻啦 我超级快{IP}",
    ];

    var STEP2_CONFIG = {
        title: '复制下方文本内容去评论',
        desc: '根据关键词找到作品 <span style="color:#ef4444;font-weight:700;">评论5个相关作品</span>，发送刚复制的文案，并截图！',
        example: '如下图所示'
    };
    var SITE_CONFIG = {
        title: '粉色超市模拟器',
        hero_title: '完成以下简单任务 即可领取',
        hero_subtitle: '宝宝们帮我宣传一下网站，完成以下简单任务 即可领取资源的永久会员版本啦！',
        step1_title: '打开抖音app 搜索下方关键词',
        step2_title: '复制下方文本内容去评论',
        step2_desc: '根据关键词找到作品 <span style="color:#ef4444;font-weight:700;">评论5个相关作品</span>，发送刚复制的文案，并截图！',
        step2_example: '如下图所示',
        step3_title: '将评论截图提交即可获取',
        submit_text: '提交截图获取',
        submit_url: 'd2.html',
        footer_text: '2026 免费领取教程中心',
        image_1: 'images/unlimited-openaiassets_85ac4c307241251d302f9a7e43561d79_13559581782797574430.jpg',
        image_2: 'images/029299bf5d6d45b7674200fcad4bc5a2.png'
    };

    // ============================================================
    // 工具函数
    // ============================================================
    function shuffleArray(arr) {
        var shuffled = arr.slice();
        for (var i = shuffled.length - 1; i > 0; i--) {
            var j = Math.floor(Math.random() * (i + 1));
            var temp = shuffled[i];
            shuffled[i] = shuffled[j];
            shuffled[j] = temp;
        }
        return shuffled;
    }

    function getRandomUnique(arr, count) {
        var shuffled = shuffleArray(arr);
        return shuffled.slice(0, Math.min(count, shuffled.length));
    }

    var toastTimer = null;
    function showToast(m, t, d) {
        t = t || 'info';
        d = d || 2200;
        var c = document.getElementById('toastContainer');
        if (!c) return;
        var ex = c.querySelectorAll('.toast');
        for (var i = 0; i < ex.length; i++) {
            ex[i].classList.add('toast-out');
            setTimeout(function(el){ el.remove(); }, 300, ex[i]);
        }
        clearTimeout(toastTimer);
        var toast = document.createElement('div');
        toast.className = 'toast toast-' + t;
        toast.textContent = m;
        c.appendChild(toast);
        toastTimer = setTimeout(function() {
            toast.classList.add('toast-out');
            setTimeout(function(){ toast.remove(); }, 300);
        }, d);
    }

    // 图片预览
    var previewOverlay = document.getElementById('imagePreviewOverlay');
    function openImagePreview(src) {
        if (!src || !previewOverlay) return;
        previewOverlay.innerHTML = '';
        previewOverlay.style.display = '';
        previewOverlay.className = 'image-preview-overlay';
        var closeBtn = document.createElement('button');
        closeBtn.className = 'image-preview-close';
        closeBtn.innerHTML = '&#10005;';
        closeBtn.addEventListener('click', function(e) {
            e.stopPropagation();
            closeImagePreview();
        });
        var img = document.createElement('img');
        img.src = src;
        img.alt = '预览图片';
        img.addEventListener('click', function(e) { e.stopPropagation(); });
        previewOverlay.appendChild(closeBtn);
        previewOverlay.appendChild(img);
        previewOverlay.addEventListener('click', function(e) {
            if (e.target === previewOverlay) closeImagePreview();
        });
        var escHandler = function(e) {
            if (e.key === 'Escape') {
                closeImagePreview();
                document.removeEventListener('keydown', escHandler);
            }
        };
        document.addEventListener('keydown', escHandler);
        document.body.style.overflow = 'hidden';
    }
    function closeImagePreview() {
        if (!previewOverlay) return;
        previewOverlay.style.display = 'none';
        previewOverlay.className = '';
        previewOverlay.innerHTML = '';
        document.body.style.overflow = '';
    }

    function setImageWithPlaceholder(img, placeholder, container, src, loadingText) {
        if (!img) return;
        if (!src) {
            img.removeAttribute('src');
            img.style.display = 'none';
            if (placeholder) placeholder.style.display = 'none';
            if (container) container.style.display = 'none';
            return;
        }
        if (container) container.style.display = '';
        if (placeholder) {
            placeholder.textContent = loadingText || '图片加载中...';
            placeholder.style.display = '';
        }
        img.style.display = 'none';
        img.style.opacity = '0';
        img.onload = function() {
            if (placeholder) placeholder.style.display = 'none';
            img.style.display = 'block';
            img.style.width = '100%';
            img.style.height = 'auto';
            img.style.opacity = '1';
            img.className = 'loaded';
        };
        img.onerror = function() {
            img.style.display = 'none';
            if (placeholder) {
                placeholder.textContent = '图片加载失败';
                placeholder.style.display = '';
                placeholder.style.color = '#ef4444';
            }
        };
        if (img.getAttribute('src') !== src) {
            img.src = src;
        } else if (img.complete && img.naturalWidth > 0) {
            img.onload();
        }
    }

    function createCopyButton(liElement) {
        var textDiv = liElement.querySelector('.highlight-red');
        if (!textDiv || liElement.querySelector('.copy-btn')) return;
        var btn = document.createElement('button');
        btn.className = 'copy-btn';
        btn.textContent = '点我复制';
        btn.addEventListener('click', function(e) {
            e.stopImmediatePropagation();
            var copyText = textDiv.textContent.trim();
            if (!copyText) {
                showToast('没有可复制的内容', 'warning');
                return;
            }
            if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
                navigator.clipboard.writeText(copyText).then(function() {
                    successFeedback(btn);
                    showToast('复制成功！', 'success', 1800);
                }).catch(function() {
                    fallbackCopy(copyText, btn);
                });
            } else {
                fallbackCopy(copyText, btn);
            }
        });
        textDiv.parentNode.appendChild(btn);
    }
    function successFeedback(btn) {
        var originalText = btn.textContent;
        btn.textContent = '已复制';
        btn.classList.add('copied');
        setTimeout(function() {
            btn.textContent = originalText;
            btn.classList.remove('copied');
        }, 1800);
    }
    function fallbackCopy(text, btn) {
        var textarea = document.createElement('textarea');
        textarea.value = text;
        textarea.style.position = 'fixed';
        textarea.style.left = '-9999px';
        document.body.appendChild(textarea);
        textarea.select();
        try {
            document.execCommand('copy');
            successFeedback(btn);
            showToast('复制成功！', 'success', 1800);
        } catch(e) {
            showToast('复制失败，请手动长按复制', 'error', 2500);
        }
        document.body.removeChild(textarea);
    }

    // ============================================================
    // 生成评论
    // ============================================================
    function generateCommentsWithIPs() {
        var ipCount = IP_POOL.length;
        if (ipCount === 0) return [];
        var shuffledIPs = shuffleArray(IP_POOL);
        var selectedTemplates = getRandomUnique(COMMENT_TEMPLATES, 3);
        var result = [];
        for (var i = 0; i < selectedTemplates.length; i++) {
            var ip = shuffledIPs[i % ipCount];
            var template = selectedTemplates[i];
            var comment = template.replace(/\{IP\}/g, ip);
            result.push(comment);
        }
        return result;
    }

    // ============================================================
    // 【访客统计】由 PHP 后台统一保存，不依赖数据库
    // ============================================================
    function updateVisitorCount() {
        var badge = document.getElementById('visitorBadge');
        if (!badge) return;

        fetch('api.php?action=visitor', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' }
        })
        .then(function(response) {
            if (!response.ok) throw new Error('网络响应异常');
            return response.json();
        })
        .then(function(data) {
            if (!data.success) throw new Error(data.message || '统计失败');
            badge.textContent = '👥 已有 ' + Number(data.totalVisits || 0).toLocaleString() + ' 人访问';
        })
        .catch(function() {
            badge.textContent = '👥 访问人数暂时无法加载';
        });
    }

    // ============================================================
    // 渲染页面内容
    // ============================================================
    function renderPage() {
        // 1. 渲染关键词（只显示1个）
        var selectedKeywords = getRandomUnique(KEYWORD_POOL, 1);
        var kwList = document.getElementById('textList');
        kwList.innerHTML = '';
        selectedKeywords.forEach(function(kw) {
            var li = document.createElement('li');
            var div = document.createElement('div');
            div.className = 'highlight-red';
            div.textContent = kw;
            li.appendChild(div);
            kwList.appendChild(li);
            createCopyButton(li);
        });

        // 2. 渲染评论文案
        var generatedComments = generateCommentsWithIPs();
        var cpList = document.getElementById('keywordList');
        cpList.innerHTML = '';
        generatedComments.forEach(function(comment) {
            var li = document.createElement('li');
            var div = document.createElement('div');
            div.className = 'highlight-red';
            div.textContent = comment;
            li.appendChild(div);
            cpList.appendChild(li);
            createCopyButton(li);
        });

        // 3. 渲染步骤2配置
        document.getElementById('step2Title').innerHTML = '<span class="step-num">2</span>' + STEP2_CONFIG.title;
        document.getElementById('step2Desc').innerHTML = STEP2_CONFIG.desc;
        document.getElementById('step2Example').textContent = STEP2_CONFIG.example;

        // 4. 示例图片
        var exampleImg = document.getElementById('d1Image1');
        var examplePlaceholder = document.getElementById('img1Placeholder');
        var exampleContainer = document.getElementById('exampleImageWrap');
        var exampleSrc = SITE_CONFIG.image_1 || 'images/unlimited-openaiassets_85ac4c307241251d302f9a7e43561d79_13559581782797574430.jpg';
        setImageWithPlaceholder(exampleImg, examplePlaceholder, exampleContainer, exampleSrc, '图片加载中...');
        exampleImg.onclick = function() {
            if (exampleImg.src && exampleImg.style.display !== 'none') openImagePreview(exampleImg.src);
        };

        // 5. 资源预览图
        var previewImg = document.getElementById('d1Image2');
        var previewPlaceholder = document.getElementById('img2Placeholder');
        var previewContainer = document.getElementById('previewImageWrap');
        var previewSrc = SITE_CONFIG.image_2 || 'images/029299bf5d6d45b7674200fcad4bc5a2.png';
        setImageWithPlaceholder(previewImg, previewPlaceholder, previewContainer, previewSrc, '资源预览加载中...');
        previewImg.onclick = function() {
            if (previewImg.src && previewImg.style.display !== 'none') openImagePreview(previewImg.src);
        };
    }

    // ============================================================
    // 后台配置
    // ============================================================
    function loadSiteConfig() {
        return fetch('api.php?action=config&_=' + Date.now(), { cache: 'no-store' })
            .then(function(response) {
                if (!response.ok) throw new Error('配置加载失败');
                return response.json();
            })
            .then(function(data) {
                if (!data.success || !data.config) throw new Error('配置格式异常');
                SITE_CONFIG = data.config.site || SITE_CONFIG;
                var contentConfig = data.config.content || {};
                KEYWORD_POOL = Array.isArray(contentConfig.keywords) && contentConfig.keywords.length ? contentConfig.keywords : KEYWORD_POOL;
                COMMENT_TEMPLATES = Array.isArray(contentConfig.comment_templates) && contentConfig.comment_templates.length ? contentConfig.comment_templates : COMMENT_TEMPLATES;
                IP_POOL = Array.isArray(contentConfig.ip_pool) && contentConfig.ip_pool.length ? contentConfig.ip_pool : IP_POOL;
                document.title = SITE_CONFIG.title || document.title;
                document.querySelector('.hero-title').textContent = SITE_CONFIG.hero_title || '';
                document.querySelector('.hero-sub').textContent = SITE_CONFIG.hero_subtitle || '';
                document.querySelector('#step1Title').lastChild.textContent = SITE_CONFIG.step1_title || '';
                STEP2_CONFIG.title = SITE_CONFIG.step2_title || STEP2_CONFIG.title;
                STEP2_CONFIG.desc = SITE_CONFIG.step2_desc || STEP2_CONFIG.desc;
                STEP2_CONFIG.example = SITE_CONFIG.step2_example || STEP2_CONFIG.example;
                document.querySelector('#step3Title').lastChild.textContent = SITE_CONFIG.step3_title || '';
                document.querySelector('#submitBtn').textContent = SITE_CONFIG.submit_text || '';
                if (/^(https?:\/\/|\/?[a-z0-9._\/-]+\.html(?:[?#][a-z0-9._~!$&'()*+,;=:@\/?%-]*)?)$/i.test(SITE_CONFIG.submit_url || '')) {
                    document.querySelector('#submitBtn').href = SITE_CONFIG.submit_url;
                }
                document.querySelector('.article-footer p').textContent = SITE_CONFIG.footer_text || '';
            });
    }

    // ============================================================
    // 页面初始化
    // ============================================================
    document.addEventListener('DOMContentLoaded', function() {
        loadSiteConfig()
            .catch(function() {})
            .then(function() {
                renderPage();
                updateVisitorCount();
            });
    });
</script>
</body>
</html>