/* ============ NovelAI 幻绘工坊 · 羊皮纸主题 ============ */
:root {
  --bg: #E8DCC4;
  --panel: #FDFBF7;
  --panel-2: #F4EBD0;
  --border-1: #C8B494;
  --border-2: #D9C5A0;
  --border-3: #EADDCA;
  --ink: #4A3B32;
  --ink-2: #5C4A3D;
  --ink-3: #8B7355;
  --ink-4: #A68A61;
  --accent: #D35400;
  --accent-2: #E67E22;
  --accent-deep: #A04000;
  --neg-ink: #8A4A43;
  --neg-border: #E8C8C2;
  --neg-bg: #F9F0ED;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.noise-overlay {
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: .04;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

#generationTiming { font-size: 14px; font-weight: 500; line-height: 1.65; color: var(--ink-2); text-align: center; }
#generationTiming:empty { display: none; }

svg { display: inline-block; vertical-align: middle; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; color: var(--ink-2); }

/* ============ 提示词藏书阁 ============ */
.spell-library { margin-bottom: 12px; border: 1px solid var(--border-1); border-radius: 9px; background: var(--panel); overflow: hidden; }
.spell-library summary { padding: 12px; color: var(--ink-2); background: var(--panel-2); cursor: pointer; font-weight: bold; }
.spell-library summary span { margin-left: 8px; font-size: 11px; font-weight: normal; color: var(--ink-3); }
.spell-content { display: grid; gap: 10px; padding: 12px; }
.spell-content input { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--border-2); border-radius: 5px; background: var(--panel); }
.spell-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.spell-filter { padding: 5px 9px; border: 1px solid var(--border-2); border-radius: 20px; background: transparent; color: var(--ink-3); font-size: 11px; }
.spell-filter[aria-pressed="true"] { background: var(--ink-2); color: var(--panel); border-color: var(--ink-2); }
.spell-target-row, .spell-draft-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; font-size: 12px; }
.spell-target-row select { max-width: 160px; padding: 5px; border: 1px solid var(--border-2); background: var(--panel); border-radius: 4px; }
.spell-list { max-height: 240px; overflow-y: auto; display: grid; gap: 7px; overscroll-behavior: contain; }
.spell-card { border: 1px solid var(--border-3); border-radius: 6px; padding: 10px; background: var(--panel); }
.spell-card-head { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.spell-card h4 { font-size: 12px; }
.spell-card p { color: var(--ink-3); font: 11px/1.6 Consolas, monospace; overflow-wrap: anywhere; margin: 7px 0; }
.spell-card .spell-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.spell-card button { font-size: 11px; }
.spell-save-row { display: flex; gap: 6px; }
.spell-save-row button { flex-shrink: 0; }
.spell-draft-row { margin: 8px 0 12px; }
.spell-draft-row button:disabled { opacity: .45; cursor: default; }
.spell-library button:focus-visible, .spell-library input:focus-visible, .spell-library select:focus-visible, .spell-library summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 480px) { .spell-save-row { flex-direction: column; } .spell-library summary span { display: block; margin: 4px 0 0 16px; } }

/* 角色与参考图沿用卷轴表单的留白和边框。 */
.char-card-head select, #compatModelSelect { padding: 9px; border: 1px solid var(--border-2); border-radius: 6px; background: var(--panel); min-width: 0; }
#compatModelSelect { width: 100%; margin-top: 8px; }
.char-card .char-negative { background: var(--neg-bg); border-color: var(--neg-border); min-height: 76px; margin-top: 10px; }
.char-position { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border-2); }
.char-position-grid { max-width: 280px; margin-top: 8px; }
.char-position button[aria-pressed="true"] { color: var(--panel); background: var(--ink-3); border-color: var(--ink-3); }
#vibeList { display: grid; gap: 16px; margin-top: 16px; }
.vibe-card { display: grid; gap: 12px; padding: 16px; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 10px; }
.vibe-card img { width: 100%; max-height: 220px; object-fit: contain; border-radius: 6px; }
.vibe-card label { display: grid; gap: 8px; font-size: 12px; color: var(--ink-3); }
.vibe-card input[type="range"] { width: 100%; }
#deleteModelBtn { margin-top: 8px; }
#maskFile { max-width: 100%; font-size: 12px; }
button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============ 顶栏 ============ */
.topbar {
  position: relative;
  background: rgba(244, 235, 208, .92);
  backdrop-filter: blur(4px);
  border-bottom: 2px solid var(--border-1);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
  box-shadow: 0 1px 3px rgba(90, 70, 50, .08);
}
.topbar-line {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 2px;
  background: linear-gradient(to right, transparent, #8B7355, transparent);
  opacity: .3;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  background: var(--ink-3);
  padding: 8px;
  border-radius: 10px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.25);
}
.brand-icon svg { width: 22px; height: 22px; color: var(--panel-2); }
.brand h1 { font-size: 20px; font-weight: 700; letter-spacing: 2px; color: var(--ink-2); white-space: nowrap; }
.brand-sub { font-size: 10px; color: var(--ink-4); letter-spacing: 4px; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.pill-group {
  display: flex; gap: 2px;
  background: var(--bg);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border-1);
  box-shadow: inset 0 1px 3px rgba(90,70,50,.12);
}
.pill {
  border: none; background: transparent;
  padding: 6px 14px;
  font-size: 12px; font-weight: 700;
  border-radius: 999px;
  color: var(--ink-3);
  transition: all .18s;
  white-space: nowrap;
}
.pill:hover { background: rgba(217, 197, 160, .5); }
.pill.active { background: var(--ink-3); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }

