/* =========================================================
   造物台 · AI Creative Suite
   Deep-space glass UI · cyan / violet accents
   ========================================================= */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #05070d;
  --bg-2: #080b14;
  --panel-bg: linear-gradient(165deg, rgba(18, 26, 44, 0.9), rgba(7, 11, 19, 0.94));
  --panel-border: rgba(148, 163, 184, 0.16);
  --surface: #0b101b;
  --glass: rgba(13, 19, 32, 0.68);
  --glass-2: rgba(148, 163, 184, 0.06);
  --glass-3: rgba(148, 163, 184, 0.1);
  --topbar-bg: rgba(5, 8, 14, 0.64);
  --input-bg: rgba(4, 8, 15, 0.55);
  --hud-bg: rgba(7, 11, 19, 0.62);
  --ink: #eaf1ff;
  --result-ink: #e2eaf7;
  --ink-2: #aeb9ce;
  --ink-3: #7d8ba3;
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(148, 163, 184, 0.32);
  --accent: #67e8f9;
  --accent-2: #22d3ee;
  --accent-bright: #67e8f9;
  --accent-soft: rgba(34, 211, 238, 0.12);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.14);
  --gold: #fbbf24;
  --danger: #fb7185;
  --ok: #34d399;
  --btn-bg: #eef9ff;
  --btn-ink: #04111c;
  --btn-border: rgba(255, 255, 255, 0.85);
  --grad-text: linear-gradient(100deg, #f4fbff 4%, #7dd3fc 42%, #a78bfa 100%);
  --glow-a: rgba(34, 211, 238, 0.36);
  --glow-b: rgba(139, 92, 246, 0.3);
  --grid-line: rgba(148, 163, 184, 0.055);
  --noise-opacity: 0.05;
  --stroke-char: rgba(103, 232, 249, 0.2);
  --scroll-thumb: rgba(148, 163, 184, 0.22);
  --shadow-sm: 0 2px 14px -6px rgba(0, 0, 0, 0.7);
  --shadow: 0 34px 90px -54px rgba(0, 0, 0, 0.95), 0 0 60px -46px rgba(34, 211, 238, 0.4);
  --shadow-lg: 0 60px 150px -60px rgba(0, 0, 0, 1), 0 0 120px -70px rgba(34, 211, 238, 0.55);
  --radius: 20px;
  --radius-sm: 12px;
  --display: "Segoe UI Variable Display", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", "Noto Sans Mono", monospace;
  --topbar-h: 72px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f9;
  --bg-2: #e4eaf4;
  --panel-bg: linear-gradient(165deg, rgba(255, 255, 255, 0.9), rgba(243, 247, 253, 0.94));
  --panel-border: rgba(15, 23, 42, 0.1);
  --surface: #ffffff;
  --glass: rgba(255, 255, 255, 0.68);
  --glass-2: rgba(15, 23, 42, 0.035);
  --glass-3: rgba(15, 23, 42, 0.06);
  --topbar-bg: rgba(246, 249, 254, 0.72);
  --input-bg: rgba(255, 255, 255, 0.66);
  --hud-bg: rgba(255, 255, 255, 0.62);
  --ink: #0b1424;
  --result-ink: #182333;
  --ink-2: #475569;
  --ink-3: #5f6f88;
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.24);
  --accent: #0e7490;
  --accent-2: #0891b2;
  --accent-soft: rgba(8, 145, 178, 0.1);
  --violet: #6d28d9;
  --violet-soft: rgba(109, 40, 217, 0.08);
  --gold: #b45309;
  --danger: #be123c;
  --ok: #047857;
  --btn-bg: #0b1424;
  --btn-ink: #f5fbff;
  --btn-border: #0b1424;
  --grad-text: linear-gradient(100deg, #0b1424 4%, #0e7490 46%, #6d28d9 100%);
  --glow-a: rgba(34, 211, 238, 0.22);
  --glow-b: rgba(139, 92, 246, 0.16);
  --grid-line: rgba(15, 23, 42, 0.055);
  --noise-opacity: 0.028;
  --stroke-char: rgba(8, 145, 178, 0.18);
  --scroll-thumb: rgba(15, 23, 42, 0.2);
  --shadow-sm: 0 2px 14px -6px rgba(15, 23, 42, 0.18);
  --shadow: 0 34px 90px -54px rgba(15, 23, 42, 0.35), 0 0 60px -46px rgba(8, 145, 178, 0.25);
  --shadow-lg: 0 60px 150px -60px rgba(15, 23, 42, 0.45), 0 0 120px -70px rgba(8, 145, 178, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
  background: var(--accent-2);
  color: #021018;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  border: 3px solid transparent;
  background-clip: content-box;
}

/* ------------------------------------------------------- 背景特效 */

.bg-fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-grid {
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 18%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 18%, transparent 78%);
  opacity: 0.9;
}

.bg-glow {
  position: absolute;
  width: 62vw;
  height: 62vw;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.75;
  will-change: transform;
}

.bg-glow-a {
  top: -34vw;
  left: -18vw;
  background: radial-gradient(circle, var(--glow-a), transparent 66%);
  animation: drift-a 22s ease-in-out infinite alternate;
}

.bg-glow-b {
  top: 6vh;
  right: -30vw;
  background: radial-gradient(circle, var(--glow-b), transparent 66%);
  animation: drift-b 26s ease-in-out infinite alternate;
}

.bg-noise {
  position: absolute;
  inset: 0;
  opacity: var(--noise-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(5vw, 4vh, 0) scale(1.12); }
}

@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.05); }
  to { transform: translate3d(-4vw, 5vh, 0) scale(1); }
}

/* ------------------------------------------------------- 背景风格（可切换） */

[data-bg] .bg-fx::before,
[data-bg] .bg-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}

/* 场景配色：文字、强调色、面板与阴影跟随背景一起变化
   space 保留原有配色，其余场景通过 scene-* 变量统一派生 */

