@font-face {
  font-family: 'Anima Hero Art';
  src: url('/fonts/anima-hero-art.woff2?v=1') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */
/* [主题切换] 公共层：字体 / 圆角 / 缓动（非颜色，两主题共用） */
:root {
  --font-display: 'Cormorant Garamond', 'Songti SC', 'STSong', serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  --r-sm: 6px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 26px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* [玻璃拟态] 磨砂与模糊工具变量 */
  --glass-blur: blur(22px) saturate(160%);
  --glass-blur-sm: blur(12px) saturate(140%);
}

/* [玻璃拟态] 深色层：深空紫黑基底 + 半透明玻璃表面，保留暖金强调色 */
[data-theme="dark"] {
  --bg: #101013;
  --bg-2: rgba(255, 255, 255, 0.05);
  --surface: rgba(255, 255, 255, 0.07);
  --surface-2: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.10);
  --border-2: rgba(255, 255, 255, 0.16);
  --text: #f2efe9;
  --text-dim: #a8a29a;
  --text-mute: #77716a;
  --accent: #e0ad72;
  --accent-2: #c78f52;
  --danger: #e07a6b;
  --ok: #8bc39f;

  --glass: rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(255, 255, 255, 0.11);
  --glass-line: rgba(255, 255, 255, 0.12);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.10);
  --glass-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);

  --aurora-a: rgba(148, 163, 184, 0.13);
  --aurora-b: rgba(96, 152, 162, 0.10);
  --aurora-c: rgba(196, 156, 118, 0.09);
  --aurora-d: rgba(146, 136, 178, 0.10);
}

/* [玻璃拟态] 浅色层：暖白底 + 柔和极光，白色磨砂玻璃表面 */
[data-theme="light"] {
  --bg: #f7f6f3;
  --bg-2: rgba(255, 255, 255, 0.55);
  --surface: rgba(255, 255, 255, 0.64);
  --surface-2: rgba(255, 255, 255, 0.85);
  --border: rgba(30, 24, 16, 0.08);
  --border-2: rgba(30, 24, 16, 0.15);
  --text: #28221a;
  --text-dim: #6d655a;
  --text-mute: #9c9489;
  --accent: #b07a3e;
  --accent-2: #96632c;
  --danger: #b04528;
  --ok: #5a7d5a;

  --glass: rgba(255, 255, 255, 0.64);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-line: rgba(255, 255, 255, 0.85);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --glass-shadow: 0 10px 32px rgba(70, 52, 30, 0.08);

  --aurora-a: rgba(255, 201, 168, 0.32);
  --aurora-b: rgba(193, 182, 255, 0.24);
  --aurora-c: rgba(170, 210, 255, 0.26);
  --aurora-d: rgba(255, 206, 222, 0.22);
}

/* [主题切换] 图标显示：深色显示太阳，浅色显示月亮 */
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* [主题切换] select 下拉列表跟随主题，避免突然弹白色 */
[data-theme="dark"] select { color-scheme: dark; }
[data-theme="light"] select { color-scheme: light; }

/* ---------- reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
  /* [主题切换] 背景与文字色平滑过渡 */
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.app-auth-pending > :not(.grain) {
  visibility: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  border: 0;
  background: none;
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
a {
  color: inherit;
  text-decoration: none;
}

/* ---------- background atmosphere: aurora glass (极光氛围) ---------- */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: -12%;
  pointer-events: none;
}
body::before {
  z-index: -2;
  background:
    radial-gradient(38% 34% at 14% 16%, var(--aurora-a, rgba(212, 163, 115, 0.10)), transparent 70%),
    radial-gradient(32% 30% at 86% 10%, var(--aurora-b, rgba(212, 163, 115, 0.08)), transparent 70%),
    radial-gradient(40% 36% at 82% 86%, var(--aurora-c, rgba(212, 163, 115, 0.07)), transparent 72%),
    radial-gradient(30% 28% at 18% 80%, var(--aurora-d, rgba(212, 163, 115, 0.06)), transparent 70%);
  filter: blur(34px);
  animation: animaAuroraDrift 46s var(--ease) infinite alternate;
}
body::after {
  z-index: -3;
  background:
    radial-gradient(60% 48% at 50% 118%, var(--aurora-b, rgba(212, 163, 115, 0.07)), transparent 66%),
    radial-gradient(48% 42% at 50% -18%, var(--aurora-c, rgba(212, 163, 115, 0.06)), transparent 66%),
    var(--bg);
  animation: animaAuroraBreath 30s ease-in-out infinite alternate;
}
@keyframes animaAuroraDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4%, 3%, 0) scale(1.1); }
}
@keyframes animaAuroraBreath {
  from { opacity: 0.72; transform: translate3d(0, 0, 0) scale(1); }
  to   { opacity: 1; transform: translate3d(-3%, 2%, 0) scale(1.06); }
}
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.7'/></svg>");
}

/* ---------- top nav ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 26px;
  height: 26px;
  display: block;
  flex: 0 0 auto;
  border-radius: 7px;
  background: url('/assets/brand/anima-mark-light.png?v=20260912') center / cover no-repeat;
}

[data-theme="dark"] .brand-mark {
  background-image: url('/assets/brand/anima-mark-dark.png?v=20260912');
}

.brand-word {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.18em;
}
.meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-dim);
  font-size: 12px;
}
.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text);
  background: var(--surface);
}
.model-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulse 2.4s var(--ease) infinite;
}
.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
}

/* ---------- page ---------- */
.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 40px 80px;
}

/* ---------- hero ---------- */
.hero {
  padding: 64px 0 56px;
  max-width: 900px;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--accent);
  margin: 0 0 24px;
  text-transform: uppercase;
}
.title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(48px, 7vw, 96px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
}
.title em {
  font-style: italic;
  color: var(--accent);
}
.sub {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-dim);
  margin: 0;
  max-width: 520px;
}