.anri-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-1);
  box-shadow: inset 0 1px 3px rgba(90,70,50,.12);
  font-size: 13px; font-weight: 500; color: var(--ink-3);
  white-space: nowrap;
}
.anri-box svg { width: 16px; height: 16px; color: var(--accent); }
.anri-box b { color: var(--accent); }

/* ============ 主体布局 ============ */
.layout {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 16px;
  max-width: 1800px;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
  z-index: 10;
  min-height: 0;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(90, 70, 50, .1);
}
.side-panel {
  width: 340px;
  flex-shrink: 0;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}
.result-panel { width: 400px; border: 2px dashed var(--border-1); box-shadow: inset 0 2px 8px rgba(90,70,50,.08); display: flex; flex-direction: column; overflow: hidden; }
.center-panel { flex: 1; min-width: 420px; display: flex; flex-direction: column; overflow: hidden; }

.corner { position: absolute; width: 12px; height: 12px; opacity: .4; z-index: 5; }
.corner-tl { top: 8px; left: 8px; border-top: 1px solid var(--ink-3); border-left: 1px solid var(--ink-3); }
.corner-tr { top: 8px; right: 8px; border-top: 1px solid var(--ink-3); border-right: 1px solid var(--ink-3); }

.panel-body { padding: 20px; display: flex; flex-direction: column; gap: 22px; }

/* ============ 左栏组件 ============ */
.section { display: flex; flex-direction: column; gap: 10px; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 17px; font-weight: 700; color: var(--ink-2);
  border-bottom: 1px solid var(--border-3);
  padding-bottom: 8px;
  background: none; border-top: none; border-left: none; border-right: none;
  text-align: left; width: 100%;
}
.section-title svg { width: 19px; height: 19px; color: var(--ink-4); flex-shrink: 0; }
.section-title.no-border { border-bottom: none; padding-bottom: 0; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-3); padding-bottom: 8px; }
.section-title.collapsible { cursor: pointer; transition: color .15s; }
.section-title.collapsible:hover { color: var(--ink-3); }
.section-title-left { display: flex; align-items: center; gap: 8px; }
.chevron { width: 18px; height: 18px; transition: transform .2s; margin-left: auto; }
.chevron.open { transform: rotate(180deg); }

.size-badge {
  font-size: 12px; font-family: Consolas, monospace;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--ink-3);
  border: 1px solid var(--border-2);
}

.field { position: relative; margin-top: 10px; }
.field-label {
  position: absolute; top: -9px; left: 12px;
  background: var(--panel);
  padding: 0 5px;
  font-size: 12px; font-weight: 700; color: var(--ink-3);
  z-index: 2;
}
.field input, .field select {
  width: 100%;
  background: transparent;
  border: 2px solid var(--border-3);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
  position: relative; z-index: 1;
  transition: border-color .15s;
}
.field input:focus, .field select:focus { border-color: var(--ink-3); }
.field input[type="password"] { padding-right: 38px; font-family: Consolas, monospace; }
.field.small input { padding: 8px 10px; font-size: 13px; }
.field.flex1 { flex: 1; }

.eye-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--ink-3); z-index: 3;
  padding: 4px; display: flex;
}
.eye-btn:hover { color: var(--ink-2); }
.eye-btn svg { width: 16px; height: 16px; }

.select-box {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border-1);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-2);
  box-shadow: inset 0 1px 3px rgba(90,70,50,.1);
  cursor: pointer; outline: none;
}

