:root {
  --bg: #08080a;
  --bg-2: #0c0c10;
  --panel: #111116;
  --panel-2: #16161c;
  --line: #23232c;
  --line-2: #2f2f3a;
  --text: #eae8e4;
  --muted: #8b8b96;
  --dim: #5d5d69;
  --gold: #d8a95f;
  --gold-dim: #a8813f;
  --gold-soft: rgba(216, 169, 95, 0.12);
  --red: #e0705e;
  --green: #6fbf8b;
  --radius: 14px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
}

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

/* 关键：自定义 display 会覆盖 [hidden] 的 UA 样式，必须强制 */
[hidden] { display: none !important; }

html, body {
  height: 100%;
}

body {
  background:
    radial-gradient(900px 500px at 82% -8%, rgba(216, 169, 95, 0.07), transparent 60%),
    radial-gradient(700px 420px at 4% 104%, rgba(110, 140, 200, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a34; border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #3a3a48; background-clip: content-box; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  height: 62px;
  flex: 0 0 62px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 13, 0.82);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 11px; }

.brand-mark {
  width: 34px; height: 34px;
  display: block;
  flex: 0 0 auto;
  border-radius: 9px;
  overflow: hidden;
  background: #d8a95f;
  box-shadow: 0 4px 14px -4px rgba(216, 169, 95, 0.45);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }

.brand-text h1 {
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.4px;
  line-height: 1.2;
}
.brand-text span { font-size: 11px; color: var(--dim); letter-spacing: 0.3px; }

.top-stats {
  display: flex;
  gap: 22px;
  margin-left: auto;
  padding-right: 6px;
}
.stat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.stat-label { font-size: 10.5px; color: var(--dim); letter-spacing: 0.5px; }
.stat-value { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-value i { font-style: normal; font-size: 10px; color: var(--dim); margin-left: 1px; }
.stat-value.warn { color: var(--gold); }
.stat-value.err { color: var(--red); }

/* 顶栏导航 */
.topnav { display: flex; gap: 3px; margin-left: 6px; }
.topnav a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  transition: 0.15s;
}
.topnav a:hover { color: var(--gold); background: var(--gold-soft); border-color: rgba(216, 169, 95, 0.22); }

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 550;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  transition: 0.16s ease;
  white-space: nowrap;
}
.btn:hover { border-color: #414150; background: #1c1c23; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn.danger { color: var(--red); border-color: rgba(224, 112, 94, 0.32); }
.btn.danger:hover { background: rgba(224, 112, 94, 0.12); border-color: var(--red); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn.primary {
  background: linear-gradient(160deg, #e8bd77, var(--gold) 55%, var(--gold-dim));
  color: #1a140b;
  border: 1px solid rgba(255, 220, 160, 0.5);
  box-shadow: 0 8px 22px -10px rgba(216, 169, 95, 0.8);
  font-weight: 650;
}
.btn.primary:hover { filter: brightness(1.06); }
.btn kbd {
  font: inherit;
  font-size: 10.5px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
  color: #4a3a1c;
}

.link {
  font-size: 11.5px;
  color: var(--muted);
  border-bottom: 1px dashed var(--line-2);
  padding-bottom: 1px;
}
.link:hover { color: var(--gold); border-color: var(--gold); }

.icon-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 7px;
  color: var(--muted);
  font-size: 14px;
}
.icon-btn:hover { background: #22222b; color: var(--text); }

/* ---------------- 布局 ---------------- */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 404px minmax(0, 1fr);
  overflow: hidden;
  min-height: 0;
}

.composer {
  overflow-y: auto;
  padding: 16px 16px 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(14, 14, 18, 0.6), rgba(8, 8, 10, 0.2));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage {
  overflow-y: auto;
  padding: 16px 20px 60px;
  min-width: 0;
}

/* ---------------- 区块 ---------------- */

.block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 13px 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.block-head h2 {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}
.block-hint { font-size: 11.5px; color: var(--dim); line-height: 1.5; margin-top: -4px; }

.charcount { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; transition: color .18s; }
.charcount.warn { color: #d8a95f; }
.charcount.over { color: #e0705e; font-weight: 600; }

/* 画风预设 */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

/* ---------------- AI 编排 ---------------- */

.block-ai {
  border-color: rgba(216, 169, 95, 0.26);
  background: linear-gradient(165deg, rgba(216, 169, 95, 0.07), rgba(17, 17, 22, 0.9) 55%);
}

.ai-pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  color: var(--dim);
  border: 1px solid var(--line-2);
  background: #15151b;
}
.ai-pill.on {
  color: var(--gold);
  border-color: rgba(216, 169, 95, 0.4);
  background: var(--gold-soft);
}

.ai-row { display: flex; gap: 7px; align-items: stretch; }
.ai-row select { flex: 1; font-size: 12px; padding: 7px 10px; }
.ai-row .btn { flex: 0 0 auto; }

.ai-plan {
  border: 1px solid rgba(216, 169, 95, 0.24);
  background: rgba(9, 9, 12, 0.7);
  border-radius: 9px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  animation: fadeUp 0.3s ease both;
}
.ai-plan .plan-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--dim);
}
.ai-plan .plan-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid rgba(216, 169, 95, 0.3);
}
.ai-plan .plan-tag.fb {
  color: var(--muted);
  background: #1a1a21;
  border-color: var(--line-2);
}
.plan-artists { display: flex; flex-wrap: wrap; gap: 4px; }
.plan-artists span {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px;
  color: var(--gold);
  background: rgba(216, 169, 95, 0.08);
  border-radius: 4px;
  padding: 2px 5px;
}
.plan-text {
  font-size: 11px;
  line-height: 1.65;
  color: #b6b4b0;
  word-break: break-word;
  max-height: 92px;
  overflow: auto;
}
.plan-foot { display: flex; gap: 6px; }