/* ---------- workbench ---------- */
.workbench {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 24px;
  margin-top: 16px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  position: relative;
  transition: border-color 0.4s var(--ease);
}
.panel:hover {
  border-color: var(--border-2);
}
.panel-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 22px;
}
.panel-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.panel-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* images grid */
.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}
.image-slot {
  aspect-ratio: 4 / 5;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r);
  background: var(--bg-2);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: all 0.3s var(--ease);
}
.image-slot:hover {
  border-color: var(--accent-2);
  background: #110f0c;
}
.image-slot.is-drag {
  border-color: var(--accent);
  background: #15110b;
  transform: scale(1.02);
}
.image-add {
  display: grid;
  place-items: center;
  color: var(--accent-2);
}
.image-add svg {
  opacity: 0.7;
}
.image-item {
  border-style: solid;
  border-color: var(--border);
}
.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: rgba(10, 9, 8, 0.9);
  border: 1px solid var(--border-2);
  border-radius: 50%;
  color: var(--text);
  opacity: 0;
  transition: all 0.2s var(--ease);
  font-size: 12px;
}
.image-item:hover .image-delete {
  opacity: 1;
}
.image-delete:hover {
  background: var(--danger);
  border-color: var(--danger);
}
.image-toolbar {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.image-toolbar .btn-ghost {
  flex: 1;
  padding: 10px;
  justify-content: center;
}
.btn-clear:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-library:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.images-tip {
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-align: center;
}

/* image extra actions */
.image-actions {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.image-item:hover .image-actions {
  opacity: 1;
}
.image-act {
  flex: 1;
  height: 22px;
  display: grid;
  place-items: center;
  background: rgba(10, 9, 8, 0.85);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  transition: all 0.2s var(--ease);
}
.image-act:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.image-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 6px;
  background: var(--accent);
  color: #1a140d;
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.image-item.is-dragging {
  opacity: 0.4;
  transform: scale(0.96);
}
.image-item.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(212, 163, 115, 0.3);
}

/* prompt toolbar */
.prompt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 18px;
}
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--text-dim);
  transition: all 0.2s var(--ease);
}
.chip-btn:hover {
  border-color: var(--accent-2);
  color: var(--text);
  background: #100e0a;
}
.chip-btn.chip-fav:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.chip-btn.chip-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* icon button (settings) */
.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  color: var(--text-dim);
  transition: all 0.2s var(--ease);
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* cancel button */
.btn-cancel {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-cancel:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* history toolbar */
.history-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.history-period-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-2);
}
.history-period-tab {
  min-width: 58px;
  padding: 7px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.history-period-tab:hover {
  color: var(--text);
}
.history-period-tab.is-active,
.history-period-tab[aria-selected="true"] {
  background: var(--accent);
  color: #18120b;
  box-shadow: 0 4px 14px rgba(201, 166, 107, 0.2);
}
.search-box {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-dim);
  transition: border-color 0.2s var(--ease);
}
.search-box:focus-within {
  border-color: var(--accent-2);
}
.search-box input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: 13px;
}
.search-box input::placeholder {
  color: var(--text-mute);
}
.history-actions {
  display: flex;
  gap: 8px;
}

/* history item extra */
.history-item .history-acts {
  display: flex;
  gap: 6px;
  margin-left: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
#imageHistory .history-acts {
  margin-left: 0;
}
.history-downloads {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
.history-act {
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  transition: all 0.2s var(--ease);
}
.history-act:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.history-act.act-del:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ---------- image preview lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  /* 黑色遮罩，突出图片内容 */
  background: rgba(0, 0, 0, 0.94);
  display: none;
  animation: fadeIn 0.2s var(--ease);
  touch-action: none;
  user-select: none;
}
.lightbox:not([hidden]) {
  display: block;
}
.lightbox-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
}
.lightbox-counter {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-family: var(--mono, 'JetBrains Mono', monospace);
  letter-spacing: 0.04em;
  pointer-events: none;
}
.lightbox-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  pointer-events: auto;
}
.lightbox-tool,
.lightbox-close {
  width: 40px;
  height: 40px;
  font-size: 18px;
  line-height: 1;
  color: #f4efe6;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
  cursor: pointer;
}
.lightbox-tool {
  font-size: 16px;
  font-weight: 500;
  border-radius: 999px;
  width: auto;
  min-width: 40px;
  padding: 0 12px;
}
.lightbox-close {
  font-size: 24px;
}
.lightbox-tool:hover,
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.28);
}
.lightbox-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  display: grid;
  place-items: center;
}
.lightbox-viewport.is-dragging {
  cursor: grabbing;
}
/* 完整图片：不裁剪；缩放/平移由 transform 控制 */
.lightbox-viewport img {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  transform-origin: center center;
  will-change: transform;
  pointer-events: none;
  /* 初始 fit 由 JS 设置 width/height 或 transform */
  display: block;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.45);
  color: #f4efe6;
  font-size: 28px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s var(--ease), opacity 0.2s var(--ease);
}
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.16);
}
.lightbox-nav[hidden] {
  display: none !important;
}
.lightbox-prev {
  left: 16px;
}
.lightbox-next {
  right: 16px;
}
.lightbox-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  z-index: 2;
  margin: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  letter-spacing: 0.02em;
  pointer-events: none;
}
@media (max-width: 640px) {
  .lightbox-hint {
    display: none;
  }
  .lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }
  .lightbox-prev {
    left: 8px;
  }
  .lightbox-next {
    right: 8px;
  }
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 40px;
}
.modal:not([hidden]) {
  display: grid;
}
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.25s var(--ease);
}
.modal-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  animation: modalIn 0.3s var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.modal-close {
  width: 30px;
  height: 30px;
  font-size: 22px;
  color: var(--text-dim);
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: all 0.2s var(--ease);
}
.modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* preset list */
.preset-group {
  margin-bottom: 18px;
}
.preset-group-title {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.preset-item {
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 12px;
  color: var(--text);
  text-align: left;
  transition: all 0.2s var(--ease);
  line-height: 1.4;
}
.preset-item:hover {
  border-color: var(--accent);
  background: #100e0a;
}
.preset-item .preset-cat {
  display: block;
  font-size: 10px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  margin-top: 4px;
  letter-spacing: 0.06em;
}

/* prompt list (history / fav) */
.prompt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prompt-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: all 0.2s var(--ease);
}
.prompt-item:hover {
  border-color: var(--border-2);
}
.prompt-item-text {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  cursor: pointer;
  word-break: break-word;
}
.prompt-item-text:hover {
  color: var(--accent);
}
.prompt-item-meta {
  font-size: 10px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  margin-top: 4px;
}
.prompt-empty {
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
  padding: 24px;
}

/* library grid */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.library-item {
  position: relative;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-2);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.library-item:hover {
  border-color: var(--accent);
}
.library-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.library-item .lib-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(10, 9, 8, 0.85);
  border: 1px solid var(--border-2);
  border-radius: 50%;
  color: var(--text);
  font-size: 12px;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: all 0.2s var(--ease);
}
.library-item:hover .lib-del {
  opacity: 1;
}
.library-item .lib-del:hover {
  background: var(--danger);
  border-color: var(--danger);
}
.library-item .lib-add {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #1a140d;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: all 0.2s var(--ease);
}
.library-item:hover .lib-add {
  opacity: 1;
}
.library-upload {
  display: block;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r);
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  cursor: pointer;
  transition: all 0.3s var(--ease);
}
.library-upload:hover {
  border-color: var(--accent);
  background: #15110b;
}

/* settings form */
.settings-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.settings-row label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.settings-row select,
.settings-row input {
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  outline: none;
  font-size: 13px;
}
.settings-row select:focus,
.settings-row input:focus {
  border-color: var(--accent-2);
}

.settings-help {
  color: var(--text-mute);
  font-size: 11px;
  line-height: 1.5;
}

