/* NAI 造梦工坊 — 高级深空流光美学 (V3 终极旗舰版) */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep: #06070a;
  --bg-main: #0c0e14;
  --bg-card: rgba(18, 21, 32, 0.72);
  --bg-card-hover: rgba(25, 30, 46, 0.85);
  --bg-input: #10131d;
  --bg-input-focus: #141824;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-accent: rgba(139, 124, 246, 0.45);

  --text-main: #f3f5fa;
  --text-muted: #949db2;
  --text-dim: #5a647b;

  --primary: #7c6cf0;
  --primary-glow: rgba(124, 108, 240, 0.38);
  --primary-light: #a498ff;
  --primary-dark: #5846db;

  --accent-gold: #fbbf24;
  --accent-cyan: #06b6d4;
  --ok: #10b981;
  --ok-glow: rgba(16, 185, 129, 0.2);
  --warn: #f59e0b;
  --err: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 56px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 28px var(--primary-glow);
}

body {
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 15% 10%, rgba(124, 108, 240, 0.09) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 65%, rgba(6, 182, 212, 0.06) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 100%, rgba(236, 72, 153, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
}

.hidden { display: none !important; }

/* ═════════════════════════════════════════════════════════════
   1. 登录页美学
   ═════════════════════════════════════════════════════════════ */
.auth-wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}
.auth-ambient {
  position: absolute;
  width: 580px;
  height: 580px;
  background: radial-gradient(circle, rgba(124, 108, 240, 0.22) 0%, rgba(6, 182, 212, 0.1) 40%, transparent 70%);
  filter: blur(60px);
  animation: pulseGlow 10s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes pulseGlow {
  0% { transform: scale(0.9) translate(-20px, -20px); opacity: 0.7; }
  100% { transform: scale(1.1) translate(20px, 20px); opacity: 1; }
}

.auth-box {
  position: relative;
  width: 100%;
  max-width: 410px;
  background: rgba(18, 21, 32, 0.82);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 38px 32px 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(124, 108, 240, 0.25);
  animation: authFadeUp 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes authFadeUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(124, 108, 240, 0.12);
  border: 1px solid rgba(124, 108, 240, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 12px;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
}

.auth-title {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 30%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}
.auth-sub {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 22px;
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 12px;
  font-size: 13px;
  color: var(--text-dim);
  pointer-events: none;
}
.input-wrap input {
  width: 100%;
  height: 40px;
  padding-left: 36px;
  padding-right: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  font-size: 13.5px;
  color: var(--text-main);
  transition: all 0.2s ease;
}
.input-wrap input:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 108, 240, 0.2);
}

.auth-btn {
  margin-top: 6px;
  height: 42px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.arrow-icon { font-size: 14px; transition: transform 0.2s ease; }
.auth-btn:hover .arrow-icon { transform: translateX(3px); }

.auth-err {
  min-height: 18px;
  font-size: 11.5px;
  color: var(--err);
  text-align: center;
  margin-top: 4px;
}
.auth-note {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-subtle);
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
}
.auth-note code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--primary-light);
}

/* ═════════════════════════════════════════════════════════════
   2. 顶部导航
   ═════════════════════════════════════════════════════════════ */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.navbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(12, 14, 20, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}
.nav-spark {
  color: var(--primary-light);
  font-size: 16px;
  text-shadow: 0 0 10px var(--primary);
}
.nav-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.nav-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(124, 108, 240, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(124, 108, 240, 0.3);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.pill-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.pill-btn:active { transform: translateY(0); }

.chip-icon { font-size: 12px; }
.chip-edit { font-size: 10px; opacity: 0.6; }
.user-chip:hover .chip-edit { opacity: 1; }

.admin-chip {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.3);
  color: #fbbf24;
  font-weight: 600;
}
.admin-chip:hover {
  background: rgba(251, 191, 36, 0.16);
  border-color: #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.25);
}

.user-txt.admin {
  color: #fbbf24;
  font-weight: 600;
}

.nav-logout {
  padding: 6px 12px;
  font-size: 12px;
}

/* ═════════════════════════════════════════════════════════════
   3. 双栏工作区
   ═════════════════════════════════════════════════════════════ */
.studio {
  flex: 1;
  display: flex;
  gap: 20px;
  padding: 20px 24px;
  max-width: 1720px;
  width: 100%;
  margin: 0 auto;
}