[data-theme="dark"][data-bg="aurora"] {
  --scene-ink-hi: #ecfeff;
  --scene-ink-2: #a9c6c9;
  --scene-ink-3: #7a9aa0;
  --scene-bg: #040b0e;
  --scene-bg-2: #07141a;
  --scene-accent: #5eead4;
  --scene-accent-2: #2dd4bf;
  --scene-violet: #818cf8;
}

[data-theme="light"][data-bg="aurora"] {
  --scene-ink-hi: #052e2b;
  --scene-ink-2: #3f5f5c;
  --scene-ink-3: #5d7a75;
  --scene-bg: #eefaf8;
  --scene-bg-2: #e0f4ef;
  --scene-accent: #0f766e;
  --scene-accent-2: #0d9488;
  --scene-violet: #4f46e5;
}

[data-theme="dark"][data-bg="mesh"] {
  --scene-ink-hi: #eef2ff;
  --scene-ink-2: #b0b9d4;
  --scene-ink-3: #7f89a8;
  --scene-bg: #070910;
  --scene-bg-2: #0b0e1a;
  --scene-accent: #93c5fd;
  --scene-accent-2: #60a5fa;
  --scene-violet: #c4b5fd;
}

[data-theme="light"][data-bg="mesh"] {
  --scene-ink-hi: #141a2e;
  --scene-ink-2: #4a5570;
  --scene-ink-3: #6b7694;
  --scene-bg: #f2f4fb;
  --scene-bg-2: #e8ecf7;
  --scene-accent: #3b5bdb;
  --scene-accent-2: #4263eb;
  --scene-violet: #7048e8;
}

[data-theme="dark"][data-bg="grid"] {
  --scene-ink-hi: #e6fff1;
  --scene-ink-2: #a8c9b7;
  --scene-ink-3: #77977f;
  --scene-bg: #030907;
  --scene-bg-2: #06130e;
  --scene-accent: #4ade80;
  --scene-accent-2: #22c55e;
  --scene-violet: #22d3ee;
}

[data-theme="light"][data-bg="grid"] {
  --scene-ink-hi: #04231a;
  --scene-ink-2: #3c6353;
  --scene-ink-3: #5f8272;
  --scene-bg: #f0fbf4;
  --scene-bg-2: #e4f6ea;
  --scene-accent: #15803d;
  --scene-accent-2: #16a34a;
  --scene-violet: #0e7490;
}

[data-theme="dark"][data-bg="dusk"] {
  --scene-ink-hi: #fff4e6;
  --scene-ink-2: #d9b8a6;
  --scene-ink-3: #a88372;
  --scene-bg: #0d0708;
  --scene-bg-2: #170c0d;
  --scene-accent: #fbbf24;
  --scene-accent-2: #fb923c;
  --scene-violet: #fb7185;
}

[data-theme="light"][data-bg="dusk"] {
  --scene-ink-hi: #2a1408;
  --scene-ink-2: #6d4a36;
  --scene-ink-3: #8c6a55;
  --scene-bg: #fbf3ec;
  --scene-bg-2: #f6e7db;
  --scene-accent: #b45309;
  --scene-accent-2: #c2410c;
  --scene-violet: #be123c;
}

[data-theme="dark"][data-bg="minimal"] {
  --scene-ink-hi: #f4f4f5;
  --scene-ink-2: #b4b4bd;
  --scene-ink-3: #85858f;
  --scene-bg: #09090b;
  --scene-bg-2: #101013;
  --scene-accent: #cbd5e1;
  --scene-accent-2: #e2e8f0;
  --scene-violet: #94a3b8;
}

[data-theme="light"][data-bg="minimal"] {
  --scene-ink-hi: #18181b;
  --scene-ink-2: #52525b;
  --scene-ink-3: #71717a;
  --scene-bg: #f7f7f8;
  --scene-bg-2: #ededf0;
  --scene-accent: #334155;
  --scene-accent-2: #475569;
  --scene-violet: #64748b;
}

/* 深色场景统一派生 */
[data-theme="dark"][data-bg]:not([data-bg="space"]) {
  --ink: var(--scene-ink-hi);
  --result-ink: var(--scene-ink-hi);
  --ink-2: var(--scene-ink-2);
  --ink-3: var(--scene-ink-3);
  --bg: var(--scene-bg);
  --bg-2: var(--scene-bg-2);
  --surface: color-mix(in srgb, var(--scene-bg-2) 82%, var(--scene-accent) 18%);
  --accent: var(--scene-accent);
  --accent-2: var(--scene-accent-2);
  --accent-bright: var(--scene-accent);
  --accent-soft: color-mix(in srgb, var(--scene-accent) 13%, transparent);
  --violet: var(--scene-violet);
  --violet-soft: color-mix(in srgb, var(--scene-violet) 14%, transparent);
  --btn-bg: color-mix(in srgb, var(--scene-ink-hi) 92%, var(--scene-accent) 8%);
  --btn-ink: var(--scene-bg);
  --btn-border: color-mix(in srgb, var(--scene-ink-hi) 82%, transparent);
  --grad-text: linear-gradient(100deg, var(--scene-ink-hi) 4%, var(--scene-accent) 44%, var(--scene-violet) 100%);
  --glow-a: color-mix(in srgb, var(--scene-accent) 34%, transparent);
  --glow-b: color-mix(in srgb, var(--scene-violet) 28%, transparent);
  --grid-line: color-mix(in srgb, var(--scene-accent) 8%, transparent);
  --line: color-mix(in srgb, var(--scene-accent) 14%, transparent);
  --line-strong: color-mix(in srgb, var(--scene-accent) 30%, transparent);
  --stroke-char: color-mix(in srgb, var(--scene-accent) 20%, transparent);
  --scroll-thumb: color-mix(in srgb, var(--scene-accent) 24%, transparent);
  --topbar-bg: color-mix(in srgb, var(--scene-bg) 55%, rgba(5, 8, 14, 0.64));
  --input-bg: color-mix(in srgb, var(--scene-bg) 40%, rgba(4, 8, 15, 0.55));
  --hud-bg: color-mix(in srgb, var(--scene-bg-2) 45%, rgba(7, 11, 19, 0.62));
  --panel-bg: linear-gradient(165deg,
    color-mix(in srgb, var(--scene-accent) 10%, rgba(18, 26, 44, 0.9)),
    color-mix(in srgb, var(--scene-bg) 35%, rgba(7, 11, 19, 0.94)));
  --shadow: 0 34px 90px -54px rgba(0, 0, 0, 0.95), 0 0 60px -46px color-mix(in srgb, var(--scene-accent) 40%, transparent);
  --shadow-lg: 0 60px 150px -60px rgba(0, 0, 0, 1), 0 0 120px -70px color-mix(in srgb, var(--scene-accent) 55%, transparent);
}