.add-model-row { display: flex; gap: 6px; }
.add-model-row input {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border-1);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px; outline: none;
}
.add-model-row input::placeholder { color: var(--border-1); }
.add-model-row button {
  padding: 8px 10px;
  background: var(--ink-3); color: #fff;
  border: none; border-radius: 10px;
  display: flex; align-items: center;
  transition: background .15s;
}
.add-model-row button:hover { background: var(--ink-2); }
.add-model-row button svg { width: 14px; height: 14px; }

.hint-box {
  font-size: 10px; color: var(--ink-3);
  background: rgba(244, 235, 208, .6);
  border: 1px solid var(--border-3);
  padding: 8px;
  border-radius: 8px;
}

.size-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.size-btn {
  font-size: 12px; padding: 8px 0;
  border-radius: 10px;
  border: 1px solid var(--border-1);
  background: var(--panel-2);
  color: var(--ink-2);
  transition: all .15s;
}
.size-btn:hover { background: var(--border-3); }
.size-btn.active { background: var(--ink-3); color: #fff; border-color: transparent; box-shadow: 0 1px 3px rgba(0,0,0,.2); }

.wh-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }

.slider-card {
  background: var(--panel-2);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  box-shadow: inset 0 1px 3px rgba(90,70,50,.08);
}
.slider-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.slider-head span:first-child { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.slider-val {
  font-size: 12px; font-family: Consolas, monospace;
  background: var(--panel);
  padding: 0 6px;
  border: 1px solid var(--border-1);
  border-radius: 4px;
  color: var(--ink-3);
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 6px;
  background: var(--border-3);
  border-radius: 8px;
  appearance: none;
  cursor: pointer;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  cursor: pointer;
}

.seed-row { display: flex; gap: 8px; margin-top: 10px; }
.icon-btn {
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-1);
  border-radius: 10px;
  display: flex; align-items: center;
  transition: background .15s;
}
.icon-btn:hover { background: var(--border-3); }
.icon-btn svg { width: 18px; height: 18px; color: var(--ink-3); }

.adv-body { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.check-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-2);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(244,235,208,.4);
}
.check-row input { accent-color: var(--accent); }

/* ============ 中栏 ============ */
.tabbar {
  display: flex; gap: 6px;
  padding: 6px;
  background: var(--border-3);
  border-radius: 14px 14px 0 0;
  box-shadow: inset 0 1px 4px rgba(90,70,50,.12);
  border-bottom: 1px solid var(--border-2);
}
.tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 4px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px; font-weight: 700;
  color: rgba(139, 115, 85, .7);
  transition: all .18s;
}
.tab svg { width: 16px; height: 16px; }
.tab:hover { background: rgba(244, 235, 208, .5); color: var(--ink-3); }
.tab.active { background: var(--panel); color: var(--ink-3); box-shadow: 0 2px 6px rgba(90,70,50,.15); border-color: var(--border-2); }
.tab-label-short { display: none; }

.prompt-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-height: 0;
}
.tab-pane { display: none; flex-direction: column; gap: 18px; }
.tab-pane.active { display: flex; }

.quality-card {
  background: rgba(244, 235, 208, .5);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-3);
}
.quality-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.quality-head > label:first-child { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.quality-card input[type="text"] {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-1);
  padding: 4px;
  font-size: 13px;
  color: var(--ink-3);
  outline: none;
}
.quality-card input[type="text"]:disabled { opacity: .5; }

.switch-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); cursor: pointer; }
.switch { position: relative; display: inline-block; width: 32px; height: 16px; }
.switch input { display: none; }
.switch-track {
  position: absolute; inset: 0;
  background: var(--border-1);
  border-radius: 999px;
  transition: background .2s;
}
.switch-track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }

.mini-hint { font-size: 10px; color: var(--ink-4); margin-top: 4px; }
.mini-hint.mb8 { margin-top: 0; margin-bottom: 8px; font-size: 12px; }
.warn-hint { font-size: 10px; color: var(--accent); margin-top: 4px; }

