/* ===== HTML 一键部署平台 - 全局样式（移动端适配） ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #667eea;
    --primary2: #764ba2;
    --text: #1f2937;
    --muted: #6b7280;
    --bg: #f5f6fa;
    --card: #ffffff;
    --border: #e5e7eb;
    --danger: #dc2626;
    --ok: #059669;
}
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
a { color: var(--primary); text-decoration: none; }

/* ---- 顶栏 ---- */
.topbar { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 58px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a { padding: 8px 12px; border-radius: 8px; color: #4b5563; font-size: 14px; }
.nav a:hover { background: #f3f4f6; }
.nav .nav-cta { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; }
.nav .nav-admin { color: var(--primary); font-weight: 600; }
.nav .nav-muted { color: #9ca3af; }
.nav .nav-market { color: #b45309; font-weight: 700; background: #fff7ed; }
.nav .nav-market:hover { background: #ffedd5; }
.nav-toggle { display: none; font-size: 22px; cursor: pointer; padding: 4px 10px; }
.nav-toggle-cb { display: none; }

/* ---- 首页 Hero ---- */
.hero { background: linear-gradient(135deg, var(--primary) 0%, var(--primary2) 100%); color: #fff; text-align: center; padding: 56px 16px 130px; }
.hero h1 { font-size: 34px; margin-bottom: 12px; }
.hero p { opacity: .9; font-size: 15px; }
.upload-wrap { margin-top: -90px; padding-bottom: 40px; }
.upload-card { background: var(--card); border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.12); padding: 28px; max-width: 640px; margin: 0 auto; }
.dropzone { border: 2px dashed #c7cbf5; border-radius: 12px; padding: 42px 20px; text-align: center; cursor: pointer; transition: .2s; background: #fafbff; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: #f0f2ff; }
.dropzone .dz-icon { font-size: 44px; }
.dropzone .dz-main { font-size: 16px; font-weight: 600; margin-top: 10px; }
.dropzone .dz-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.quota-tip { text-align: center; font-size: 13px; color: var(--muted); margin-top: 14px; }
.quota-tip b { color: var(--primary); }

/* ---- 结果卡片 ---- */
.result-card { margin-top: 18px; border: 1px solid #d1fae5; background: #ecfdf5; border-radius: 12px; padding: 18px; display: none; }
.result-card.show { display: block; }
.result-url { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.result-url input { flex: 1; min-width: 200px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; }
.pub-hint { margin-top: 10px; padding: 10px 12px; background: #fff7ed; border: 1px solid #fed7aa; color: #b45309; border-radius: 8px; font-size: 13px; }
.pub-hint a { color: #b45309; font-weight: 700; }

/* 发布到市场勾选 */
.pub-check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; color: #4b5563; cursor: pointer; }
.pub-check input { width: auto; flex: none; }

/* ---- 网页市场首页精选 ---- */
.market-home { margin: 10px auto 30px; }
.mh-top { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 16px; }
.mh-top h2 { font-size: 18px; }
.mh-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mh-card { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.05); display: flex; flex-direction: column; }
.mh-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.12); transform: translateY(-2px); transition: .2s; }
.mh-preview { position: relative; height: 120px; background: #f3f4f6; overflow: hidden; }
.mh-preview iframe { width: 100%; height: 320px; border: 0; pointer-events: none; transform: scale(.375); transform-origin: top left; }
.mh-title { padding: 10px 12px 4px; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-meta { padding: 0 12px 12px; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }

/* ---- 网页市场页 ---- */
.market-head { margin-top: 20px; }
.market-toolbar { display: flex; gap: 12px; margin: 16px 0; flex-wrap: wrap; align-items: center; }
.market-search { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.market-search input { flex: 1; }
.market-sort { display: flex; gap: 8px; }
.market-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 40px; }
.mk-card { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.06); display: flex; flex-direction: column; }
.mk-card:hover { box-shadow: 0 10px 30px rgba(0,0,0,.14); }
.mk-preview { position: relative; display: block; height: 200px; background: #f3f4f6; overflow: hidden; }
.mk-preview iframe { width: 100%; height: 100%; border: 0; pointer-events: none; }
.mk-preview .mk-open { position: absolute; right: 12px; bottom: 12px; background: rgba(31,41,55,.85); color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 20px; opacity: 0; transition: .2s; }
.mk-preview:hover .mk-open { opacity: 1; }
.mk-body { padding: 14px 16px 16px; }
.mk-title { font-weight: 700; font-size: 15px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.mk-actions { display: flex; gap: 8px; }
.empty-market { text-align: center; padding: 50px 20px; }
.empty-market .em-emoji { font-size: 48px; }
.empty-market h3 { margin: 12px 0 8px; }
.empty-market p { color: var(--muted); font-size: 14px; }
.btn { display: inline-block; padding: 11px 22px; background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; text-align: center; }
.btn:hover { opacity: .92; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-gray { background: #6b7280; }
.btn-red { background: #dc2626; }
.btn-line { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn[disabled] { background: #c7cbd4; cursor: not-allowed; }

.card { background: var(--card); border-radius: 14px; box-shadow: 0 2px 12px rgba(0,0,0,.05); padding: 24px; margin: 20px 0; }
.page-title { font-size: 22px; margin: 28px 0 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 8px; }

.form-box { max-width: 420px; margin: 48px auto; background: #fff; border-radius: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.08); padding: 34px; }
.form-box h1 { font-size: 20px; margin-bottom: 20px; text-align: center; }
label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=url], input[type=number], select, textarea {
    width: 100%; padding: 11px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(102,126,234,.15); }
.alert { padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-err { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-ok { background: #ecfdf5; color: var(--ok); border: 1px solid #d1fae5; }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; padding: 10px 12px; background: #f9fafb; color: #6b7280; font-size: 12px; white-space: nowrap; }
table.list td { padding: 12px; border-top: 1px solid #f3f4f6; vertical-align: middle; }
table.list .url-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.tag-ai { background: #ede9fe; color: #7c3aed; }
.tag-up { background: #e0f2fe; color: #0369a1; }
.tag-ok { background: #ecfdf5; color: var(--ok); }
.tag-bad { background: #fef2f2; color: var(--danger); }

/* ---- 特性区 ---- */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 10px 0 50px; }
.feature { background: #fff; border-radius: 14px; padding: 22px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.feature .f-icon { font-size: 32px; }
.feature h3 { font-size: 15px; margin: 10px 0 6px; }
.feature p { font-size: 13px; color: var(--muted); }

/* ---- 二维码弹窗 & Toast ---- */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.modal.show { display: flex; }
.modal-box { background: #fff; border-radius: 16px; padding: 28px; width: 100%; max-width: 340px; text-align: center; }
.modal-title { font-weight: 700; margin-bottom: 16px; }
.qr-box { display: flex; justify-content: center; min-height: 200px; align-items: center; }
.qr-box img, .qr-box canvas { border-radius: 8px; }
.qr-url { font-size: 12px; color: var(--muted); word-break: break-all; margin: 12px 0; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px); background: #1f2937; color: #fff; padding: 10px 20px; border-radius: 30px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- AI 页面 ---- */
.ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0 40px; }
.ai-panel textarea { min-height: 180px; resize: vertical; }

/* AI 生成模式选择 */
.ai-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.mode-card { border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; background: #fff; transition: .15s; }
.mode-card b { font-size: 14px; color: var(--text); }
.mode-card span { font-size: 11px; color: var(--muted); line-height: 1.4; }
.mode-card input { display: none; }
.mode-card.active { border-color: var(--primary); background: #eef0ff; box-shadow: 0 0 0 3px rgba(102,126,234,.12); }
.mode-card.disabled { opacity: .5; cursor: not-allowed; }
.ai-preview { border: 1px solid var(--border); border-radius: 12px; background: #fff; overflow: hidden; display: flex; flex-direction: column; }
.ai-preview-bar { padding: 10px 14px; background: #f9fafb; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.ai-preview iframe { width: 100%; height: 420px; border: 0; background: #fff; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 后台 ---- */
.admin-layout { display: flex; gap: 20px; margin: 24px 0 40px; align-items: flex-start; }
.admin-side { width: 190px; flex-shrink: 0; background: #fff; border-radius: 14px; padding: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.admin-side a { display: block; padding: 11px 14px; border-radius: 8px; color: #4b5563; font-size: 14px; margin-bottom: 4px; }
.admin-side a.on, .admin-side a:hover { background: #eef0ff; color: var(--primary); font-weight: 600; }
.admin-main { flex: 1; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.stat .num { font-size: 26px; font-weight: 700; color: var(--primary); }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }

.footer { text-align: center; padding: 24px 16px; color: #9ca3af; font-size: 13px; }

/* ---- 移动端 ---- */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
    .nav a { padding: 12px; }
    .nav-toggle-cb:checked ~ .nav { display: flex; }
    .hero h1 { font-size: 24px; }
    .features { grid-template-columns: repeat(2, 1fr); }
    .mh-grid { grid-template-columns: 1fr; }
    .market-grid { grid-template-columns: 1fr; }
    .market-toolbar { flex-direction: column; align-items: stretch; }
    .ai-grid { grid-template-columns: 1fr; }
    .admin-layout { flex-direction: column; }
    .admin-side { width: 100%; display: flex; overflow-x: auto; }
    .admin-side a { white-space: nowrap; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .upload-card { padding: 18px; }
}

/* ===== 积分系统 ===== */
.nav .nav-points { color: #b45309; font-weight: 600; }
.points-overview { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.po-balance { font-size: 34px; font-weight: 800; color: var(--primary); line-height: 1; }
.po-balance span { font-size: 14px; color: #6b7280; font-weight: 500; margin-left: 4px; }
.po-link { display: inline-block; margin-top: 8px; font-size: 13px; }
.po-right { text-align: right; }
.po-tip { font-size: 12px; color: #9ca3af; margin-top: 6px; }
.sec-title { margin: 28px 0 12px; font-size: 18px; }
.store-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.store-card { background: var(--card); border-radius: 14px; box-shadow: 0 2px 12px rgba(0,0,0,.05); padding: 20px; }
.sc-icon { font-size: 30px; }
.sc-name { font-weight: 700; font-size: 16px; margin: 8px 0 6px; }
.sc-desc { font-size: 13px; color: #6b7280; line-height: 1.6; margin-bottom: 12px; }
.sc-price { font-weight: 700; color: #b45309; margin-bottom: 12px; }
.rules { font-size: 14px; line-height: 1.9; color: #374151; }
.rules ol { margin-left: 20px; }
.rules b { color: var(--primary); }
.price-input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }

/* ===== 上传页：单文件 / 源码包切换 ===== */
.up-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.up-tab { flex: 1; padding: 10px; border: 1px solid var(--border); background: #fff; border-radius: 10px; font-size: 14px; cursor: pointer; color: #6b7280; }
.up-tab.active { border-color: var(--primary); color: var(--primary); font-weight: 600; background: #f0f2ff; }

/* ===== 市场：价格与购买 ===== */
.mk-price { position: absolute; top: 8px; left: 8px; background: rgba(180,83,9,.92); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; }
.mk-preview { position: relative; }
.btn-buy { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; border: none; }
.btn-buy:hover { opacity: .92; }

/* ===== 移动端适配 ===== */
@media (max-width: 600px) {
    .store-grid { grid-template-columns: 1fr; }
    .points-overview { flex-direction: column; align-items: flex-start; }
    .po-right { text-align: left; }
}
