/* 方羽AI · 主图复刻
   深色底 #111214 + 青柠 #bef264 强调，边框用白色透明度分层，系统字体 */

:root {
  --ink: #111214;
  --surface: #17181b;
  --lime: #bef264;
  --lime-soft: rgba(190, 242, 100, 0.12);
  --lime-line: rgba(190, 242, 100, 0.33);

  --card: rgba(255, 255, 255, 0.035);
  --field: rgba(255, 255, 255, 0.05);
  --hover: rgba(255, 255, 255, 0.08);
  --line-weak: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.15);
  --line-strong: rgba(255, 255, 255, 0.3);

  --t50: #fafafa;
  --t100: #f5f5f5;
  --t200: #e5e5e5;
  --t300: #d4d4d4;
  --t400: #a3a3a3;
  --t500: #737373;

  --rose: #fda4af;
  --rose-bg: rgba(244, 63, 94, 0.1);
  --rose-line: rgba(244, 63, 94, 0.3);
  --emerald: #6ee7b7;
  --emerald-dot: #34d399;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--ink);
  /* 极淡 40px 网格 */
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 40px 40px;
  color: #ececee;
  font: 13px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
::selection { background: var(--lime); color: #000; }
select option { background: var(--surface); color: #ececee; }

* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 通用 ---------- */
.logo-row { display: flex; align-items: center; gap: 10px; }
.logo { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line-weak); }
.logo-lg { width: 36px; height: 36px; }
.logo-name { font-size: 15px; font-weight: 600; line-height: 1; letter-spacing: -0.01em; color: var(--t100); }
.logo-sub { margin-top: 3px; font-size: 10px; line-height: 1; letter-spacing: 0.04em; color: var(--t400); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--lime); color: #000; }
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-secondary { background: var(--field); border-color: var(--line); color: var(--t200); }
.btn-secondary:hover:not(:disabled) { background: var(--hover); border-color: rgba(255, 255, 255, 0.2); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-cost { margin-left: -4px; font-weight: 400; opacity: 0.65; }
.btn-block { width: 100%; padding: 11px; font-size: 14px; }
.link { padding: 2px 4px; border: 0; border-radius: 4px; background: none; color: var(--t400); font-size: 12px; cursor: pointer; transition: color 0.15s; }
.link:hover { color: var(--t100); }
.link-danger:hover, .link-danger.is-confirm { color: var(--rose); }
.muted { color: var(--t400); font-weight: 400; }
.icon-btn { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--t400); cursor: pointer; transition: color 0.15s, background-color 0.15s; }
.icon-btn:hover { color: var(--rose); background: rgba(255, 255, 255, 0.04); }

.chip { display: inline-flex; align-items: center; padding: 1px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--field); color: var(--t300); font-size: 11px; font-weight: 400; line-height: 16px; }
.chip-danger { background: var(--rose-bg); border-color: var(--rose-line); color: var(--rose); }
.chip-lime { background: var(--lime-soft); border-color: var(--lime-line); color: var(--lime); }

/* ---------- 登录 / 注册 ---------- */
.auth { min-height: 100dvh; display: flex; }
.auth-brand { width: 46%; display: flex; flex-direction: column; padding: 48px; border-right: 1px solid var(--line); }
.auth-copy { margin: auto 0; max-width: 440px; }
.eyebrow { margin-bottom: 20px; font-size: 11px; letter-spacing: 0.3em; color: var(--lime); }
.auth-copy h1 { margin: 0 0 20px; font-size: 40px; font-weight: 600; line-height: 1.18; letter-spacing: -0.01em; color: var(--t50); }
.auth-copy p { margin: 0; font-size: 14px; line-height: 1.8; color: var(--t300); }
.auth-foot { font-size: 11px; color: var(--t500); }
.auth-main { flex: 1; display: grid; place-items: center; padding: 48px 24px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-hello { font-size: 13px; color: var(--t400); }
.auth-title { margin: 4px 0 28px; font-size: 26px; font-weight: 600; color: var(--t50); }
.tabs { display: flex; gap: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.tabs button { position: relative; padding: 0 0 10px; border: 0; background: none; font-size: 14px; color: var(--t400); cursor: pointer; transition: color 0.15s; }
.tabs button:hover { color: var(--t300); }
.tabs button[aria-selected="true"] { color: var(--t50); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--lime); }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 6px; font-size: 11px; color: var(--t400); }
.field input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: var(--field);
  color: var(--t100);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.field input::placeholder, textarea::placeholder { color: var(--t500); }