/* ---------------- 配方库 ---------------- */

.recipe-count { font-size: 10.5px; color: var(--dim); }

.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 268px;
  overflow-y: auto;
  padding-right: 2px;
}

.recipe-item {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 7px 9px;
  transition: 0.15s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.recipe-item:hover { border-color: rgba(216, 169, 95, 0.45); background: #1b1b22; }
.recipe-item.active { border-color: rgba(216, 169, 95, 0.6); background: var(--gold-soft); }
.recipe-name { font-size: 12px; font-weight: 600; }
.recipe-item.active .recipe-name { color: var(--gold); }
.recipe-note {
  font-size: 10.5px;
  color: var(--dim);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recipe-meta { font-size: 9.5px; color: #55555f; letter-spacing: 0.3px; }

.preset {
  text-align: left;
  border: 1px solid var(--line);
  background-color: var(--panel-2);
  background-image: var(--preset-cover, none);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  border-radius: 9px;
  padding: 8px 9px;
  min-height: 84px;
  transition: 0.15s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
}
.preset.has-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 8, 10, 0.12), rgba(8, 8, 10, 0.84));
  pointer-events: none;
}
.preset.has-cover .preset-name,
.preset.has-cover .preset-tags { position: relative; z-index: 1; }
.preset-name { font-size: 12px; font-weight: 600; }
.preset-tags { font-size: 10px; color: var(--dim); }
.preset:hover { border-color: #3d3d4b; background: #1b1b22; }
.preset.active {
  border-color: rgba(216, 169, 95, 0.55);
  background: var(--gold-soft);
}
.preset.active::after {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 2px;
  background: var(--gold);
}
.preset-name {
  font-size: 12.5px;
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-tags {
  display: block;
  font-size: 10px;
  color: var(--dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 表单 */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.4px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.field-label em { font-style: normal; color: var(--dim); font-size: 10.5px; }

textarea, input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%;
  background: #0b0b0e;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}
textarea { min-height: 52px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12px; }
textarea:focus, input:focus, select:focus {
  border-color: rgba(216, 169, 95, 0.5);
  box-shadow: 0 0 0 3px rgba(216, 169, 95, 0.09);
}
textarea::placeholder, input::placeholder { color: #4b4b56; }
select { appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, #6a6a78 50%), linear-gradient(135deg, #6a6a78 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }

.micro { font-size: 10.5px; color: var(--dim); line-height: 1.6; }
.micro code, .micro b { color: var(--muted); }
code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px;
  background: #1b1b22;
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--gold);
}

/* 折叠 */
.fold {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0e0e12;
  overflow: hidden;
}
.fold > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before {
  content: "▸";
  font-size: 9px;
  color: var(--dim);
  margin-right: 3px;
  transition: transform 0.15s;
}
.fold[open] > summary::before { transform: rotate(90deg); }
.fold > summary > span { flex: 1; }
.fold > summary em { font-style: normal; font-size: 10.5px; color: var(--dim); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold[open] > summary { border-bottom: 1px solid var(--line); color: var(--text); }
.fold-body { padding: 9px; display: flex; flex-direction: column; gap: 8px; }
.fold-body textarea { background: #08080b; }
.fold-preview .final-prompt {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.7;
  color: var(--gold);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 170px;
  overflow: auto;
  background: #08080b;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
}
.fold-preview .btn { align-self: flex-start; }

/* chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 99px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  background: var(--panel-2);
  transition: 0.15s;
}
.chip:hover { color: var(--gold); border-color: rgba(216, 169, 95, 0.45); }

.template-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: -3px; }

/* 参数 */
.param-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.slider-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.slider-row label { display: flex; flex-direction: column; gap: 5px; }
.slider-row span { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.slider-row b { color: var(--gold); font-variant-numeric: tabular-nums; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-dim), #2a2a34);
  border-radius: 99px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #14141a;
  box-shadow: 0 0 0 3px rgba(216, 169, 95, 0.12);
  cursor: pointer;
}

.check { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.check input { appearance: none; width: 15px; height: 15px; border: 1px solid var(--line-2); border-radius: 4px; background: #0b0b0e; flex: 0 0 auto; position: relative; cursor: pointer; }
.check input:checked { background: var(--gold); border-color: var(--gold); }
.check input:checked::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; color: #1a140b; font-weight: 800; }

/* 底部生成条 */
.composer-foot {
  position: sticky;
  bottom: 0;
  padding: 14px 0 14px;
  margin-top: auto;
  background: var(--bg);
  box-shadow: 0 -18px 22px -6px var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.composer-foot .btn.primary { width: 100%; padding: 12px; font-size: 14px; }
.cost-hint { font-size: 10.5px; color: var(--dim); text-align: center; min-height: 15px; }
.cost-hint b { color: var(--gold); }
.cost-hint .warn { color: var(--gold); }

/* ---------------- 作品墙 ---------------- */

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: -16px;
  background: linear-gradient(180deg, var(--bg) 60%, rgba(8, 8, 10, 0.6));
  padding-top: 4px;
  z-index: 5;
  backdrop-filter: blur(6px);
}

.stage-title { display: flex; align-items: baseline; gap: 9px; }
.stage-title h2 {
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.6px;
}
.stage-count { font-size: 11px; color: var(--dim); }
.stage-actions { display: flex; align-items: center; gap: 9px; }

.queue-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid rgba(216, 169, 95, 0.3);
  border-radius: 99px;
  padding: 4px 11px 4px 9px;
}
.queue-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.3s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.8); } }
.progress { width: 56px; height: 3px; border-radius: 99px; background: rgba(216, 169, 95, 0.22); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 99px; transition: width 0.4s ease; }

.wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  cursor: zoom-in;
  animation: fadeUp 0.4s ease both;
  transition: transform 0.2s ease, border-color 0.2s;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card:hover { transform: translateY(-2px); border-color: #40404f; }
.card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0a0d;
}
.card-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 18px 8px 7px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.82));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.18s;
  font-size: 10px;
  color: #cfcdc9;
}
.card:hover .card-overlay { opacity: 1; }
.card-seed { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.3px; }
.card-open { color: var(--gold); font-size: 10.5px; }

.card.skeleton {
  display: grid;
  place-items: center;
  background: linear-gradient(110deg, #12121a 20%, #1a1a24 40%, #12121a 60%);
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
  cursor: default;
  border-style: dashed;
  border-color: rgba(216, 169, 95, 0.28);
}
@keyframes shimmer { to { background-position: -220% 0; } }
.card.skeleton span { font-size: 11px; color: var(--gold); letter-spacing: 0.6px; }

.empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 90px 20px;
  color: var(--dim);
}
.empty-art { width: 96px; opacity: 0.28; color: var(--gold); }
.empty-title { font-size: 14px; color: var(--muted); }
.empty-sub { font-size: 12px; max-width: 300px; text-align: center; line-height: 1.7; }

.job-error {
  grid-column: 1 / -1;
  border: 1px solid rgba(224, 112, 94, 0.3);
  background: rgba(224, 112, 94, 0.07);
  color: #e6a196;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.job-error b { color: var(--red); }
.err-bar {
  grid-column: 1 / -1;
  border: 1px solid rgba(224, 112, 94, 0.28);
  background: rgba(224, 112, 94, 0.07);
  color: #e6a196;
  font-size: 12px;
  border-radius: 8px;
  padding: 7px 11px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: 0.15s;
}
.err-bar:hover { background: rgba(224, 112, 94, 0.13); border-color: rgba(224, 112, 94, 0.45); }
.job-error span { flex: 1; }
.job-error-close {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: #e6a196;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
  padding: 0 2px;
  opacity: 0.55;
  transition: 0.15s;
}
.job-error-close:hover { opacity: 1; color: var(--red); }

/* ---------------- 弹窗 ---------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 6, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal[hidden] { display: none; }

.modal-card {
  width: min(540px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop 0.2s ease;
}
@keyframes pop { from { transform: scale(0.97); opacity: 0; } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.modal-head h3 { font-size: 14px; font-weight: 600; }
.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  flex: 0 0 auto;
}

.settings-sec { display: flex; flex-direction: column; gap: 10px; }
.settings-sec > h4 {
  font-size: 10.5px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.sec-hint {
  text-transform: none;
  letter-spacing: 0;
  font-size: 10.5px;
  color: var(--dim);
  font-weight: 400;
}
.token-row { display: flex; gap: 6px; }
.token-row input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; }
.llm-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.btn.danger {
  color: #e0705e;
  border-color: rgba(224, 112, 94, 0.35);
}
.btn.danger:hover {
  background: rgba(224, 112, 94, 0.12);
  border-color: rgba(224, 112, 94, 0.6);
}
.key-status { font-size: 11.5px; color: var(--dim); display: flex; align-items: center; gap: 7px; }
.key-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.key-status.ok { color: var(--green); }
.key-status.ok .dot { background: var(--green); box-shadow: 0 0 8px rgba(111, 191, 139, 0.6); }
.key-status.bad { color: var(--red); }
.key-status.bad .dot { background: var(--red); }

/* 编排接口诊断：地址 / 模型列表 / 对话，逐行显示 */
.llm-diag {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-3, var(--bg-2));
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 190px;
  overflow-y: auto;
}
.llm-diag-row { display: flex; flex-direction: column; gap: 2px; font-size: 11px; line-height: 1.45; }
.llm-diag-row b { font-weight: 600; color: var(--muted); }
.llm-diag-row span { color: var(--dim); word-break: break-all; }
.llm-diag-row.ok b { color: var(--green); }
.llm-diag-row.bad b { color: var(--red); }
.llm-diag-row.warn b { color: #d9a13b; }
.llm-diag[hidden] { display: none; }

/* 看图 */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 6, 0.9);
  backdrop-filter: blur(14px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px;
  animation: fade 0.18s ease;
}
.lightbox[hidden] { display: none; }
.lb-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  width: 100%;
  height: 100%;
  max-width: 1500px;
  align-items: center;
}
.lb-imgwrap { position: relative; height: 100%; min-height: 0; }
/* 用绝对定位给 img 一个确定尺寸的画布，否则 grid 里 100% 高度会循环解析，图会被撑爆 */
.lb-imgwrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 24px 60px rgba(0, 0, 0, 0.6));
}
.lb-meta {
  align-self: center;
  max-height: 100%;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(17, 17, 22, 0.94);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.lb-meta-head { display: flex; flex-direction: column; gap: 3px; border-bottom: 1px solid var(--line); padding-bottom: 11px; }
.lb-seed { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--gold); }
.lb-params { font-size: 10.5px; color: var(--dim); }
.lb-section h4 { font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.lb-prompt { font-size: 11.5px; line-height: 1.75; color: #cdcbc7; word-break: break-word; }
.lb-prompt.muted { color: var(--dim); font-size: 11px; }
.lb-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.lb-hint { margin-top: 2px; }
.lb-close {
  position: absolute; top: 18px; right: 20px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted); font-size: 15px;
  display: grid; place-items: center;
}
.lb-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 64px;
  color: var(--muted); font-size: 26px;
  border-radius: 8px;
  display: grid; place-items: center;
}
.lb-nav:hover { color: var(--gold); background: rgba(255, 255, 255, 0.05); }
.lb-nav.prev { left: 8px; }
.lb-nav.next { right: 350px; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #1c1c24;
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 99px;
  font-size: 12.5px;
  box-shadow: var(--shadow);
  z-index: 200;
  animation: toastIn 0.22s ease;
}
.toast[hidden] { display: none; }
.toast.err { border-color: rgba(224, 112, 94, 0.45); color: #f0b3a8; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

/* 响应式 */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow-y: auto; }
  .composer { border-right: none; border-bottom: 1px solid var(--line); overflow: visible; }
  .top-stats .stat:nth-child(1) { display: none; }
  .lb-inner { grid-template-columns: 1fr; }
  .lb-nav.next { right: 8px; }
  .lb-meta { display: none; }
}