.prompt-field label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  margin-bottom: 8px;
}
.prompt-field label svg { width: 16px; height: 16px; }
.prompt-field textarea {
  width: 100%; height: 130px;
  background: rgba(244, 235, 208, .2);
  border: 2px solid var(--border-3);
  border-radius: 12px;
  padding: 14px;
  font-size: 13px;
  resize: none;
  outline: none;
  line-height: 1.7;
  transition: border-color .15s;
}
.prompt-field textarea:focus { border-color: var(--ink-3); }
.neg-label { color: var(--neg-ink) !important; }
.neg-textarea {
  height: 90px !important;
  background: rgba(249, 240, 237, .5) !important;
  border-color: var(--neg-border) !important;
  color: var(--neg-ink) !important;
}
.neg-textarea:focus { border-color: #C1827A !important; }

/* 多角色 */
.char-card {
  background: rgba(244,235,208,.4);
  border: 1px solid var(--border-3);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.char-card-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.char-card-head input {
  min-width: 0;
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}
.char-card textarea {
  width: 100%; height: 60px;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  resize: vertical;
  outline: none;
  line-height: 1.6;
}
.char-del {
  background: none; border: none;
  color: var(--neg-ink);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
}
.char-del:hover { background: rgba(138, 74, 67, .1); }
.char-card { background: var(--panel); border-width: 2px; padding: 16px; }
.char-number { background: var(--ink-3); color: white; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; }
.char-genders { display: flex; gap: 4px; padding: 4px; background: var(--panel-2); border: 1px solid var(--border-1); border-radius: 8px; }
.char-genders button { width: 28px; height: 28px; border: 0; border-radius: 4px; color: var(--ink-3); background: transparent; font-size: 16px; }
.char-genders button[aria-pressed="true"] { background: var(--ink-3); color: white; }
.char-card-head .char-del { margin-left: auto; font-size: 12px; }
.char-card-body { display: grid; grid-template-columns: minmax(0,1fr) 160px; gap: 16px; }
.char-prompts label, .char-field-label { display: block; font-size: 10px; font-weight: 700; color: var(--ink-4); }
.char-prompts textarea { display: block; margin-top: 4px; height: 64px; }
.char-prompts .char-uc-label { margin-top: 8px; color: var(--neg-ink); }
.char-prompts .char-negative { margin-top: 4px; min-height: 40px; height: 40px; }
.char-card .char-position { margin-top: 4px; padding: 6px; background: var(--bg); border: 1px solid var(--border-1); border-radius: 8px; }
.char-position > button { width: 100%; }
.char-position-grid { aspect-ratio: 1; margin-top: 4px; }
.char-position .chip-btn { min-width: 0; padding: 2px; font-size: 10px; border-radius: 4px; }
.char-position-grid button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.dashed-btn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 767px) { .char-card-body { grid-template-columns: minmax(0,1fr); } .char-position-grid { max-width: none; } }
.dashed-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 2px dashed var(--border-1);
  border-radius: 12px;
  color: var(--ink-3);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .15s;
}
.dashed-btn:hover { background: rgba(244,235,208,.5); border-color: var(--ink-3); }
.dashed-btn svg { width: 15px; height: 15px; }

/* 上传盒 */
.upload-box {
  position: relative;
  border: 2px dashed var(--border-1);
  border-radius: 12px;
  min-height: 140px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  overflow: hidden;
  background: rgba(244,235,208,.3);
  transition: border-color .15s;
}
.upload-box:hover { border-color: var(--ink-3); }
.upload-inner {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--ink-4); font-size: 12px;
  padding: 20px;
}
.upload-inner svg { width: 28px; height: 28px; }
.upload-preview { max-width: 100%; max-height: 260px; object-fit: contain; display: block; }
.remove-img-btn {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(74, 59, 50, .75);
  color: #fff;
  font-size: 12px;
  z-index: 3;
}