.field input:focus, textarea:focus, select:focus { border-color: rgba(255, 255, 255, 0.5); }
.field input[name="inviteCode"] { font-family: var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; }
.register-only { display: none; }
.is-register .register-only { display: block; }
.form-error { margin: 0 0 16px; padding: 8px 12px; border: 1px solid var(--rose-line); border-radius: 6px; background: var(--rose-bg); color: var(--rose); font-size: 12px; }
.form-error:empty { display: none; }
#authSubmit { margin-top: 8px; }
.auth-note { margin: 14px 0 0; font-size: 11px; line-height: 1.7; color: var(--t400); }

/* ---------- 顶栏 / 底栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 24px;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-self: stretch; margin-left: 32px; }
.nav-tab { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 16px; font-size: 13px; color: var(--t300); text-decoration: none; white-space: nowrap; transition: color 0.15s; }
.nav-tab:hover { color: var(--t100); }
.nav-tab.is-active { color: var(--t50); }
.nav-tab.is-active svg { color: var(--lime); }
.nav-tab.is-active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--lime); }
.account { display: flex; align-items: center; gap: 18px; margin-left: auto; font-size: 12px; }
.credits { display: flex; align-items: center; gap: 7px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: none; font-size: 12px; cursor: pointer; transition: border-color 0.15s, background-color 0.15s; }
.credits:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.04); }
.credits-more { font-size: 10px; color: var(--t400); }
.coin { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, var(--lime), #65a30d); }
.credits strong { font-weight: 500; color: var(--lime); font-variant-numeric: tabular-nums; }
.credits-unit { color: var(--t400); }
.credits.is-low strong { color: var(--rose); }
.credits.bump strong { display: inline-block; animation: bump 0.6s ease-out; }
.user { display: flex; align-items: center; gap: 8px; color: var(--t300); }
.user #username { max-width: 10em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #404040; color: var(--t200); font-size: 11px; }

.footbar { display: flex; align-items: center; gap: 16px; height: 32px; padding: 0 24px; border-top: 1px solid var(--line); font-size: 11px; color: var(--t400); }
.status { display: flex; align-items: center; gap: 6px; }
.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald-dot); }
.footbar-right { margin-left: auto; }

/* ---------- 工作台 ---------- */
.workspace {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 24px;
  max-width: 1440px;
  min-height: calc(100dvh - 56px - 32px);
  margin: 0 auto;
  padding: 16px 24px 40px;
  align-items: start;
}

/* 左栏：所有输入放在一屏内 */
.composer.is-flash { animation: flash 1.2s ease-out; }
.composer { position: sticky; top: 72px; display: flex; flex-direction: column; max-height: calc(100dvh - 88px); overflow: auto; }
.step { padding: 12px 18px; border-bottom: 1px solid var(--line-weak); }
.field-label { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--t100); white-space: nowrap; }
.field-label small { margin-left: auto; font: 400 10px var(--font-mono); color: var(--t500); font-variant-numeric: tabular-nums; }
.field-label .chip { padding: 0 5px; font-size: 10px; line-height: 15px; }
.step-no { font: 500 10px var(--font-mono); color: var(--t500); font-variant-numeric: tabular-nums; }

/* 01 / 02 图片：参考图和商品图并排，高度跟着屏幕高度收放 */
.uploads { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; --upload-h: clamp(108px, 18vh, 160px); }
.upload-col { min-width: 0; }
.drop {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: var(--upload-h);
  border: 2px dashed var(--lime-line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.drop:hover { background: var(--field); }
.drop.is-over { border-color: var(--lime); background: var(--lime-soft); }
.drop.has-image { border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); }
.drop > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; border-radius: 7px; }
.drop-empty { padding: 0 8px; text-align: center; pointer-events: none; }
.drop-empty b { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 500; color: var(--lime); }
.drop-empty b::before { content: "+ "; }
.drop-empty small { font-size: 10.5px; color: var(--t400); }
.drop-tools { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.drop:hover .drop-tools, .drop:focus-within .drop-tools { opacity: 1; }
.chip-btn { padding: 3px 8px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 999px; background: rgba(0, 0, 0, 0.75); color: var(--t200); font-size: 10.5px; cursor: pointer; }
.chip-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.4); }