.sidebar {
  width: 440px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 模式 Tab 切换 */
.mode-tabs-wrap { width: 100%; }
.mode-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-sm);
}
.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}
.mode-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}
.mode-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(124, 108, 240, 0.35);
}
.mode-icon { font-size: 13px; }

/* 灵感快捷胶囊 */
.tag-capsules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.capsule {
  font-size: 11px;
  color: var(--primary-light);
  background: rgba(124, 108, 240, 0.1);
  border: 1px solid rgba(124, 108, 240, 0.25);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.capsule:hover {
  background: rgba(124, 108, 240, 0.22);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* 拟物画幅卡尺 */
.ratio-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.ratio-chip {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.ratio-chip:hover {
  border-color: var(--border-medium);
  background: var(--bg-input-focus);
}
.ratio-chip.active {
  border-color: var(--primary);
  background: rgba(124, 108, 240, 0.12);
  color: var(--text-main);
}
.ratio-box {
  border: 1.5px solid currentColor;
  border-radius: 2px;
  display: block;
}
.r-portrait  { width: 10px; height: 15px; }
.r-square    { width: 12px; height: 12px; }
.r-landscape { width: 15px; height: 10px; }
.r-tall      { width: 9px;  height: 16px; }
.ratio-txt { font-size: 10.5px; font-weight: 500; }

/* 卡片通用 */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}
.card:hover { border-color: var(--border-medium); }

.card-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.card-title-bar.sub-bar { margin-top: 12px; }
.sec-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sec-title-sm {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.title-icon { font-size: 13px; }
.title-tip { font-size: 10.5px; color: var(--text-dim); }

/* 输入控件 */
input[type="number"],
textarea,
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 11px;
  transition: all 0.2s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 108, 240, 0.15);
}

textarea { resize: vertical; line-height: 1.55; }
#promptInp { font-size: 13px; min-height: 85px; }
#ucInp { font-size: 11.5px; color: var(--text-muted); }

.uc-preset-wrap select {
  font-size: 11px;
  padding: 2px 6px;
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  width: auto;
}

/* 尺寸排版 */
.field-item { margin-bottom: 11px; }
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.styled-select { cursor: pointer; }

.dim-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 11px;
}
.dim-input-box { flex: 1; position: relative; }
.dim-axis {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
}
.dim-input-box input {
  padding-left: 28px;
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.dim-cross { color: var(--text-dim); font-size: 12px; }

.warn-pill {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.slider-box { margin-bottom: 12px; }
.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.slider-readout {
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: var(--primary-light);
  font-weight: 600;
}
input[type="range"] {
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  outline: none;
  accent-color: var(--primary);
  cursor: pointer;
}

.field-inline-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 4px;
}
.field-half { flex: 1; }
.checkbox-half {
  display: flex;
  align-items: center;
  padding-bottom: 6px;
}

.chk-container {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.chk-container input {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Inpaint 专属卡片 */
.inpaint-card {
  border-color: var(--border-accent);
  background: rgba(22, 26, 42, 0.75);
  box-shadow: 0 0 20px rgba(124, 108, 240, 0.12);
  animation: fadeInDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropzone {
  border: 1.5px dashed rgba(124, 108, 240, 0.4);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(124, 108, 240, 0.08);
}
.drop-icon { font-size: 24px; display: block; margin-bottom: 6px; }
.drop-text { font-size: 12.5px; font-weight: 600; color: var(--text-main); margin-bottom: 3px; }
.drop-sub { font-size: 10.5px; color: var(--text-dim); }

.ip-canvas-area { margin-top: 10px; }
.ip-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.tool-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}
.tool-item input[type="range"] { width: 65px; }
.tool-item.full { width: 100%; justify-content: space-between; }
.tool-item.full input[type="range"] { flex: 1; width: auto; margin: 0 8px; }
.val-num { font-family: ui-monospace, SFMono-Regular, monospace; color: var(--primary-light); font-size: 11px; min-width: 26px; }

.canvas-wrapper {
  background: #06070a;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
#ipPaintCanvas {
  max-width: 100%;
  max-height: 280px;
  border-radius: 4px;
  cursor: crosshair;
  touch-action: none;
  background: #0c0e14;
}

.ip-canvas-tip {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-dim);
}

.i2i-prev-area img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: 8px;
  display: block;
}

/* 吸底操作卡 */
.action-footer {
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(12, 14, 20, 0.96) 100%);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-md);
}
.action-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cost-tag { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.tier-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.tier-tag.free {
  background: var(--ok-glow);
  color: var(--ok);
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.tier-tag.paid {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.exec-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.btn-icon { font-size: 14px; }

.console-status {
  margin-top: 8px;
  font-size: 11.5px;
  min-height: 16px;
  color: var(--text-muted);
  word-break: break-all;
}
.console-status.ok { color: var(--ok); }
.console-status.err { color: var(--err); }

.lock-tip {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  color: var(--text-dim);
}
.lock-ico { font-size: 11px; }

/* ═════════════════════════════════════════════════════════════
   4. 视口主画布与扫描动效
   ═════════════════════════════════════════════════════════════ */
.viewport-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.canvas-frame {
  width: 100%;
  min-height: 520px;
  max-height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #08090d;
  background-image:
    linear-gradient(45deg, #0d0f17 25%, transparent 25%),
    linear-gradient(-45deg, #0d0f17 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0d0f17 75%),
    linear-gradient(-45deg, transparent 75%, #0d0f17 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* 扫描线动画 */
.scanning-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-light), transparent);
  box-shadow: 0 0 14px var(--primary);
  animation: scanMove 2s ease-in-out infinite;
  z-index: 5;
}
@keyframes scanMove {
  0% { transform: translateY(0); opacity: 0.3; }
  50% { transform: translateY(500px); opacity: 1; }
  100% { transform: translateY(0); opacity: 0.3; }
}

#resultImg {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  animation: fadeIn 0.3s ease;
  cursor: zoom-in;
}

.canvas-empty {
  text-align: center;
  padding: 40px 20px;
}
.cosmic-ring {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 1.5px dashed rgba(124, 108, 240, 0.4);
  position: relative;
  animation: spin 16s linear infinite;
}
.cosmic-star {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary-light);
  box-shadow: 0 0 10px var(--primary);
  position: absolute;
  top: -3.5px;
  left: 23.5px;
}
.empty-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.empty-desc { font-size: 11.5px; color: var(--text-dim); }

.canvas-toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 10px;
}
.action-btn-group { display: flex; gap: 8px; align-items: center; }
.meta-data-tag {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.action-pill-btn {
  background: rgba(124, 108, 240, 0.15);
  border-color: rgba(124, 108, 240, 0.35);
  color: var(--primary-light);
}
.action-pill-btn:hover {
  background: rgba(124, 108, 240, 0.25);
  border-color: var(--primary);
}

/* 历史画廊 */
.gallery-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.hist-cell {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 3/4;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.hist-cell:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}
.hist-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hist-cell .cap {
  position: absolute;
  inset: auto 0 0 0;
  padding: 18px 8px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.92));
  font-size: 10px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.hist-cell.failed {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--err);
  font-size: 11px;
  padding: 8px;
  text-align: center;
  background: rgba(239, 68, 68, 0.05);
}