.settings-billing {
  margin: 0 0 20px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--border);
}
.settings-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.settings-section-head strong {
  color: var(--text);
  font-size: 13px;
}
.settings-billing-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.settings-billing-summary > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-2);
}
.settings-billing-summary strong,
.settings-billing-summary span {
  display: block;
}
.settings-billing-summary strong {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-billing-summary span {
  margin-top: 3px;
  color: var(--text-mute);
  font-size: 10px;
}
.settings-ledger {
  max-height: 224px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.settings-ledger-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.settings-ledger-item:last-child {
  border-bottom: 0;
}
.settings-ledger-main {
  min-width: 0;
}
.settings-ledger-main strong,
.settings-ledger-main span,
.settings-ledger-balance {
  display: block;
}
.settings-ledger-main strong {
  overflow: hidden;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-ledger-main span,
.settings-ledger-balance {
  color: var(--text-mute);
  font-size: 10px;
}
.settings-ledger-delta {
  align-self: start;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.settings-ledger-delta.is-debit {
  color: var(--danger);
}
.settings-ledger-delta.is-credit {
  color: var(--ok);
}
.settings-ledger-balance {
  grid-column: 1 / -1;
}
.settings-ledger-empty {
  margin: 0;
  padding: 16px 12px;
  color: var(--text-mute);
  font-size: 11px;
  text-align: center;
}

.settings-security {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* toast */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text);
  z-index: 200;
  opacity: 0;
  transition: all 0.3s var(--ease);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success {
  border-color: var(--ok);
  color: var(--ok);
}
.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}
.face-meta-label::before {
  content: '● ';
  font-size: 8px;
  vertical-align: middle;
}
.face-meta-name {
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* form */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  position: relative;
}
.field label {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.field-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-mute);
}
.field[hidden],
.panel-left[hidden] {
  display: none !important;
}
.field textarea,
.field select {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
  font-size: 15px;
}
.field textarea {
  resize: none;
  font-family: var(--font-ui);
  line-height: 1.6;
  min-height: 100px;
}
.field textarea::placeholder {
  color: var(--text-mute);
}
.field textarea:focus,
.field select:focus {
  border-color: var(--accent-2);
  background: #100e0a;
}
.counter {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-size: 11px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  pointer-events: none;
}
.select {
  position: relative;
}
.select::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select select {
  appearance: none;
  padding-right: 38px;
  cursor: pointer;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.grid-3 .field {
  margin-bottom: 0;
}

/* actions */
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.image-output-summary {
  width: fit-content;
  margin: 18px 0 -10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
}

.image-output-summary[data-state="insufficient"] {
  color: var(--danger);
}

img.image-load-retrying {
  opacity: 0.55;
  transition: opacity 180ms ease;
}
img.image-load-failed {
  opacity: 0.45;
  object-fit: contain;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 6px,
      rgba(255, 80, 80, 0.08) 6px,
      rgba(255, 80, 80, 0.08) 12px
    );
  border: 1px dashed rgba(255, 120, 120, 0.35);
}

/* history reuse image picker */
.reuse-picker-head,
.reuse-picker-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.reuse-picker-head {
  margin-bottom: 14px;
  color: var(--text-mute);
  font-size: 12px;
}
.reuse-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.reuse-picker-item {
  position: relative;
  display: grid;
  grid-template-rows: 104px auto;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-2);
  cursor: pointer;
}
.reuse-picker-item:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.reuse-picker-item input {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  z-index: 1;
}
.reuse-picker-item img {
  width: 100%;
  height: 104px;
  display: block;
  object-fit: cover;
  border-radius: 4px;
  background: #000;
}
.reuse-picker-item span {
  overflow: hidden;
  color: var(--text-dim);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reuse-picker-actions {
  justify-content: flex-end;
  margin-top: 18px;
}
.reuse-picker-actions .btn-primary {
  min-height: 38px;
  width: auto;
  padding: 0 18px;
}
.image-concurrency-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.select-compact select {
  min-width: 68px;
  padding: 9px 32px 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
}
.select-compact::after {
  right: 12px;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  background: var(--accent);
  color: #1a140d;
  border-radius: var(--r);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.04em;
  transition: all 0.25s var(--ease);
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s var(--ease);
}
.btn-primary:hover:not(:disabled) {
  background: #e0b487;
  transform: translateY(-1px);
}
.btn-primary:hover:not(:disabled)::before {
  transform: translateX(100%);
}
.btn-primary:disabled {
  background: var(--surface-2);
  color: var(--text-mute);
  cursor: not-allowed;
}
.btn-primary.is-loading {
  pointer-events: none;
  background: var(--accent-2);
}
.btn-arrow {
  font-size: 18px;
  transition: transform 0.3s var(--ease);
}
.btn-primary:hover:not(:disabled) .btn-arrow {
  transform: translateX(4px);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-mute);
  transition: background 0.3s var(--ease);
}
.status[data-state='ready'] .status-dot {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.status[data-state='working'] .status-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.2s var(--ease) infinite;
}
.status[data-state='error'] .status-dot {
  background: var(--danger);
}

/* ---------- result ---------- */
.result {
  margin-top: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
}
.result-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 22px;
}
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border-2);
}
.stage-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: radial-gradient(ellipse at center, #110f0c 0%, #050403 100%);
  transition: opacity 0.6s var(--ease);
}
.stage-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.loader {
  display: flex;
  gap: 6px;
}
.loader span {
  width: 4px;
  height: 24px;
  background: var(--accent);
  border-radius: 2px;
  animation: bars 1.1s var(--ease) infinite;
}
.loader span:nth-child(2) {
  animation-delay: 0.12s;
}
.loader span:nth-child(3) {
  animation-delay: 0.24s;
}
.loader span:nth-child(4) {
  animation-delay: 0.36s;
}
.stage-text {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}
.result-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--text);
  transition: all 0.2s var(--ease);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.result-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}

/* ---------- history ---------- */
.history {
  margin-top: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
}
.history-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: all 0.2s var(--ease);
}
.history-item:hover {
  border-color: var(--border-2);
  background: #100e0a;
}
.history-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
}
.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.history-thumb-preview {
  cursor: zoom-in;
  outline: none;
  transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}