.products { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 6px; height: var(--upload-h); }
.slot { position: relative; min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: rgba(0, 0, 0, 0.3); }
.slot img { width: 100%; height: 100%; object-fit: cover; }
.slot-no { position: absolute; left: 3px; bottom: 3px; padding: 0 4px; border-radius: 3px; background: rgba(0, 0, 0, 0.7); font: 600 9px/14px var(--font-mono); color: var(--t200); }
.slot-remove { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 12px; line-height: 18px; cursor: pointer; opacity: 0; transition: opacity 0.15s, background-color 0.15s; }
.slot:hover .slot-remove, .slot-remove:focus-visible { opacity: 1; }
.slot-remove:hover { background: rgba(244, 63, 94, 0.8); }
.slot-add { display: grid; place-items: center; border: 2px dashed var(--lime-line); background: none; color: var(--lime); font-size: 18px; cursor: pointer; transition: border-color 0.15s, background-color 0.15s; }
.slot-add:hover { background: var(--field); }
.products.is-over .slot-add { border-color: var(--lime); background: var(--lime-soft); }
.slot-add.wide { grid-column: 1 / -1; grid-row: 1 / -1; align-content: center; gap: 2px; padding: 0 8px; font-size: 12px; font-weight: 500; line-height: 1.5; text-align: center; }
.slot-add.wide small { display: block; font-size: 10.5px; font-weight: 400; color: var(--t400); }

/* 03 / 04 文字 */
.texts { display: flex; flex-direction: column; gap: 12px; }
textarea { display: block; min-height: 58px; padding: 8px 10px; font-size: 12.5px; line-height: 1.55; resize: vertical; }