/* 浅色场景统一派生 */
[data-theme="light"][data-bg]:not([data-bg="space"]) {
  --ink: var(--scene-ink-hi);
  --result-ink: var(--scene-ink-hi);
  --ink-2: var(--scene-ink-2);
  --ink-3: var(--scene-ink-3);
  --bg: var(--scene-bg);
  --bg-2: var(--scene-bg-2);
  --surface: color-mix(in srgb, #ffffff 84%, var(--scene-accent) 16%);
  --accent: var(--scene-accent);
  --accent-2: var(--scene-accent-2);
  --accent-bright: color-mix(in srgb, var(--scene-accent) 55%, #ffffff);
  --accent-soft: color-mix(in srgb, var(--scene-accent) 11%, transparent);
  --violet: var(--scene-violet);
  --violet-soft: color-mix(in srgb, var(--scene-violet) 10%, transparent);
  --btn-bg: color-mix(in srgb, var(--scene-ink-hi) 94%, var(--scene-accent) 6%);
  --btn-ink: var(--scene-bg);
  --btn-border: var(--scene-ink-hi);
  --grad-text: linear-gradient(100deg, var(--scene-ink-hi) 4%, var(--scene-accent) 46%, var(--scene-violet) 100%);
  --glow-a: color-mix(in srgb, var(--scene-accent) 22%, transparent);
  --glow-b: color-mix(in srgb, var(--scene-violet) 17%, transparent);
  --grid-line: color-mix(in srgb, var(--scene-accent) 9%, transparent);
  --line: color-mix(in srgb, var(--scene-ink-hi) 12%, transparent);
  --line-strong: color-mix(in srgb, var(--scene-ink-hi) 26%, transparent);
  --stroke-char: color-mix(in srgb, var(--scene-accent) 18%, transparent);
  --scroll-thumb: color-mix(in srgb, var(--scene-ink-hi) 20%, transparent);
  --topbar-bg: color-mix(in srgb, var(--scene-bg) 25%, rgba(246, 249, 254, 0.72));
  --input-bg: color-mix(in srgb, var(--scene-bg) 20%, rgba(255, 255, 255, 0.66));
  --hud-bg: color-mix(in srgb, var(--scene-bg-2) 22%, rgba(255, 255, 255, 0.62));
  --panel-bg: linear-gradient(165deg,
    color-mix(in srgb, var(--scene-accent) 7%, rgba(255, 255, 255, 0.9)),
    color-mix(in srgb, var(--scene-bg) 25%, rgba(243, 247, 253, 0.94)));
  --shadow: 0 34px 90px -54px rgba(15, 23, 42, 0.35), 0 0 60px -46px color-mix(in srgb, var(--scene-accent) 25%, transparent);
  --shadow-lg: 0 60px 150px -60px rgba(15, 23, 42, 0.45), 0 0 120px -70px color-mix(in srgb, var(--scene-accent) 35%, transparent);
}

/* 极光 */
[data-bg="aurora"] .bg-grid {
  opacity: 0.26;
}

[data-bg="aurora"] .bg-glow {
  filter: blur(110px);
  opacity: 0.92;
}

[data-bg="aurora"] .bg-fx::before {
  display: block;
  inset: -30%;
  background:
    radial-gradient(45% 55% at 28% 30%, color-mix(in srgb, var(--scene-accent) 34%, transparent), transparent 68%),
    radial-gradient(42% 50% at 72% 26%, color-mix(in srgb, var(--scene-violet) 32%, transparent), transparent 70%),
    radial-gradient(40% 46% at 55% 82%, color-mix(in srgb, var(--scene-accent-2) 20%, transparent), transparent 70%);
  filter: blur(46px) saturate(1.25);
  animation: bg-drift 28s ease-in-out infinite alternate;
}

@keyframes bg-drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(2%, 2%, 0) scale(1.08); }
}

[data-theme="light"][data-bg="aurora"] .bg-fx::before {
  opacity: 0.62;
}

/* 雾面渐变 */
[data-bg="mesh"] .bg-grid,
[data-bg="mesh"] .bg-glow,
[data-bg="mesh"] .bg-noise {
  display: none;
}

[data-bg="mesh"] .bg-fx::before {
  display: block;
  background:
    radial-gradient(38% 42% at 10% 10%, color-mix(in srgb, var(--scene-accent) 30%, transparent), transparent 72%),
    radial-gradient(36% 40% at 90% 14%, color-mix(in srgb, var(--scene-violet) 28%, transparent), transparent 72%),
    radial-gradient(44% 48% at 78% 90%, color-mix(in srgb, var(--gold) 16%, transparent), transparent 72%),
    radial-gradient(40% 44% at 18% 88%, color-mix(in srgb, var(--ok) 20%, transparent), transparent 72%);
}