/* ---------------- 内嵌侧栏 ---------------- */
.topnav .dock-open {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: 0.15s;
}
.topnav .dock-open:hover,
.topnav .dock-open.on {
  color: var(--gold);
  background: var(--gold-soft);
  border-color: rgba(216, 169, 95, 0.24);
}

.dock {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(640px, 94vw);
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-left: 1px solid var(--line-2);
  box-shadow: -24px 0 60px -24px rgba(0, 0, 0, 0.85);
  animation: dockIn 0.22s ease-out;
}
@keyframes dockIn {
  from { transform: translateX(26px); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}
.dock-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.dock-tabs { display: flex; gap: 3px; flex: 1; flex-wrap: wrap; }
.dock-tabs button {
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: 0.15s;
}
.dock-tabs button:hover { color: var(--text); background: var(--panel-2); }
.dock-tabs button.on {
  color: var(--gold);
  background: var(--gold-soft);
  border-color: rgba(216, 169, 95, 0.28);
}
.dock-body { flex: 1; min-height: 0; }
.dock-body iframe { width: 100%; height: 100%; border: 0; background: var(--bg-2); }
.dock-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.dock-foot span { font-size: 11px; color: var(--dim); }

/* embed 模式：子页隐藏自己的页头 */
body.embedded { background: var(--bg-2) !important; }
body.embedded .wrap { padding: 14px 16px 48px !important; max-width: none !important; }
body.embedded .page-head { display: none !important; }

/* ---------------- 高级输入 ---------------- */
.adv-badge {
  font-size: 10px;
  color: var(--gold);
  border: 1px solid rgba(216, 169, 95, 0.3);
  background: var(--gold-soft);
  border-radius: 999px;
  padding: 2px 7px;
}
.adv-tabs {
  display: flex;
  gap: 3px;
  margin: 2px 0 10px;
  border-bottom: 1px solid var(--line);
}
.adv-tabs button {
  font-family: inherit;
  font-size: 11.5px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 6px 9px 7px;
  cursor: pointer;
}
.adv-tabs button:hover { color: var(--text); }
.adv-tabs button.on { color: var(--gold); border-bottom-color: var(--gold); }
.adv-panel { display: flex; flex-direction: column; gap: 9px; }
.adv-panel[hidden] { display: none !important; }
.adv-mode { display: flex; gap: 16px; }
.adv-mode .check { margin: 0; }
.adv-misc { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.adv-misc .check { margin: 0; }
.adv-global { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 62px;
  padding: 10px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted);
  cursor: pointer;
  transition: 0.15s;
  text-align: center;
}
.dropzone:hover, .dropzone.over { border-color: var(--gold-dim); background: var(--gold-soft); }
.dropzone b { font-size: 12px; color: var(--text); font-weight: 600; }
.dropzone span { font-size: 10.5px; color: var(--dim); }

.ref-list { display: flex; flex-direction: column; gap: 6px; }
.ref-item {
  display: grid;
  grid-template-columns: 46px 1fr 20px;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
}
.ref-item img { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; }
.ref-title { font-size: 11px; color: var(--text); margin-bottom: 3px; }
.ref-ctl { display: flex; flex-wrap: wrap; gap: 3px 10px; align-items: center; }
.ref-ctl label { font-size: 10.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.ref-ctl input[type="number"] { width: 56px; padding: 2px 4px; font-size: 10.5px; }
.ref-ctl select { padding: 2px 4px; font-size: 10.5px; }

.i2i-preview { position: relative; width: 100%; }
.i2i-preview img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #000;
}
.i2i-preview .icon-btn { position: absolute; top: 6px; right: 6px; }

.char-list { display: flex; flex-direction: column; gap: 5px; }
.char-row {
  display: grid;
  grid-template-columns: 20px 1fr 46px 46px 20px;
  gap: 4px;
  align-items: center;
}
.char-row input[type="text"] { padding: 5px 7px; font-size: 11px; }
.char-row input[type="number"] { padding: 5px 3px; font-size: 10px; text-align: center; }
.char-row .check { margin: 0; }
.char-neg { margin-top: 6px; }
.char-neg .link { font-size: 11px; }

.chunk-add { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 4px; }
.chunk-add input { padding: 5px 7px; font-size: 11px; }
.chunk { display: inline-flex; align-items: center; gap: 2px; }
.chunk .chip { border-radius: 7px 0 0 7px; }
.chunk-del {
  font-family: inherit;
  font-size: 9px;
  color: var(--dim);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 7px 7px 0;
  padding: 4px 6px;
  cursor: pointer;
}
.chunk-del:hover { color: var(--red); }

/* ---------------- 灵感画廊 ---------------- */
.inspire { margin: 0 0 16px; }
.inspire-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.inspire-head span { font-size: 11px; color: var(--muted); letter-spacing: 0.03em; }
.inspire-head .link { font-size: 11px; }
.inspire-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.inspire-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
  height: auto;
  aspect-ratio: 1216 / 832;
  min-height: 148px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: 0.18s;
}
.inspire-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.inspire-art {
  position: absolute;
  inset: 0;
  background-image:
    var(--cover, none),
    radial-gradient(circle at 78% 22%, hsla(var(--h), 62%, 62%, 0.55), transparent 48%),
    linear-gradient(150deg, hsl(var(--h), 34%, 24%), hsl(calc(var(--h) + 42), 40%, 11%));
  background-size: cover, auto, auto;
  background-position: center center, center, center;
  background-repeat: no-repeat;
  opacity: 0.96;
}
.inspire-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(8, 8, 10, 0.92), transparent 62%);
}
.inspire-name, .inspire-cat { position: relative; z-index: 1; }
.inspire-name {
  font-size: 11px;
  line-height: 1.3;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inspire-cat { font-size: 9.5px; color: var(--gold); }
.inspire-model {
  position: absolute;
  top: 8px;
  right: 9px;
  z-index: 2;
  font-size: 9.5px;
  line-height: 1.4;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--gold);
  background: rgba(8, 8, 10, 0.68);
  border: 1px solid rgba(216, 169, 95, 0.38);
  backdrop-filter: blur(4px);
  letter-spacing: 0.2px;
  pointer-events: none;
}