.history-thumb-preview:hover,
.history-thumb-preview:focus-visible {
  box-shadow: 0 0 0 2px var(--accent, #c9a66b);
  transform: scale(1.03);
}
.history-info {
  flex: 1;
  min-width: 0;
}
.history-prompt {
  font-size: 13px;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-meta {
  font-size: 11px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  margin-top: 4px;
}
.history-empty {
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
  font-family: var(--font-mono);
  margin: 0;
  padding: 24px;
}

.modal-panel:has(.image-history-detail) {
  width: min(760px, 100%);
}
.image-history-detail {
  display: grid;
  gap: 20px;
}
.image-history-detail-section {
  display: grid;
  gap: 10px;
}
.image-history-detail-section > .chip-btn {
  justify-self: start;
}
.image-history-detail-label {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
}
.image-history-detail-prompt {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.image-history-detail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.image-history-detail-media {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-2);
}
.image-history-detail-media img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.image-history-detail-media figcaption {
  padding: 7px 9px;
  color: var(--text-mute);
  font-size: 11px;
}
.image-history-detail-empty {
  margin: 0;
  color: var(--text-mute);
  font-size: 13px;
}
.image-history-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--border);
}
.image-history-detail-meta > div {
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.image-history-detail-meta dt,
.image-history-detail-meta dd {
  margin: 0;
  font-size: 12px;
}
.image-history-detail-meta dt {
  color: var(--text-mute);
}
.image-history-detail-meta dd {
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .image-history-detail-meta {
    grid-template-columns: 1fr;
  }
}

/* ---------- footer ---------- */
.foot {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 40px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-mute);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

/* ---------- animations ---------- */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
@keyframes bars {
  0%, 100% {
    transform: scaleY(0.4);
    opacity: 0.4;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}
.fade-in {
  animation: fadeIn 0.6s var(--ease) both;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- tab switch ---------- */
.tab-switch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}
.tab-btn {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--text-dim);
  transition: all 0.25s var(--ease);
  border: 1px solid transparent;
}
.canvas-entry {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  background: var(--accent);
  color: #1a140d;
  font-weight: 500;
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
  animation: fadeIn 0.35s var(--ease);
}

/* ---------- grid-2 ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.grid-2 .field {
  margin-bottom: 0;
}

/* ---------- image result grid ---------- */
.image-queue-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -8px 0 12px;
  color: var(--text-dim);
  font: 11px/1.4 var(--font-mono);
}
.image-task-list {
  border-top: 1px solid var(--border);
  margin-bottom: 20px;
}
.image-task-card {
  display: grid;
  gap: 10px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.image-task-head,
.image-task-meta,
.image-task-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.image-task-head > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.image-task-head strong {
  font-size: 13px;
  font-weight: 600;
}
.image-task-head div > span,
.image-task-meta {
  color: var(--text-mute);
  font: 10px/1.4 var(--font-mono);
}
.image-task-state {
  flex: none;
  padding: 3px 8px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  color: var(--text-dim);
  font: 10px/1.4 var(--font-mono);
}
.image-task-card.is-active .image-task-state {
  border-color: var(--accent-2);
  color: var(--accent);
}
.image-task-card.is-completed .image-task-state {
  border-color: var(--ok);
  color: var(--ok);
}
.image-task-card.is-failed .image-task-state,
.image-task-card.is-cancelled .image-task-state {
  border-color: var(--danger);
  color: var(--danger);
}
.image-task-prompt,
.image-task-error {
  margin: 0;
  overflow-wrap: anywhere;
}
.image-task-prompt {
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
}
.image-task-error {
  color: var(--danger);
  font-size: 11px;
}
.image-task-progress {
  height: 4px;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 2px;
}
.image-task-progress span {
  display: block;
  height: 100%;
  min-width: 0;
  background: var(--accent);
  transition: width 0.35s var(--ease);
}
.image-task-card.is-completed .image-task-progress span {
  background: var(--ok);
}
.image-task-card.is-failed .image-task-progress span,
.image-task-card.is-cancelled .image-task-progress span {
  background: var(--danger);
}
.image-task-actions {
  justify-content: flex-end;
}
.image-task-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}
.image-task-result {
  position: relative;
  min-width: 0;
}
.image-task-thumb {
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  background: #000;
}
.image-task-thumb:hover,
.image-task-thumb:focus-visible {
  border-color: var(--accent);
}
.image-task-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.image-task-download,
.image-download-button {
  position: absolute;
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(8, 8, 8, 0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}
.image-task-download {
  right: 6px;
  bottom: 6px;
  padding: 4px 8px;
}
.image-download-button {
  top: 10px;
  right: 10px;
  padding: 7px 12px;
}
.image-task-download:hover,
.image-download-button:hover,
.image-task-download:focus-visible,
.image-download-button:focus-visible {
  border-color: var(--accent);
  background: rgba(8, 8, 8, 0.96);
  color: var(--accent);
}
/* [成片展示] 图片成片区：完整展示生成图，支持预览与放大 */
.image-stage {
  aspect-ratio: auto;
  min-height: 240px;
  /* [成片展示] 预览区保持黑底，避免浅色主题影响观感 */
  background: #000;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
}
.image-result-grid {
  display: grid;
  /* [成片展示] 卡片更宽，减少多图时的过度裁切感 */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 16px;
  align-items: start;
}
/* [成片展示] 单张结果时占满舞台，便于完整预览 */
.image-result-grid:has(.image-result-item:only-child) {
  grid-template-columns: minmax(0, 1fr);
}
.image-result-item {
  position: relative;
  /* [成片展示] 取消强制 1:1，按图片真实比例完整呈现 */
  aspect-ratio: auto;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border-2);
  background: #000;
  cursor: zoom-in;
}
.image-result-item img {
  width: 100%;
  height: auto;
  max-width: 100%;
  /* [成片展示] 使用图片自然比例；长图由成片区纵向滚动完整查看 */
  max-height: none;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto;
  background: #000;
  cursor: zoom-in;
}
.image-result-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  z-index: 2;
}
.image-result-item:hover .image-result-actions,
.image-result-item:focus-within .image-result-actions {
  opacity: 1;
}
/* [成片展示] 触控设备无 hover，始终露出操作条 */
@media (hover: none) {
  .image-result-actions {
    opacity: 1;
  }
}
.image-result-actions .btn-ghost {
  flex: 1;
  min-width: 0;
  justify-content: center;
  padding: 6px 10px;
  font-size: 11px;
  background: rgba(10, 9, 8, 0.85);
  color: #f4efe6;
  border-color: rgba(255, 255, 255, 0.18);
}
.image-result-actions .btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .top,
  .page,
  .foot {
    padding-left: 20px;
    padding-right: 20px;
  }
  .workbench {
    grid-template-columns: 1fr;
  }
  .hero {
    padding: 32px 0 32px;
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .actions {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .btn-primary {
    justify-content: center;
  }
  .status {
    justify-content: center;
  }
  .foot {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .kbd {
    display: none;
  }
}

@media (max-width: 640px) {
  #imageTab .actions {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .image-concurrency-control {
    width: 100%;
    justify-content: space-between;
  }
  #imageGenerateBtn {
    flex: 1;
    justify-content: center;
  }
  #imageStatus {
    width: 100%;
  }
  .image-task-head,
  .image-task-head > div {
    align-items: flex-start;
  }
  .image-task-head > div {
    flex-direction: column;
    gap: 3px;
  }
  .image-task-results {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .top {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 12px;
  }
  .meta {
    width: 100%;
    min-width: 0;
    gap: 8px;
  }
  .tab-switch {
    flex: 1;
    min-width: 0;
  }
  .tab-btn {
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
    white-space: nowrap;
  }
  .user-info {
    min-width: 0;
    max-width: 42%;
    padding: 6px 8px;
  }
  .user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ---------- 用户信息 ---------- */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 999px;
}
.user-name {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text);
}
.user-role {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--accent);
  color: #1a140d;
  border-radius: 4px;
  font-weight: 500;
}
.user-connection {
  font-size: 10px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.user-connection[data-state="offline"] {
  color: var(--danger);
}

/* ---------- 管理员面板 ---------- */
.admin-users {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-user-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.admin-user-info {
  flex: 1;
}
.admin-user-name {
  font-size: 14px;
  color: var(--text);
}
.admin-user-meta {
  font-size: 11px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.admin-user-role {
  font-size: 10px;
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
}
.admin-user-role.admin {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a140d;
}
.admin-user-actions {
  display: flex;
  gap: 6px;
}
.admin-user-actions .history-act {
  padding: 6px 10px;
  font-size: 10px;
}


/* ============================================================
   [主题切换] 组件过渡 + 浅色专属适配 + reduced-motion
   ============================================================ */

/* [主题切换] 主要交互面过渡：背景 / 边框 / 文字 */
.panel {
  transition: border-color 0.4s var(--ease), background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.btn-primary {
  transition: all 0.25s var(--ease), background-color 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.btn-ghost {
  transition: all 0.2s var(--ease), background-color 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.chip-btn {
  transition: all 0.2s var(--ease), background-color 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.field textarea,
.field select {
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.icon-btn {
  transition: all 0.2s var(--ease), background-color 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.tab-btn {
  transition: all 0.25s var(--ease), background-color 0.3s var(--ease), border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.search-box {
  transition: border-color 0.2s var(--ease), background-color 0.3s var(--ease), color 0.3s var(--ease);
}

/* [主题切换] 尊重系统减少动效偏好，过渡降级为瞬时 */
@media (prefers-reduced-motion: reduce) {
  body,
  .panel,
  .btn-primary,
  .btn-ghost,
  .chip-btn,
  .field textarea,
  .field select,
  .icon-btn,
  .tab-btn,
  .search-box {
    transition: none !important;
  }
}

/* ---------- [主题切换] 浅色模式专属覆盖（硬编码深色值） ---------- */

/* [主题切换] 浅色：背景径向渐变光晕改为更淡的暖棕 */
/* [玻璃拟态] 浅色层极光由顶部 aurora 系统（body::before/::after + --aurora-*）统一提供 */

/* [主题切换] 浅色：噪点更淡，改 multiply 避免发灰 */
[data-theme="light"] .grain {
  opacity: 0.025;
  mix-blend-mode: multiply;
}

/* [主题切换] stage / lightbox 始终黑底，两主题都不改（规则保持 #000 / rgba 黑遮罩） */

/* [主题切换] 浅色：模态遮罩略淡 */
[data-theme="light"] .modal-mask {
  background: rgba(0, 0, 0, 0.5);
}

/* [主题切换] 浅色：image-slot hover / 拖拽背景 */
[data-theme="light"] .image-slot:hover {
  background: #f3ede3;
}
[data-theme="light"] .image-slot.is-drag {
  background: #f7f2ea;
}

/* [主题切换] 浅色：chip-btn hover */
[data-theme="light"] .chip-btn:hover {
  background: #f3ede3;
}

/* [主题切换] 浅色：textarea/select focus 背景为纯白 */
[data-theme="light"] .field textarea:focus,
[data-theme="light"] .field select:focus {
  background: #ffffff;
}

/* [主题切换] 浅色：预设项 hover */
[data-theme="light"] .preset-item:hover {
  background: #f3ede3;
}

/* [主题切换] 浅色：历史项 hover */
[data-theme="light"] .history-item:hover {
  background: #f3ede3;
}

/* [主题切换] 浅色：素材库上传 hover */
[data-theme="light"] .library-upload:hover {
  background: #f7f2ea;
}

/* [主题切换] 浅色：Toast 阴影减弱 */
[data-theme="light"] .toast {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* [主题切换] 浅色：模态面板 / 登录面板加柔和阴影 */
[data-theme="light"] .modal-panel {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .auth-panel {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

/* [主题切换] 浅色：主按钮 hover 用更深的强调色 */
[data-theme="light"] .btn-primary:hover:not(:disabled) {
  background: #8a5a2e;
  color: #1a140d;
}


/* history batch export selection */
.history-check {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
}
.history-check input.history-select {
  width: 16px;
  height: 16px;
  accent-color: var(--accent, #c9a66b);
  cursor: pointer;
}
.history-item.is-selected {
  border-color: color-mix(in srgb, var(--accent, #c9a66b) 55%, var(--border));
}

/* ============================================================
   Full-screen workspace layout
   The desktop canvas stays within the viewport; long content scrolls
   inside the composer and activity regions instead of the document.
   ============================================================ */

:root {
  --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 8px;
}

.grain,
.kicker,
.panel-num,
.btn-arrow {
  display: none;
}

.top {
  width: 100%;
  max-width: none;
  height: 60px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px);
  position: relative;
  z-index: 20;
}

.brand-word {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.brand-mark {
  border-radius: 7px;
}

.meta {
  gap: 8px;
}

.tab-switch,
.user-info {
  border-radius: var(--r);
}

.tab-switch {
  padding: 3px;
}

.tab-btn {
  min-height: 30px;
  padding: 5px 13px;
  border-radius: var(--r-sm);
  font-family: var(--font-ui);
  font-weight: 550;
  letter-spacing: 0;
}

.user-info {
  padding: 4px 6px 4px 10px;
}

.user-name,
.user-connection,
.user-role {
  font-family: var(--font-ui);
}
.user-balance {
  padding-left: 9px;
  border-left: 1px solid var(--border-2);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

.page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 24px 20px;
}

.tab-panel.active {
  animation: none;
}

.hero {
  max-width: none;
  min-width: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 18px;
}

.title {
  flex: none;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 25px;
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: 0;
}

.title em {
  font-style: normal;
  display: inline-block;
  font-family: 'Anima Hero Art', 'STKaiti', 'KaiTi', serif;
  font-size: 1.34em;
  font-weight: 400;
  line-height: 0.82;
  letter-spacing: 0.04em;
  white-space: nowrap;
  vertical-align: -0.08em;
  transform: rotate(-2deg);
  transform-origin: center;
  font-synthesis: none;
}

.sub {
  margin: 0;
  max-width: none;
  color: var(--text-mute);
  font-size: 13px;
  line-height: 1.5;
}

.workspace-shell {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(380px, 5fr) minmax(500px, 7fr);
  gap: 12px;
}

/* Upload and prompt remain separate semantic sections inside one surface. */
.workbench {
  min-width: 0;
  min-height: 0;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

.workbench::-webkit-scrollbar,
.activity-stack::-webkit-scrollbar {
  width: 8px;
}

.workbench::-webkit-scrollbar-track,
.activity-stack::-webkit-scrollbar-track {
  background: transparent;
}

.workbench::-webkit-scrollbar-thumb,
.activity-stack::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border: 2px solid var(--surface);
  border-radius: 8px;
}

.workbench > .panel {
  min-width: 0;
  padding: 20px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.workbench > .panel + .panel {
  border-top: 1px solid var(--border);
}

.workbench > .panel:hover {
  border-color: var(--border);
}

/* Image generation uses one dense vertical flow. The optional reference strip
   disappears without reserving a column for text-only models. */
#imageWorkbench {
  grid-template-columns: minmax(0, 1fr);
}

#imageWorkbench > .image-reference-panel {
  padding-bottom: 14px;
}

#imageWorkbench > .image-composer-panel {
  padding-top: 16px;
}

#imageWorkbench > .image-reference-panel + .image-composer-panel {
  border-top: 1px solid var(--border);
}

#imageWorkbench.is-text-only > .image-composer-panel {
  padding-top: 20px;
  border-top: 0;
}

#imageWorkbench .image-reference-panel .panel-head {
  margin-bottom: 9px;
}

#imageWorkbench .image-reference-panel .images-grid {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

#imageWorkbench .image-reference-panel .image-slot {
  width: 76px;
  min-width: 76px;
  height: 72px;
  max-height: 72px;
  aspect-ratio: auto;
}

#imageWorkbench .image-reference-panel .image-add {
  width: 100%;
  min-width: 104px;
  flex: 1 0 104px;
}

#imageWorkbench .image-reference-panel:has(.image-item) .image-add {
  max-width: 76px;
  min-width: 76px;
  flex-basis: 76px;
}

#imageWorkbench .image-reference-panel .image-toolbar,
#imageWorkbench .image-reference-panel .images-tip {
  margin-top: 7px;
}

#imageWorkbench .image-reference-panel .images-tip {
  margin-bottom: 0;
  font-size: 10px;
  line-height: 1.35;
}

.panel-head,
.result-head {
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-title {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: 0;
}

.panel-hint {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0;
}

.images-grid {
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
}

.image-slot {
  max-height: 136px;
  border-width: 1px;
}

.image-toolbar {
  margin-top: 10px;
}

.images-tip {
  margin-top: 10px;
  text-align: left;
  font-family: var(--font-ui);
  letter-spacing: 0;
}

.field {
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0;
  text-transform: none;
}

.field textarea,
.field select {
  padding: 11px 12px;
  font-size: 13px;
}

.field textarea {
  min-height: 82px;
}

#imagePrompt {
  min-height: 104px;
  max-height: 60vh;
  resize: vertical;
}

.image-parameter-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px 16px;
}

.image-parameter {
  min-width: 0;
}

#imageModelField,
#imageSizeField {
  grid-column: 1 / -1;
}

.image-parameter[hidden] {
  display: none !important;
}

.image-parameter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.image-parameter-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.image-parameter-hint {
  min-width: 0;
  overflow: hidden;
  color: var(--text-mute);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-search-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.image-search-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}

.image-search-options input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.image-search-options label:has(input:disabled) {
  opacity: .45;
  cursor: not-allowed;
}
.image-concurrency-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}
.image-choice-concurrency {
  width: auto;
  min-height: 38px;
  padding: 5px;
}

.image-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.image-model-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.image-choice-button {
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-2);
  color: var(--text-dim);
  cursor: pointer;
  font: inherit;
  text-align: center;
  transition: border-color 150ms var(--ease), background 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease);
}

.image-choice-button:hover {
  border-color: var(--border-2);
  color: var(--text);
}

.image-choice-button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 68%, transparent);
  outline-offset: 2px;
}