[data-theme="light"][data-bg="mesh"] .bg-fx::before {
  opacity: 0.5;
}

/* 网格矩阵 */
[data-bg="grid"] .bg-glow {
  display: none;
}

[data-bg="grid"] .bg-grid {
  background-size: 48px 48px;
  opacity: 1;
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 62%, transparent 96%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 62%, transparent 96%);
}

[data-bg="grid"] .bg-fx::after {
  display: block;
  background:
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--accent) 6%, transparent) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 60% 40% at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
}

/* 暖霞 */
[data-bg="dusk"] .bg-glow-a {
  background: radial-gradient(circle, color-mix(in srgb, var(--scene-accent) 34%, transparent), transparent 66%);
}

[data-bg="dusk"] .bg-glow-b {
  background: radial-gradient(circle, color-mix(in srgb, var(--scene-violet) 26%, transparent), transparent 66%);
}

[data-bg="dusk"] .bg-grid {
  opacity: 0.4;
}

/* 极简 */
[data-bg="minimal"] .bg-grid,
[data-bg="minimal"] .bg-glow,
[data-bg="minimal"] .bg-noise,
[data-bg="minimal"] .bg-fx::before,
[data-bg="minimal"] .bg-fx::after {
  display: none;
}

/* ------------------------------------------------------- 背景选择器 */

.bg-picker {
  position: relative;
  display: inline-flex;
}

.bg-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 70;
  width: 248px;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: var(--panel-bg);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}

.bg-menu-title {
  margin: 0 0 10px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bg-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bg-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass-2);
  color: var(--ink-2);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, color 0.16s ease, background-color 0.16s ease;
}

.bg-option:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--glass-3);
}

.bg-option[aria-checked="true"] {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--accent-soft);
}