/* ═════════════════════════════════════════════════════════════
   5. 全屏沉浸式灯箱 (Lightbox)
   ═════════════════════════════════════════════════════════════ */
.lightbox-shell {
  position: relative;
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  background: #0d101a;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0,0,0,0.8);
  overflow: hidden;
  animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.lightbox-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-subtle);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s ease;
}
.lightbox-close-btn:hover {
  background: rgba(239, 68, 68, 0.8);
  border-color: transparent;
}
.lightbox-content {
  display: flex;
  max-height: 90vh;
}
.lightbox-img-pane {
  flex: 1.4;
  background: #06070a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}
.lightbox-img-pane img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: var(--shadow-md);
}
.lightbox-info-pane {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lightbox-title {
  font-size: 16px;
  font-weight: 700;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.lightbox-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lightbox-field .lbl, .lightbox-meta-grid .lbl {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.val-text {
  font-size: 12.5px;
  color: var(--text-main);
  background: var(--bg-input);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  max-height: 110px;
  overflow-y: auto;
  line-height: 1.5;
  user-select: text;
}
.lightbox-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}
.lightbox-meta-grid div { display: flex; flex-direction: column; gap: 2px; }
.val-mono {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11.5px;
  color: var(--primary-light);
}
.lightbox-actions {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

/* ═════════════════════════════════════════════════════════════
   6. 模态窗口层（个人设置 + 管理中枢全屏抽屉）
   ═════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-window {
  background: #111420;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg), 0 0 32px rgba(124, 108, 240, 0.2);
  animation: scaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  overflow-y: auto;
}

.modal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-title-row h3 {
  font-size: 15.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 个人设置 */
.profile-window {
  width: 100%;
  max-width: 400px;
}
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-item label {
  font-size: 11.5px;
  color: var(--text-muted);
}
.form-sep {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}
.form-sub-title {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

/* 管理中枢全屏抽屉模态 */
.admin-backdrop {
  align-items: flex-start;
  padding: 30px 20px;
}
.admin-window {
  width: 100%;
  max-width: 1260px;
  max-height: 90vh;
  border: 1px solid var(--border-accent);
  box-shadow: var(--shadow-lg), 0 0 45px rgba(124, 108, 240, 0.25);
}
.admin-top-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-crown { font-size: 16px; }
.admin-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-tab-nav {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}
.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.nav-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* 控制台卡片式表单 */
.admin-card {
  background: rgba(14, 17, 26, 0.7);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.admin-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 6px;
}
.card-caption {
  display: flex;
  align-items: center;
  gap: 6px;
}
.caption-icon { font-size: 13px; }
.caption-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.caption-tip {
  font-size: 11px;
  color: var(--text-dim);
}

.admin-form-grid {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.admin-field.flex-1 { flex: 1; min-width: 170px; }
.admin-field.flex-2 { flex: 2.2; min-width: 280px; }

.field-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.admin-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.admin-input-ico {
  position: absolute;
  left: 10px;
  font-size: 12px;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 1;
}
.styled-admin-input {
  width: 100%;
  height: 38px;
  padding-left: 32px;
  padding-right: 12px;
  background: #0b0d14;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12.5px;
  transition: all 0.2s ease;
}
.styled-admin-input.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 11.5px;
  padding-right: 64px;
}
.styled-admin-input:focus {
  background: #0f121d;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 108, 240, 0.2);
}

.admin-inner-btn {
  position: absolute;
  right: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 10.5px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.admin-inner-btn:hover {
  background: rgba(124, 108, 240, 0.2);
  border-color: var(--primary);
  color: #fff;
}

.admin-select-wrap select {
  height: 38px;
  background: #0b0d14;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  padding: 0 10px;
  cursor: pointer;
}
.admin-field-action {
  display: flex;
  align-items: flex-end;
}
.admin-add-btn {
  height: 38px;
  padding: 0 16px;
  font-size: 12.5px;
  font-weight: 600;
  gap: 6px;
  white-space: nowrap;
}
.btn-sub-ico { font-size: 12px; }
.table-container {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}
.data-table th, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.data-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--primary-light);
}
.data-table .prompt-cell {
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table .thumb {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.stat-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  text-align: center;
}
.stat-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-light);
  font-family: ui-monospace, SFMono-Regular, monospace;
  letter-spacing: -0.5px;
}
.stat-desc {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* 额度弹窗行 */
.anlas-key-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
}
.anlas-total-row {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-medium);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-light);
  display: flex;
  justify-content: space-between;
}