/* 05 出图设置 */
.setting { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 8px; }
.setting + .setting { margin-top: 10px; }
.setting-label { font-size: 11.5px; color: var(--t400); white-space: nowrap; }
.setting-inline { display: flex; align-items: center; gap: 10px; }
.setting-inline select { flex: 1; min-width: 0; }
select {
  appearance: none;
  padding: 6px 28px 6px 10px;
  font-size: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a3a3a3' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--t300);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.seg button:hover { border-color: var(--line-strong); color: var(--t100); }
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] { border-color: var(--lime); background: var(--lime-soft); color: var(--lime); }
.seg button small { font-size: 10px; opacity: 0.7; }
.seg-ratio { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.seg-ratio button { flex-direction: column; justify-content: center; gap: 3px; padding: 6px 0 4px; font-size: 11px; line-height: 1.2; }
.seg-res { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.seg-res button { justify-content: center; gap: 5px; padding: 6px 0; }
.seg-res b { font-weight: 600; }
.ratio-shape { display: block; height: 12px; max-width: 20px; border: 1.5px solid currentColor; border-radius: 2px; opacity: 0.8; }
.ratio-auto { width: 12px; border-style: dashed; }
.stepper { display: inline-flex; align-items: center; flex: none; border: 1px solid var(--line); border-radius: 6px; background: var(--field); }
.stepper button { width: 28px; height: 30px; border: 0; background: none; color: var(--t200); font-size: 15px; cursor: pointer; }
.stepper button:hover:not(:disabled) { color: var(--lime); }
.stepper button:disabled { opacity: 0.3; cursor: default; }
.stepper output { min-width: 20px; text-align: center; font: 500 13px var(--font-mono); color: var(--t100); font-variant-numeric: tabular-nums; }

.composer-foot { position: sticky; bottom: 0; padding: 10px 18px; border-top: 1px solid var(--line); background: #151618; }
.btn-go { width: 100%; justify-content: space-between; padding: 10px 16px; font-size: 14px; font-weight: 600; }
.go-cost { font-size: 12px; font-weight: 500; opacity: 0.7; font-variant-numeric: tabular-nums; }
.go-hint { min-height: 1.3em; margin: 4px 0 0; font-size: 11px; color: var(--t400); }
.go-hint.warn { color: var(--rose); }
kbd { padding: 0 4px; border: 1px solid var(--line); border-radius: 3px; background: var(--field); font: 10px var(--font-mono); color: var(--t300); }

/* ---------- 生成记录 ---------- */
.feed { min-width: 0; }
.feed-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 16px; }
.feed-head h2 { margin: 0; font-size: 18px; font-weight: 600; color: var(--t50); }

.sheet { scroll-margin-top: 72px; margin-bottom: 16px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; animation: fade-up 0.3s ease-out both; }
.sheet.is-leaving { opacity: 0; transform: translateY(-4px); transition: opacity 0.25s, transform 0.25s; }
.sheet-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.sheet-head time { font: 500 12px var(--font-mono); color: var(--t200); font-variant-numeric: tabular-nums; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { padding: 0 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--field); font-size: 11px; line-height: 18px; color: var(--t300); }
.sheet-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.sheet-points { margin: 10px 0 0; overflow: hidden; color: var(--t300); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sheet-points::before { content: "卖点"; margin-right: 8px; padding: 0 6px; border-radius: 3px; background: var(--lime-soft); color: var(--lime); font-size: 10px; }
.sheet-points + .sheet-points { margin-top: 6px; }
.sheet-extra::before { content: "要求"; background: rgba(56, 189, 248, 0.12); color: #7dd3fc; }
.sheet-change::before { content: "修改"; background: rgba(251, 191, 36, 0.12); color: #fcd34d; }
.is-edit .tags span:first-child { border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.1); color: #fcd34d; }
.sheet-body { display: grid; grid-template-columns: 120px 28px minmax(0, 1fr); gap: 12px; align-items: start; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-weak); }
.sources { display: flex; flex-direction: column; gap: 12px; }
.src { margin: 0; }
.src figcaption { margin-top: 5px; font-size: 10px; letter-spacing: 0.12em; color: var(--t400); }
.thumb { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: rgba(0, 0, 0, 0.3); cursor: zoom-in; transition: border-color 0.15s; }
.thumb:hover { border-color: var(--line-strong); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.src-ref .thumb, .prod-thumbs .thumb { aspect-ratio: 1; }
.prod-thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.flow { display: grid; place-items: center; height: 120px; color: var(--lime); opacity: 0.8; }
.flow svg { width: 24px; height: 12px; }

.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.tile { position: relative; margin: 0; aspect-ratio: var(--ratio, 1 / 1); overflow: hidden; border: 1px solid var(--line-weak); border-radius: 8px; background: rgba(0, 0, 0, 0.4); }
.tile > img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.tile.is-done { border-color: rgba(190, 242, 100, 0.3); }
.tile.is-done:hover { border-color: var(--lime); }
.tile.just-done > img { animation: fade-in 0.6s ease-out both; }
.tile-bar {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(17, 18, 20, 0.85);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
}
.tile:hover .tile-bar, .tile:focus-within .tile-bar { opacity: 1; transform: none; }
.tile-bar button, .tile-bar a { flex: 1; padding: 5px 0; border: 0; border-radius: 5px; background: none; color: var(--t200); font-size: 12px; text-align: center; text-decoration: none; cursor: pointer; }
.tile-bar button:hover { background: var(--hover); color: #fff; }
.tile-bar a { background: var(--lime); color: #000; font-weight: 500; }
.tile-bar a:hover { opacity: 0.9; }
.tile-face { position: absolute; inset: 0; display: grid; place-items: center; }
.tile-msg { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px; text-align: center; }
.tile-msg strong { font-size: 12px; font-weight: 500; color: var(--lime); }
.tile-msg span { font-size: 11px; color: var(--t400); font-variant-numeric: tabular-nums; }
.tile-msg .elapsed { font-family: var(--font-mono); color: var(--t300); }
.is-busy .tile-face { background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0 8px, rgba(255, 255, 255, 0.06) 8px 16px); }
.is-busy:not(.is-queued) .tile-msg::before { content: ""; width: 22px; height: 22px; margin-bottom: 4px; border: 2px solid rgba(190, 242, 100, 0.3); border-top-color: var(--lime); border-radius: 50%; animation: spin 0.8s linear infinite; }
.is-queued .tile-msg strong { color: var(--t300); }
.is-busy:not(.is-queued) .tile-face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  background-size: 200% 100%;
  animation: shimmer 2.4s linear infinite;
}
.tile-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.06); }
.tile-progress i { display: block; height: 100%; background: var(--lime); box-shadow: 0 0 8px rgba(190, 242, 100, 0.5); transition: width 1s linear; }
.is-failed { border-color: var(--rose-line); background: rgba(244, 63, 94, 0.05); }
.is-failed .tile-msg strong { color: var(--rose); }
.is-failed .tile-msg span { max-width: 26ch; color: var(--t300); }
.is-failed em { font-size: 11px; font-style: normal; color: var(--emerald); }

.empty { padding: 40px 24px; border: 1px dashed var(--line); border-radius: 10px; text-align: center; }
.empty-flow { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--t500); font-size: 16px; }
.ph {
  display: grid;
  place-items: center;
  width: 96px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 8px, rgba(255, 255, 255, 0.08) 8px 16px);
  font-size: 11px;
  color: var(--t400);
}
.ph-lime { border-color: var(--lime-line); background-image: repeating-linear-gradient(45deg, rgba(180, 255, 80, 0.05) 0 8px, rgba(180, 255, 80, 0.1) 8px 16px); color: var(--lime); }
.empty p { margin: 20px 0 0; font-size: 12px; color: var(--t400); }
.load-more { display: flex; margin: 4px auto 0; }

/* ---------- 看大图 ---------- */
.viewer { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: rgba(10, 10, 12, 0.92); backdrop-filter: blur(6px); animation: fade-in 0.2s ease-out; }
.viewer-bar { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line-weak); background: var(--ink); }
.viewer-pos { font: 12px var(--font-mono); color: var(--t400); font-variant-numeric: tabular-nums; }
.viewer-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.viewer-close { font-size: 20px; color: var(--t300); }
.viewer-close:hover { color: #fff; background: var(--hover); }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: stretch; justify-content: center; gap: 24px; padding: 24px 72px; }
.viewer-stage figure { flex: 1; min-width: 0; min-height: 0; max-width: 1100px; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.viewer-stage img { max-width: 100%; max-height: calc(100% - 28px); object-fit: contain; border-radius: 6px; }
.viewer-stage.is-compare img { width: 100%; height: calc(100% - 28px); }
.viewer-stage figcaption { margin-top: 10px; font-size: 11px; color: var(--t400); }
.viewer-nav { position: absolute; top: 50%; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--t200); font-size: 22px; line-height: 1; cursor: pointer; transform: translateY(-50%); }
.viewer-nav:hover:not(:disabled) { border-color: var(--line-strong); color: #fff; }
.viewer-nav:disabled { opacity: 0.25; cursor: default; }
.viewer-nav.prev { left: 16px; }
.viewer-nav.next { right: 16px; }

/* ---------- 积分明细弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(4px); animation: fade-in 0.2s ease-out; }
.modal-panel { display: flex; flex-direction: column; width: 100%; max-width: 520px; max-height: min(720px, 86dvh); overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); animation: fade-up 0.25s ease-out; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--t50); }
.modal-close { margin-left: auto; font-size: 20px; color: var(--t300); }
.modal-close:hover { color: #fff; background: var(--hover); }
.modal-body { display: flex; flex-direction: column; min-height: 0; padding: 16px 20px 20px; overflow: auto; }
.modal-body > * { flex-shrink: 0; } /* 内容超高时整体滚动，不压扁里面的卡片 */
.balance-card { position: relative; display: flex; align-items: flex-end; gap: 16px; overflow: hidden; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.balance-card::after { content: ""; position: absolute; right: -28px; top: -28px; width: 120px; height: 120px; border-radius: 50%; background: var(--lime); opacity: 0.12; pointer-events: none; }
.balance-label { font-size: 11px; letter-spacing: 0.1em; color: var(--t400); }
.balance-num { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.balance-num strong { font-size: 36px; font-weight: 600; line-height: 1.1; color: var(--lime); font-variant-numeric: tabular-nums; }
.balance-num span { font-size: 12px; color: var(--t400); }
.price-list { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-left: auto; font-size: 11px; color: var(--t400); }
.price-list b { font-weight: 500; color: var(--t200); font-variant-numeric: tabular-nums; }
.recharge { display: flex; align-items: center; gap: 16px; margin-top: 12px; padding: 12px; border: 1px solid var(--lime-line); border-radius: 10px; background: var(--lime-soft); }
.recharge img { flex: none; width: 104px; height: 104px; padding: 5px; border-radius: 8px; background: #fff; }
.recharge-title { font-size: 14px; font-weight: 600; color: var(--lime); }
.recharge p { margin: 6px 0 0; font-size: 12px; line-height: 1.7; color: var(--t300); }
.recharge b { font-weight: 500; color: var(--t50); }
.link-lime { padding: 0; color: var(--lime); text-decoration: underline; text-underline-offset: 3px; }
.link-lime:hover { color: var(--lime); opacity: 0.85; }
.log-head { margin: 18px 0 8px; font-size: 12px; font-weight: 600; color: var(--t100); }
.log-list { border: 1px solid var(--line); border-radius: 10px; }
.log-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 76px; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-weak); }
.log-row:last-child { border-bottom: 0; }
.log-title { overflow: hidden; color: var(--t100); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.log-time { margin-top: 1px; font: 11px var(--font-mono); color: var(--t500); font-variant-numeric: tabular-nums; }
.log-delta { font: 500 13px var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.log-delta.plus { color: var(--emerald); }
.log-delta.minus { color: var(--rose); }
.log-balance { font-size: 11px; color: var(--t400); text-align: right; font-variant-numeric: tabular-nums; }
.log-empty { padding: 28px 14px; color: var(--t400); font-size: 12px; text-align: center; }
.log-skeleton { height: 12px; margin: 14px; border-radius: 4px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent); background-size: 200% 100%; animation: shimmer 2.4s linear infinite; }
.log-more { display: flex; margin: 12px auto 0; }

/* ---------- 改图弹窗：左边大图，右边写修改要求 ---------- */
.edit-panel { max-width: 1040px; max-height: min(820px, 92dvh); }
.edit-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 0; overflow: auto; }
.edit-stage { display: grid; place-items: center; padding: 20px; border-right: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); }
.edit-stage img { max-width: 100%; max-height: min(64dvh, 640px); object-fit: contain; border-radius: 6px; }
.edit-side { display: flex; flex-direction: column; gap: 14px; padding: 16px 18px 18px; }
.edit-side textarea { min-height: 120px; font-size: 13px; }
.edit-ideas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; color: var(--t500); }
.idea { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--field); color: var(--t300); font-size: 11.5px; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.idea:hover { border-color: var(--lime-line); color: var(--lime); }
.edit-foot { margin-top: auto; }

/* ---------- 提示条（右上角滑入） ---------- */
.toasts { position: fixed; top: 68px; right: 16px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { max-width: min(90vw, 380px); padding: 10px 14px; border: 1px solid rgba(56, 189, 248, 0.3); border-radius: 8px; background: var(--surface); color: #7dd3fc; font-size: 12.5px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); animation: slide-in 0.25s ease-out; }
.toast-ok { border-color: rgba(16, 185, 129, 0.3); color: var(--emerald); }
.toast-error { border-color: var(--rose-line); color: var(--rose); }
.toast.out { opacity: 0; transform: translateX(12px); transition: opacity 0.25s, transform 0.25s; }

/* ---------- 动效 ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(100%); } }
@keyframes flash { 0%, 30% { border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime-soft); } }
@keyframes bump { 0% { transform: translateY(-2px); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (hover: none) {
  .drop-tools, .slot-remove, .tile-bar { opacity: 1; transform: none; }
}

/* ---------- 矮屏（比如 1366×768 的笔记本）：再紧凑一点，保证左栏一屏放下 ---------- */
@media (min-width: 961px) and (max-height: 740px) {
  .uploads { --upload-h: clamp(100px, 16vh, 160px); }
  .step { padding: 10px 18px; }
  .texts { gap: 8px; }
  textarea { height: 42px; min-height: 42px; }
  .setting + .setting { margin-top: 8px; }
  .seg-ratio button { gap: 2px; padding: 4px 0 3px; }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .composer { position: static; max-height: none; overflow: visible; }
  .composer-foot { position: sticky; bottom: 0; border-radius: 0 0 10px 10px; }
}
@media (max-width: 760px) {
  .edit-body { grid-template-columns: 1fr; }
  .edit-stage { padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .edit-stage img { max-height: 36dvh; }
}
@media (max-width: 820px) {
  .auth { flex-direction: column; }
  .auth-brand { width: auto; padding: 28px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-copy { margin: 32px 0 8px; }
  .auth-copy h1 { font-size: 30px; }
  .auth-foot { display: none; }
  .auth-main { padding: 32px 24px 48px; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 16px; }
  .logo-sub, .user, .nav-tab svg, .credits-more { display: none; }
  .nav { margin-left: 12px; }
  .nav-tab { padding: 0 8px; }
  .workspace { padding: 16px 12px 32px; }
  .sheet-body { grid-template-columns: 1fr; }
  .sources { flex-direction: row; align-items: flex-start; }
  .src-ref { width: 96px; flex: none; }
  .prod-thumbs { grid-template-columns: repeat(4, 44px); }
  .flow { height: auto; transform: rotate(90deg); justify-self: start; margin-left: 36px; }
  .results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-actions { margin-left: 0; width: 100%; }
  .viewer-stage { flex-direction: column; padding: 12px; gap: 12px; }
  .viewer-nav { top: auto; bottom: 16px; transform: none; }
  .modal:has(.edit-panel) { padding: 0; }
  .edit-panel { max-height: 100dvh; border-radius: 0; }
  .ph { width: 72px; }
}