.bg-option .swatch {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.swatch-space {
  background:
    radial-gradient(circle at 28% 26%, #22d3ee 0 18%, transparent 42%),
    radial-gradient(circle at 76% 72%, #a78bfa 0 20%, transparent 48%),
    #05070d;
}

.swatch-aurora {
  background: linear-gradient(135deg, #22d3ee 0%, #a78bfa 48%, #34d399 100%);
}

.swatch-mesh {
  background:
    radial-gradient(circle at 20% 20%, #22d3ee 0 22%, transparent 50%),
    radial-gradient(circle at 80% 30%, #a78bfa 0 24%, transparent 52%),
    radial-gradient(circle at 60% 85%, #fbbf24 0 20%, transparent 48%),
    #0b101b;
}

.swatch-grid {
  background:
    repeating-linear-gradient(0deg, rgba(103, 232, 249, 0.6) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(90deg, rgba(103, 232, 249, 0.6) 0 1px, transparent 1px 6px),
    #05070d;
}

.swatch-dusk {
  background:
    radial-gradient(circle at 25% 30%, #fb923c 0 26%, transparent 58%),
    radial-gradient(circle at 78% 70%, #f43f5e 0 28%, transparent 60%),
    #120a0c;
}

.swatch-minimal {
  background: linear-gradient(160deg, #0b101b, #05070d);
}

@media (max-width: 720px) {
  .bg-menu {
    position: fixed;
    top: calc(var(--topbar-h) + 10px);
    right: 12px;
    left: 12px;
    width: auto;
  }

  .bg-option {
    padding: 10px;
    font-size: 13.5px;
  }
}

#app-shell,
#login-view {
  position: relative;
  z-index: 1;
}

/* ---------------------------------------------------------------- 启动 */

.boot {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.boot-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.72); opacity: 0.35; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* ---------------------------------------------------------------- 登录 */

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: safe center;
  padding: 32px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(900px 560px at 18% 0%, var(--glow-a), transparent 62%),
    radial-gradient(800px 520px at 88% 100%, var(--glow-b), transparent 60%);
}

.login-view::before,
.login-view::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.login-view::before {
  width: min(78vw, 820px);
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 0 0 100px color-mix(in srgb, var(--accent) 6%, transparent);
  animation: spin 48s linear infinite;
}

.login-view::after {
  width: min(56vw, 560px);
  aspect-ratio: 1;
  border: 1px dashed color-mix(in srgb, var(--violet) 15%, transparent);
  animation: spin 70s linear infinite reverse;
}

@keyframes spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.login-bg {
  position: absolute;
  right: -7vw;
  bottom: -20vh;
  font-family: var(--display);
  font-size: min(52vw, 740px);
  line-height: 0.8;
  font-weight: 700;
  color: transparent;
  -webkit-text-stroke: 1px var(--stroke-char);
  opacity: 1;
  pointer-events: none;
  user-select: none;
  mask-image: linear-gradient(180deg, #000 10%, transparent 88%);
  -webkit-mask-image: linear-gradient(180deg, #000 10%, transparent 88%);
}

.login-corner {
  position: absolute;
  z-index: 2;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  opacity: 0.75;
  pointer-events: none;
}

.login-corner.top-left {
  top: 28px;
  left: 32px;
}

.login-corner.bottom-right {
  right: 32px;
  bottom: 26px;
}

.login-card {
  position: relative;
  z-index: 3;
  width: min(432px, 100%);
  padding: 38px 38px 30px;
  background: linear-gradient(170deg, rgba(17, 25, 42, 0.9), rgba(6, 10, 18, 0.94));
  border: 1px solid var(--panel-border);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(26px) saturate(1.2);
  -webkit-backdrop-filter: blur(26px) saturate(1.2);
  overflow: hidden;
}

[data-theme="light"] .login-card {
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.94), rgba(244, 248, 254, 0.96));
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--violet), transparent);
  opacity: 0.7;
}

.login-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 18px;
  pointer-events: none;
}

.login-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 26px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.login-meta-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
}

.login-meta-code {
  margin-left: auto;
  color: var(--ink-3);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 30%, transparent), rgba(8, 12, 20, 0.9));
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  color: var(--accent);
  font-family: var(--display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1;
  flex: 0 0 auto;
  box-shadow:
    0 0 26px -8px color-mix(in srgb, var(--accent) 65%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

[data-theme="light"] .brand-mark {
  color: #f0fdff;
  background: linear-gradient(145deg, #0891b2, #6d28d9);
  border-color: rgba(255, 255, 255, 0.34);
}

.brand-mark.large {
  width: 56px;
  height: 56px;
  border-radius: 15px;
  font-size: 31px;
  margin-bottom: 20px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  flex: 0 0 auto;
}

.login-card h1 {
  font-family: var(--display);
  font-size: 38px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
}

.login-sub {
  color: var(--ink-2);
  font-size: 13.5px;
  margin-bottom: 26px;
}

.input-with-icon {
  position: relative;
  margin-bottom: 14px;
}

.input-with-icon .icon {
  position: absolute;
  left: 15px;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
  color: var(--ink-3);
  width: 17px;
  height: 17px;
  pointer-events: none;
}

.login-card .input-with-icon input {
  width: 100%;
  height: 50px;
  padding: 0 16px 0 44px !important;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 12px !important;
  font-size: 14.5px !important;
  letter-spacing: 0.05em;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input-with-icon input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 30px -12px var(--accent);
}

.form-error {
  color: var(--danger);
  font-size: 12.5px;
  margin: 0 0 12px;
}

.login-foot {
  margin-top: 26px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-align: center;
}

.login-admin-link {
  display: block;
  margin-top: 12px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-align: center;
  text-decoration: none;
  transition: color 0.16s ease;
}

.login-admin-link:hover {
  color: var(--accent);
}

.login-switch {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-align: center;
  cursor: pointer;
  transition: color 0.16s ease;
}

.login-switch:hover {
  color: var(--violet);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--btn-bg);
  border-color: var(--btn-border);
  color: var(--btn-ink);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent),
    0 16px 40px -22px color-mix(in srgb, var(--accent) 80%, transparent);
}

.btn.primary .icon {
  color: var(--accent-2);
}

.btn.primary:hover {
  background: #ffffff;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 65%, transparent),
    0 20px 46px -20px color-mix(in srgb, var(--accent) 85%, transparent);
}

[data-theme="light"] .btn.primary:hover {
  background: #142138;
}

.btn.ghost {
  background: var(--glass-2);
  border-color: var(--line);
  color: var(--ink-2);
}

.btn.ghost:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: var(--accent-soft);
  color: var(--ink);
}

.btn.small {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12px;
  gap: 6px;
}

.btn.small .icon {
  width: 14px;
  height: 14px;
}

.btn.tall {
  height: auto;
  min-height: 88px;
  padding: 0 22px;
  flex-direction: column;
  gap: 7px;
  border-radius: 12px;
}

.btn.tall .icon {
  width: 21px;
  height: 21px;
}

.btn.tall span {
  font-size: 13px;
}

.btn.wide {
  width: 100%;
  height: 50px;
  font-size: 14.5px;
  border-radius: 12px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn:hover {
  background: var(--glass-2);
  border-color: var(--line);
  color: var(--accent);
}

.icon-btn.tiny {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.icon-btn.tiny .icon {
  width: 14px;
  height: 14px;
}

.icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 22px;
  height: var(--topbar-h);
  padding: 0 clamp(16px, 4vw, 42px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent 4%, color-mix(in srgb, var(--accent) 36%, transparent) 34%, color-mix(in srgb, var(--violet) 28%, transparent) 66%, transparent 96%);
  opacity: 0.65;
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.12;
}

.brand-text strong {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.brand-text small {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.24em;
  margin-top: 3px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--glass-2);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 31px;
  padding: 0 13px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.tab:hover {
  color: var(--ink);
  background: var(--glass-2);
}

.tab.is-active {
  color: var(--ink);
  background: var(--accent-soft);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 26%, transparent),
    0 0 22px -14px var(--accent);
}

.tab.is-active::before {
  content: "";
  width: 4px;
  height: 4px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.tab.is-disabled {
  color: var(--ink-3);
  cursor: not-allowed;
  opacity: 0.8;
}

.tab.is-disabled::after {
  content: "SOON";
  margin-left: 7px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 150px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--glass-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px var(--accent);
  flex: 0 0 auto;
}

.provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 270px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--glass-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 9px var(--ok);
  flex: 0 0 auto;
}

.provider-badge.is-warn::before {
  background: var(--gold);
  box-shadow: 0 0 9px var(--gold);
}

.provider-badge.is-off::before {
  background: var(--danger);
  box-shadow: 0 0 9px var(--danger);
}

/* ---------------------------------------------------------------- 提示条 */

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - clamp(32px, 8vw, 84px));
  max-width: 1180px;
  margin: 16px auto 0;
  padding: 11px 15px;
  border: 1px solid color-mix(in srgb, var(--gold) 32%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--gold) 8%, var(--glass));
  color: var(--ink-2);
  font-size: 12.5px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.banner .icon {
  color: var(--gold);
  width: 16px;
  height: 16px;
}

.banner span {
  flex: 1;
}

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

#main {
  width: min(1180px, 100% - clamp(32px, 8vw, 84px));
  margin: 0 auto;
  padding: 46px 0 44px;
}

.view {
  animation: fade-in 0.38s cubic-bezier(0.22, 0.7, 0.3, 1) both;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- Hero */

.hero {
  margin-bottom: 36px;
}

.hero.has-hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  gap: 48px;
  align-items: end;
}

.hero-copy {
  min-width: 0;
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(38px, 5.2vw, 62px);
  line-height: 1.1;
  letter-spacing: 0.005em;
  font-weight: 600;
  margin: 0 0 16px;
  text-wrap: balance;
}

.hero em {
  font-style: normal;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 24px color-mix(in srgb, var(--accent) 18%, transparent));
}

.hero-sub {
  color: var(--ink-2);
  font-size: 14.5px;
  max-width: 580px;
}

.hero.small {
  margin-bottom: 28px;
}

.hero.small h1 {
  font-size: clamp(30px, 3.8vw, 44px);
  margin-bottom: 10px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 22px;
}

.hero-tags span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--glass-2);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
}