/* 按钮通用 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}
.btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.btn.primary:active:not(:disabled) { transform: translateY(0); }
.btn.primary.glow { box-shadow: 0 4px 16px var(--primary-glow); }
.btn.primary.glow:hover:not(:disabled) { box-shadow: 0 6px 24px rgba(124, 108, 240, 0.55); }

.btn.ghost-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
  color: var(--text-muted);
}
.btn.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-medium);
  color: var(--text-main);
}
.btn.tiny { padding: 3px 8px; font-size: 11px; }
.btn.small { padding: 5px 12px; font-size: 12px; }
.btn.icon-btn { background: transparent; padding: 4px; font-size: 13px; color: var(--text-dim); }
.btn.icon-btn:hover { color: var(--text-main); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.5); }

/* 浮动 Toast */
.toast-chip {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 22, 35, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-accent);
  color: var(--text-main);
  padding: 9px 22px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  z-index: 200;
  box-shadow: var(--shadow-lg), 0 0 16px var(--primary-glow);
  animation: fadeInUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-chip.err {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: var(--shadow-lg), 0 0 16px rgba(239, 68, 68, 0.3);
}

/* 动效 */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleUp { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* 响应式 */
@media (max-width: 1080px) {
  .studio { flex-direction: column; }
  .sidebar { width: 100%; }
  .canvas-frame { min-height: 400px; }
  .admin-backdrop { padding: 10px; }
  .lightbox-content { flex-direction: column; }
  .lightbox-info-pane { border-left: none; border-top: 1px solid var(--border-subtle); }
}
