/* ==========================================================
   AI 抠图工作台 · 深色高级 SaaS 主题（全自适应）
   ========================================================== */
/* 全局：HTML hidden 属性必须优先于任何 display 规则（防止 .xxx{display:flex} 覆盖） */
[hidden] { display: none !important; }
:root {
  --bg: #eef4fb;
  --bg-soft: #f8fafc;
  --panel: rgba(15, 23, 42, 0.72);
  --panel-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #0f172a;
  --text-dim: #64748b;
  --text-faint: #94a3b8;
  --accent-1: #0062ff;
  --accent-2: #38bdf8;
  --grad: linear-gradient(135deg, #0062ff 0%, #2f7bff 45%, #38bdf8 100%);
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #f43f5e;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -20px rgba(15, 23, 42, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- 背景光晕 ---- */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(0, 98, 255, 0.10), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(56, 189, 248, 0.12), transparent 55%),
    radial-gradient(1000px 700px at 50% 120%, rgba(0, 98, 255, 0.06), transparent 60%);
}

/* ============ 顶部导航（像素级三段式） ============ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 16px;
  background-color: #f8fafc;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  width: 100%;
  box-sizing: border-box;
  user-select: none;
  flex-shrink: 0;
  overflow: hidden;
  position: sticky; top: 0; z-index: 60;
}
/* 左侧：固定不压缩 */
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0; }
.logo-box {
  width: auto; height: 30px;
  background: none; border-radius: 0;
  display: flex; align-items: center; justify-content: center;
  color: white; flex: none;
}
.logo-box img { height: 30px; width: auto; display: block; }
.app-title { font-size: 13px; font-weight: 600; color: #0f172a; white-space: nowrap; }
.version-badge {
  font-size: 11px; padding: 2px 8px;
  background: rgba(15, 23, 42, 0.06);
  color: #94a3b8; border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.04);
  white-space: nowrap;
}
.version-badge.xg-role-pro {
  color: #fbbf24; border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.1);
}
/* 中间：允许在安全范围内居中，但决不允许无限拉伸变形 */
.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  max-width: 680px;
  margin: 0 20px;
  overflow: hidden;
}
/* 监控胶囊容器 */
.monitor-capsule {
  display: flex; align-items: center; gap: 8px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.06);
  padding: 4px 12px; border-radius: 20px;
  font-size: 11px; color: #94a3b8;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.monitor-item { display: inline-flex; align-items: center; gap: 5px; }