.hero-tags span::before {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
}

/* ---------------------------------------------------------------- HUD */

.hero-hud {
  position: relative;
  padding: 15px 17px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--hud-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 24px 60px -50px #000;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-family: var(--mono);
  overflow: hidden;
}

.hero-hud::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 40%, transparent), transparent);
}

.hero-hud::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 5%, transparent);
  border-radius: 8px;
  pointer-events: none;
}

.hud-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent);
  animation: ping 2.2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.hero-hud.is-warn .pulse-dot {
  background: var(--gold);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold) 50%, transparent);
}

.hero-hud.is-off .pulse-dot {
  background: var(--danger);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 50%, transparent);
}

@keyframes ping {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

.hud-code {
  margin-left: auto;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}

.hud-list {
  margin: 0;
  padding: 4px 0 2px;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--line) 70%, transparent);
  font-size: 9px;
}

.hud-row:last-child {
  border-bottom: none;
}

.hud-row dt {
  color: var(--ink-3);
  letter-spacing: 0.12em;
  flex: 0 0 auto;
}

.hud-row dd {
  margin: 0;
  max-width: 158px;
  color: var(--ink);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 26px;
  margin-top: 10px;
  opacity: 0.75;
}

.hud-bars i {
  flex: 1;
  height: calc(var(--h) * 1%);
  border-radius: 1px 1px 0 0;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 6%, transparent));
  animation: hudbar 2.8s ease-in-out infinite alternate;
  animation-delay: var(--d, 0s);
}

@keyframes hudbar {
  from { opacity: 0.35; transform: scaleY(0.82); }
  to { opacity: 0.85; transform: scaleY(1); }
}

/* ---------------------------------------------------------------- 卡片 */

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 430px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 45%, transparent) 30%, color-mix(in srgb, var(--violet) 32%, transparent) 70%, transparent);
  opacity: 0.7;
  pointer-events: none;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(110% 80% at 50% 0%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 55%);
  pointer-events: none;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-form {
  padding: 24px;
}

.panel-output {
  display: flex;
  flex-direction: column;
  min-height: 560px;
  padding: 24px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.panel-head h2 {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel-form .panel-head h2::before,
.panel-output .panel-head h2::before {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  margin-right: 9px;
  vertical-align: 2px;
}

.panel-form .panel-head h2::before {
  content: "01 /";
}

.panel-output .panel-head h2::before {
  content: "02 /";
}

.panel-head .hint,
.panel-head .meta {
  margin-left: auto;
}

.hint {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.meta {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.panel-output:has(#copy-output.is-streaming) .meta {
  color: var(--accent);
}

.panel-output:has(#copy-output.is-streaming) .meta::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
  vertical-align: 2px;
}

.field {
  margin-bottom: 17px;
}

.field label,
.option-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.req {
  color: var(--accent);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

textarea,
select,
input[type="text"],
input:not([type]) {
  width: 100%;
}

textarea,
select,
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]) {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.65;
  caret-color: var(--accent);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

textarea {
  resize: vertical;
  min-height: 92px;
}

textarea::placeholder,
input::placeholder {
  color: var(--ink-3);
  opacity: 0.72;
}

textarea:focus,
select:focus,
input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 58%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 28px -14px var(--accent);
  background: color-mix(in srgb, var(--input-bg) 72%, var(--bg));
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
  cursor: pointer;
}

.field-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 5px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.length-custom {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}

.length-custom input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.length-custom > span {
  flex: 0 0 auto;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--glass-2);
  color: var(--ink-2);
  font-size: 12px;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.chip:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  color: var(--ink);
  background: var(--glass-3);
}

.chip.is-active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  color: var(--accent);
  font-weight: 600;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent),
    0 0 20px -12px var(--accent);
}

.chip .ratio {
  width: 11px;
  height: 11px;
  border: 1.3px solid currentColor;
  border-radius: 2px;
  opacity: 0.75;
}

.chip[data-ratio="16:9"] .ratio {
  width: 13px;
  height: 8px;
}

.chip[data-ratio="9:16"] .ratio {
  width: 8px;
  height: 13px;
}

.chip[data-ratio="4:3"] .ratio {
  width: 12px;
  height: 9px;
}

.chip[data-ratio="3:4"] .ratio {
  width: 9px;
  height: 12px;
}

.advanced {
  margin: 2px 0 18px;
  border-top: 1px dashed var(--line);
  padding-top: 13px;
}

.advanced summary {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::before {
  content: "+";
  display: inline-block;
  width: 14px;
  color: var(--accent);
  font-size: 12px;
}

.advanced[open] summary::before {
  content: "−";
}

.advanced textarea {
  margin-top: 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 4px;
}

.form-note {
  margin-top: 14px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  line-height: 1.7;
}

/* ---------------------------------------------------------- 文案输出 */

.editor-output {
  flex: 1;
  min-height: 400px;
  max-height: 620px;
  padding: 25px 27px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 55%),
    var(--input-bg);
  color: var(--result-ink);
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.95;
  letter-spacing: 0.012em;
  text-rendering: optimizeLegibility;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-y: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.editor-output.is-empty {
  display: grid;
  place-items: center;
  background: var(--glass-2);
}

.editor-output.is-streaming::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.18em;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: blink 0.85s steps(2, start) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 30px 14px;
  color: var(--ink-3);
  text-align: center;
}

.empty-state .empty-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
  color: var(--accent);
  opacity: 0.55;
  stroke-width: 1.3;
  filter: drop-shadow(0 0 16px color-mix(in srgb, var(--accent) 30%, transparent));
}