@media (max-width: 1400px) {
  .inspire-card { height: 140px; }
}
@media (max-width: 980px) {
  .inspire-row { grid-template-columns: 1fr; }
  .inspire-card { height: 132px; }
}

/* ============================================================
   视觉增强 —— 只加视觉属性（阴影/过渡/圆角/光晕），不动布局
   ============================================================ */

/* 细滚动条，暗金色，鼠标移上去才明显 */
* { scrollbar-width: thin; scrollbar-color: #2a2a33 transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #24242d;
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #3a3a46; background-clip: content-box; }

/* 选中文字用金色，和主题一致 */
::selection { background: rgba(216, 169, 95, 0.28); color: #fff; }

/* 所有可点元素统一过渡，避免生硬跳变 */
button, a, .preset, .inspire-card, .card, .dock-open, .mbtn {
  transition: background-color .16s ease, border-color .16s ease,
              color .16s ease, transform .16s ease, box-shadow .16s ease;
}

/* 输入区聚焦时给一圈极淡的金色光晕 */
textarea:focus, input:focus, select:focus {
  box-shadow: 0 0 0 3px rgba(216, 169, 95, 0.09);
}

/* 作品卡片：悬停轻微抬起 + 金色描边（原来只有边框变色） */
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(216, 169, 95, 0.35);
  box-shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(216, 169, 95, 0.08);
}

/* 主按钮：悬停时金色微微发亮 */
button:hover:not(:disabled),
.btn:hover:not(:disabled) {
  filter: brightness(1.06);
}
button:active:not(:disabled),
.btn:active:not(:disabled) { transform: translateY(1px); }

/* 设置弹窗：更沉的底、更柔的边、顶部一条金色细线做视觉锚点 */
.modal > div, .modal .sheet, .modal .panel {
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.modal h4 {
  position: relative;
  padding-top: 4px;
}
.modal h4::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 1px;
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  opacity: 0.75;
}

/* 设置里的每一组更透气 */
.modal .setting-row, .modal .field { padding-top: 7px; padding-bottom: 7px; }

/* 分割线用渐变淡出，比实线柔和 */
hr, .divider {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

/* 顶部导航按钮悬停时底色渐入 */
.topnav .dock-open:hover {
  background: rgba(255, 255, 255, 0.035);
}

/* 词库/统计等页面里的空状态，给个居中淡出 */
.empty, .sempty {
  animation: fadeIn .25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* 减少动效偏好时全部关掉 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