.monitor-item .val { color: #1e293b; font-weight: 500; font-variant-numeric: tabular-nums; }
.monitor-capsule .divider { width: 1px; height: 10px; background: rgba(15, 23, 42, 0.1); }
.monitor-capsule .gpu-name {
  color: #38bdf8;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  min-width: 0;
  flex: 0 1 auto;
}
.monitor-capsule .gpu-name #gpu-text {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px;
}
/* 迷你进度条（复用 stat-fill 颜色分级） */
.monitor-item .mini-bar {
  width: 34px; height: 3px; border-radius: 2px;
  background: rgba(15, 23, 42, 0.08); overflow: hidden;
  display: inline-block; flex: none;
}
.monitor-item .mini-bar .stat-fill { display: block; height: 100%; border-radius: 2px; width: 0; transition: width .5s ease; }
.monitor-item .stat-fill.ok    { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.monitor-item .stat-fill.warn  { background: linear-gradient(90deg, #facc15, #f59e0b); }
.monitor-item .stat-fill.warn2 { background: linear-gradient(90deg, #f59e0b, #f97316); }
.monitor-item .stat-fill.danger{ background: linear-gradient(90deg, #ef4444, #dc2626); }
.monitor-item.stat-warn, .monitor-item.stat-warn2, .monitor-item.stat-danger { color: #1e293b; }
/* 右侧额度与按钮 */
.header-right { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 0; }
.quota-pill {
  display: flex; align-items: center; gap: 4px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.06);
  padding: 4px 10px; border-radius: 6px;
  font-size: 11px; color: #94a3b8;
  white-space: nowrap;
}
.quota-num { color: #0f172a; font-weight: 600; font-variant-numeric: tabular-nums; }
#xg-header-mid .quota-num { color: #38bdf8; }
#xg-header-hd .quota-num { color: #7dd3fc; }
.quota-pill.xg-zero { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.25); }
.quota-pill.xg-zero .quota-num { color: #f87171; }
.pro-upgrade-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff; font-size: 11px; font-weight: 600;
  padding: 5px 12px; border-radius: 6px; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  font-family: inherit; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
  transition: all 0.2s;
}
.pro-upgrade-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.pro-upgrade-btn:active { transform: translateY(0); }
/* 工具页统一的右上角「返回首页」入口（图片编辑 / PDF 工具箱共用） */
.edit-home-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 999px; text-decoration: none;
  background: rgba(47, 123, 255, 0.08); border: 1px solid rgba(47, 123, 255, 0.28);
  color: #0052cc; font-size: 11.5px; font-weight: 600; line-height: 1;
  white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.edit-home-btn svg { width: 12px; height: 12px; flex-shrink: 0; }
.edit-home-btn:hover { background: #0062ff; border-color: #0062ff; color: #fff; transform: translateY(-1px); }
.edit-home-btn:active { transform: translateY(0); }

/* ============ 全局统一导航栏（首页 / 图片编辑 / PDF 工具箱 三端复用） ============
   左：品牌 Logo（回首页）+ 工作台切换 Tab（当前页高亮）
   中：当前文件信息（fname / dims / 徽标，随页面语义变化）
   右：当前页操作按钮插槽 + 全站常驻「今日免费」额度（永远最右）
   高度 60px，白底毛玻璃 + 1px 分割线，与工作台底色划清界限 */
.gnav {
  position: sticky; top: 0; z-index: 60; flex-shrink: 0; width: 100%; box-sizing: border-box;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 10px 24px -20px rgba(15, 23, 42, 0.45);
  user-select: none;
}
.gnav-inner {
  max-width: 1720px; margin: 0 auto; height: 60px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; min-width: 0;
}
.gnav-left { display: flex; align-items: center; gap: 28px; flex: none; min-width: 0; }
.gnav-brand { display: flex; align-items: center; flex: none; text-decoration: none; }
.gnav-brand img { height: 30px; width: auto; display: block; }
/* 分段式工作台切换 Tab：灰槽 + 白色活动滑块，与 PDF 分段控制器同语言 */
.gnav-tabs {
  display: flex; align-items: center; gap: 4px; flex: none;
  background: #eef2f7; border-radius: 12px; padding: 4px;
}
.gnav-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 16px; border-radius: 9px; text-decoration: none;
  font-size: 12.5px; font-weight: 500; color: #64748b; white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.gnav-tab svg { width: 14px; height: 14px; flex-shrink: 0; }
.gnav-tab:hover { color: #0f172a; background: rgba(255, 255, 255, 0.75); }
.gnav-tab.active {
  background: #ffffff; color: #0062ff; font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}
/* 中部：文件名等上下文信息；无内容时整块收起（不留横杠与空位） */
.gnav-center {
  flex: 1 1 0; min-width: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.gnav-center:has(#edit-fname:empty) { display: none; }   /* 图片编辑页：无文件 → 整块收起 */
.gnav-center:has(#pdf-fname:empty) { display: none; }    /* PDF 页：无文件 → 整块收起 */
.gnav-right { display: flex; align-items: center; gap: 10px; flex: none; min-width: 0; margin-left: auto; }
.gnav-right .edit-btn { flex-shrink: 0; }
.gnav-right .edit-sep { flex-shrink: 0; }
/* 次操作按钮（添加/清空）弱化为中性浅灰，不抢「保存/导出」主色焦点 */
.gnav-right .edit-btn-add,
.gnav-right .edit-btn-clear {
  background: #f1f5f9; border-color: rgba(148, 163, 184, 0.3); color: #475569; font-weight: 500;
}
.gnav-right .edit-btn-add:hover:not(:disabled),
.gnav-right .edit-btn-clear:hover:not(:disabled) {
  background: #e2e8f0; border-color: rgba(100, 116, 139, 0.45); color: #1e293b;
}
/* 全站常驻额度徽章：永远在最右侧边缘 */
.gnav-quota {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  padding: 5px 11px; border-radius: 999px;
  background: #f8fafc; border: 1px solid #e2e8f0;
  font-size: 12px; color: #64748b; line-height: 1; white-space: nowrap;
}
.gnav-quota svg { width: 13px; height: 13px; color: #f59e0b; flex-shrink: 0; }
.gnav-quota b { color: #0f172a; font-weight: 700; }
@media (max-width: 1460px) {
  .gnav-center .version-badge { display: none; }   /* 先藏徽标，保住文件名 */
}
@media (max-width: 1240px) {
  .gnav-left { gap: 16px; }
  .gnav-center { display: none !important; }   /* 中部信息让位 */
  .gnav-tab span { display: none; }      /* Tab 只留图标 */
  .gnav-tab { padding: 7px 11px; }
  .gnav-inner { gap: 10px; padding: 0 14px; }
  .gnav-right { gap: 8px; }
}
@media (max-width: 1024px) {
  .gnav-right .edit-btn { padding-left: 8px; padding-right: 8px; }
  .gnav-quota { padding: 4px 8px; font-size: 11px; }
}
@media (max-width: 1450px) {
  #gpu-badge { display: none; }
}
@media (max-width: 1240px) {
  .quota-pill { font-size: 10px; padding: 3px 7px; }
  #xg-header-role { display: none; }
}
@media (max-width: 1100px) {
  .monitor-item .mini-bar { display: none; }
  .quota-pill { font-size: 9.5px; }
  #gpu-load-badge { display: none; }
}
.badge svg { width: 14px; height: 14px; flex: none; }
.badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
  animation: breathe 1.8s ease-in-out infinite;
}
@keyframes breathe { 0%,100% {opacity: 1;} 50% {opacity: .35;} }
.badge-link { cursor: pointer; transition: border-color .2s, color .2s; }
.badge-link:hover { border-color: var(--border-strong); color: var(--text); }
.badge-external {
  color: #bae6fd; border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}
/* 系统监控进度条徽章（CPU / 内存 / GPU） */
.stat-prog {
  flex-direction: column; align-items: stretch; gap: 4px;
  border-radius: 12px; padding: 6px 10px; min-width: 88px;
  white-space: nowrap;
}
.stat-prog .stat-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 6px;
  font-size: 11px; line-height: 1;
}
.stat-prog .stat-label { color: var(--text-dim); font-weight: 500; }
.stat-prog .stat-val { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-bar {
  height: 4px; border-radius: 999px; background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}
.stat-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
  transition: width .5s ease, background .3s ease;
}
.stat-fill.ok    { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.stat-fill.warn  { background: linear-gradient(90deg, #facc15, #f59e0b); }
.stat-fill.warn2 { background: linear-gradient(90deg, #f59e0b, #f97316); }
.stat-fill.danger{ background: linear-gradient(90deg, #ef4444, #dc2626); animation: statPulse 1s ease-in-out infinite; }
@keyframes statPulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.stat-warn  { border-color: rgba(250, 204, 21, 0.55) !important; }
.stat-warn2 { border-color: rgba(249, 115, 22, 0.65) !important; }
.stat-danger{ border-color: rgba(239, 68, 68, 0.8) !important; }
/* 局域网分享按钮 */
.share-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, rgba(0, 98, 255, 0.2), rgba(56, 189, 248, 0.16));
  border: 1px solid rgba(47, 123, 255, 0.5); color: #60a5fa;
  border-radius: 999px; padding: 8px 15px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: all .2s; white-space: nowrap;
}
.share-btn:hover {
  border-color: #2563eb; color: #fff;
  box-shadow: 0 0 16px rgba(0, 98, 255, 0.4), inset 0 0 12px rgba(0, 98, 255, 0.12);
  transform: translateY(-1px);
}
.share-btn svg { width: 14px; height: 14px; flex: none; }

/* 分享弹窗 */
.share-card { width: min(560px, 94vw); }
.share-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; color: var(--text);
}
.share-title svg { width: 17px; height: 17px; color: #2563eb; }
.share-body {
  display: flex; gap: 22px; align-items: center; padding: 6px 4px 2px;
  flex-wrap: wrap; justify-content: center;
}
.share-qr {
  width: 176px; height: 176px; flex: none; border-radius: 14px;
  background: #fff; padding: 10px; box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.5);
}
.share-qr svg, .share-qr canvas, .share-qr img { width: 100% !important; height: 100% !important; display: block; border-radius: 6px; }
.share-info { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 14px; }
.share-row { display: flex; flex-direction: column; gap: 7px; }
.share-label { font-size: 12px; color: var(--text-faint); font-weight: 600; letter-spacing: .4px; }
.share-url-row { display: flex; gap: 8px; align-items: center; }
.share-url-row code {
  flex: 1; font-size: 13.5px; color: #bae6fd; font-family: "Cascadia Code", Consolas, monospace;
  background: rgba(56, 189, 248, 0.07); border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 9px; padding: 8px 11px; word-break: break-all;
}
.btn-copy {
  flex: none; border: 1px solid rgba(47, 123, 255, 0.5); background: rgba(0, 98, 255, 0.14);
  color: #60a5fa; border-radius: 9px; padding: 8px 14px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .2s;
}
.btn-copy:hover { background: rgba(0, 98, 255, 0.28); color: #fff; }
.share-tips {
  background: rgba(15, 23, 42, 0.03); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; display: flex; flex-direction: column; gap: 6px;
}
.share-tips p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--text-dim); }
.share-tips b { color: var(--text); font-weight: 600; }

/* ============ 布局 ============ */
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 460px) 1fr;
  gap: clamp(14px, 1.8vw, 24px);
  max-width: 1900px;
  margin: 0 auto;
  padding: clamp(12px, 2vw, 22px) clamp(16px, 3vw, 40px) 40px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

/* ============ 左侧面板 ============ */
.left-panel { padding: clamp(14px, 1.6vw, 22px); display: flex; flex-direction: column; gap: 16px; }

/* 上传区 */
.dropzone {
  border: 1.5px dashed rgba(15, 23, 42, 0.22);
  border-radius: var(--radius-sm);
  padding: clamp(38px, 4.2vw, 68px) 24px;
  text-align: center; cursor: pointer;
  transition: border-color .25s, background .25s, transform .15s;
  background: rgba(15, 23, 42, 0.02);
  outline: none;
}
.dropzone:hover, .dropzone:focus-visible { border-color: rgba(47, 123, 255, 0.7); background: rgba(0, 98, 255, 0.06); }
.dropzone.dragover {
  border-color: var(--accent-2);
  background: rgba(56, 189, 248, 0.07);
  transform: scale(1.01);
}
.dz-icon {
  width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 20px;
  background: rgba(0, 98, 255, 0.14); border: 1px solid rgba(0, 98, 255, 0.35);
  display: grid; place-items: center; color: #2563eb;
}
.dz-icon svg { width: 38px; height: 38px; }
.dz-title { font-size: 17px; color: var(--text); font-weight: 500; }
.dz-title em { font-style: normal; color: #2563eb; }
.dz-sub { font-size: 13px; color: var(--text-faint); margin-top: 10px; }

/* 参数 */
.params { display: flex; flex-direction: column; gap: 14px; }
.param-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.param-label { font-size: 13px; color: var(--text-dim); font-weight: 500; flex: none; }
.seg {
  display: flex; background: rgba(15, 23, 42, 0.05);
  border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px;
}
.seg-btn {
  border: none; background: transparent; color: var(--text-dim);
  font-size: 13px; font-weight: 500; padding: 6px 14px; border-radius: 8px;
  cursor: pointer; transition: all .2s; font-family: inherit;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--grad); color: #fff;
  box-shadow: 0 4px 14px -4px rgba(0, 98, 255, 0.6);
}
.color-pick { display: flex; align-items: center; gap: 8px; }
.color-pick input[type="color"] {
  width: 34px; height: 30px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: transparent; padding: 2px; cursor: pointer;
}
.color-pick span { font-size: 12.5px; color: var(--text-dim); letter-spacing: .04em; font-family: ui-monospace, Consolas, monospace; }
.switch-row { display: flex; align-items: center; gap: 10px; cursor: pointer; width: 100%; }
.switch-row input { display: none; }
.switch {
  width: 38px; height: 22px; border-radius: 999px; background: rgba(15, 23, 42, .14);
  position: relative; transition: background .25s; flex: none; margin-left: auto;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .25s;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.switch-row input:checked + .switch { background: var(--grad); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }

/* 操作按钮 */
.ops { display: flex; gap: 10px; }
.btn-primary {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 13px 18px;
  font-size: 15px; font-weight: 600; color: #fff; font-family: inherit;
  background: var(--grad); cursor: pointer;
  box-shadow: 0 10px 26px -8px rgba(0, 98, 255, 0.6);
  transition: transform .15s, box-shadow .2s, opacity .2s;
}
.btn-primary svg { width: 15px; height: 15px; }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 30px -8px rgba(0, 98, 255, 0.75); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
/* 加载至画板：常规按钮尺寸（非横贯大按钮） */
.ws-actions .btn-primary.btn-sm {
  flex: 0 0 auto; padding: 9px 18px; font-size: 13.5px; border-radius: 10px;
  box-shadow: 0 6px 16px -8px rgba(0, 98, 255, 0.5);
}
.btn-ghost {
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
  border-radius: 12px; padding: 0 18px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .2s; font-family: inherit;
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }

/* 显存不足警告条 */
.vram-warn {
  display: flex; align-items: center; gap: 8px;
  background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24; border-radius: 12px; padding: 10px 14px;
  font-size: 13px; margin-bottom: 12px; line-height: 1.4;
}
.vram-warn svg { flex: none; }
.vram-warn-close {
  margin-left: auto; background: none; border: none; color: #fbbf24;
  font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1; font-family: inherit;
  opacity: .8;
}
.vram-warn-close:hover { opacity: 1; }

/* 全局进度 */
.global-progress { padding-top: 2px; }
.gp-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-dim); margin-bottom: 7px; }
.gp-track { height: 8px; border-radius: 999px; background: rgba(15, 23, 42, .08); overflow: hidden; }
.gp-fill {
  height: 100%; border-radius: 999px; width: 0%;
  background: linear-gradient(90deg, #38bdf8, #0062ff, #38bdf8, #38bdf8);
  background-size: 300% 100%;
  animation: gradShift 1.8s linear infinite;
  transition: width .35s ease;
  box-shadow: 0 0 14px rgba(0, 98, 255, 0.65);
}
.gp-fill.full { animation: none; background: linear-gradient(90deg, #10b981, #34d399); box-shadow: 0 0 12px rgba(16, 185, 129, 0.5); }
/* 终止抠图按钮 */
.gp-cancel {
  background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5; font-size: 12px; font-weight: 600; padding: 4px 10px;
  border-radius: 999px; cursor: pointer; font-family: inherit; line-height: 1.3;
  transition: all .15s;
}
.gp-cancel:hover { background: rgba(239, 68, 68, 0.22); color: #fff; }
.gp-cancel:disabled { opacity: .4; cursor: not-allowed; }

/* ZIP 行 */
.zip-row { display: flex; }
.btn-zip {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7; border-radius: 12px; padding: 11px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all .2s; text-decoration: none;
}
.btn-zip svg { width: 15px; height: 15px; }
.btn-zip:hover { background: rgba(16, 185, 129, 0.18); transform: translateY(-1px); }

/* ============ 右侧面板 ============ */
.right-panel { padding: clamp(14px, 1.6vw, 22px); min-height: 320px; }
.grid-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.grid-head h2 { font-size: 16px; font-weight: 650; }
.add-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px dashed rgba(15, 23, 42, 0.3); background: transparent;
  color: var(--text-dim); border-radius: 10px; padding: 7px 14px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all .2s;
}
.add-btn:hover { border-color: rgba(47, 123, 255, 0.7); color: #2563eb; background: rgba(0, 98, 255, 0.07); }
.add-btn svg { width: 14px; height: 14px; }
/* 清空全部按钮 */
.clear-all-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(248, 113, 113, 0.35); background: transparent;
  color: #fca5a5; border-radius: 10px; padding: 7px 14px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all .2s;
}
.clear-all-btn:hover:not(:disabled) { border-color: #f87171; color: #fff; background: rgba(248, 113, 113, 0.14); }
.clear-all-btn:disabled { opacity: .4; cursor: not-allowed; }
.clear-all-btn svg { width: 14px; height: 14px; }
.count {
  font-size: 12px; color: var(--accent-2); background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3); padding: 2px 9px; border-radius: 999px;
  margin-left: 6px; font-weight: 600; vertical-align: 1px;
}
.hint { font-size: 12px; color: var(--text-faint); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(190px, 20vw, 280px), 1fr));
  gap: clamp(12px, 1.4vw, 18px);
}

/* 图片卡片 */
.card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s, border-color .2s, box-shadow .2s;
  position: relative;
}
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.7); }
.card.done { border-color: rgba(16, 185, 129, 0.35); }
.card.fail { border-color: rgba(244, 63, 94, 0.45); }

.card-thumb {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  /* 透明棋盘格 */
  background-color: #f1f5f9;
  background-image:
    linear-gradient(45deg, rgba(15, 23, 42, .06) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(15, 23, 42, .06) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(15, 23, 42, .06) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(15, 23, 42, .06) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.card-thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; display: block; pointer-events: none;
}
/* 抠图结果（完成态主显，透明底棋盘格可见） */
.t-result { z-index: 2; }
/* 原图：默认完整显示（待处理/处理中）；完成态裁剪隐藏，hover 时按分割线露出左侧 */
.t-orig { z-index: 1; }
.card.has-cmp .t-orig { clip-path: inset(0 100% 0 0); }
.card.done.has-cmp:hover .t-orig { clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0); }
/* hover 分割线 */
.t-divider {
  position: absolute; top: 0; bottom: 0; left: var(--pos, 50%);
  width: 2px; background: #fff; z-index: 3; pointer-events: none;
  opacity: 0; box-shadow: 0 0 10px rgba(0, 0, 0, 0.65);
  transform: translateX(-1px);
}
.card.done.has-cmp:hover .t-divider { opacity: 1; }
.t-divider::after {
  content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #0f172a;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.5);
}
/* 处理中卡片高亮 */
.card.processing {
  border-color: rgba(56, 189, 248, 0.55) !important;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25), 0 14px 34px -14px rgba(0, 0, 0, 0.7);
}

.card-del {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 24px; height: 24px; border-radius: 8px; border: none;
  background: rgba(10, 13, 22, 0.72); color: #475569; cursor: pointer;
  display: grid; place-items: center; opacity: 0; transition: opacity .2s, background .2s;
  backdrop-filter: blur(4px);
}
.card:hover .card-del { opacity: 1; }
.card-del:hover { background: var(--danger); color: #fff; }
.card-del svg { width: 12px; height: 12px; }

.card-state {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.card-state.pending { background: rgba(71, 85, 105, 0.7); color: #1e293b; }
.card-state.processing { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; border: 1px solid rgba(56,189,248,.35); }
.card-state.done { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border: 1px solid rgba(16,185,129,.35); }
.card-state.fail { background: rgba(244, 63, 94, 0.16); color: #fda4af; border: 1px solid rgba(244,63,94,.4); }

.card-body { padding: 10px 12px 12px; }
.card-name {
  font-size: 12.5px; color: var(--text); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta { font-size: 11px; color: var(--text-faint); margin-top: 3px; display: flex; justify-content: space-between; }

/* 逐图进度条（加粗醒目） */
/* 卡片进度条：渐变光效版（旧细条已移除，processing 时整图流光 + 渐变光条） */
.card-progress {
  height: 8px; border-radius: 99px;
  background: rgba(15, 23, 42, 0.08);
  margin-top: 10px; overflow: hidden; position: relative;
}
.card-progress .fill {
  height: 100%; border-radius: 99px; width: 100%;
  transition: width .4s ease;
}
.card-progress .fill.wait { width: 100% !important; opacity: .28; background: rgba(15, 23, 42, 0.14); }
.card-progress .fill.glow {
  width: 100% !important;
  background: linear-gradient(90deg, #38bdf8, #0062ff, #38bdf8, #38bdf8);
  background-size: 300% 100%;
  animation: gradShift 1.5s linear infinite;
  box-shadow: 0 0 16px rgba(0, 98, 255, 0.65);
}
.card-progress .fill.done-glow {
  width: 100% !important;
  background: linear-gradient(90deg, #10b981, #34d399);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}
.card-progress .fill.err { width: 100% !important; background: var(--danger); }
@keyframes gradShift { 0% { background-position: 0% 0; } 100% { background-position: 300% 0; } }

/* 处理中：图片整体渐变流光覆盖层 */
.card-glow {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(115deg,
    rgba(56, 189, 248, 0) 0%,
    rgba(56, 189, 248, 0.28) 25%,
    rgba(0, 98, 255, 0.30) 50%,
    rgba(168, 85, 247, 0.28) 75%,
    rgba(56, 189, 248, 0) 100%);
  background-size: 300% 100%;
  animation: gradShift 1.8s linear infinite;
  mix-blend-mode: screen;
}
.card.processing .card-thumb::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  box-shadow: inset 0 0 0 1.5px rgba(0, 98, 255, 0.55), inset 0 0 30px rgba(0, 98, 255, 0.25);
  border-radius: inherit;
}

.card-actions { display: flex; gap: 8px; margin-top: 10px; }
.card-actions .mini {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 9px; padding: 8px 6px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .18s; text-decoration: none;
}
.mini-dl { border: none; background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px rgba(0,98,255,.6); }
.mini-dl:hover { transform: translateY(-1px); }
.mini-cmp { border: 1px solid var(--border-strong); background: transparent; color: var(--text-dim); }
.mini-cmp:hover { color: var(--text); border-color: rgba(15, 23, 42, .3); }
.mini svg { width: 13px; height: 13px; }
.card-error { font-size: 11px; color: #fda4af; margin-top: 8px; word-break: break-all; }

/* 空状态 */
.empty-state {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: clamp(36px, 4vh, 64px) 24px; color: var(--text-faint);
  cursor: pointer; border: 1.5px dashed rgba(15, 23, 42, 0.12);
  border-radius: 14px; transition: all .25s;
  min-height: clamp(180px, 30vh, 400px);
}
.empty-state:hover { border-color: rgba(47, 123, 255, 0.6); color: var(--text-dim); background: rgba(0, 98, 255, 0.04); }
.empty-state svg { width: 58px; height: 58px; opacity: .5; }
.empty-state p { font-size: 15.5px; }

/* ============ 对比 Modal ============ */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 8, 14, 0.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-card {
  position: relative; width: min(96vw, 1100px); height: min(92vh, 900px); max-height: 92vh;
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  border-radius: 20px; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.85);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14.5px; font-weight: 600; }
.modal-title span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-state { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; flex: none; }
.cmp-state.ok { background: rgba(16,185,129,.16); color: #6ee7b7; border: 1px solid rgba(16,185,129,.35); }
.cmp-state.pending { background: rgba(71,85,105,.5); color: #475569; }
.modal-close {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); cursor: pointer;
  display: grid; place-items: center; transition: all .2s;
}
.modal-close:hover { color: #fff; border-color: var(--border-strong); background: rgba(15, 23, 42, .05); }
.modal-close svg { width: 16px; height: 16px; }

/* 对比滑块 */
.cmp {
  position: relative; width: 100%; flex: 1; min-height: 0; max-height: none;
  background-color: #f1f5f9;   /* 全局画布：纯深灰，不随滑块改变 */
  user-select: none; overflow: hidden;
}
/* 图片舞台：仅包裹图片实际展示区域（按原图比例等比缩放），棋盘格只作用于此 */
.cmp-stage {
  position: absolute; inset: 0; margin: auto;
  max-width: calc(100% - 20px); max-height: calc(100% - 20px);
  aspect-ratio: var(--ar, 4 / 3);
  background-color: #f1f5f9;
  background-image:
    linear-gradient(45deg, rgba(15, 23, 42, .07) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(15, 23, 42, .07) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(15, 23, 42, .07) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(15, 23, 42, .07) 75%);
  background-size: 18px 18px;
}
.cmp-stage img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: fill; display: block; pointer-events: none;
}
.cmp-after { z-index: 1; }                 /* 底层：抠图结果，透明区域透出棋盘格 */
.cmp-before { z-index: 2; clip-path: inset(0 0 0 50%); }  /* 顶层：原图，随滑块裁切 */

/* 并排双面板模式（参考图二：左原图 | 右抠图） */
.cmp-dual {
  position: absolute; inset: 0; display: flex; z-index: 2;
}
.cmp-panel {
  flex: 1; min-width: 0; display: grid; place-items: center;
  overflow: hidden; padding: 10px;
}
.cmp-panel-l { background: rgba(15, 23, 42, 0.92); }
.cmp-panel-r { background: transparent; }
.cmp-dual-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 8px; box-shadow: 0 4px 24px rgba(0,0,0,.35);
}
.cmp-swap {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 7; width: 46px; height: 46px; border-radius: 50%;
  background: #0f172a; color: #fff; border: 1px solid rgba(15, 23, 42, .25);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 6px 24px rgba(0,0,0,.55); transition: all .18s;
}
.cmp-swap:hover { background: #1e293b; transform: translate(-50%, -50%) scale(1.06); }
.cmp-swap svg { width: 22px; height: 22px; }
/* 模式切换：并排 vs 滑块 vs 单图 */
.cmp.mode-dual .cmp-before, .cmp.mode-dual .cmp-after,
.cmp.mode-dual .cmp-divider, .cmp.mode-dual .cmp-range,
.cmp.mode-dual .cmp-hint, .cmp.mode-dual .cmp-tag,
.cmp.mode-dual .cmp-stage { display: none !important; }
.cmp.mode-slider .cmp-dual { display: none; }
/* 未抠图：单图大图查看（无对比、无棋盘格） */
.cmp.mode-single .cmp-dual,
.cmp.mode-single .cmp-divider,
.cmp.mode-single .cmp-range,
.cmp.mode-single .cmp-hint,
.cmp.mode-single .cmp-bgbar,
.cmp.mode-single .cmp-tag,
.cmp.mode-single .cmp-after { display: none !important; }
.cmp.mode-single .cmp-stage { background-image: none; }
.cmp.mode-single .cmp-before { clip-path: none !important; }

/* 底部文件信息栏 */
.modal-info {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  font-size: 12px; color: var(--text-dim); flex: 1;
}
.mi-name { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46%; }
.mi-dim, .mi-size { white-space: nowrap; }
.cmp-divider {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
  background: #fff; transform: translateX(-1px);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.6); pointer-events: none;
}
.cmp-handle {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; color: #0f172a; display: grid; place-items: center;
  box-shadow: 0 4px 18px rgba(0,0,0,.5);
}
.cmp-handle svg { width: 20px; height: 20px; }
.cmp-range {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: ew-resize; margin: 0; z-index: 5;
}
.cmp-tag {
  position: absolute; bottom: 14px; font-size: 11.5px; font-weight: 600;
  padding: 4px 12px; border-radius: 999px; pointer-events: none;
  background: rgba(10, 13, 22, 0.72); border: 1px solid var(--border-strong);
  color: var(--text); backdrop-filter: blur(6px);
}
.cmp-tag-l { left: 14px; }
.cmp-tag-r { right: 14px; color: #6ee7b7; border-color: rgba(16,185,129,.4); }

/* 对比背景切换（棋盘格 / 黑 / 白）——右上角，避开中央分割线与底部标签 */
.cmp-bgbar {
  position: absolute; top: 12px; right: 12px;
  display: flex; align-items: center; gap: 8px; z-index: 6;
  background: rgba(10, 13, 22, 0.82); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 5px 12px; backdrop-filter: blur(6px);
}
.cmp-bg-label { font-size: 11px; color: var(--text-dim); margin-right: 2px; white-space: nowrap; }
.cmp-bg-btn {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border-strong);
  cursor: pointer; padding: 0; transition: all .15s;
}
.cmp-bg-btn[data-bg="check"] { background-color: #94a3b8; background-image:
  linear-gradient(45deg, rgba(15, 23, 42, .28) 25%, transparent 25%),
  linear-gradient(-45deg, rgba(15, 23, 42, .28) 25%, transparent 25%),
  linear-gradient(45deg, transparent 75%, rgba(15, 23, 42, .28) 75%),
  linear-gradient(-45deg, transparent 75%, rgba(15, 23, 42, .28) 75%);
  background-size: 11px 11px; }
.cmp-bg-btn[data-bg="black"] { background: #000; }
.cmp-bg-btn[data-bg="white"] { background: #fff; }
.cmp-bg-btn.active { outline: 2px solid #38bdf8; outline-offset: 1px; border-color: #38bdf8; }
/* 背景模式：只切换图片舞台的底色（画布保持深灰） */
.cmp.bg-black .cmp-stage { background-color: #000; background-image: none; }
.cmp.bg-white .cmp-stage { background-color: #fff; background-image: none; }
.cmp.bg-white .cmp-stage .cmp-tag, .cmp.bg-white .cmp-stage .cmp-bgbar { background: rgba(15, 23, 42, 0.72); }
.cmp-hint {  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font-size: 12px; font-weight: 600; color: #1e293b;
  padding: 6px 16px; border-radius: 999px; pointer-events: none;
  background: rgba(10, 13, 22, 0.78); border: 1px solid rgba(0, 98, 255, 0.5);
  backdrop-filter: blur(6px); z-index: 6; letter-spacing: .5px;
  box-shadow: 0 6px 20px -6px rgba(0,0,0,.6);
  animation: hintPulse 2s ease-in-out infinite;
}
@keyframes hintPulse { 0%, 100% { opacity: .95; } 50% { opacity: .6; } }
/* 抠图结果加载提示 */
.cmp-loading {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font-size: 12px; font-weight: 600; color: #1e293b;
  padding: 6px 16px; border-radius: 999px; pointer-events: none;
  background: rgba(10, 13, 22, 0.85); border: 1px solid rgba(245, 158, 11, 0.55);
  backdrop-filter: blur(6px); z-index: 8; display: none; white-space: nowrap;
}
.cmp-loading::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 7px;
  border-radius: 50%; border: 2px solid rgba(245, 158, 11, 0.35);
  border-top-color: #f59e0b; vertical-align: -1px;
  animation: spinCmp .7s linear infinite;
}
@keyframes spinCmp { to { transform: rotate(360deg); } }

.modal-foot { display: flex; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); }
.modal-foot .btn-zip { flex: none; min-width: 160px; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(17, 23, 37, 0.95); border: 1px solid var(--border-strong);
  color: #f1f5f9; padding: 11px 22px; border-radius: 12px;
  font-size: 13.5px; font-weight: 500; z-index: 200;
  box-shadow: 0 18px 44px -12px rgba(0,0,0,.7);
  backdrop-filter: blur(10px);
  animation: toast-in .25s ease;
}
.toast[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============ 自适应 ============ */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; height: auto; overflow: visible; align-items: stretch; }
  .left-panel { flex-direction: row; flex-wrap: wrap; align-items: stretch; overflow-y: visible; }
  .right-panel { overflow: visible; min-height: 320px; }
  .grid { overflow-y: visible; flex: none; }
  .dropzone { flex: 1 1 100%; }
  .params { flex: 1 1 100%; }
  .ops { flex: 1 1 100%; }
}

@media (max-width: 640px) {
  .topbar { padding-top: 14px; }
  .top-status { width: 100%; justify-content: flex-start; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .modal { padding: 10px; }
  .cmp { aspect-ratio: 3 / 4; }
  .hint { display: none; }
}


/* ============ 三选项卡 ============ */
.workspace { max-width: 1600px; margin: 0 auto; }
.tab-nav {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 0 0 18px; padding: 5px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: fit-content;
  max-width: 100%;
}
.tab-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: none; color: var(--text-dim);
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: 10px; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.tab-btn svg { width: 16px; height: 16px; }
.tab-btn:hover { color: var(--text); background: rgba(15, 23, 42, 0.05); }
.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(0, 98, 255, 0.32), rgba(56, 189, 248, 0.2));
  box-shadow: 0 0 0 1px rgba(47, 123, 255, 0.5), 0 6px 18px -8px rgba(0, 98, 255, 0.5);
}
.tab-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(16, 185, 129, 0.16); color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.tab-tag.tag-off { background: rgba(148, 163, 184, 0.14); color: #94a3b8; border-color: rgba(148, 163, 184, 0.3); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* 图片编辑页：面板高度锁定视口内，右侧工具栏超高时独立滚动，不影响中间画布与左侧列表 */
#panel-outpaint { height: calc(100vh - 165px); min-height: 0; overflow: hidden; }
#panel-outpaint .edit-workspace { height: 100%; }

/* ============ 引擎页（消除 / 扩图） ============ */
.engine-page { max-width: 980px; margin: 0 auto; }
.engine-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 18px; padding: 26px 28px;
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.engine-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.engine-icon {
  width: 56px; height: 56px; flex: none; border-radius: 16px;
  display: grid; place-items: center; color: #2563eb;
  background: rgba(0, 98, 255, 0.14); border: 1px solid rgba(0, 98, 255, 0.35);
}
.engine-icon svg { width: 28px; height: 28px; }
.engine-title { flex: 1; min-width: 220px; }
.engine-title h3 { margin: 0; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.engine-title p { margin: 6px 0 0; font-size: 13px; color: var(--text-dim); }
.model-chip {
  font-size: 11px; font-weight: 700; color: #60a5fa;
  background: rgba(0, 98, 255, 0.16); border: 1px solid rgba(47, 123, 255, 0.4);
  padding: 3px 9px; border-radius: 999px;
}
.engine-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; padding: 8px 15px; border-radius: 999px;
  background: rgba(100, 116, 139, 0.2); border: 1px solid rgba(148, 163, 184, 0.35);
  color: #475569; white-space: nowrap;
}
.engine-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; flex: none; }
.engine-badge.on { background: rgba(16, 185, 129, 0.14); border-color: rgba(16, 185, 129, 0.4); color: #6ee7b7; }
.engine-badge.on .dot { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22); animation: breathe 1.8s ease-in-out infinite; }
.engine-badge.off { background: rgba(100, 116, 139, 0.12); border-color: rgba(148, 163, 184, 0.3); color: #94a3b8; }
.engine-badge.off .dot { background: #64748b; }
.engine-steps { display: flex; flex-direction: column; gap: 14px; margin: 24px 0; }
.engine-step { display: flex; gap: 14px; align-items: flex-start; }
.step-no {
  width: 26px; height: 26px; flex: none; border-radius: 8px;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  color: #2563eb; background: rgba(0, 98, 255, 0.14); border: 1px solid rgba(47, 123, 255, 0.4);
}
.engine-step b { font-size: 14px; color: var(--text); }
.engine-step p { margin: 4px 0 0; font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.engine-step code {
  font-family: "Cascadia Code", Consolas, monospace; font-size: 12px;
  color: #bae6fd; background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25); border-radius: 6px; padding: 1px 7px;
}
.engine-step em { font-style: normal; color: #fcd34d; }
.engine-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 4px; }
.engine-btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff !important; text-decoration: none;
  padding: 13px 22px; border-radius: 12px; font-size: 15px; font-weight: 700;
  box-shadow: 0 8px 22px -8px rgba(16, 185, 129, 0.55);
  transition: all .2s; border: none; cursor: pointer;
  font-family: inherit; width: 100%; justify-content: center;
}
.engine-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 28px -8px rgba(16, 185, 129, 0.65); }
.engine-btn:disabled { opacity: .6; cursor: wait; transform: none !important; }
.engine-btn-alt { background: linear-gradient(135deg, #0062ff, #0052cc); box-shadow: 0 8px 22px -8px rgba(0, 98, 255, 0.55); }
.engine-btn-alt:hover:not(:disabled) { box-shadow: 0 12px 28px -8px rgba(0, 98, 255, 0.65); }
.engine-btn svg { width: 18px; height: 18px; }
.engine-launch-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; background: rgba(15, 23, 42, 0.06);
  color: var(--text); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .2s;
}
.engine-launch-btn:hover:not(:disabled) { background: rgba(15, 23, 42, 0.1); border-color: rgba(47, 123, 255, 0.5); }
.engine-launch-btn:disabled { opacity: .55; cursor: wait; }
.engine-launch-btn svg { width: 15px; height: 15px; color: #2563eb; }
/* 启动成功 → 已启动（绿色高亮） */
.engine-launch-btn.online {
  background: linear-gradient(135deg, #16a34a, #22c55e) !important;
  color: #fff !important; border-color: transparent !important;
  box-shadow: 0 8px 24px -6px rgba(34, 197, 94, 0.5);
}
.engine-launch-btn.online svg { color: #fff !important; }
.engine-launch-btn .spin { animation: eng-rot 1.1s linear infinite; }
@keyframes eng-rot { to { transform: rotate(360deg); } }
/* 引擎启动进度条 */
.engine-progress { display: flex; align-items: center; gap: 10px; margin: 8px 0 10px; }
.engine-progress[hidden] { display: none; }
.engine-progress-track {
  flex: 1; height: 8px; border-radius: 5px;
  background: rgba(15, 23, 42, 0.08); overflow: hidden;
}
.engine-progress-fill {
  height: 100%; width: 0%; border-radius: 5px;
  background: linear-gradient(90deg, #0062ff, #3b82f6, #0062ff);
  background-size: 200% 100%;
  transition: width .45s ease;
  animation: eng-shimmer 1.5s linear infinite;
}
@keyframes eng-shimmer { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }
.engine-progress-text { font-size: 12px; color: var(--text-dim); min-width: 74px; text-align: right; white-space: nowrap; }
.engine-tip { font-size: 12.5px; color: var(--text-faint); }

/* ============ 云端扩图卡片（SiliconFlow） ============ */
.cloud-card { margin-top: 14px; }
.cloud-status-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-faint); margin-bottom: 8px; }
.cloud-dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; }
.cloud-dot.on { background: #34d399; box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.25); }
.cloud-dot.err { background: #f87171; box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.25); }
.cloud-key-row { display: flex; gap: 8px; margin-bottom: 10px; }
.cloud-key-row input {
  flex: 1; min-width: 0; background: rgba(15, 23, 42, 0.05); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  font-size: 12.5px; font-family: inherit; outline: none;
}
.cloud-key-row input:focus { border-color: rgba(47, 123, 255, 0.6); }
.cloud-save {
  background: rgba(47, 123, 255, 0.15); color: #60a5fa;
  border: 1px solid rgba(47, 123, 255, 0.4); border-radius: 8px;
  padding: 0 16px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
  white-space: nowrap; transition: all .2s;
}
.cloud-save:hover { background: rgba(47, 123, 255, 0.28); }
.cloud-model-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cloud-model-row select {
  flex: 1; min-width: 0; background: rgba(15, 23, 42, 0.05); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
  font-size: 12.5px; font-family: inherit; outline: none; cursor: pointer;
}
.cloud-tip { font-size: 11.5px; color: var(--text-faint); line-height: 1.55; margin-top: 4px; }
.cloud-tip b { color: #2563eb; }
.run-row { display: flex; gap: 10px; }
.btn-cloud {
  background: linear-gradient(135deg, #0ea5e9 0%, #0062ff 100%) !important;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25) !important;
}
.btn-cloud:hover { box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35) !important; transform: translateY(-1px); }
.cloud-running { position: relative; }
.cloud-running::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  border: 2px solid rgba(14, 165, 233, 0.6); animation: cloudPulse 1.2s ease infinite;
}
@keyframes cloudPulse { 0%,100% { opacity: .9; } 50% { opacity: .25; } }


/* ============ 引擎双栏工作台 ============ */
.engine-workbench {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: clamp(14px, 1.8vw, 24px);
  align-items: start;
  max-width: 1900px; margin: 0 auto;
}
.engine-info { position: sticky; top: 16px; }
.engine-workspace {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 18px; padding: 22px 24px;
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.ws-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ws-toolbar h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.ws-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.ws-dropzone {
  border: 1.5px dashed rgba(15, 23, 42, 0.2); border-radius: 12px;
  padding: clamp(20px, 3vw, 30px) 16px; text-align: center; cursor: pointer;
  transition: all .25s; background: rgba(15, 23, 42, 0.02); outline: none;
}
.ws-dropzone:hover, .ws-dropzone:focus-visible { border-color: rgba(47, 123, 255, 0.7); background: rgba(0, 98, 255, 0.06); }
.ws-dropzone.dragover { border-color: var(--accent-2); background: rgba(56, 189, 248, 0.07); }
.ws-dropzone svg { width: 30px; height: 30px; color: #2563eb; margin-bottom: 8px; }
.ws-dropzone p { margin: 0; font-size: 14px; color: var(--text); }
.ws-dropzone p em { font-style: normal; color: #2563eb; }
.ws-dropzone span { display: block; margin-top: 6px; font-size: 12px; color: var(--text-faint); }
.ws-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px; min-height: 120px;
}
.ws-empty {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 34px 16px; color: var(--text-faint); font-size: 13px;
  border: 1.5px dashed rgba(15, 23, 42, 0.1); border-radius: 12px;
}
.ws-empty svg { width: 34px; height: 34px; opacity: .45; }
.ws-empty p { margin: 0; }
.ws-card {
  position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: rgba(15, 23, 42, 0.03); transition: border-color .2s;
}
.ws-card:hover { border-color: rgba(47, 123, 255, 0.55); }
.ws-card-thumb { aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden; background: rgba(0, 0, 0, 0.25); }
.ws-card-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ws-card-name {
  font-size: 11px; color: var(--text-dim); padding: 6px 8px 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-card-del {
  position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 7px;
  border: none; background: rgba(15, 23, 42, 0.78); color: #fca5a5; cursor: pointer;
  display: grid; place-items: center; transition: background .2s;
}
/* 已编辑区卡片左上角「发送到画板」悬浮按钮 */
.ip-edit-send {
  position: absolute; left: 4px; top: 4px; z-index: 6;
  display: inline-flex; align-items: center;
  background: linear-gradient(135deg, #0052cc, #3b82f6);
  color: #fff; font-size: 10.5px; font-weight: 600;
  padding: 3px 7px; border-radius: 6px; border: none; cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.45); white-space: nowrap;
}
.ws-card:hover .ip-edit-send { opacity: 1; pointer-events: auto; }
.ip-edit-send:hover { transform: translateY(-1px); }
.ws-card-del:hover { background: rgba(248, 113, 113, 0.25); }
.ws-card-del svg { width: 12px; height: 12px; }
/* 涂抹消除页：大画板（底部历史横排）+ 右侧已编辑竖条 */
.ip-workspace { display: flex; flex-direction: row; gap: 14px; align-items: stretch; min-width: 0; }
.ip-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ip-main .ip-board { flex: 1 1 auto; min-width: 0; }
.ip-main .ip-canvas-wrap { min-height: 48vh; }
/* 画板底部：历史记录横排 */
.ip-hist-bar {
  flex: 0 0 auto;
  background: rgba(15, 23, 42, 0.02); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px 12px; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 8px;
}
.ip-hist-bar .ws-toolbar { flex-direction: row; justify-content: space-between; align-items: center; }
.ip-hist-bar .ws-toolbar h3 { font-size: 13.5px; }
.ip-hist-bar .ws-tools { flex-direction: row; }
#inpaint-grid.ws-grid {
  display: flex; flex-direction: row; gap: 10px;
  overflow-x: auto; overflow-y: hidden; min-height: 0;
  padding-bottom: 4px; align-items: flex-start; scrollbar-width: thin;
}
#inpaint-grid .ws-card { flex: 0 0 100px; }
#inpaint-grid .ws-card-thumb { aspect-ratio: 1 / 1; }
#inpaint-grid .ws-card-name { font-size: 11px; }
#inpaint-grid .ws-empty { flex: 1 1 100%; min-width: 260px; }
#inpaint-grid .ws-card.active { border-color: #2563eb; box-shadow: 0 0 0 1.5px rgba(165, 180, 252, 0.45); }
/* 右侧竖条：已编辑 */
.ip-edited {
  flex: 0 0 300px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
  background: rgba(15, 23, 42, 0.02); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px; box-sizing: border-box;
}
.ip-edited .ws-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
.ip-edited .ws-toolbar h3 { font-size: 14px; }
.ip-edited .ws-tools { flex-direction: column; width: 100%; }
.ip-edited .add-btn, .ip-edited .clear-all-btn { width: 100%; justify-content: center; }
#ip-edited-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  overflow-y: auto; overflow-x: hidden; flex: 1 1 auto;
  min-height: 0; padding-bottom: 4px; align-content: start;
  scrollbar-width: thin;
}
#ip-edited-grid .ws-card { min-width: 0; }
#ip-edited-grid .ws-card-thumb { aspect-ratio: 1 / 1; }
#ip-edited-grid .ws-card-name { font-size: 10.5px; }
#ip-edited-grid .ws-empty { grid-column: 1 / -1; min-height: 120px; padding: 18px 8px; }
/* 已编辑区大图预览浮层（悬停 3 秒触发，尺寸与涂抹画板一致，由 JS 动态设定；默认停靠网页右侧，少遮挡画板） */
.ip-edit-preview {
  position: fixed; left: auto; right: 20px; top: 50%; transform: translateY(-50%);
  z-index: 9999;
  display: none; align-items: center; justify-content: center;
  background: rgba(5, 8, 15, 0.9); backdrop-filter: blur(3px);
  border: 1px solid rgba(148, 163, 184, 0.25); border-radius: 12px;
  cursor: zoom-out;
  box-sizing: border-box; padding: 10px;
}
.ip-edit-preview.show { display: flex; }
.ip-edit-preview img {
  max-width: 100%; max-height: 100%;
  border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  background: repeating-conic-gradient(#94a3b8 0% 25%, #1e293b 0% 50%) 0 0 / 22px 22px;
  transform-origin: center center;
  transition: transform 0.15s ease;
}
.ip-edit-preview .ip-edit-pv-tip {
  position: absolute; left: 10px; bottom: 8px; z-index: 2;
  font-size: 11px; color: #94a3b8; background: rgba(10, 15, 25, 0.8);
  padding: 3px 10px; border-radius: 6px; pointer-events: none;
  white-space: nowrap;
}
.ip-edit-preview .ip-edit-pv-name {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  color: #475569; font-size: 13px; background: rgba(10, 14, 24, 0.75);
  padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(148, 163, 184, 0.3);
  max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 2px; }
.ws-actions .btn-primary { margin: 0; }
.ws-actions .btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.ws-hint { font-size: 12.5px; color: var(--text-faint); }
.engine-launch { margin-top: 4px; display: flex; flex-direction: column; gap: 14px; }
.launch-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-dim);
  background: rgba(15, 23, 42, 0.03); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 13px;
}
.launch-row code {
  font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px;
  color: #bae6fd; background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25); border-radius: 6px; padding: 1px 8px;
}
.launch-vram { margin-left: auto; font-size: 11.5px; color: #fcd34d; }
.engine-launch .engine-btn { justify-content: center; }
@media (max-width: 900px) {
  .engine-workbench { grid-template-columns: 1fr; }
  .engine-info { position: static; }
}


/* ============ 引擎页：下载角标 / 扩图参数 / 结果区 ============ */
.ws-card-name { padding-right: 26px; }
.ws-card-dl {
  position: absolute; bottom: 5px; right: 5px; width: 22px; height: 22px;
  border-radius: 7px; border: none; background: rgba(15, 23, 42, 0.82);
  color: #93c5fd; cursor: pointer; display: grid; place-items: center;
  transition: background .2s;
}
.ws-card-dl:hover { background: rgba(59, 130, 246, 0.4); }
.ws-card-dl svg { width: 12px; height: 12px; }
.ws-divider { border: 0; border-top: 1px dashed rgba(15, 23, 42, 0.14); margin: 4px 0 0; }
.ws-opts { display: flex; flex-direction: column; gap: 10px; padding: 2px 0; }
.ws-opt-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ws-opt-label { font-size: 13px; color: var(--text-dim); min-width: 58px; }
.ws-select {
  background: rgba(15, 23, 42, 0.06); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
  font-size: 13px; font-family: inherit; cursor: pointer; outline: none;
}
.ws-select:focus { border-color: rgba(47, 123, 255, 0.6); }
.ws-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ws-result {
  position: relative; border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; background: rgba(15, 23, 42, 0.03);
  transition: border-color .2s;
}
.ws-result:hover { border-color: rgba(0, 98, 255, 0.55); }
.ws-result-thumb { aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden; background: rgba(0, 0, 0, 0.25); }
.ws-result-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ws-result-name { font-size: 11px; color: var(--text-dim); padding: 6px 8px 42px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-result-dl {
  position: absolute; left: 6px; right: 52%; bottom: 6px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, #0052cc, #3b82f6); color: #fff;
  border: none; border-radius: 8px; padding: 7px 0; font-size: 12px;
  font-weight: 600; cursor: pointer; font-family: inherit; transition: opacity .2s;
}
.ws-result-dl:disabled { opacity: 0.5; cursor: wait; }
.ws-result-dl svg { width: 13px; height: 13px; }
.ws-result-re {
  position: absolute; left: 52%; right: 6px; bottom: 6px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(59, 130, 246, 0.16); color: #7dd3fc;
  border: 1px solid rgba(59, 130, 246, 0.45); border-radius: 8px;
  padding: 6px 0; font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all .2s; white-space: nowrap;
}
.ws-result-re:hover { background: rgba(59, 130, 246, 0.3); color: #bae6fd; }
.ws-result-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; background: rgba(15, 23, 42, 0.55); font-size: 12.5px; color: #60a5fa; }
.ws-result-state .spin { width: 15px; height: 15px; border: 2px solid rgba(199, 210, 254, 0.35); border-top-color: #2563eb; border-radius: 50%; animation: spin 0.9s linear infinite; }
.ws-result-cancel {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.25);
  background: rgba(15, 23, 42, 0.7); color: #fca5a5;
  font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.ws-result-cancel:hover { background: rgba(220, 38, 38, 0.85); color: #fff; border-color: transparent; }
.ws-result.cancelled { opacity: 0.55; }
.ws-result.cancelled .ws-result-thumb img { filter: grayscale(0.8); }
.est-box {
  margin: 10px 0 4px; padding: 9px 12px;
  border: 1px dashed rgba(0, 98, 255, 0.35); border-radius: 10px;
  background: rgba(0, 98, 255, 0.06); font-size: 12px; line-height: 1.6;
}
.est-line { color: #60a5fa; }
.est-line b { color: #2563eb; font-size: 12.5px; }
.est-tip { color: #fbbf24; font-size: 11.5px; margin-top: 2px; }
.est-tip.warn { color: #fbbf24; }
.est-tip.good { color: #6ee7b7; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ============ 扩图：比例 chips / 自定义宽高 ============ */
.ratio-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ratio-chip {
  background: rgba(15, 23, 42, 0.05); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 7px; padding: 5px 10px;
  font-size: 12px; font-family: inherit; cursor: pointer; transition: all 0.15s;
}
.ratio-chip:hover { color: var(--text); border-color: rgba(47, 123, 255, 0.5); }
.ratio-chip.active {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.32), rgba(59, 130, 246, 0.32));
  color: #dbeafe; border-color: rgba(47, 123, 255, 0.75);
}
.ratio-chip.ratio-custom { border-style: dashed; }
.ws-num {
  width: 62px; background: rgba(15, 23, 42, 0.06); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px;
  font-size: 13px; font-family: inherit; outline: none; text-align: center;
}
.ws-num:focus { border-color: rgba(47, 123, 255, 0.6); }
.ws-colon { color: var(--text-dim); font-weight: 700; }
.ws-prompt-row { flex-direction: column; align-items: stretch; gap: 7px; }
.ws-prompt {
  width: 100%; background: rgba(15, 23, 42, 0.05); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; font-family: inherit; line-height: 1.5; outline: none;
  resize: vertical; min-height: 56px; box-sizing: border-box;
}
.ws-prompt:focus { border-color: rgba(47, 123, 255, 0.6); }
.ws-prompt::placeholder { color: rgba(148, 163, 184, 0.65); }


/* ============ 拖拽框扩图预览区 ============ */
.op-box { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.op-box-stage {
  position: relative; width: 100%; height: 320px; overflow: hidden;
  background: repeating-conic-gradient(rgba(15, 23, 42, 0.05) 0% 25%, transparent 0% 50%) 50% / 22px 22px,
              linear-gradient(180deg, rgba(15,23,42,0.9), rgba(15,23,42,0.96));
  border: 1px solid var(--border); border-radius: 12px; user-select: none;
}
.op-box-stage img {
  position: absolute; max-width: none; max-height: none;
  display: block; pointer-events: none;
}
.op-box-veil { position: absolute; inset: 0; pointer-events: none; }
.op-veil { position: absolute; background: rgba(2, 6, 23, 0.52); }
.op-box-frame {
  position: absolute; border: 1.5px solid rgba(129, 140, 248, 0.95);
  box-shadow: 0 0 0 1px rgba(2, 6, 23, 0.4);
  cursor: move; touch-action: none; box-sizing: border-box;
}
.op-box-frame::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(129,140,248,0.14) 0 1px, transparent 1px 14px),
              repeating-linear-gradient(90deg, rgba(129,140,248,0.14) 0 1px, transparent 1px 14px);
  pointer-events: none;
}
.op-handle {
  position: absolute; width: 11px; height: 11px; background: #fff;
  border: 1.5px solid #0062ff; border-radius: 3px; box-sizing: border-box;
  touch-action: none;
}
.op-handle.hnw { left: -6px; top: -6px; cursor: nwse-resize; }
.op-handle.hn  { left: calc(50% - 6px); top: -6px; cursor: ns-resize; }
.op-handle.hne { right: -6px; top: -6px; cursor: nesw-resize; }
.op-handle.he  { right: -6px; top: calc(50% - 6px); cursor: ew-resize; }
.op-handle.hse { right: -6px; bottom: -6px; cursor: nwse-resize; }
.op-handle.hs  { left: calc(50% - 6px); bottom: -6px; cursor: ns-resize; }
.op-handle.hsw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.op-handle.hw  { left: -6px; top: calc(50% - 6px); cursor: ew-resize; }
.op-box-info {
  font-size: 12.5px; color: #60a5fa; background: rgba(0, 98, 255, 0.12);
  border: 1px solid rgba(0, 98, 255, 0.3); border-radius: 8px;
  padding: 7px 10px; min-height: 18px; line-height: 1.5;
}
.op-box-actions { display: flex; gap: 8px; }
.op-box-btn {
  flex: 1; background: rgba(15, 23, 42, 0.06); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 0;
  font-size: 12.5px; font-family: inherit; cursor: pointer; transition: all 0.15s;
}
.op-box-btn:hover { background: rgba(0, 98, 255, 0.16); border-color: rgba(47, 123, 255, 0.6); }


/* ============ 紧凑化布局（2026-09 拥挤修复） ============ */
.engine-card { padding: 18px 20px; }
.engine-icon { width: 44px; height: 44px; border-radius: 13px; }
.engine-icon svg { width: 22px; height: 22px; }
.engine-title h3 { font-size: 16px; }
.engine-title p { margin: 3px 0 0; font-size: 12.5px; }
.engine-badge { padding: 6px 12px; font-size: 12px; }
.engine-steps { gap: 9px; margin: 14px 0; }
.engine-step { gap: 10px; }
.engine-step b { font-size: 13.5px; }
.engine-step p { margin: 1px 0 0; font-size: 12.5px; line-height: 1.5; }
.engine-launch { gap: 10px; }
.launch-row { padding: 7px 11px; }
.engine-tip { font-size: 12px; }
.engine-workbench { grid-template-columns: minmax(250px, 310px) 1fr; gap: clamp(12px, 1.5vw, 20px); }
.engine-workspace { padding: 16px 18px; gap: 12px; }
.ws-dropzone { padding: clamp(14px, 2vw, 22px) 14px; }
.ws-dropzone svg { width: 26px; height: 26px; margin-bottom: 6px; }
.ws-dropzone p { font-size: 13.5px; }
.ws-dropzone span { margin-top: 4px; font-size: 11.5px; }
.ws-empty { padding: 20px 14px; }
.ws-grid { gap: 10px; min-height: 96px; }
.ws-results { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 10px; }
.op-box-stage { height: 280px; }
.ws-opt-row { gap: 10px; }
.ws-opt-label { min-width: 54px; font-size: 12.5px; }
.ws-opts { gap: 9px; }
.ws-opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; }
.ws-opt-grid .ws-opt-row { min-width: 0; }
.op-box-info-row { display: flex; align-items: center; gap: 8px; }
.op-box-info-row .op-box-info { flex: 1; margin: 0; }
.op-box-actions { flex: none; }

/* ============ 页面内涂抹消除画板 ============ */
.ip-board {
  margin-top: 0;
  background: #ffffff; border: 1px solid var(--border);
  border-radius: 16px; padding: 14px;
}
.ip-board-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.ip-board-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 700; color: var(--text); min-width: 0;
}
.ip-board-title svg { color: #2563eb; flex: none; }
.ip-file {
  font-size: 12.5px; font-weight: 500; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px;
}
.ip-board-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ip-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ip-clear-red {
  display: inline-flex; align-items: center; gap: 5px;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff; border: 1px solid rgba(248, 113, 113, 0.5);
  border-radius: 8px; font-size: 12.5px; font-weight: 600;
  padding: 7px 12px; cursor: pointer; transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}
.ip-clear-red:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(220, 38, 38, 0.45); }
.ip-clear-red svg { flex: none; }
.ip-brush-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-dim); white-space: nowrap;
}
.ip-brush-label input[type="range"] { width: 90px; accent-color: #0062ff; }
.ip-brush-label span { min-width: 22px; text-align: right; color: var(--text); font-weight: 600; }
.ip-tool-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(15, 23, 42, 0.05); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 6px 11px; font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.ip-tool-btn:hover { color: var(--text); border-color: var(--border-strong); }
.ip-tool-btn.active {
  background: rgba(47, 123, 255, 0.16); color: #60a5fa;
  border-color: rgba(47, 123, 255, 0.55);
}
.ip-tool-btn svg { flex: none; }
.ip-canvas-wrap {
  position: relative; width: 100%; min-height: 580px; max-height: 84vh;
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; cursor: crosshair;
}
.ip-canvas-wrap canvas {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  will-change: transform;
}
#ip-mask { pointer-events: auto; }
.ip-cursor {
  position: absolute; z-index: 6; pointer-events: none;
  border: 1.5px solid rgba(15, 23, 42, 0.95);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  background: rgba(15, 23, 42, 0.08);
}
.ip-size {
  position: absolute; right: 10px; top: 10px; z-index: 5;
  font-size: 11.5px; font-weight: 600; color: #60a5fa;
  background: rgba(10, 13, 22, 0.82); border: 1px solid rgba(47, 123, 255, 0.45);
  padding: 3px 10px; border-radius: 999px; pointer-events: none;
  font-variant-numeric: tabular-nums; letter-spacing: .3px;
}
.ip-canvas-wrap.ip-dragover::after {
  content: "松开即可上传并载入新图";
  position: absolute; inset: 0; z-index: 7;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #dbeafe;
  background: rgba(0, 98, 255, 0.28);
  border: 2px dashed #2563eb; border-radius: 12px;
  pointer-events: none; backdrop-filter: blur(2px);
}
.ip-auto {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--text);
  background: rgba(47, 123, 255, 0.1); border: 1px solid rgba(47, 123, 255, 0.35);
  border-radius: 10px; padding: 8px 13px; cursor: pointer;
  transition: all .15s; user-select: none; white-space: nowrap;
}
.ip-auto:hover { border-color: rgba(47, 123, 255, 0.6); }
.ip-auto input { accent-color: #0062ff; width: 15px; height: 15px; cursor: pointer; }
.ip-auto:has(input:checked) {
  background: rgba(47, 123, 255, 0.22);
  border-color: rgba(47, 123, 255, 0.7);
  color: #dbeafe;
}
.ip-canvas-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  color: var(--text-faint); font-size: 13px; text-align: center;
  pointer-events: auto; cursor: pointer;
  transition: background .2s;
}
.ip-canvas-empty:hover { background: rgba(47, 123, 255, 0.06); }
.ip-canvas-empty svg { opacity: .5; }
.ip-board-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px;
}
.ip-act {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; font-size: 13px; border-radius: 10px;
}
.ip-status {
  flex: 1; min-width: 120px; font-size: 12.5px; color: var(--text-dim);
  text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ip-run {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; font-size: 14px;
}
.ip-dl { flex: none; }
.ws-card-load { cursor: pointer; transition: border-color .15s, transform .15s; }
.ws-card-load:hover { border-color: rgba(47, 123, 255, 0.6); transform: translateY(-1px); }
.ws-card-load .ws-card-thumb { position: relative; }
.ws-card-load .ws-card-thumb::after {
  content: "🖌 载入画板"; position: absolute; left: 6px; bottom: 6px;
  font-size: 10.5px; font-weight: 600; color: #dbeafe;
  background: rgba(10, 13, 22, 0.78); border: 1px solid rgba(47, 123, 255, 0.5);
  padding: 2px 8px; border-radius: 999px; opacity: 0; transition: opacity .15s;
}
.ws-card-load:hover .ws-card-thumb::after { opacity: 1; }
@media (max-width: 700px) {
  .ip-board-head { flex-direction: column; align-items: flex-start; }
  .ip-status { text-align: left; }
}
.op-box-btn { flex: none; padding: 6px 16px; }

/* ====== 图片编辑页（Tab3） ====== */
.edit-workspace { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.edit-canvas-wrap > .edit-dropzone {
  position: absolute; inset: 0; z-index: 5; margin: 0; min-height: 0;
  border-radius: 12px; align-items: center; justify-content: center;
}
.edit-dropzone {
  flex: 1; display: flex; align-items: center; justify-content: center;
  border: 2px dashed rgba(47,123,255,0.45); border-radius: 18px;
  background: linear-gradient(180deg, rgba(47,123,255,0.10), rgba(30,41,59,0.04));
  cursor: pointer; transition: border-color .2s, background .2s; min-height: 320px;
  margin: 4px 0 8px;
}
.edit-dropzone:hover, .edit-dropzone.drag { border-color: #3b82f6; background: rgba(47,123,255,0.12); }
.edit-drop-inner { text-align: center; color: #94a3b8; padding: 40px; }
.edit-drop-inner svg { opacity: .75; margin-bottom: 14px; }
.edit-drop-inner h3 { margin: 0 0 8px; font-size: 20px; font-weight: 600; color: #1e293b; }
.edit-drop-inner h3 em { font-style: normal; color: #3b82f6; }
.edit-drop-inner p { margin: 0; font-size: 13px; color: #64748b; }

.edit-workbench { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.edit-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: rgba(15, 23, 42, 0.035); border: 1px solid rgba(148,163,184,0.14);
  border-radius: 12px; padding: 8px 12px;
}
.edit-tb-right { margin-left: auto; display: flex; gap: 8px; }
.edit-sep { width: 1px; height: 22px; background: rgba(148,163,184,0.22); margin: 0 4px; }
.edit-btn {
  padding: 6px 11px; border-radius: 8px; border: 1px solid rgba(148,163,184,0.25);
  background: #ffffff; color: #334155; font-size: 12.5px; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px; transition: all .15s;
}
.edit-btn:hover:not(:disabled) { border-color: rgba(47,123,255,0.6); color: #1e293b; background: rgba(47,123,255,0.12); }
/* 禁用态：浅灰底 + 深灰字（不再用 opacity 叠加，避免白字糊在浅底上） */
.edit-btn:disabled,
.edit-btn-primary:disabled,
.edit-btn-accent:disabled {
  opacity: 1; cursor: not-allowed;
  background: #f1f5f9; background-image: none;
  color: #94a3b8; border-color: rgba(148,163,184,0.3);
  box-shadow: none; transform: none;
}
.edit-btn-add { color: #2563eb; border-color: rgba(47,123,255,0.5); }
.edit-btn-clear { color: #dc2626; border-color: rgba(248,113,113,0.45); }
.edit-btn-clear:hover:not(:disabled) { border-color: #ef4444; color: #b91c1c; background: rgba(239,68,68,0.08); }
.edit-btn-accent {
  background: linear-gradient(135deg, #0052cc, #3b82f6); border: none; color: #fff; font-weight: 600;
}
.edit-btn-accent:hover:not(:disabled) { background: linear-gradient(135deg, #0062ff, #60a5fa); color: #fff; }
.edit-btn-primary {
  background: linear-gradient(135deg, #0052cc, #3b82f6); border: none; color: #fff; font-weight: 600;
  padding: 7px 16px;
}
.edit-btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #0062ff, #60a5fa); color: #fff; }
.edit-toggle.on { background: rgba(0,98,255,0.12); border-color: #0062ff; color: #1d4ed8; }
.edit-fname { font-size: 13px; font-weight: 600; color: #1e293b; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-dims { font-size: 12px; color: #64748b; }
.edit-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #64748b; white-space: nowrap; }
.edit-label input[type="range"] { width: 90px; accent-color: #3b82f6; }
.edit-select, .edit-num, .edit-text {
  background: #ffffff; border: 1px solid rgba(148,163,184,0.4); color: #1e293b;
  border-radius: 7px; padding: 5px 8px; font-size: 12.5px; outline: none;
}
.edit-num { width: 70px; }
.edit-text { width: 150px; }
input[type="color"].edit-brush-color, .edit-toolbar3 input[type="color"] {
  width: 30px; height: 26px; border: 1px solid rgba(148,163,184,0.3); border-radius: 6px;
  background: transparent; padding: 2px; cursor: pointer;
}
.edit-main { display: flex; gap: 10px; min-height: 0; flex: 1; }
.edit-side {
  width: 190px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0;
  background: rgba(15, 23, 42, 0.03); border: 1px solid rgba(148,163,184,0.14); border-radius: 12px; padding: 10px;
}
.edit-side-head { font-size: 13px; font-weight: 600; color: #475569; padding: 2px 2px 8px; display: flex; align-items: center; gap: 6px; }
.edit-count { background: rgba(47,123,255,0.2); color: #2563eb; font-size: 11px; padding: 1px 8px; border-radius: 999px; }
.edit-list { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: max-content; gap: 8px; align-content: start; padding-right: 2px; }
.edit-thumb {
  position: relative; border: 2px solid transparent; border-radius: 10px; overflow: hidden;
  cursor: pointer; background: rgba(15,23,42,0.05); transition: border-color .15s;
}
.edit-thumb:hover { border-color: rgba(47,123,255,0.45); }
.edit-thumb.active { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(0,98,255,0.25); }
.edit-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.edit-thumb-name { font-size: 10px; color: #94a3b8; padding: 4px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edit-thumb-del {
  position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 5px;
  border: none; background: rgba(15,23,42,0.78); color: #fca5a5; font-size: 11px; line-height: 1;
  display: none; place-items: center; cursor: pointer;
}
.edit-thumb:hover .edit-thumb-del { display: grid; }

.edit-canvas-wrap {
  position: relative; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  background: #f8fafc; /* 空态：纯净浅灰蓝，不铺棋盘格 */
  border: 1px solid rgba(148,163,184,0.14); border-radius: 12px; overflow: hidden;
}
/* 有图片后才垫透明网格（供透明 PNG 查看）；空态保持纯净 */
.edit-canvas-wrap:has(.edit-dropzone[hidden]) {
  background: repeating-conic-gradient(rgba(15, 23, 42, 0.035) 0% 25%, transparent 0% 50%) 0 0 / 20px 20px,
              rgba(2,6,23,0.04);
}
#edit-canvas { max-width: 100%; max-height: 100%; object-fit: contain; display: block; box-shadow: 0 6px 24px rgba(0,0,0,0.18); }
/* 工具条：独立浅色栏（不遮挡图片，固定画布上方） */
.edit-toolstrip {
  flex-shrink: 0; align-self: center;
  display: flex; align-items: center; gap: 3px;
  background: #ffffff; border: 1px solid rgba(148,163,184,0.25);
  border-radius: 12px; padding: 5px 8px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.06), 0 10px 24px -18px rgba(15,23,42,0.35);
}
.et-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 9px;
  color: #64748b; cursor: pointer; transition: background .15s, color .15s;
}
.et-btn:hover { background: #eff6ff; color: #0052cc; }
.et-btn.active { background: #dbeafe; color: #0052cc; box-shadow: inset 0 0 0 1px rgba(47,123,255,0.35); }
.et-btn svg { width: 19px; height: 19px; }
.et-sep { width: 1px; height: 20px; background: rgba(148,163,184,0.32); margin: 0 5px; flex-shrink: 0; }
/* 缩放百分比读数 */
.et-zoom-val {
  min-width: 42px; text-align: center; font-size: 11.5px; font-weight: 600; color: #475569;
  font-variant-numeric: tabular-nums; user-select: none; padding: 0 2px;
}
/* 无图片（上传空态）时隐藏工具条 */
.edit-canvas-col:has(.edit-dropzone:not([hidden])) .edit-toolstrip { display: none; }

/* ====== 图片编辑 v5：工具条独立成栏 + 画布缩放（放大镜） ====== */
/* 画布列：工具条在上、画布在下，纵向排列（工具条永不遮挡图片） */
.edit-canvas-col { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
/* 画布舞台：显示尺寸由 JS 按缩放比写入，四个图层（原图/画笔/水印/文字）随其同步。
   margin:auto 负责居中：不溢出时居中，缩放溢出时归零，保证左上角可滚动到 */
.edit-stage {
  position: relative; margin: auto; flex-shrink: 0; background: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
.edit-stage > #edit-canvas {
  display: block; width: 100%; height: 100%;
  max-width: none; max-height: none; box-shadow: none; border-radius: 0;
}
/* 缩放后可滚动查看全文；画笔未启用时可拖拽平移 */
.edit-canvas-wrap.is-zoomed { overflow: auto; scrollbar-width: thin; }
.edit-canvas-wrap.is-zoomed.panning { cursor: grabbing; }
.edit-canvas-wrap.panning .edit-nav-btn { opacity: 0; }
#edit-mark {
  position: absolute; max-width: 100%; max-height: 100%; object-fit: contain;
  cursor: crosshair; touch-action: none; z-index: 2;
}
#edit-mark.busy, #edit-canvas.busy { cursor: default; }
.edit-canvas-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #475569; font-size: 14px; pointer-events: none; z-index: 1;
}
.edit-canvas-tip {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  font-size: 11.5px; color: #e2e8f0; background: rgba(15,23,42,0.78); border: 1px solid rgba(148,163,184,0.18);
  padding: 4px 12px; border-radius: 999px; white-space: nowrap; pointer-events: none; z-index: 3;
}
/* 裁剪框 */
.edit-crop {
  position: absolute; z-index: 4; border: 1.5px solid #3b82f6; background: rgba(139,92,246,0.08);
  cursor: move; box-shadow: 0 0 0 9999px rgba(2,6,23,0.55);
}
.ec-handle { position: absolute; width: 11px; height: 11px; background: #38bdf8; border: 2px solid #dbeafe; border-radius: 3px; }
.ec-nw { left: -6px; top: -6px; cursor: nwse-resize; }
.ec-n  { left: calc(50% - 5px); top: -6px; cursor: ns-resize; }
.ec-ne { right: -6px; top: -6px; cursor: nesw-resize; }
.ec-e  { right: -6px; top: calc(50% - 5px); cursor: ew-resize; }
.ec-w  { left: -6px; top: calc(50% - 5px); cursor: ew-resize; }
.ec-sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.ec-s  { left: calc(50% - 5px); bottom: -6px; cursor: ns-resize; }
.ec-se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.edit-crop-info {
  position: absolute; top: -26px; left: 0; font-size: 11px; color: #7dd3fc;
  background: rgba(30,27,75,0.9); padding: 2px 8px; border-radius: 5px; white-space: nowrap;
}
/* 裁剪画布内工具条：比例预设 + 确认/退出 */
.edit-crop-bar {
  position: absolute; bottom: 46px; left: 50%; transform: translateX(-50%);
  z-index: 8; display: flex; align-items: center; gap: 3px;
  background: rgba(15, 23, 42, 0.92); border-radius: 10px; padding: 4px 6px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.28); backdrop-filter: blur(4px);
}
.ecb-btn {
  padding: 5px 10px; font-size: 12px; color: #cbd5e1;
  background: transparent; border: none; border-radius: 6px; cursor: pointer;
  transition: background .15s, color .15s; white-space: nowrap;
}
.ecb-btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.ecb-sep { width: 1px; height: 16px; background: rgba(255, 255, 255, 0.18); margin: 0 3px; }
.ecb-ok { color: #93c5fd; font-weight: 600; }
.ecb-ok:hover { background: #0062ff; color: #fff; }
.ecb-exit { color: #fca5a5; }
.ecb-exit:hover { background: rgba(239, 68, 68, 0.25); color: #fff; }

/* 编辑区缩小：画布容器限高 */
.edit-canvas-wrap { max-height: 56vh; }
.edit-main { min-height: 0; }

/* ====== 水印设置 Modal ====== */
.wm-card { width: 900px; max-width: 95vw; }
.wm-preset-state { font-size: 11px; color: #34d399; font-weight: 500; margin-left: 8px; }
.wm-body { display: flex; gap: 20px; padding: 16px 20px 20px; }
.wm-left { flex: 0 0 370px; display: flex; flex-direction: column; gap: 14px; }
.wm-field { display: flex; align-items: center; gap: 10px; }
.wm-label { font-size: 12.5px; color: #94a3b8; min-width: 52px; white-space: nowrap; }
.wm-label b { color: #7dd3fc; font-weight: 600; }
.wm-pos { display: grid; grid-template-columns: repeat(3, 34px); gap: 6px; }
/* 水印面板顶部标签页：文字水印 / 图片水印 */
.wm-tabs {
  display: flex; gap: 2px; margin-bottom: 10px;
  border-bottom: 1.5px solid rgba(15, 23, 42, 0.08); padding: 0 2px;
}
.wm-tab {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px 8px; font-size: 13px; font-weight: 500; color: #64748b;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -1.5px; cursor: pointer; transition: color .15s, border-color .15s;
}
.wm-tab:hover { color: #1d4ed8; }
.wm-tab.active { color: #0062ff; border-bottom-color: #0062ff; font-weight: 600; }
.wm-tab svg { flex-shrink: 0; }
.wm-pos-btn {
  width: 34px; height: 32px; border-radius: 8px; border: 1px solid rgba(148,163,184,0.25);
  background: rgba(255,255,255,0.92); color: #334155; font-size: 15px; cursor: pointer; transition: all .15s;
}
.wm-pos-btn:hover { border-color: rgba(47,123,255,0.6); color: #1e293b; }
.wm-pos-btn.active { background: rgba(47,123,255,0.25); border-color: #3b82f6; color: #7dd3fc; }
.wm-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.wm-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wm-preview-head { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 10px; }
.wm-nav {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(148,163,184,0.3);
  background: rgba(255,255,255,0.92); color: #334155; font-size: 18px; cursor: pointer; line-height: 1;
  display: grid; place-items: center; transition: all .15s;
}
.wm-nav:hover { border-color: #3b82f6; color: #fff; background: rgba(47,123,255,0.2); }
.wm-preview-title { font-size: 13px; color: #475569; font-weight: 600; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-preview-wrap {
  position: relative; flex: 1; min-height: 300px;
  background: repeating-conic-gradient(rgba(15, 23, 42, 0.05) 0% 25%, transparent 0% 50%) 0 0 / 18px 18px, rgba(2,6,23,0.04);
  border: 1px solid rgba(148,163,184,0.16); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
#wm-preview { max-width: 96%; max-height: 96%; }
.wm-preview-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #64748b; font-size: 13px; }
.wm-preview-tip { font-size: 11px; color: #64748b; margin-top: 10px; text-align: center; }

/* 水印菜单加大：面板与预览 */
.wm-card { width: 1080px; max-width: 96vw; }
.wm-left { flex: 0 0 400px; gap: 13px; }
.wm-preview-wrap { min-height: 420px; }
#wm-preview { max-width: 97%; max-height: 97%; }
.wm-text-actions { margin-top: 0; padding-top: 8px; border-top: 1px dashed rgba(148,163,184,0.18); }
select.edit-text { background: #ffffff; color: #334155; border: 1px solid rgba(148,163,184,0.25); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; outline: none; }
select.edit-text:focus { border-color: #3b82f6; }
.wm-field .edit-text { min-width: 0; }

/* ====== 图片编辑 v3：顶部全局栏 + 左列表 + 中画布 + 右侧折叠面板 ====== */
.edit-topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; background: rgba(255,255,255,0.72); backdrop-filter: blur(6px);
  border: 1px solid rgba(148,163,184,0.15); border-radius: 12px; flex-shrink: 0;
}
.edit-tb-left, .edit-tb-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.edit-body { display: flex; gap: 12px; min-height: 0; flex: 1; }
.edit-main { flex: 1; min-width: 0; display: flex; }
.edit-canvas-wrap { max-height: none; padding: 14px; }
.edit-toolside {
  flex: 0 0 300px; min-width: 0; display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; padding-right: 2px;
}
.edit-details {
  background: rgba(15, 23, 42, 0.03); border: 1px solid rgba(148,163,184,0.14);
  border-radius: 12px; overflow: hidden; flex-shrink: 0;
}
.edit-details summary {
  padding: 11px 14px; font-size: 13px; font-weight: 600; color: #475569; cursor: pointer;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
  user-select: none; transition: background .15s;
}
.edit-details summary::-webkit-details-marker { display: none; }
.edit-details summary::after { content: "▾"; font-size: 11px; color: #64748b; transition: transform .2s; }
.edit-details[open] summary { border-bottom: 1px solid rgba(148,163,184,0.12); background: rgba(47,123,255,0.07); color: #1e293b; }
.edit-details[open] summary::after { transform: rotate(180deg); }
/* 画笔/文字 图层眼睛开关 */
.edit-layer-eye { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.edit-layer-eye .eye-switch { display: flex; align-items: center; cursor: pointer; }
.edit-layer-eye .eye-box { font-size: 13px; line-height: 1; opacity: .4; filter: grayscale(1); transition: all .2s; padding: 2px 4px; border-radius: 5px; }
.edit-layer-eye .eye-switch input { display: none; }
.edit-layer-eye .eye-switch input:checked + .eye-box { opacity: 1; filter: none; background: rgba(47,123,255,.2); box-shadow: 0 0 0 1px rgba(47,123,255,.35); }
/* 文字工具面板 */
.edit-text-opts { border-top: 1px dashed rgba(148,163,184,.18); padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.edit-text-opts .edit-hint { font-size: 11px; color: #64748b; line-height: 1.5; }
.edit-text-opts input[type="number"], .edit-text-opts select { background: #f1f5f9; border: 1px solid rgba(148,163,184,.25); color: #1e293b; border-radius: 6px; padding: 5px 6px; font-size: 12px; }
.edit-check { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #475569; cursor: pointer; }
.edit-check input { accent-color: #3b82f6; }
.edit-panel-content { padding: 12px 14px; display: flex; flex-direction: column; gap: 11px; }
.edit-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.edit-row button { flex: 1; min-width: 58px; }
.edit-row label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 12px; color: #94a3b8; }
.edit-row select { flex: 1; min-width: 0; }
.edit-row .edit-num { width: 62px; flex: 1; }
.edit-slider { display: flex; flex-direction: column; gap: 5px; }
.edit-slider label { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #94a3b8; }
.edit-slider label span { color: #7dd3fc; font-weight: 600; }
.edit-slider input[type="range"] { width: 100%; accent-color: #3b82f6; }
.edit-toolside input[type="color"] {
  width: 46px; height: 28px; border: 1px solid rgba(148,163,184,0.3); border-radius: 6px;
  background: transparent; padding: 2px; cursor: pointer;
}
.edit-toolside .edit-select { background: #ffffff; color: #334155; border: 1px solid rgba(148,163,184,0.25); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; outline: none; }
.edit-toolside .edit-btn { white-space: nowrap; }

/* ====== 水印 v3：右侧栏内嵌展开 + 主画布预览开关 ====== */
.edit-wm-title { font-weight: 600; color: #475569; }
.edit-wm-toggle { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.edit-wm-toggle-label { font-size: 11px; color: #94a3b8; font-weight: 400; }
.wm-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.wm-switch input { opacity: 0; width: 0; height: 0; }
.wm-slider {
  position: absolute; cursor: pointer; inset: 0; border-radius: 999px;
  background: #334155; transition: background .2s; border: 1px solid rgba(148,163,184,0.3);
}
.wm-slider::before {
  content: ""; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px;
  border-radius: 50%; background: #94a3b8; transition: transform .2s, background .2s;
}
.wm-switch input:checked + .wm-slider { background: #3b82f6; border-color: #3b82f6; }
.wm-switch input:checked + .wm-slider::before { transform: translateX(16px); background: #fff; }
.edit-sub-details {
  background: rgba(0,0,0,0.22); border: 1px solid rgba(148,163,184,0.14);
  border-radius: 10px; overflow: hidden;
}
.edit-sub-details summary {
  list-style: none; display: flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 8px 10px; font-size: 12.5px; user-select: none;
}
.edit-sub-details summary::-webkit-details-marker { display: none; }
.edit-sub-details[open] summary { border-bottom: 1px solid rgba(148,163,184,0.12); background: rgba(47,123,255,0.06); }
.edit-wm-panel { padding: 10px; gap: 10px; }
.edit-wm-field { display: flex; align-items: center; gap: 8px; }
.edit-wm-label { font-size: 12px; color: #94a3b8; min-width: 30px; }
.edit-wm-panel .wm-pos { grid-template-columns: repeat(3, 30px); gap: 4px; }
.edit-wm-panel .wm-pos-btn { width: 30px; height: 28px; font-size: 13px; }
.edit-wm-panel .seg { flex: 1; }
.edit-wm-panel .seg-btn { flex: 1; padding: 6px 4px; font-size: 12px; }
.edit-wm-panel .edit-text { width: 100%; background: #ffffff; color: #334155; border: 1px solid rgba(148,163,184,0.25); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; outline: none; }
.edit-wm-panel .edit-text:focus { border-color: #3b82f6; }
.edit-wm-panel select { background: #ffffff; color: #334155; border: 1px solid rgba(148,163,184,0.25); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; outline: none; min-width: 0; flex: 1; }
.edit-wm-panel input[type="color"] { width: 40px; height: 26px; border: 1px solid rgba(148,163,184,0.3); border-radius: 6px; background: transparent; padding: 2px; cursor: pointer; }
.edit-wm-panel .edit-slider input[type="range"] { accent-color: #3b82f6; }
#edit-wm-preview { image-rendering: auto; }

/* ====== 图片编辑 v4：画布侧翻页 + 列表预览/快捷导出 ====== */
/* 画布侧翻页按钮：浅色系（不用深色块，避免压住图片） */
.edit-nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 72px; z-index: 6; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.92); color: #475569;
  border: 1px solid rgba(148,163,184,0.3); font-size: 26px; line-height: 1;
  opacity: 0.55; transition: opacity .2s, background .2s, color .2s; border-radius: 10px;
  box-shadow: 0 4px 16px -8px rgba(15,23,42,0.4);
  backdrop-filter: blur(6px);
}
.edit-nav-btn:hover { opacity: 1; background: #eff6ff; color: #0052cc; border-color: rgba(47,123,255,0.5); }
/* 悬停箭头时浮现「滚轮翻页」提示（贴按钮内侧，避免被画布 overflow 裁掉） */
.nav-btn-tip {
  position: absolute; top: 50%; white-space: nowrap; pointer-events: none;
  padding: 4px 8px; border-radius: 6px; line-height: 1;
  font-size: 10.5px; font-weight: 500; font-family: inherit;
  background: rgba(15, 23, 42, 0.8); color: #f1f5f9;
  box-shadow: 0 6px 16px -10px rgba(15, 23, 42, 0.75);
  opacity: 0; transition: opacity .16s, transform .16s;
}
#edit-prev-btn .nav-btn-tip { left: calc(100% + 8px); transform: translateY(-50%) translateX(-4px); }
#edit-prev-btn:hover .nav-btn-tip { opacity: 1; transform: translateY(-50%) translateX(0); }
#edit-next-btn .nav-btn-tip { right: calc(100% + 8px); transform: translateY(-50%) translateX(4px); }
#edit-next-btn:hover .nav-btn-tip { opacity: 1; transform: translateY(-50%) translateX(0); }
#edit-prev-btn { left: 10px; }
#edit-next-btn { right: 10px; }
.edit-canvas-wrap:hover .edit-nav-btn { opacity: 0.75; }
.edit-nav-btn[hidden] { display: none; }
.edit-list { scrollbar-width: thin; }
/* 导出⤓ 与删除✕ 竖排共享右上角操作列：✕ 在上(top:3)、⤓ 在下(top:23)，不再重叠拦截点击 */
.edit-thumb-exp {
  position: absolute; top: 23px; right: 3px; z-index: 5;
  width: 18px; height: 18px; border-radius: 5px; cursor: pointer;
  background: rgba(15,23,42,0.72); color: #e2e8f0; border: 1px solid rgba(148,163,184,0.3);
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  opacity: 0; pointer-events: none; transition: opacity .15s, background .15s; padding: 0; line-height: 1;
}
.edit-thumb:hover .edit-thumb-exp { opacity: 1; pointer-events: auto; }
.edit-thumb-exp:hover { background: rgba(47,123,255,0.8); border-color: #3b82f6; color: #fff; }
.edit-thumb-hint { position: absolute; top: 4px; left: 4px; z-index: 5; font-size: 9.5px; color: #e2e8f0; background: rgba(15,23,42,0.6); padding: 1px 6px; border-radius: 999px; opacity: 0; transition: opacity .15s; pointer-events: none; }
.edit-thumb:hover .edit-thumb-hint { opacity: 1; }
.edit-pv-layer {
  position: absolute; left: calc(100% + 10px); top: 0; z-index: 50;
  background: rgba(10,14,25,0.95); border: 1px solid rgba(148,163,184,0.3);
  border-radius: 14px; padding: 8px; box-shadow: 0 18px 50px rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  pointer-events: none;
}
.edit-pv-layer img { max-width: 100%; max-height: 100%; border-radius: 8px; display: block; }
.edit-side { position: relative; }
.edit-pv-layer.hidden-pv { display: none; }
.edit-pv-name { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 11px; color: #475569; background: rgba(2,6,23,0.75); padding: 2px 10px; border-radius: 999px; white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis; }

/* 水印开关动画提示：展开水印菜单时脉动发光 */
@keyframes wmAttnPulse {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); transform: scale(1); }
  70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); transform: scale(1.1); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); transform: scale(1); }
}
.wm-switch.wm-switch-attn {
  animation: wmAttnPulse 0.8s ease-out 3;
  border-radius: 999px;
}

/* ============ 商业化额度（顶栏内嵌版） ============ */
.xg-tb-role {
  font-size: 12px; color: #94a3b8; font-weight: 500; white-space: nowrap;
  background: rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 6px; padding: 2px 8px;
}
.xg-tb-role.xg-role-pro {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.1);
}
@media (max-width: 1450px) {
  #gpu-badge { display: none; }
}
@media (max-width: 1240px) {
  .quota-item { font-size: 11px; padding: 3px 8px; }
  #xg-header-role { display: none; }
}
@media (max-width: 1100px) {
  .stat-badge .stat-bar { display: none; }
  .quota-item { font-size: 10.5px; }
  #gpu-load-badge { display: none; }
}

/* ============ 底部版权信息 ============ */
.app-footer {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  background: rgba(255, 255, 255, 0.65);
  margin-top: auto;
}
.app-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.app-footer-brand {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: 0.3px;
}
.app-footer-line {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.6;
  max-width: 860px;
}
.app-footer-mail {
  font-size: 12px;
  color: #2563eb;
}
.app-footer-icp {
  font-size: 12px;
  color: #64748b;
  text-decoration: none;
  transition: color 0.2s ease;
}
.app-footer-icp:hover { color: #2563eb; }

/* ============ 拼图模块 ============ */
.cg-tpl-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.cg-tpl-btn {
  flex: 1 1 calc(50% - 6px); min-width: 0; box-sizing: border-box;
  padding: 7px 4px; border: 1px solid rgba(15, 23, 42, .12); border-radius: 6px;
  background: rgba(15, 23, 42, .04); color: #475569; font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  transition: all .18s;
}
.cg-tpl-btn:hover { background: rgba(15, 23, 42, .09); }
.cg-tpl-btn.active { background: rgba(59,130,246,.18); border-color: #3b82f6; color: #fff; }
.cg-tpl-btn .cg-tpl-preview { display: inline-flex; gap: 2px; flex-shrink: 0; }
.cg-tpl-btn .cg-tpl-preview i {
  width: 5px; height: 5px; background: currentColor; border-radius: 1px; display: block;
}
.cg-color-row { align-items: center; }
.cg-colors { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cg-color {
  width: 20px; height: 20px; border-radius: 5px; border: 1px solid rgba(15, 23, 42, .25);
  cursor: pointer; padding: 0; transition: all .15s; position: relative; flex-shrink: 0;
}
.cg-color:hover { transform: scale(1.12); }
.cg-color.active { box-shadow: 0 0 0 2px rgba(59,130,246,.8); }
.cg-presets { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.cg-preset-item {
  display: flex; align-items: center; gap: 6px;
  background: rgba(15, 23, 42, .04); border: 1px solid rgba(15, 23, 42, .09);
  border-radius: 6px; padding: 6px 8px;
}
.cg-preset-item .cg-preset-name { flex: 1; min-width: 0; font-size: 11.5px; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-preset-item .cg-preset-apply {
  background: #3b82f6; border: none; color: #fff; border-radius: 4px;
  padding: 3px 10px; font-size: 11px; cursor: pointer; flex-shrink: 0;
}
.cg-preset-item .cg-preset-del {
  background: rgba(248,113,113,.15); border: 1px solid rgba(248,113,113,.3); color: #fca5a5;
  border-radius: 4px; padding: 3px 7px; font-size: 11px; cursor: pointer; flex-shrink: 0;
}
.cg-presets-empty { font-size: 11.5px; color: #64748b; text-align: center; padding: 6px 0; }

/* ============ 拼图：图数紧凑布局 ============ */
.cg-count-seg .seg-btn { flex: 1; padding: 5px 2px; font-size: 12px; min-width: 0; }
.cg-count-seg { flex: 1; min-width: 0; }
/* ============ 已编辑图片区 ============ */
.edit-edited {
  position: relative;
  border-top: 1px solid rgba(15, 23, 42, 0.07);
  background: rgba(13, 14, 18, 0.55);
  padding: 10px 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.edit-edited-head { display: flex; align-items: center; justify-content: space-between; }
.edit-edited-head > span { font-size: 13px; font-weight: 600; color: #1e293b; }
.edit-edited-head .edit-btn { padding: 4px 12px; font-size: 11.5px; }
.edit-edited-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.edit-edited-list::-webkit-scrollbar { height: 6px; }
.edit-edited-list::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, .18); border-radius: 3px; }
.edit-edited-thumb {
  position: relative; flex: none; width: 92px; height: 92px; border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, .12); overflow: hidden; cursor: pointer;
  background: rgba(15, 23, 42, .04);
}
.edit-edited-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.edit-edited-thumb:hover { border-color: rgba(59,130,246,.6); }
.edit-edited-thumb .edit-thumb-del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  background: rgba(0,0,0,.65); border: none; border-radius: 5px; color: #fff;
  font-size: 11px; line-height: 1; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center;
}
.edit-edited-thumb .edit-thumb-del:hover { background: rgba(239,68,68,.85); }
/* 已编辑区导出按钮独立到左上角、常显，避免与右上角 ✕ 重叠拦截点击（pointer-events 需显式恢复） */
.edit-edited-thumb .edit-thumb-exp {
  position: absolute; top: 3px; left: 3px; right: auto; z-index: 5;
  width: 20px; height: 20px; border-radius: 5px; cursor: pointer;
  background: rgba(15,23,42,.72); color: #e2e8f0; border: 1px solid rgba(148,163,184,.35);
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  opacity: 1; pointer-events: auto; transition: background .15s; padding: 0; line-height: 1;
}
.edit-edited-thumb .edit-thumb-exp:hover { background: rgba(47,123,255,.85); border-color: #3b82f6; color: #fff; }
.edit-edited-empty { font-size: 11.5px; color: #64748b; padding: 4px 2px; }

/* 已编辑区悬浮3秒大图预览（浮在缩略图上方） */
.edit-edited-pv {
  position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translateX(-50%);
  z-index: 60; background: rgba(10,14,25,0.97); border: 1px solid rgba(148,163,184,0.35);
  border-radius: 14px; padding: 8px; box-shadow: 0 18px 50px rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  pointer-events: none; max-width: 420px; max-height: 320px;
}
.edit-edited-pv img { max-width: 100%; max-height: 100%; border-radius: 8px; display: block; }
.edit-edited-pv.hidden-pv { display: none; }
.edit-edited-pv .edit-pv-name { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 11px; color: #475569; background: rgba(2,6,23,0.75); padding: 2px 10px; border-radius: 999px; white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis; }

/* ============ 交互式拼图编辑器 ============ */
.cg-editor {
  position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
  background: #eef2f7; /* 不透明浅色底：遮住底下画布原图，避免切换比例露出背景素材 */
  overflow: hidden; /* 防止拼图板超高时溢出容器 */
}
.cg-editor[hidden] { display: none; }
.cg-editor-board {
  box-shadow: 0 6px 24px rgba(0,0,0,.5); border-radius: 4px; box-sizing: content-box;
  flex: 0 0 auto;
}
.cg-cell { transition: box-shadow .15s; background: #f8fafc; }
.cg-cell:hover { box-shadow: inset 0 0 0 2px rgba(59,130,246,.55); }
.cg-cell.cg-sel { box-shadow: inset 0 0 0 3px #3b82f6; z-index: 2; }
.cg-cell.cg-empty { cursor: pointer; }
.cg-cell img { pointer-events: none; user-select: none; -webkit-user-drag: none; }
.cg-editor.cg-panning { cursor: grabbing; }
.cg-editor.cg-panning .cg-cell { cursor: grabbing; }
.cg-cell-plus {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: rgba(15, 23, 42, .4); font-size: 30px; font-weight: 300; cursor: pointer;
}
.cg-cell-reset {
  position: absolute; top: 6px; right: 6px; z-index: 5;
  background: rgba(59,130,246,.92); color: #fff; border: none; border-radius: 6px;
  font-size: 11px; padding: 3px 9px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.4);
  font-family: inherit; line-height: 1.4;
}
.cg-cell-reset:hover { background: #2563eb; }
.cg-cell-del {
  position: absolute; top: 6px; right: 6px; z-index: 5;
  width: 22px; height: 22px; border-radius: 6px;
  background: rgba(15, 23, 42, .92); color: #1e293b; border: none;
  font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer; padding: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, transform .15s;
  font-family: inherit;
}
.cg-cell-del:hover { background: #ef4444; color: #fff; transform: scale(1.08); }
.cg-cell.cg-dragging { cursor: grabbing; opacity: .97; }
.cg-cell.cg-swap-source { cursor: grabbing; transition: none; }
.cg-editor-free-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 9;
  background: rgba(59,130,246,.92); color: #fff; font-size: 12px; font-weight: 500;
  padding: 6px 16px; border-radius: 999px; box-shadow: 0 4px 16px rgba(0,0,0,.45);
  pointer-events: none; white-space: nowrap; display: none;
}

/* 拼图比例紧凑布局 */
.cg-ratio-seg { flex: 1; min-width: 0; }
.cg-ratio-seg .seg-btn { flex: 1; padding: 5px 1px; font-size: 11.5px; min-width: 0; }
/* 素材列表拖拽反馈 */
.cg-drag-src { opacity: .5; transform: scale(.96); }
.cg-cell.cg-drop-hover { box-shadow: inset 0 0 0 3px #10b981; z-index: 3; }

/* 拖拽素材到拼图时：每个格子显示 + 号提示可替换 */
.cg-editor.cg-drag-active .cg-cell::after {
  content: "+";
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 300; color: #fff;
  background: rgba(59,130,246,.28); text-shadow: 0 2px 8px rgba(0,0,0,.5);
  pointer-events: none; border-radius: inherit;
  transition: background .12s;
}
.cg-editor.cg-drag-active .cg-cell.cg-drop-hover::after { background: rgba(16,185,129,.45); }
/* 素材已使用标记 */
.cg-used { opacity: .45; filter: saturate(.6); }
.cg-used .cg-used-tag {
  position: absolute; left: 3px; bottom: 3px; z-index: 6;
  font-size: 9px; color: #fff; background: rgba(16,185,129,.9);
  padding: 1px 6px; border-radius: 999px; pointer-events: none; white-space: nowrap;
}

/* 拼图画布比例：8 个按钮 4 列网格，避免拥挤 */
.cg-ratio-seg { display: grid !important; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.cg-ratio-seg .seg-btn { min-width: 0 !important; padding: 6px 2px !important; font-size: 12px; text-align: center; }
/* 图数区：6 个按钮 6 列 */
.cg-count-seg { display: grid !important; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.cg-count-seg .seg-btn { min-width: 0 !important; padding: 6px 2px !important; font-size: 12px; text-align: center; }

/* 右侧折叠面板：长按 summary 拖动排序 */
.edit-toolside.ed-sort-active details:not(.ed-sort-dragging) { opacity: .55; }
.edit-toolside.ed-sort-active details { transition: transform .12s, opacity .12s; }
.edit-toolside.ed-sort-active summary { cursor: grab; }
.edit-toolside.ed-sort-dragging {
  cursor: grabbing; opacity: 1 !important; position: relative; z-index: 99;
  background: rgba(59,130,246,.14); border-color: #3b82f6;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
}
.ed-sort-mark { height: 3px; border-radius: 2px; background: #3b82f6; margin: 2px 4px; box-shadow: 0 0 8px rgba(59,130,246,.8); }

/* ========== 自动化工作流（多功能组合引擎） ========== */
.auto-workspace { display: flex; flex: 1; min-height: 0; height: 100%; }
.auto-left { width: 300px; min-width: 300px; background: #f8fafc; border-right: 1px solid rgba(148,163,184,.1); display: flex; flex-direction: column; overflow: hidden; }
.auto-drop { margin: 12px; border: 1.5px dashed rgba(148,163,184,.3); border-radius: 10px; padding: 20px 10px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; flex-shrink: 0; }
.auto-drop:hover { border-color: rgba(139,92,246,.6); background: rgba(139,92,246,.05); }
.auto-drop-icon { color: #3b82f6; margin-bottom: 6px; }
.auto-drop-icon svg { width: 30px; height: 30px; }
.auto-drop-title { font-size: 12.5px; color: #475569; margin: 0; }
.auto-drop-title em { font-style: normal; color: #2563eb; }
.auto-drop-sub { font-size: 11px; color: #64748b; margin: 6px 0 0; }
.auto-list-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 14px 6px; font-size: 12px; color: #94a3b8; flex-shrink: 0; }
.auto-list-head b { color: #1e293b; }
.auto-list-head button { background: #e8eef7; border: 1px solid rgba(148,163,184,.2); color: #94a3b8; font-size: 11px; border-radius: 5px; padding: 3px 9px; cursor: pointer; }
.auto-list-head button:hover { background: #475569; color: #1e293b; }
.auto-list { flex: 1; overflow-y: auto; padding: 0 12px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.auto-thumb { position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 1; border: 1.5px solid transparent; cursor: pointer; background: #0b0c0e; }
.auto-thumb:hover { border-color: rgba(139,92,246,.5); }
.auto-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auto-thumb .auto-thumb-name { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.7); font-size: 11px; color: #1e293b; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auto-thumb.active { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(139,92,246,.3); }
.auto-thumb .auto-thumb-del { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; display: none; }
.auto-thumb:hover .auto-thumb-del { display: block; }
.auto-output { padding: 10px 12px; border-top: 1px solid rgba(148,163,184,.1); flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.auto-out-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #94a3b8; }
.auto-out-row label { width: 58px; flex-shrink: 0; }
.auto-out-row input, .auto-out-row select { flex: 1; background: #f1f5f9; border: 1px solid rgba(148,163,184,.22); color: #1e293b; border-radius: 6px; padding: 6px 8px; font-size: 12px; min-width: 0; }
.auto-run-wrap { padding: 4px 12px 12px; flex-shrink: 0; }
.auto-run { width: 100%; background: linear-gradient(135deg, #3b82f6 0%, #0062ff 100%); color: #fff; border: none; border-radius: 9px; padding: 12px 0; font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(139,92,246,.35); transition: all .2s; }
.auto-run:hover { filter: brightness(1.12); transform: translateY(-1px); }
.auto-run:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.auto-progress { padding: 0 12px 12px; flex-shrink: 0; }
.auto-prog-head { display: flex; justify-content: space-between; font-size: 12px; color: #94a3b8; margin-bottom: 5px; }
.auto-prog-head span:last-child { color: #2563eb; font-weight: 600; }
.auto-prog-track { height: 8px; border-radius: 6px; background: #e8eef7; overflow: hidden; }
.auto-prog-fill { height: 100%; width: 0%; border-radius: 6px; background: linear-gradient(90deg, #3b82f6, #0062ff); transition: width .25s; }
.auto-center { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; background: #ffffff; position: relative; overflow: auto; }
.auto-preview-empty { text-align: center; color: #64748b; max-width: 320px; }
.auto-preview-empty svg { width: 48px; height: 48px; opacity: .4; }
.auto-preview-empty p { font-size: 13px; line-height: 1.6; }
#auto-preview { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; border-radius: 6px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.auto-steps { position: absolute; left: 16px; top: 14px; display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: #94a3b8; }
.auto-steps .step { display: flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 4px; background: rgba(15,17,26,.8); }
.auto-steps .step.done { color: #34d399; }
.auto-steps .step.cur { color: #2563eb; }
.auto-steps .step.wait { color: #475569; }
.auto-right { width: 302px; min-width: 302px; background: #f8fafc; border-left: 1px solid rgba(148,163,184,.1); overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.auto-right-head { font-size: 13px; color: #1e293b; font-weight: 600; display: flex; align-items: baseline; justify-content: space-between; padding: 2px 2px; }
.auto-right-head em { font-style: normal; font-size: 11px; color: #64748b; font-weight: 400; }
.auto-nodes { display: flex; flex-direction: column; gap: 8px; }
.auto-node { background: #f1f5f9; border: 1px solid rgba(148,163,184,.12); border-radius: 9px; overflow: hidden; }
.auto-node[open] { border-color: rgba(139,92,246,.35); }
.auto-node summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: #1e293b; user-select: none; }
.auto-node summary::-webkit-details-marker { display: none; }
.auto-node summary::after { content: "▾"; margin-left: auto; color: #64748b; font-size: 11px; transition: transform .25s; }
.auto-node[open] summary::after { transform: rotate(180deg); }
.auto-node-name { flex: 1; }
.auto-node-drag { color: #64748b; cursor: grab; font-size: 13px; letter-spacing: 2px; padding: 0 4px; }
.auto-node-drag:active { cursor: grabbing; }
.auto-node-switch { display: flex; align-items: center; }
.auto-node-switch input { display: none; }
.auto-switch { width: 32px; height: 18px; border-radius: 10px; background: #475569; position: relative; transition: background .2s; flex-shrink: 0; }
.auto-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #94a3b8; transition: transform .2s, background .2s; }
.auto-node-switch input:checked + .auto-switch { background: #3b82f6; }
.auto-node-switch input:checked + .auto-switch::after { transform: translateX(14px); background: #fff; }
.auto-node-body { padding: 10px 12px 12px; border-top: 1px solid rgba(148,163,184,.1); display: flex; flex-direction: column; gap: 9px; }
.auto-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #94a3b8; }
.auto-row > label { width: 62px; flex-shrink: 0; }
.auto-row > label:has(input[type="color"]) { display: flex; align-items: center; gap: 6px; width: auto; }
.auto-row input[type="number"], .auto-row select, .auto-row input[type="text"] { flex: 1; min-width: 0; background: #ffffff; border: 1px solid rgba(148,163,184,.22); color: #1e293b; border-radius: 6px; padding: 6px 8px; font-size: 12px; }
.auto-row input[type="range"] { flex: 1; accent-color: #3b82f6; }
.auto-row input[type="color"] { width: 30px; height: 24px; padding: 0; border: 1px solid rgba(148,163,184,.3); border-radius: 5px; background: transparent; cursor: pointer; }
.auto-seg { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.auto-seg .seg-btn { flex: 1; min-width: 0; background: #ffffff; border: 1px solid rgba(148,163,184,.18); color: #94a3b8; font-size: 11px; border-radius: 5px; padding: 5px 4px; cursor: pointer; white-space: nowrap; transition: all .15s; }
.auto-seg .seg-btn.active { background: rgba(139,92,246,.22); border-color: #3b82f6; color: #1e293b; font-weight: 600; }
.auto-tpls { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; max-height: 96px; overflow-y: auto; padding-right: 3px; align-content: flex-start; }
.auto-tpls::-webkit-scrollbar { width: 5px; }
.auto-tpls::-webkit-scrollbar-track { background: transparent; }
.auto-tpls::-webkit-scrollbar-thumb { background: rgba(148,163,184,.35); border-radius: 3px; }
.auto-tpls::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.55); }
.auto-tpl { width: 42px; height: 42px; border-radius: 6px; background: #ffffff; border: 1.5px solid rgba(148,163,184,.2); cursor: pointer; display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: repeat(12, 1fr); gap: 2px; padding: 3px; box-sizing: border-box; }
.auto-tpl.active { border-color: #3b82f6; background: rgba(139,92,246,.15); }
.auto-tpl span { background: #64748b; border-radius: 2px; }
.auto-colors { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; flex: 1; }
.auto-color { width: 18px; height: 18px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; box-sizing: border-box; }
.auto-color.active { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(139,92,246,.3); }
.auto-sync { background: #e8eef7; border: 1px solid rgba(139,92,246,.4); color: #2563eb; font-size: 12px; border-radius: 6px; padding: 7px 10px; cursor: pointer; flex: 1; }
.auto-sync:hover { background: rgba(139,92,246,.15); }
.auto-check { display: flex; align-items: center; gap: 6px; color: #475569; cursor: pointer; font-size: 12px; }
.auto-check input { accent-color: #3b82f6; }
.auto-presets { border-top: 1px solid rgba(148,163,184,.12); padding-top: 10px; }
.auto-preset-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: #1e293b; margin-bottom: 8px; }
.auto-preset-head button { background: linear-gradient(135deg, #3b82f6, #0062ff); color: #fff; border: none; border-radius: 6px; font-size: 11.5px; padding: 5px 10px; cursor: pointer; }
.auto-preset-row { display: flex; gap: 6px; margin-bottom: 8px; }
.auto-preset-row input { flex: 1; background: #ffffff; border: 1px solid rgba(148,163,184,.22); color: #1e293b; border-radius: 6px; padding: 6px 8px; font-size: 12px; }
.auto-preset-row button { background: #e8eef7; border: 1px solid rgba(139,92,246,.4); color: #2563eb; border-radius: 6px; font-size: 12px; padding: 5px 10px; cursor: pointer; }
.auto-preset-list { display: flex; flex-direction: column; gap: 6px; }
.auto-preset-item { display: flex; align-items: center; gap: 6px; background: #f1f5f9; border: 1px solid rgba(148,163,184,.12); border-radius: 7px; padding: 6px 9px; font-size: 12px; color: #475569; }
.auto-preset-item .auto-preset-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auto-preset-item button { background: #e8eef7; border: 1px solid rgba(148,163,184,.2); color: #94a3b8; font-size: 11px; border-radius: 5px; padding: 3px 8px; cursor: pointer; }
.auto-preset-item button.apply { color: #2563eb; border-color: rgba(139,92,246,.4); }
.auto-node-dragging { opacity: .6; border-color: #3b82f6; }
.auto-node-drag-mark { height: 2px; background: #3b82f6; border-radius: 2px; margin: 2px 0; }

/* 自动化 UI 穿插修复 */
.auto-row > span { width: 34px; text-align: right; color: #2563eb; font-size: 11px; flex-shrink: 0; }
.auto-seg .seg-btn { min-width: 36px; padding: 5px 3px; flex: 1 1 auto; }
.auto-row > label.auto-check { width: auto; flex: 1; display: flex; align-items: center; gap: 6px; }

/* ========== 拼切长图（切长图 + 拼长图） ========== */
.tall-workspace { display: flex; flex: 1; min-height: 0; height: 100%; }
.tall-left { width: 262px; min-width: 262px; background: #f8fafc; border-right: 1px solid rgba(148,163,184,.1); display: flex; flex-direction: column; overflow: hidden; }
.tall-view-seg { display: flex; gap: 6px; margin: 12px 12px 0; }
.tall-view-seg .seg-btn { flex: 1; background: #e8eef7; border: 1px solid rgba(148,163,184,.2); color: #94a3b8; font-size: 12.5px; border-radius: 7px; padding: 8px 4px; cursor: pointer; font-weight: 600; transition: all .15s; }
.tall-view-seg .seg-btn.active { background: rgba(139,92,246,.22); border-color: #3b82f6; color: #1e293b; }
.tall-drop { margin: 10px 12px 0; border: 1.5px dashed rgba(148,163,184,.3); border-radius: 12px; padding: 34px 10px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; flex-shrink: 0; }
.tall-drop:hover { border-color: rgba(139,92,246,.6); background: rgba(139,92,246,.05); }
.tall-drop .auto-drop-icon { color: #3b82f6; margin-bottom: 6px; }
.tall-drop .auto-drop-icon svg { width: 52px; height: 52px; }
.tall-drop .auto-drop-title { font-size: 15px; margin-top: 6px; }
.tall-drop .auto-drop-sub { font-size: 12px; margin-top: 6px; }
.tall-slice-params { margin: 10px 12px 0; background: #f1f5f9; border: 1px solid rgba(139,92,246,.25); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.tall-list { flex: 1; overflow-y: auto; padding: 0 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.tall-item { background: #f1f5f9; border: 1px solid rgba(148,163,184,.14); border-radius: 8px; padding: 8px; display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.tall-item .tall-num { width: 22px; height: 22px; border-radius: 50%; background: rgba(139,92,246,.2); color: #2563eb; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tall-item .tall-thumb { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; background: #0b0c0e; border: 1px solid rgba(148,163,184,.12); flex-shrink: 0; }
.tall-item .tall-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tall-item .tall-name { font-size: 11px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tall-item .tall-dim { font-size: 10px; color: #64748b; }
.tall-item .tall-ops { display: flex; flex-wrap: wrap; gap: 3px; justify-content: flex-end; }
.tall-item .tall-ops button { background: #e8eef7; border: 1px solid rgba(148,163,184,.2); color: #94a3b8; font-size: 10px; border-radius: 4px; padding: 2px 6px; cursor: pointer; }
.tall-item .tall-ops button:hover { background: #475569; color: #1e293b; }
.tall-item .tall-ops button.del:hover { background: rgba(239,68,68,.2); border-color: #ef4444; color: #fca5a5; }
.tall-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #ffffff; overflow: hidden; }
.tall-preview-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid rgba(148,163,184,.1); flex-shrink: 0; flex-wrap: wrap; }
.tall-mode-label { font-size: 12px; color: #94a3b8; }
.tall-preview-head .auto-seg { width: auto; flex: 0 0 auto; }
.tall-preview-head .auto-seg .seg-btn { flex: none; min-width: 0; padding: 5px 10px; }
.tall-zoom { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.tall-zoom button { background: #e8eef7; border: 1px solid rgba(148,163,184,.2); color: #475569; font-size: 13px; border-radius: 5px; padding: 3px 9px; cursor: pointer; }
.tall-zoom button:hover { background: #475569; }
.tall-zoom span { font-size: 11px; color: #94a3b8; min-width: 38px; text-align: center; }
.tall-preview { flex: 1; overflow: auto; padding: 16px; display: flex; justify-content: center; align-items: flex-start; }
.tall-preview-inner { display: flex; flex-direction: column; align-items: center; background: #fff; border-radius: 6px; box-shadow: 0 8px 30px rgba(0,0,0,.5); overflow: hidden; transform-origin: top center; }
.tall-slice-piece { position: relative; width: 100%; }
.tall-slice-piece img { display: block; width: 100%; height: auto; }
.tall-slice-piece .tall-piece-idx { position: absolute; left: 8px; top: 8px; background: rgba(15,17,26,.72); color: #2563eb; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px; }
.tall-stitch-card { display: flex; flex-direction: column; }
.tall-stitch-card img { display: block; width: 100%; height: auto; }
.tall-stitch-card.amz { background: #fff; padding: 20px 0; }
.tall-stitch-card .tall-card-idx { text-align: center; color: #334155; font-size: 12px; font-weight: 600; padding: 10px 0 0; }
.tall-empty { color: #64748b; font-size: 13px; text-align: center; margin-top: 80px; line-height: 1.7; }
.tall-export { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid rgba(148,163,184,.1); background: #f8fafc; flex-shrink: 0; flex-wrap: wrap; }
.tall-export-label { font-size: 12px; color: #94a3b8; }
.tall-export .auto-seg { width: auto; flex: 0 0 auto; }
.tall-export .auto-seg .seg-btn { flex: none; min-width: 0; padding: 5px 9px; }
.tall-prefix { width: 110px; background: #ffffff; border: 1px solid rgba(148,163,184,.22); color: #1e293b; border-radius: 6px; padding: 5px 8px; font-size: 12px; }
.tall-export-btn { background: linear-gradient(135deg, #3b82f6 0%, #0062ff 100%); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(139,92,246,.35); margin-left: auto; transition: all .2s; }
.tall-export-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.tall-export-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* 拼切长图 v2：宽度询问 + 切缝预览 */
.tall-slice-w-info { color: #2563eb; font-weight: 600; }
.tall-slice-count { font-size: 12px; color: #94a3b8; }
.tall-slice-count b { color: #f59e0b; font-size: 14px; }
.tall-slice-piece.seam { border-bottom: 3px dashed #f59e0b; }
.tall-slice-piece.seam:last-child { border-bottom: none; }
.tall-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.68); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 9000; }
.tall-modal { width: 380px; max-width: 90vw; background: #f1f5f9; border: 1px solid rgba(139,92,246,.35); border-radius: 12px; padding: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.6); }
.tall-modal-title { font-size: 15px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
.tall-modal-desc { font-size: 12.5px; color: #94a3b8; line-height: 1.6; margin: 0 0 14px; }
.tall-modal .auto-seg .seg-btn { padding: 8px 6px; }
.tall-q-custom { margin-top: 10px; }
.tall-q-custom input { width: 120px; background: #ffffff; border: 1px solid rgba(148,163,184,.22); color: #1e293b; border-radius: 6px; padding: 7px 10px; font-size: 13px; }
.tall-q-ops { display: flex; gap: 10px; margin-top: 18px; justify-content: flex-end; }
.tall-q-ops button { border-radius: 7px; padding: 8px 20px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid rgba(148,163,184,.25); background: #e8eef7; color: #94a3b8; }
.tall-q-ops button:hover { background: #475569; color: #1e293b; }
.tall-q-ops button.primary { background: linear-gradient(135deg, #3b82f6, #0062ff); border: none; color: #fff; }
.tall-q-ops button.primary:hover { filter: brightness(1.12); }

/* 拼切长图 A+ 模块化编辑器 */
.tall-body-row { flex: 1; min-height: 0; display: flex; }
.tall-module-lib { width: 118px; min-width: 118px; background: #f8fafc; border-right: 1px solid rgba(148,163,184,.1); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.tall-module-title { font-size: 11.5px; color: #94a3b8; line-height: 1.5; }
.tall-module-title em { font-style: normal; font-size: 10px; color: #64748b; }
.tall-module-card { background: #f1f5f9; border: 1.5px dashed rgba(139,92,246,.5); border-radius: 8px; padding: 14px 6px; text-align: center; font-size: 12px; color: #475569; cursor: grab; transition: all .15s; }
.tall-module-card:hover { background: rgba(139,92,246,.12); border-style: solid; }
.tall-module-card:active { cursor: grabbing; }
.tall-block { background: #ffffff; border: 1.5px dashed rgba(148,163,184,.3); border-radius: 8px; margin: 0 0 12px; position: relative; }
.tall-block.sel { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(139,92,246,.25); }
.tall-block-head { display: flex; justify-content: flex-end; gap: 4px; padding: 4px 6px; }
.tall-block-head button { width: 20px; height: 20px; border-radius: 5px; border: none; background: #e8eef7; color: #94a3b8; font-size: 12px; cursor: pointer; line-height: 1; }
.tall-block-head button:hover { background: #475569; color: #1e293b; }
.tall-block-head button.del:hover { background: rgba(239,68,68,.25); color: #fca5a5; }
.tall-block-empty { min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #475569; font-size: 12px; cursor: pointer; padding: 10px; }
.tall-block-empty .plus { width: 30px; height: 30px; border-radius: 50%; border: 1.5px dashed #64748b; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #94a3b8; }
.tall-block-img img { display: block; width: 100%; height: auto; }
.tall-block-img .tall-block-tag { font-size: 10.5px; color: #94a3b8; padding: 4px 8px; display: flex; align-items: center; gap: 6px; }
.tall-carousel-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 12px; color: #475569; }
.tall-carousel-head .num { font-weight: 700; color: #f59e0b; min-width: 16px; text-align: center; }
.tall-carousel-head button { width: 22px; height: 22px; border-radius: 5px; border: none; background: #e8eef7; color: #475569; font-size: 14px; cursor: pointer; line-height: 1; }
.tall-carousel-head button:hover { background: #475569; }
.tall-carousel-slots { display: grid; gap: 6px; padding: 0 8px 8px; }
.tall-car-slot { aspect-ratio: 3/2; border: 1.5px dashed rgba(148,163,184,.3); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #475569; font-size: 10.5px; cursor: pointer; overflow: hidden; position: relative; background: #0b0c0e; }
.tall-car-slot:hover { border-color: rgba(139,92,246,.5); }
.tall-car-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tall-car-slot .slot-idx { position: absolute; left: 3px; top: 3px; background: rgba(0,0,0,.6); color: #2563eb; font-size: 9px; padding: 1px 5px; border-radius: 3px; }
.tall-tree-folder { background: #f1f5f9; border: 1px solid rgba(148,163,184,.14); border-radius: 8px; padding: 6px 8px; margin-bottom: 8px; }
.tall-tree-folder-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #1e293b; padding: 2px 0 4px; }
.tall-tree-folder-head .cnt { color: #f59e0b; font-size: 11px; margin-left: auto; }
.tall-tree-folder-head button { background: #e8eef7; border: 1px solid rgba(148,163,184,.2); color: #94a3b8; font-size: 10px; border-radius: 4px; padding: 1px 6px; cursor: pointer; }
.tall-tree-child { display: flex; align-items: center; gap: 6px; padding: 3px 0 3px 22px; font-size: 11px; color: #94a3b8; }
.tall-tree-child img { width: 26px; height: 26px; border-radius: 4px; object-fit: cover; }
.tall-tree-child .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tall-tree-child button { background: #e8eef7; border: 1px solid rgba(148,163,184,.2); color: #94a3b8; font-size: 10px; border-radius: 4px; padding: 1px 6px; cursor: pointer; }
.tall-tree-empty { font-size: 11px; color: #64748b; padding: 4px 2px; }

/* 自动化实时预览 v2 */
.auto-preview-stage { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 0; flex: 1; }
.auto-preview-stage[hidden] { display: none; }
.auto-preview-stage canvas { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 8px 30px rgba(0,0,0,.4); background: #0b0c0e; }
.auto-nav { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(148,163,184,.3); background: rgba(15,17,26,.7); color: #475569; font-size: 13px; cursor: pointer; flex: none; transition: all .15s; }
.auto-nav:hover { background: rgba(139,92,246,.2); border-color: #3b82f6; color: #fff; }
.auto-preview-info { max-width: 90%; padding: 6px 14px; border-radius: 8px; background: rgba(139,92,246,.1); border: 1px solid rgba(139,92,246,.3); color: #475569; font-size: 12px; text-align: center; margin-top: 8px; flex: none; }
.auto-preview-info[hidden] { display: none; }

/* ==================== 多文件夹分组折叠列表（图片编辑工作台） ==================== */
/* 注意：.edit-list 本身是两列 grid；header/body 必须通栏（grid-column: 1 / -1），
   缩略图网格由 .edit-folder-body 内部自行实现两列 */
.edit-folder-head {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  width: 100%; height: 36px; padding: 0 10px;
  border: 0; border-radius: 8px; background: #F3F4F6;
  cursor: pointer; text-align: left; font: inherit; color: inherit;
  transition: background-color .15s ease;
}
.edit-folder-head:hover { background: #E5E7EB; }
.edit-folder-head .ef-left { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto; }
.edit-folder-head .ef-icon { width: 15px; height: 15px; flex: none; color: #9CA3AF; transition: color .15s ease; }
.edit-folder-head:hover .ef-icon { color: #6B7280; }
.edit-folder-head .ef-name {
  flex: 1 1 auto; min-width: 0;
  font-size: 12.5px; font-weight: 600; color: #374151;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.edit-folder-head .ef-count { flex: none; font-size: 11px; color: #9CA3AF; white-space: nowrap; }
.edit-folder-head .ef-chev { width: 14px; height: 14px; flex: none; color: #9CA3AF; transition: transform .2s ease; }
.edit-folder-head.folded .ef-chev { transform: rotate(-90deg); }
.edit-folder-body {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  align-content: start; padding: 8px 2px;
}
.edit-folder-body .edit-thumb img { object-fit: cover; }