.image-choice-button.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-2));
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 36%, transparent);
}

.image-choice-title {
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-choice-detail {
  max-width: 100%;
  overflow: hidden;
  color: var(--text-mute);
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-choice-button.is-selected .image-choice-detail {
  color: var(--text-dim);
}

.image-model-options .image-choice-detail {
  overflow: visible;
  line-height: 1.4;
  text-overflow: clip;
  white-space: normal;
}

.image-size-groups {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.image-size-group {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
}

.image-size-group-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-mute);
  font-size: 10px;
  font-weight: 650;
  line-height: 1;
  text-align: center;
}

.image-size-group-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.image-size-group-square .image-size-group-choices,
.image-size-group-auto .image-size-group-choices {
  grid-template-columns: minmax(0, 1fr);
}

.image-choice-size {
  min-height: 42px;
  padding: 6px 4px;
  flex-direction: row;
  gap: 6px;
}

.image-ratio-icon {
  width: 12px;
  height: 12px;
  flex: none;
  border: 1px solid currentColor;
  border-radius: 2px;
  opacity: 0.72;
}

.image-ratio-landscape {
  width: 15px;
  height: 10px;
}

.image-ratio-portrait {
  width: 9px;
  height: 15px;
}

.image-ratio-auto {
  border-style: dashed;
  border-radius: 50%;
}

.image-resolution-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.image-count-parameter {
  padding: 13px 14px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-2);
}