.empty-state p {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
}

.empty-state span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

.empty-state.wide {
  grid-column: 1 / -1;
  padding: 54px 20px;
  border: 1px dashed color-mix(in srgb, var(--line-strong) 70%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--glass-2) 60%, transparent);
}

.output-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 15px;
}

.output-actions .hint {
  color: var(--ink-3);
}

.spacer {
  flex: 1;
}

/* ---------------------------------------------------------------- 文生图 */

.image-panel {
  padding: 19px;
  margin-bottom: 34px;
}

.prompt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 12px;
  align-items: stretch;
}

.prompt-row textarea {
  min-height: 88px;
  font-size: 14px;
  resize: none;
}

.image-options {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 26px;
  margin-top: 17px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.option-group {
  min-width: 0;
}

.option-group.grow {
  flex: 1 1 220px;
  min-width: 180px;
}

.option-group.grow input {
  height: 31px;
  padding: 4px 11px;
  font-size: 12px;
}

.option-group.compact select {
  width: auto;
  height: 31px;
  padding: 4px 30px 4px 11px;
  font-size: 12px;
}

.option-group.model-group select {
  width: auto;
  min-width: 190px;
  max-width: 260px;
  height: 31px;
  padding: 4px 30px 4px 11px;
  font-size: 12px;
}

.option-label {
  margin-bottom: 7px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
}

.section-head h2 {
  display: inline-flex;
  align-items: center;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.section-head h2::before {
  content: "";
  width: 16px;
  height: 1px;
  margin-right: 10px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.section-head .hint,
.section-head .btn {
  margin-left: auto;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 34px;
}

.job-card {
  grid-column: 1 / -1;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.job-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.job-prompt {
  flex: 1;
  min-width: 200px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.job-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 23px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--glass-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.job-status::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.job-status.is-running {
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 30%, var(--line));
  background: color-mix(in srgb, var(--gold) 8%, transparent);
}

.job-status.is-running::before {
  animation: pulse 1s infinite;
}

.job-status.is-done {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 30%, var(--line));
  background: color-mix(in srgb, var(--ok) 8%, transparent);
}

.job-status.is-failed {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.job-time {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.job-model {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--glass-2);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.job-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.job-error {
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--danger) 7%, transparent);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.6;
}

.job-progress {
  height: 2px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--glass-3);
  overflow: hidden;
}

.job-progress span {
  display: block;
  width: 34%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--violet));
  box-shadow: 0 0 12px var(--accent);
  animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(330%); }
}

.img-tile {
  position: relative;
  display: block;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  background: var(--glass-3);
  cursor: zoom-in;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.img-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.img-tile:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 34px -14px var(--accent);
}

.img-tile:hover img {
  transform: scale(1.035);
}

.img-tile .tile-overlay {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 24px 9px 8px;
  color: #e6fbff;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  background: linear-gradient(transparent, rgba(2, 6, 12, 0.74));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.img-tile:hover .tile-overlay {
  opacity: 1;
}

.tile-download {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid color-mix(in srgb, var(--accent-bright) 35%, transparent);
  border-radius: 6px;
  background: rgba(3, 10, 18, 0.5);
  color: var(--accent-bright);
  text-decoration: none;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.tile-download:hover {
  background: color-mix(in srgb, var(--accent-bright) 24%, transparent);
  border-color: var(--accent-bright);
}

.tile-download .icon {
  width: 13px;
  height: 13px;
}

.skeleton {
  position: relative;
  aspect-ratio: 1;
  border-radius: 11px;
  overflow: hidden;
  background: var(--glass-3);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--accent) 10%, transparent) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer 1.6s infinite;
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

.recent-tile {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  background: var(--glass);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.recent-tile:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: 0 0 32px -16px var(--accent);
}

.recent-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.recent-tile:hover img {
  transform: scale(1.03);
}

.recent-meta {
  padding: 9px 11px 11px;
  background: var(--glass-2);
}

.recent-meta p {
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-meta time {
  display: block;
  margin-top: 4px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------- 历史 */

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--glass-2);
}

.segmented button {
  height: 30px;
  padding: 0 20px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent),
    0 0 18px -12px var(--accent);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.history-item:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  box-shadow: 0 0 34px -24px var(--accent);
}

.history-top {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.history-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.history-time {
  margin-left: auto;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.history-prompt {
  margin-bottom: 6px;
  color: var(--ink-3);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-excerpt {
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-empty {
  padding: 60px 20px;
  border: 1px dashed color-mix(in srgb, var(--line-strong) 70%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--glass-2) 60%, transparent);
  color: var(--ink-3);
  font-size: 12.5px;
  text-align: center;
}

/* ---------------------------------------------------------------- 灯箱 */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(900px 500px at 50% 0%, color-mix(in srgb, var(--accent-bright) 10%, transparent), transparent 65%),
    rgba(3, 6, 12, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: fade-in 0.2s ease both;
}

.lightbox-close {
  position: absolute;
  top: 22px;
  right: 24px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 50%;
  background: rgba(13, 19, 32, 0.6);
  color: #eaf8ff;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.lightbox-close:hover {
  border-color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent-bright) 16%, transparent);
}

.lightbox-body {
  display: grid;
  grid-template-columns: minmax(0, auto) 300px;
  gap: 24px;
  align-items: center;
  max-width: min(1180px, 100%);
  max-height: 100%;
}

.lightbox-body img {
  display: block;
  max-width: min(68vw, 880px);
  max-height: 82vh;
  border: 1px solid color-mix(in srgb, var(--accent-bright) 22%, transparent);
  border-radius: 13px;
  background: #0a0f18;
  box-shadow: 0 0 90px -30px color-mix(in srgb, var(--accent-bright) 50%, transparent), 0 40px 100px -30px #000;
}

.lightbox-side {
  padding: 22px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(10, 15, 26, 0.66);
  color: #eef6ff;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.lightbox-side .eyebrow {
  color: var(--accent-bright);
}

.lightbox-side .eyebrow::before {
  background: linear-gradient(90deg, var(--accent-bright), transparent);
}

.lightbox-prompt {
  margin: 0 0 20px;
  max-height: 38vh;
  overflow-y: auto;
  overflow-wrap: anywhere;
  color: rgba(238, 246, 255, 0.82);
  font-size: 13px;
  line-height: 1.8;
}

.lightbox-side .btn {
  width: 100%;
  margin-bottom: 9px;
}

.lightbox-side .btn.ghost {
  border-color: rgba(148, 163, 184, 0.32);
  background: transparent;
  color: rgba(238, 246, 255, 0.8);
}

.lightbox-side .btn.ghost:hover {
  border-color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent-bright) 10%, transparent);
  color: #ffffff;
}