/* 蒙版编辑器 */
.mask-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.mask-tools { display: flex; align-items: center; gap: 10px; }
.brush-label { font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.brush-label input { width: 90px; }
.mask-wrap { border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; background: #2b241d; display: flex; justify-content: center; }
#maskCanvas { max-width: 100%; cursor: crosshair; touch-action: none; }

/* 操作行上方提示区 */
.prompt-notes {
  padding: 0 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notice-card {
  background: rgba(244, 235, 208, .5);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-3);
}
.notice-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.notice-title { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.notice-card .mini-hint { margin-top: 2px; line-height: 1.6; }
.billing-note {
  padding: 8px 12px;
  font-size: 11px; line-height: 1.6;
  color: var(--ink-3);
  background: var(--panel-2);
  border: 1px solid var(--border-3);
  border-radius: 8px;
}
.billing-note strong { color: var(--ink-2); }

/* 操作行 */
.action-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid var(--border-3);
  background: rgba(253, 251, 247, .6);
}
.action-btn {
  padding: 11px 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  color: var(--ink-3);
  border: 2px solid var(--border-1);
  box-shadow: 0 1px 2px rgba(90,70,50,.08);
  transition: all .15s;
}
.action-btn:hover { background: var(--panel-2); }
.action-btn.alt { background: var(--bg); }
.action-btn.alt:hover { background: var(--border-2); }
.action-btn svg { width: 16px; height: 16px; }
.action-btn:disabled, .generate-btn:disabled { opacity: .6; cursor: not-allowed; }

.batch-select {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--panel);
  border: 2px solid var(--border-1);
  box-shadow: 0 1px 2px rgba(90,70,50,.08);
  font-size: 13px; font-weight: 700; color: var(--ink-3);
  transition: all .15s;
}
.batch-select:hover { background: var(--panel-2); }
.batch-select select {
  border: none; background: transparent; outline: none;
  font: inherit; color: var(--ink-2);
  padding: 11px 0;
  cursor: pointer;
}

.generate-btn {
  flex: 1;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(to bottom, var(--accent-2), var(--accent));
  color: var(--panel);
  border: 1px solid var(--accent-deep);
  box-shadow: 0 4px 10px rgba(211, 84, 0, .35);
  transition: all .18s;
  min-width: 180px;
}
.generate-btn:hover:not(:disabled) {
  box-shadow: 0 6px 14px rgba(211, 84, 0, .45);
  transform: translateY(-1px);
  background: linear-gradient(to bottom, var(--accent), #BA4A00);
}
.generate-btn svg { width: 20px; height: 20px; }
.generate-btn.small { font-size: 14px; padding: 10px 20px; min-width: 0; flex: 0; }
.generate-btn .short { display: none; }

/* ============ 右栏 ============ */
.result-tabbar {
  display: flex; gap: 4px;
  padding: 6px;
  background: var(--border-3);
  border-bottom: 1px solid var(--border-2);
  z-index: 2;
}
.result-tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 4px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px; font-weight: 700;
  color: rgba(139, 115, 85, .7);
  transition: all .18s;
}
.result-tab svg { width: 14px; height: 14px; }
.result-tab:hover { background: rgba(244,235,208,.5); }
.result-tab.active { background: var(--panel); color: var(--accent); box-shadow: 0 2px 5px rgba(90,70,50,.15); border-color: var(--border-2); }

.result-pane { display: none; flex: 1; overflow-y: auto; min-height: 0; }
.result-pane.active { display: flex; flex-direction: column; }

.empty-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 24px;
}
.empty-state.small { padding: 40px 24px; }
.empty-circle {
  width: 96px; height: 96px;
  background: var(--bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
  border: 4px solid var(--panel);
  box-shadow: 0 4px 12px rgba(90,70,50,.15);
}
.empty-circle svg { width: 40px; height: 40px; color: var(--border-1); }
.empty-state h3 { color: var(--ink-2); font-size: 22px; margin-bottom: 14px; letter-spacing: 4px; }
.empty-poem { color: var(--ink-3); font-size: 13px; line-height: 1.9; max-width: 250px; margin-bottom: 16px; }

.status-card {
  font-size: 10px; color: var(--ink-4);
  background: rgba(232, 220, 196, .5);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  width: 100%;
  display: flex; flex-direction: column; gap: 4px;
}
.status-row { display: flex; justify-content: space-between; }
.mono { font-family: Consolas, monospace; color: var(--ink-2); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.loading-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 24px;
}
.loading-state h3 { color: var(--ink-2); letter-spacing: 3px; margin: 18px 0 10px; }
.spinner {
  width: 54px; height: 54px;
  border: 4px solid var(--border-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-view { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
#resultImages { display: flex; flex-direction: column; gap: 10px; }
#resultImages img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  cursor: zoom-in;
  box-shadow: 0 2px 8px rgba(90,70,50,.15);
}
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-1);
  background: var(--panel-2);
  color: var(--ink-2);
  font-size: 12px; font-weight: 700;
  transition: all .15s;
}
.chip-btn:hover { background: var(--border-3); }

.history-storage { flex-shrink: 0; padding: 10px 14px; border-bottom: 1px solid var(--border-2); background: var(--panel-2); font-size: 12px; }
.history-storage summary {
  cursor: pointer;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  list-style: none;
  display: flex; align-items: center; gap: 6px;
}
.history-storage summary::-webkit-details-marker { display: none; }
.history-storage summary::before {
  content: "▸";
  font-size: 10px; color: var(--ink-4);
  transition: transform .15s;
}
.history-storage[open] summary { margin-bottom: 6px; }
.history-storage[open] summary::before { transform: rotate(90deg); }
.history-storage label { display: flex; align-items: center; gap: 6px; font-weight: bold; }
.history-storage p { margin: 6px 0; line-height: 1.5; }
.history-storage input { accent-color: var(--accent); }
.history-storage button { font-size: 11px; }
.history-item .history-actions { display: flex; flex-wrap: wrap; gap: 5px; padding: 7px; background: var(--panel); }
.history-item .history-actions button { padding: 4px 7px; font-size: 11px; }
.history-item .history-caption { display: block; padding: 5px 7px 0; font-size: 10px; color: var(--ink-3); }
.history-item .history-open { border: 0; padding: 0; display: block; width: 100%; background: transparent; }
.history-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 14px;
}
.history-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border-2); cursor: pointer; }
.history-item img { width: 100%; height: 130px; object-fit: cover; display: block; }
.history-item .hist-del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(74,59,50,.7);
  color: #fff; font-size: 11px;
  display: none;
}
.history-item:hover .hist-del { display: block; }