.image-concurrency-parameter {
  padding: 13px 14px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-2);
}

.image-count-value {
  min-width: 48px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 650;
  text-align: right;
}

.image-count-range {
  --range-progress: 0%;
  width: 100%;
  height: 18px;
  margin: 2px 0 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.image-count-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--range-progress), var(--border-2) var(--range-progress));
}

.image-count-range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--border-2);
}

.image-count-range::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.image-count-range::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -7px;
  appearance: none;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 70%, var(--border));
}

.image-count-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}

.image-count-range:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 68%, transparent);
  outline-offset: 4px;
}

.image-range-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 1px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 10px;
}

.prompt-toolbar {
  gap: 6px;
  margin: -2px 0 14px;
}

.chip-btn {
  padding: 6px 9px;
  border-radius: var(--r-sm);
  font-family: var(--font-ui);
  letter-spacing: 0;
}

.grid-3,
.grid-2 {
  gap: 10px;
}

.actions {
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
}

.btn-primary {
  min-height: 42px;
  padding: 11px 18px;
  justify-content: center;
  letter-spacing: 0;
}

.btn-primary::before {
  display: none;
}

.status {
  margin-left: auto;
  font-family: var(--font-ui);
  letter-spacing: 0;
}

.activity-stack {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

.activity-head {
  min-height: 57px;
  padding: 13px 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 4;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(12px);
}

.activity-head h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 650;
}

.activity-head p {
  margin: 2px 0 0;
  color: var(--text-mute);
  font-size: 11px;
  line-height: 1.35;
}

.activity-empty {
  flex: 1;
  min-height: 260px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-mute);
}

.activity-empty::before {
  content: '';
  width: 52px;
  height: 38px;
  margin-bottom: 16px;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  box-shadow: 9px 9px 0 -3px var(--surface), 9px 9px 0 -2px var(--border);
}

.activity-empty strong {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
}

.activity-empty span {
  max-width: 360px;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
}

.activity-stack:has(.result:not([hidden]), .history:not([hidden])) .activity-empty {
  display: none;
}

.activity-stack > .result,
.activity-stack > .history {
  flex: none;
  margin: 0;
  padding: 18px 20px 20px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.activity-stack > .result + .history {
  border-top: 1px solid var(--border);
}

.activity-stack .stage {
  max-height: 58vh;
}
.activity-stack .image-stage {
  max-height: min(72vh, 1000px);
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
}

.activity-stack .history-list {
  margin-top: 10px;
  gap: 8px;
}

.activity-stack .history-item {
  padding: 10px;
  border-radius: var(--r-sm);
}

.activity-stack .history-toolbar {
  margin-bottom: 10px;
}

.activity-stack .history-empty {
  padding: 18px;
}

.image-task-list {
  margin-bottom: 14px;
}

.image-task-card {
  padding: 12px 0;
}

.image-stage {
  min-height: 220px;
}

.image-result-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  padding: 10px;
}

.foot {
  display: none;
}

@media (min-width: 961px) {
  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    overflow: hidden;
  }

  .page {
    height: calc(100dvh - 60px);
  }

  .tab-panel.active {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: 68px minmax(0, 1fr);
  }

  .workspace-shell {
    padding-bottom: 0;
  }
}

@media (min-width: 1500px) {
  .workspace-shell {
    grid-template-columns: minmax(440px, 4fr) minmax(720px, 7fr);
  }

  .workbench {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  }

  #imageWorkbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .workbench > .panel + .panel {
    border-top: 0;
    border-left: 1px solid var(--border);
  }

  #imageWorkbench > .image-reference-panel + .image-composer-panel {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .image-slot {
    max-height: 152px;
  }
}

@media (max-width: 1100px) and (min-width: 961px) {
  .workspace-shell {
    grid-template-columns: minmax(360px, 0.9fr) minmax(500px, 1.1fr);
  }

  .top,
  .page {
    padding-left: 16px;
    padding-right: 16px;
  }

  .sub,
  .kbd {
    display: none;
  }
}

@media (max-height: 820px) and (min-width: 961px) {
  .tab-panel.active {
    grid-template-rows: 56px minmax(0, 1fr);
  }

  .title {
    font-size: 22px;
  }

  .workbench > .panel {
    padding: 14px 16px;
  }

  .panel-head,
  .result-head {
    margin-bottom: 8px;
  }

  .image-slot {
    max-height: 108px;
  }

  .images-tip {
    margin-top: 7px;
  }

  .field {
    margin-bottom: 10px;
  }

  .field textarea {
    min-height: 70px;
  }

  #imagePrompt {
    min-height: 82px;
  }

  .image-parameter-list {
    gap: 10px 12px;
  }

  .image-parameter-head {
    margin-bottom: 6px;
  }

  .image-choice-button {
    min-height: 34px;
    padding: 6px 8px;
  }

  .image-choice-size {
    min-height: 32px;
  }

  .prompt-toolbar {
    margin-bottom: 10px;
  }

  .actions {
    margin-top: 12px;
    padding-top: 12px;
  }
}