/* ---------------------------------------------------------------- Toast */

.toasts {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(360px, calc(100vw - 44px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 9px;
  background: var(--glass);
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.55;
  box-shadow: 0 24px 60px -30px #000, 0 0 40px -30px var(--accent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: toast-in 0.24s ease both;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.success {
  border-left-color: var(--ok);
}

.toast.is-leaving {
  animation: toast-out 0.2s ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(6px); }
}

/* ---------------------------------------------------------------- 页脚 */

.footer a {
  color: inherit;
  text-decoration: none;
  transition: color 0.16s ease;
}

.footer a:hover {
  color: var(--accent);
}

.footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px 20px 30px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
}

.footer .dot {
  opacity: 0.5;
}

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1080px) {
  .hero.has-hud {
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 32px;
  }

  .studio-grid {
    grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .hero.has-hud {
    grid-template-columns: 1fr;
  }

  .hero-hud {
    display: none;
  }

  .studio-grid {
    grid-template-columns: 1fr;
  }

  .panel-output {
    min-height: 440px;
  }

  .editor-output {
    min-height: 300px;
  }

  .topbar {
    gap: 12px;
  }

  .provider-badge,
  .user-chip {
    display: none;
  }

  .lightbox-body {
    grid-template-columns: 1fr;
    gap: 16px;
    overflow-y: auto;
  }

  .lightbox-body img {
    max-width: 86vw;
    max-height: 62vh;
  }

  .lightbox-prompt {
    max-height: none;
  }
}

@media (max-width: 720px) {
  :root {
    --topbar-h: 62px;
  }

  #main {
    width: calc(100% - 32px);
    padding-top: 30px;
  }

  .topbar {
    padding: 0 14px;
  }

  .brand-text {
    display: none;
  }

  .tabs {
    padding: 2px;
  }

  .tab {
    height: 29px;
    padding: 0 10px;
    font-size: 12.5px;
  }

  .tab.is-disabled {
    display: none;
  }

  .topbar-actions .btn span {
    display: none;
  }

  .topbar-actions .btn {
    width: 36px;
    height: 36px;
    padding: 0;
  }

  .hero {
    margin-bottom: 26px;
  }

  .hero h1 {
    font-size: clamp(31px, 9vw, 42px);
  }

  .hero-sub {
    font-size: 13.5px;
  }

  .hero-tags span {
    font-size: 8px;
  }

  .panel-form,
  .panel-output {
    padding: 18px;
  }

  .editor-output {
    padding: 20px;
    font-size: 14.5px;
    line-height: 1.95;
  }

  .prompt-row {
    grid-template-columns: 1fr;
  }

  .btn.tall {
    min-height: 50px;
    flex-direction: row;
  }

  .image-options {
    gap: 15px;
  }

  .option-group.grow {
    flex-basis: 100%;
  }

  .history-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .history-actions {
    justify-content: flex-end;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 11px;
  }

  .job-images {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .banner {
    width: calc(100% - 28px);
    margin-top: 12px;
    font-size: 12px;
  }

  .login-card {
    padding: 30px 24px 24px;
    border-radius: 22px;
  }

  .login-card h1 {
    font-size: 32px;
  }

  .login-bg {
    font-size: 120vw;
    right: -26vw;
  }

  .login-corner {
    display: none;
  }

  .login-view::before {
    width: 150vw;
  }

  .login-view::after {
    width: 110vw;
  }

  .toasts {
    right: 14px;
    bottom: 14px;
  }

  .footer {
    font-size: 8px;
  }
}

/* ------------------------------------------------------- 移动端可读性 */

@media (max-width: 720px) {
  body {
    font-size: 16px;
    line-height: 1.7;
  }

  /* 颗粒噪点在小屏上会削弱文字锐度，直接关闭 */
  .bg-noise {
    display: none;
  }

  .tab {
    font-size: 13.5px;
  }

  .hero-sub {
    font-size: 15px;
    line-height: 1.7;
  }

  .hero-tags span {
    font-size: 11px;
    letter-spacing: 0.12em;
  }

  .eyebrow {
    font-size: 11px;
  }

  .editor-output {
    font-size: 16px;
    line-height: 1.9;
  }

  .boot,
  .login-meta,
  .login-foot,
  .login-admin-link,
  .login-switch,
  .user-chip,
  .provider-badge,
  .hint,
  .meta,
  .option-label,
  .field-foot,
  .form-note,
  .advanced summary,
  .empty-state span,
  .job-status,
  .job-time,
  .job-model,
  .recent-meta p,
  .recent-meta time,
  .tag,
  .history-time,
  .history-prompt,
  .length-custom > span,
  .img-tile .tile-overlay,
  .hud-head,
  .hud-row,
  .hud-row dd {
    font-size: 12px;
  }

  .footer {
    font-size: 11px;
  }

  .brand-text small,
  .tab.is-disabled::after {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