/* ============ 移动端导航 ============ */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(244, 235, 208, .95);
  backdrop-filter: blur(4px);
  border-top: 2px solid var(--border-1);
  z-index: 40;
}
.mobile-nav button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: 8px 0;
  background: none; border: none;
  color: var(--ink-3);
  font-size: 10px; font-weight: 700;
}
.mobile-nav button svg { width: 20px; height: 20px; }
.mobile-nav button.active { color: var(--accent); background: rgba(232, 220, 196, .5); }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(60, 45, 30, .55);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--panel);
  border-radius: 14px;
  border: 1px solid var(--border-1);
  width: min(680px, 100%);
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.modal-box.narrow { width: min(380px, 100%); padding: 20px; }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-3);
}
.modal-head h3 { font-size: 15px; color: var(--ink-2); }
.modal-close {
  background: none; border: none;
  font-size: 16px; color: var(--ink-3);
  padding: 4px 8px; border-radius: 6px;
}
.modal-close:hover { background: var(--border-3); }
.modal-close.light { color: #fff; background: rgba(0,0,0,.4); position: absolute; top: 12px; right: 12px; border-radius: 50%; width: 34px; height: 34px; }
.json-pre {
  padding: 16px 18px;
  overflow: auto;
  font-family: Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-all;
  flex: 1;
  min-height: 0;
}
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border-3); display: flex; justify-content: flex-end; gap: 8px; }
.viewer-box { position: relative; max-width: min(92vw, 900px); }
.viewer-box img { max-width: 100%; max-height: 88vh; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.4); display: block; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(74, 59, 50, .92);
  color: #F4EBD0;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  max-width: 80vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: rgba(138, 74, 67, .95); }

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: var(--border-2); border-radius: 20px; border: 2px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background-color: var(--border-1); }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  html, body { height: auto; min-height: 100%; }
  body { overflow: auto; min-height: 100dvh; padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
  .layout { flex: none; }
  .side-panel, .center-panel { flex-shrink: 0; }
  #panelParams { overflow: visible; }
  .mobile-nav { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .topbar { padding: 6px 10px; flex-wrap: wrap; gap: 6px; }
  .brand h1 { font-size: 15px; letter-spacing: 1px; }
  .brand-sub, .anri-box { display: none; }
  .brand-icon { padding: 6px; }
  .brand-icon svg { width: 16px; height: 16px; }
  .pill { padding: 5px 9px; font-size: 10px; }

  .layout {
    flex-direction: column;
    padding: 8px;
    padding-bottom: 64px;
    gap: 8px;
    overflow: visible;
  }
  .side-panel, .result-panel, .center-panel { width: 100%; min-width: 0; display: none; }
  body[data-mpanel="panelParams"] #panelParams { display: block; }
  body[data-mpanel="panelPrompt"] #panelPrompt { display: flex; }
  body[data-mpanel="panelResult"] #panelResult { display: flex; min-height: 70vh; }
  .mobile-nav { display: flex; }
  .tab-label-long { display: none; }
  .tab-label-short { display: inline; }
  .tab { font-size: 11px; gap: 4px; padding: 8px 2px; }
  .action-btn .long { display: none; }
  .generate-btn { font-size: 14px; }
  .generate-btn .long { display: none; }
  .generate-btn .short { display: inline; }
  .prompt-body { padding: 12px; }
  .panel-body { padding: 14px; gap: 16px; }
}