@media (max-width: 960px) {
  body {
    min-height: 100dvh;
    overflow-y: auto;
  }

  .top {
    position: sticky;
    top: 0;
  }

  .page {
    padding: 0 16px 24px;
  }

  .hero {
    min-height: 62px;
  }

  .workspace-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .workbench,
  .activity-stack {
    overflow: visible;
  }

  .activity-stack {
    min-height: 360px;
  }

  .activity-head {
    position: static;
  }

  .activity-stack .stage {
    max-height: none;
  }

  .activity-stack .image-stage {
    max-height: 70vh;
    overflow-y: auto;
  }
}

@media (max-width: 640px) {
  .top {
    height: auto;
    min-height: 58px;
    padding: 10px 12px;
    gap: 8px;
  }

  .brand-word {
    display: none;
  }

  .meta {
    width: auto;
    flex: 1;
    justify-content: flex-end;
  }

  .tab-switch {
    flex: 1;
  }

  .tab-btn {
    flex: 1;
    padding-inline: 8px;
  }

  .user-info {
    max-width: 34%;
  }

  .user-role,
  .user-connection {
    display: none;
  }

  .page {
    padding-inline: 12px;
  }

  .hero {
    min-height: 72px;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
  }

  .title {
    font-size: 21px;
  }

  .sub {
    font-size: 12px;
  }

  .workbench > .panel,
  .activity-stack > .result,
  .activity-stack > .history {
    padding: 16px;
  }

  .images-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .image-slot {
    max-height: none;
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .image-choice-grid,
  .image-model-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-parameter-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .image-parameter {
    grid-column: 1 / -1;
  }

  .image-resolution-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .image-parameter-head {
    align-items: flex-start;
  }

  .image-parameter-hint {
    max-width: 62%;
    white-space: normal;
  }

  #imageTab .grid-2:last-of-type .field:last-child {
    grid-column: 1 / -1;
  }

  .actions {
    align-items: stretch;
  }

  .status {
    margin-left: 0;
    justify-content: center;
  }

  .history-toolbar,
  .history-actions {
    width: 100%;
  }

  .history-period-tabs {
    width: 100%;
  }

  .history-period-tab {
    flex: 1;
  }

  .search-box {
    min-width: 0;
    width: 100%;
  }

  .history-actions > * {
    flex: 1;
    justify-content: center;
  }

  .history-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .history-item .history-acts {
    width: 100%;
    margin-left: 30px;
  }

  #imageHistory .history-acts {
    margin-left: 0;
  }
}

@media (max-width: 420px) {
  .meta > .icon-btn,
  .user-info {
    display: none;
  }

  .prompt-toolbar .chip-btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }

  .activity-empty {
    min-height: 220px;
    padding: 24px 18px;
  }
}

@media (max-width: 350px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 .field:last-child {
    grid-column: 1 / -1;
  }
}

/* ---------- unified task feed ---------- */
.activity-stack .activity-head {
  min-height: 0;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
  position: static;
  flex: none;
}

.activity-title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.activity-title-row > div {
  min-width: 0;
}

.activity-tools-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(150px, 210px);
  align-items: center;
  gap: 10px;
}

.image-task-search {
  min-width: 0;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-mute);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}

.image-task-search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.image-task-search input {
  min-width: 0;
  width: 100%;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 11px;
}

.image-task-search input::placeholder {
  color: var(--text-mute);
}

.image-task-search input::-webkit-search-cancel-button {
  opacity: .55;
}

.image-task-period-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.image-task-period-tabs button {
  min-width: 0;
  padding: 6px 10px;
  color: var(--text-mute);
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.2;
  transition: color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}

.image-task-period-tabs button:hover {
  color: var(--text);
}

.image-task-period-tabs button.is-active,
.image-task-period-tabs button[aria-selected="true"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 4px color-mix(in srgb, #000 8%, transparent);
}

.activity-stack .image-task-list {
  width: 100%;
  margin: 0;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.activity-stack .image-task-list > .activity-empty {
  min-height: 360px;
}

.activity-stack .image-task-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
  display: grid;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 30px color-mix(in srgb, #000 5%, transparent);
}

.activity-stack .image-task-head {
  padding: 18px 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.activity-stack .image-task-state {
  flex: none;
  padding: 5px 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font: 600 11px/1.2 var(--font-ui);
}

.activity-stack .image-task-state::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 14%, transparent);
}

.activity-stack .image-task-card.is-active .image-task-state {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.activity-stack .image-task-card.is-active .image-task-state::before {
  animation: task-state-pulse 1.4s ease-out infinite;
  animation-delay: var(--task-loading-delay, 0ms);
}

.activity-stack .image-task-card.is-completed .image-task-state {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 38%, var(--border));
  background: color-mix(in srgb, var(--ok) 10%, var(--surface));
}

.activity-stack .image-task-card.is-failed .image-task-state,
.activity-stack .image-task-card.is-cancelled .image-task-state {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 34%, var(--border));
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
}

.image-task-head-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--text-mute);
  font: 11px/1.3 var(--font-mono);
}

