:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --text: #16181d;
  --muted: #8a8f99;
  --primary: #ff2442;
  --primary-press: #e01f3a;
  --border: #ececf0;
  --ok: #16a34a;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(20, 24, 40, 0.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}
#app { padding: 0 14px calc(20px + var(--safe-b)); }

/* header */
.hd {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 14px 12px;
  margin: 0 -14px 14px;
  display: flex; align-items: center; gap: 10px;
}
.hd h1 { font-size: 17px; margin: 0; font-weight: 700; flex: 1; }
.hd .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hd .back { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: var(--radius-sm); padding: 11px 16px;
  font-size: 15px; font-weight: 600; cursor: pointer; background: var(--surface-2);
  color: var(--text); border: 1px solid var(--border); transition: .15s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:active { background: var(--primary-press); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.danger { color: var(--err); border-color: #f5c2c7; background: #fff5f6; }

.row { display: flex; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card.tap { cursor: pointer; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* job list */
.job-title { font-size: 16px; font-weight: 700; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.badge.gen { background: #fff4e5; color: #b8660b; }
.badge.ready { background: #e8f7ee; color: var(--ok); }
.badge.err { background: #fdeaea; color: var(--err); }

/* progress */
.bar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s; }
.bar > i.anim { background-image: linear-gradient(45deg, rgba(255,255,255,.35) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.35) 50%, rgba(255,255,255,.35) 75%, transparent 75%, transparent); background-size: 1rem 1rem; animation: stripes 1s linear infinite; }
@keyframes stripes { from { background-position: 0 0; } to { background-position: 1rem 0; } }

/* config */
.cfg-sec { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; background: var(--surface-2); }
.cfg-sec h4 { margin: 0 0 8px; font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
textarea, input[type=text] {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px; font-size: 14px; font-family: inherit; resize: vertical; background: #fff; color: var(--text);
}
textarea { min-height: 70px; }
.refbox { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.refbox img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.refbox .ph { width: 56px; height: 56px; border-radius: 8px; border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* stepper */
.stepper { display: flex; gap: 6px; margin-bottom: 14px; }
.step { flex: 1; text-align: center; font-size: 12px; padding: 8px 4px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); cursor: pointer; }
.step.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.step.done { color: var(--ok); border-color: #bfe6cd; }
.step.disabled { opacity: .4; cursor: not-allowed; }

/* images */
.img-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.img-wrap { display: flex; flex-direction: column; min-width: 0; }
.img-cell { position: relative; width: 100%; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: var(--surface-2); }
.img-cell.sel { border-color: var(--primary); }
.img-cell img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.img-cell .pick { position: absolute; left: 6px; right: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; text-align: center; padding: 5px; border-radius: 8px; cursor: pointer; backdrop-filter: blur(2px); }
.img-cell .pick.sel-label { background: var(--primary); cursor: default; font-size: 11px; padding: 3px; }
.img-cell .badge-sel { position: absolute; top: 4px; right: 4px; background: var(--primary); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 999px; }
/* 生成图「保存」按钮：右上角小胶囊（PC 下载 / 手机存相册） */
.img-cell .img-save { position: absolute; top: 4px; right: 4px; z-index: 3; background: rgba(0,0,0,.55); color: #fff; border: none; font-size: 11px; line-height: 1; padding: 4px 8px; border-radius: 999px; cursor: pointer; backdrop-filter: blur(2px); }
.img-cell .img-save:active { transform: scale(.92); }

/* 生成时间小字（渲染在 .img-cell 之外的正下方，不再被「选择」按钮遮挡） */
.img-time { font-size: 10px; line-height: 1.2; color: var(--muted); text-align: center; padding: 3px 2px 0; white-space: nowrap; letter-spacing: .2px; }

.dish-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 10px; }
.dish-card .dn { font-weight: 600; font-size: 14px; }
.dish-card .dc { font-size: 12px; color: var(--muted); }
.dish-card .drow { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.dish-card .dthumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); background: var(--surface-2); }

/* titles */
.title-item { display: flex; gap: 8px; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 10px; margin-bottom: 8px; }
.title-item .t { flex: 1; font-size: 14px; }
.title-item.sel { border-color: var(--primary); background: #fff5f6; }
.title-input { flex: 1; font-size: 14px; font-weight: 600; min-height: 38px; }
.title-badge { font-size: 11px; color: var(--primary); background: #ffe9ec; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.prompt-edit { margin-top: 8px; }
.prompt-edit .hint { margin-bottom: 4px; }
.prompt-edit textarea { min-height: 64px; font-size: 12px; color: #444; background: #fff; }
/* 餐品完整提示词行头：标签可换行、复制按钮永不被压缩变形 */
.prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.prompt-head-label { flex: 1 1 auto; min-width: 0; line-height: 1.4; }
.copy-btn { flex: 0 0 auto; white-space: nowrap; padding: 5px 10px; }
.btn.sm.copy-btn .icon { width: 15px; height: 15px; }
.sync-btn { flex: 0 0 auto; white-space: nowrap; padding: 5px 10px; color: var(--primary); border-color: var(--primary); }
.btn.sm.sync-btn .icon { width: 15px; height: 15px; }
/* 变量简单解释（所有提示词编辑器旁统一展示） */
.var-help { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; font-size: 11px; color: var(--muted); margin: 2px 0 6px; line-height: 1.6; }
.var-help .vh { display: inline-flex; align-items: center; gap: 3px; }
.var-help .vh code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: #6b4b8a; background: #f3eefb; border-radius: 5px; padding: 1px 5px; }
.var-help .vh-sep { color: var(--border); }
.copy-row { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 10px; }
.copy-row .ct { flex: 1; white-space: pre-wrap; font-size: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); padding: 4px 9px; border-radius: 999px; color: #444; }

/* modal（手机端：弹窗可内部滚动；配合 app.js 的 visualViewport 适配，键盘弹出也能拉到上面的输入框） */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; z-index: 50; overscroll-behavior: contain; }
.modal { background: var(--surface); width: 100%; max-width: 480px; margin: 0 auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(20px + var(--safe-b)); max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.modal h3 { margin: 0 0 14px; }
.field { margin-bottom: 12px; }

/* toast & overlay */
.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px); background: #16181d; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99; max-width: 80%; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.overlay { position: fixed; inset: 0; background: rgba(255,255,255,.7); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 80; }
.overlay.hidden { display: none; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.overlay-text { font-size: 13px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

.icon { width: 20px; height: 20px; display: inline-block; vertical-align: middle; }
.icon.sm { width: 16px; height: 16px; }
.hidden { display: none !important; }
.section-title { font-size: 14px; font-weight: 700; margin: 16px 0 8px; }
.ver { text-align: center; font-size: 11px; color: var(--muted); margin-top: 18px; }

/* multi-ref grid */
.refgrid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.refcell { position: relative; width: 56px; height: 56px; }
.refcell img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.refcell .refx { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--err); color: #fff; border: none; font-size: 13px; line-height: 18px; cursor: pointer; padding: 0; }
.refadd { width: 56px; height: 56px; border-radius: 8px; border: 1px dashed var(--border); background: var(--surface-2); color: var(--muted); font-size: 12px; cursor: pointer; }

/* dish list */
.dishdet { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 12px; background: var(--surface-2); }
.dishlist { max-height: 320px; overflow-y: auto; margin: 6px -12px 6px; padding: 0 12px; }
.drow2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.drow2:last-child { border-bottom: none; }
.dn2 { font-size: 13px; }
.dn2 .muted { font-size: 11px; }
.field { margin-bottom: 10px; }

/* top bar（制作/我的 + 刷新 + 版本） */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); padding: 9px 14px; margin: 0 -14px 14px; display: flex; align-items: center; gap: 10px; }
.topbar .tabs { display: flex; gap: 6px; flex: 1; }
.topbar .tab { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 600; padding: 6px 13px; border-radius: 999px; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.topbar .tab .icon { width: 16px; height: 16px; }
.topbar .tab.on { background: var(--primary); color: #fff; }
.topbar .topright { display: flex; align-items: center; gap: 8px; }
.topbar .verlabel { font-size: 12px; color: var(--muted); }
.topbar .verbtn { cursor: pointer; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: 12px; font-weight: 600; }
.topbar .verbtn:active { transform: scale(0.94); }
.topbar .logout { width: auto; padding: 0 12px; border-radius: 999px; }

/* auth */
.auth-wrap { max-width: 360px; margin: 7vh auto 0; padding: 0 4px; }
.auth-logo { font-size: 20px; font-weight: 800; text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px; }
.auth-logo .icon { width: 22px; height: 22px; color: var(--primary); }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 18px; }
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.seg-item { flex: 1; text-align: center; padding: 8px; border-radius: 999px; font-weight: 600; color: var(--muted); cursor: pointer; font-size: 14px; }
.seg-item.on { background: var(--primary); color: #fff; }
.brand { font-size: 18px; font-weight: 800; margin: 2px 0 12px; }

/* quota / changelog */
.quota-big { font-size: 30px; font-weight: 800; margin-top: 6px; }
.changelog .cl-ver { font-weight: 700; margin: 12px 0 4px; font-size: 14px; }
.changelog .cl-ver:first-child { margin-top: 0; }
.changelog .cl-list { margin: 0; padding-left: 18px; }
.changelog .cl-list li { font-size: 13px; color: #444; margin-bottom: 5px; line-height: 1.5; }
/* 更新日志 折叠/展开 + 翻页 */
.cl-more { display: block; width: 100%; margin-top: 12px; padding: 8px 0; border: none; border-top: 1px dashed var(--border, #eee); background: none; color: var(--primary, #e8455f); font-size: 13px; font-weight: 600; cursor: pointer; }
.cl-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border, #eee); }
.cl-page-btn { border: 1px solid var(--border, #eee); background: #fff; color: var(--text, #333); font-size: 13px; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.cl-page-btn:disabled { opacity: .4; cursor: default; }

/* admin */
.admin-row .drow { display: flex; align-items: center; gap: 8px; }
.quota-input { width: 90px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; font-size: 14px; font-family: inherit; background: #fff; color: var(--text); }
.topbar .verbtn.logout { width: auto; padding: 0 12px; border-radius: 999px; }

/* 生成中动画（缩略图位置，非阻塞） */
.spinner.sm { width: 22px; height: 22px; border-width: 2px; }
.img-cell.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 3/4; background: var(--surface-2); border: 1px dashed var(--border); }
.img-cell.loading .loading-text { font-size: 11px; color: var(--muted); }
.dthumb.loading { display: flex; align-items: center; justify-content: center; }
.text-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 8px 0; }

/* 图片删除按钮 */
.img-x { position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(22,24,29,.62); color: #fff; border: none; font-size: 15px; line-height: 20px; cursor: pointer; padding: 0; z-index: 2; }
.img-x:active { transform: scale(0.9); }

/* 放大预览 */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.86); z-index: 120; display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.lightbox.hidden { display: none; }

/* 提示词预览 */
.pv-wrap { margin-top: 8px; }
.pv-title { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.pv { font-size: 12px; color: #444; background: #fff; border: 1px dashed var(--border); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow: auto; }
img[data-act="zoom"] { cursor: zoom-in; }

/* 继承可视化横幅（新建任务把上一任务的提示词/参考图同步到「展开/收起 配置」里，看得见） */
.inherit-box { font-size: 12px; line-height: 1.8; color: #8a5a60; background: #fff5f6; border: 1px solid #ffd3da; border-radius: var(--radius-sm); padding: 8px 10px; margin: 6px 0 10px; }
.inherit-box .ih-title { font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.inherit-box .ih-row { color: #6b5457; }
.inherit-box .ih-ok { color: var(--primary); font-weight: 600; }
.inherit-box .ih-no { color: var(--muted); }

/* 下拉选择（提示词组等） */
select { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; font-size: 14px; font-family: inherit; background: #fff; color: var(--text); appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.mini-link { color: var(--primary); text-decoration: underline; margin-left: 4px; }

/* 笔记页：一键生成前的「配置注入」摘要 */
.cfg-sum { font-size: 12px; line-height: 1.75; color: #6b5457; background: #fff5f6; border: 1px solid #ffd3da; border-radius: var(--radius-sm); padding: 8px 10px; margin: 8px 0; }
.cfg-sum .cs-title { font-weight: 700; color: var(--primary); margin-bottom: 3px; }
.cfg-sum .cs-row { word-break: break-word; }

/* 提示词组管理页 */
.preset-card .p-name, .preset-card .p-prompt { font-size: 14px; }
.preset-card .refgrid { margin-top: 6px; }
.preset-card .row .btn { flex: 1; }

/* 桌面/宽屏：弹窗居中显示（手机端保持底部抽屉），并留白滚动 */
@media (min-width: 560px) {
  .modal-mask { align-items: center; justify-content: center; }
  .modal { border-radius: 18px; max-height: 88vh; margin: 0; }
}
/* 手机端输入更友好：所有输入/文本框 ≥16px，避免 iOS 聚焦自动放大页面 */
input, textarea, select { font-size: 16px; }
@media (min-width: 560px) { input, textarea, select { font-size: 14px; } }

/* ---------- 站内「长按保存到相册」面板 ----------
   手机端浏览器不开放「一键写入相册」接口时（HTTP 环境 / 微信等内置浏览器）用它兜底：
   展示大图 + 长按提示 + 「仍要下载到文件」。关键是**不触发 <a download>**，避免跳出「下载界面」。 */
.save-sheet { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 130; display: flex; align-items: flex-end; justify-content: center; overscroll-behavior: contain; }
.save-sheet .ss-box { background: var(--surface); width: 100%; max-width: 520px; max-height: 92%; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; overflow: hidden; }
.save-sheet .ss-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.save-sheet .ss-title { font-weight: 700; font-size: 15px; }
.save-sheet .ss-sub { font-size: 12.5px; color: var(--muted); line-height: 1.65; margin-top: 4px; }
.save-sheet .ss-sub b { color: var(--primary); }
.save-sheet .ss-list { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 14px; display: flex; flex-direction: column; gap: 14px; }
.save-sheet .ss-item { text-align: center; }
.save-sheet .ss-name { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
/* 列表默认显示缩略图（420px ≈40KB）→ 秒开；点图片可换成原图再长按保存 */
.save-sheet .ss-item img { width: 100%; min-height: 200px; background: var(--surface-2); border-radius: 12px; display: block; cursor: pointer; -webkit-touch-callout: default; user-select: none; }
.save-sheet .ss-hint { font-size: 12px; color: var(--primary); margin-top: 6px; min-height: 17px; }
.save-sheet .ss-foot { display: flex; gap: 10px; padding: 10px 14px calc(12px + var(--safe-b)); border-top: 1px solid var(--border); background: var(--surface); }
.save-sheet .ss-foot .btn { flex: 1; }
.save-sheet .ss-foot .btn.primary { flex: 1.7; }   /* 「保存到相册」是主操作，按钮更宽更醒目 */
@media (min-width: 560px) {
  .save-sheet { align-items: center; }
  .save-sheet .ss-box { border-radius: 18px; max-height: 88vh; }
}

/* 笔记页头部「保存全部」按钮：不压缩、不换行（窄屏标题换行时也保持完整） */
.hd .save-all-btn { flex: 0 0 auto; white-space: nowrap; }
.hd .save-all-btn .icon { width: 15px; height: 15px; }

/* ---------- 笔记图片下载页 /download.html（电脑端点「保存全部」打开）---------- */
.dl-body { max-width: 480px; }
@media (min-width: 700px) { .dl-body { max-width: 900px; } }
.dl-wrap { padding: 14px 14px calc(24px + var(--safe-b)); }
.dl-top { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 14px; }
.dl-hd { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; margin-bottom: 10px; }
.dl-hd h1 { font-size: 17px; margin: 0 0 2px; }
.dl-hd .btn { flex: 0 0 auto; white-space: nowrap; text-decoration: none; }
.dl-sub { font-size: 12.5px; color: var(--muted); }
.dl-group { margin-bottom: 16px; }
.dl-gtitle { font-weight: 700; font-size: 14px; margin: 0 0 8px; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.dl-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.dl-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; cursor: zoom-in; background: var(--surface-2); }
.dl-name { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 0 0; }

/* ---------- x：生成任务后台化（进度条 + 结果已就绪横幅）---------- */
.gen-prog { margin-top: 8px; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--primary); font-size: 13px; font-weight: 600; }
.gen-ready { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(255, 36, 66, .07); border: 1px solid rgba(255, 36, 66, .28); }
.gen-ready.bad { background: rgba(245, 158, 11, .10); border-color: rgba(245, 158, 11, .38); }
.gen-ready .gr-t { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.gen-ready .gr-s { font-size: 12px; color: var(--muted); margin-bottom: 8px; line-height: 1.5; }