.image-task-head-meta > span {
  max-width: 180px;
  padding: 3px 7px;
  overflow: hidden;
  color: var(--text-dim);
  background: var(--surface-2);
  border-radius: 5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-task-head-meta i {
  font-style: normal;
}

.activity-stack .image-task-prompt {
  margin: 0;
  padding: 8px 18px 0;
  overflow: hidden;
  display: -webkit-box;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.activity-stack .image-task-card.is-prompt-expanded .image-task-prompt {
  display: block;
}

.image-task-prompt-toggle {
  width: fit-content;
  margin: 6px 18px 14px;
  padding: 0;
  color: var(--text-mute);
  font-size: 11px;
}

.image-task-prompt-toggle:hover {
  color: var(--accent);
}

.activity-stack .image-task-progress {
  height: 2px;
  margin: 14px 18px 0;
  background: var(--border);
  border-radius: 999px;
}

.activity-stack .image-task-card.is-completed .image-task-progress {
  display: none;
}

.activity-stack .image-task-progress span {
  border-radius: inherit;
}

.activity-stack .image-task-progress.is-indeterminate {
  overflow: hidden;
}

.activity-stack .image-task-progress.is-indeterminate span {
  width: 38%;
  min-width: 72px;
  background: linear-gradient(90deg, transparent, var(--accent) 42%, var(--accent-2) 58%, transparent);
  animation: task-progress-loading 1.4s ease-in-out infinite;
  animation-delay: var(--task-loading-delay, 0ms);
  will-change: transform;
}

.activity-stack .image-task-error {
  margin: 12px 18px 0;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 22%, var(--border));
  border-radius: 8px;
}

.image-task-reference-strip {
  min-width: 0;
  margin: 16px 18px 0;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.image-task-section-label {
  color: var(--text-mute);
  font: 600 10px/1.3 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.image-task-reference-list {
  min-width: 0;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.image-task-reference-list button {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.image-task-reference-list button:hover,
.image-task-reference-list button:focus-visible {
  border-color: var(--accent);
}

.image-task-reference-list img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.image-task-output {
  margin: 16px 18px 18px;
  display: grid;
  gap: 9px;
}

.activity-stack .image-task-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.activity-stack .image-task-results:has(.image-task-result:only-child) {
  grid-template-columns: minmax(0, min(100%, 460px));
}

.activity-stack .image-task-result {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.activity-stack .image-task-thumb {
  width: 100%;
  height: auto;
  min-height: 160px;
  aspect-ratio: auto;
  display: block;
  border: 0;
  border-radius: 0;
  background: var(--surface-2);
}

.activity-stack .image-task-thumb img {
  width: 100%;
  height: auto;
  max-height: 620px;
  display: block;
  object-fit: contain;
}

.activity-stack .image-task-download {
  right: 8px;
  bottom: 8px;
}

.image-task-output-placeholder {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--text-mute);
  background:
    linear-gradient(110deg, transparent 35%, color-mix(in srgb, var(--surface) 58%, transparent) 48%, transparent 61%),
    var(--surface-2);
  background-size: 240% 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  animation: task-output-shimmer 1.8s linear infinite;
  animation-delay: var(--task-loading-delay, 0ms);
}

.image-task-output-placeholder strong {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
}

.image-task-output-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: task-spinner-rotate .8s linear infinite;
  animation-delay: var(--task-loading-delay, 0ms);
}

@keyframes task-output-shimmer {
  to { background-position: -240% 0; }
}

@keyframes task-spinner-rotate {
  to { transform: rotate(1turn); }
}

@keyframes task-progress-loading {
  from { transform: translateX(-115%); }
  to { transform: translateX(365%); }
}

@keyframes task-state-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 30%, transparent); }
  70%, 100% { box-shadow: 0 0 0 6px transparent; }
}

.activity-stack .image-task-actions {
  min-height: 54px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  flex-wrap: wrap;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

.activity-stack .image-task-actions button {
  padding: 8px 10px;
  color: var(--text-dim);
  border-radius: 7px;
  font-size: 11px;
  white-space: nowrap;
}

.activity-stack .image-task-actions button:hover,
.activity-stack .image-task-actions button:focus-visible {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.activity-stack .image-task-actions button.is-danger {
  margin-left: auto;
}

.activity-stack .image-task-actions button.is-danger:hover,
.activity-stack .image-task-actions button.is-danger:focus-visible {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

@media (max-width: 600px) {
  .activity-tools-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .image-task-search {
    width: 100%;
  }

  .activity-stack .image-task-list {
    padding: 10px;
  }

  .activity-stack .image-task-head {
    align-items: flex-start;
  }

  .image-task-head-meta {
    flex-wrap: wrap;
  }

  .activity-stack .image-task-results {
    grid-template-columns: minmax(0, 1fr);
  }

  .image-task-reference-strip {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ================================================================
   GLASSMORPHISM LAYER 路 ANIMA Glass (鐜荤拑鎷熸€?
   ----------------------------------------------------------------
   鍗婇€忔槑纾ㄧ爞琛ㄩ潰 + 鑳屾櫙妯＄硦 + 楂樺厜鎻忚竟 + 鏋佸厜姘涘洿銆?   杩藉姞鍦ㄦ牳蹇冩牱寮忎箣鍚庯紝鍒╃敤绾ц仈瑕嗙洊鏃х殑涓嶉€忔槑琛ㄩ潰銆?   ================================================================ */

/* ---------- 涓昏鐜荤拑琛ㄩ潰 ---------- */
.top,
.workbench,
.panel,
.result,
.history,
.modal-panel,
.activity-stack,
.toast {
  background: var(--glass, var(--surface));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-color: var(--border);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
}

/* ---------- 鎮诞鐜荤拑瀵艰埅 ---------- */
.top {
  position: sticky;
  top: 0;
  height: 62px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 24px;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--glass-highlight), 0 6px 24px rgba(70, 52, 30, 0.05);
}
[data-theme="dark"] .top {
  box-shadow: var(--glass-highlight), 0 6px 24px rgba(0, 0, 0, 0.22);
}

/* ---------- 娆＄骇纾ㄧ爞鍏冪礌 ---------- */
.btn-ghost,
.icon-btn,
.chip-btn,
.model-chip,
.search-box,
.tab-switch,
.user-info,
.image-slot,
.library-item,
.history-item,
.prompt-item,
.preset-item,
.admin-user-item,
.reuse-picker-item,
.select-compact,
.image-task-search,
.image-choice-grid,
.image-size-group,
.image-search-options {
  background: var(--bg-2);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
  border-color: var(--border);
  box-shadow: var(--glass-highlight);
}

/* ---------- 鏍囩椤靛垏鎹?---------- */
.tab-btn.active {
  background: var(--surface-2);
  color: var(--accent-2);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  box-shadow: var(--glass-highlight);
  font-weight: 650;
}

/* ---------- 杈撳叆鎺т欢 ---------- */
.field textarea,
.field input,
.field select,
.select-compact select,
.modal-panel input,
.modal-panel select,
.modal-panel textarea,
.image-task-search input,
.search-box input {
  background: var(--bg-2);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
  border-color: var(--border);
  box-shadow: var(--glass-highlight);
}
.field textarea:focus,
.field input:focus,
.field select:focus,
.select-compact select:focus,
.modal-panel input:focus,
.modal-panel select:focus,
.modal-panel textarea:focus {
  background: var(--surface-2);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent), var(--glass-highlight);
}

/* ---------- 涓绘寜閽細娓愬彉鐜荤拑鍏?---------- */
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow: 0 12px 34px color-mix(in srgb, var(--accent) 28%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 44px color-mix(in srgb, var(--accent) 38%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:active { transform: translateY(0); }

/* ---------- 鎮仠鍙嶉 ---------- */
.btn-ghost:hover,
.icon-btn:hover,
.chip-btn:hover,
.model-chip:hover,
.library-item:hover,
.history-item:hover,
.prompt-item:hover,
.preset-item:hover,
.admin-user-item:hover,
.reuse-picker-item:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
}
.image-slot:hover {
  background: var(--surface-2);
  border-color: var(--accent-2);
}
.search-box:focus-within {
  border-color: var(--accent);
}

/* ---------- 妯℃€佷笌閬僵 ---------- */
.modal-mask {
  background: rgba(10, 7, 22, 0.42);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}
[data-theme="light"] .modal-mask {
  background: rgba(70, 58, 90, 0.22);
}

/* ---------- 鐏锛氭繁鐜荤拑 ---------- */
.lightbox {
  background: rgba(7, 5, 16, 0.88);
  backdrop-filter: blur(22px) saturate(110%);
  -webkit-backdrop-filter: blur(22px) saturate(110%);
}

/* ---------- 鏍囬娓愬彉鍏?---------- */
.title em {
  font-family: 'Anima Hero Art', 'STKaiti', 'KaiTi', 'STXingkai', 'Xingkai SC', serif;
  font-style: normal;
  font-size: 1.52em;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #d9a45e 0%, #b07a3e 55%, #8f5f2c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 2px 5px rgba(176, 122, 62, 0.22));
}
[data-theme="dark"] .title em {
  background-image: linear-gradient(180deg, #f2cb96 0%, #e0ad72 55%, #c78f52 100%);
}

/* ---------- 品牌标志与细节 ---------- */
.brand-mark {
  box-shadow: 0 4px 12px rgba(70, 52, 30, 0.16),
              inset 0 0 0 1px rgba(30, 24, 16, 0.07);
}
[data-theme="dark"] .brand-mark {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5),
              inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ---------- 鍑忓皯鍔ㄦ晥 ---------- */
@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    animation: none !important;
  }
}

