﻿/* ════════════════════════════════════════════════════════
   扩散 v1.0  ·  style.css
   设计语言：深色极简 + 紫色渐变品牌色 + 流畅微动画
   ════════════════════════════════════════════════════════ */

/* -- 核心主题系统 -------------------------------------------- */
:root, [data-theme="obsidian"] {
  --bg-base:      #000000;
  --bg-surface:   rgba(9,9,11, 0.7);
  --bg-card:      rgba(18,18,20, 0.75);
  --bg-hover:     #1c1c20;
  --bg-input:     #121214;
  --border:       rgba(255,255,255,.06);
  --border-focus: rgba(255,255,255,.2);

  --primary:      #e2e8f0;
  --primary-2:    #f8fafc;
  --accent:       #6366f1;
  --grad:         linear-gradient(135deg, #1e1e24 0%, #0d0d12 100%);
  --grad-hover:   linear-gradient(135deg, #2a2a32 0%, #17171e 100%);

  --text:         #ededed;
  --text-2:       #a1a1aa;
  --text-3:       #71717a;

  --shadow-card:  0 8px 32px rgba(0,0,0,.6);
  --shadow-glow:  0 0 20px rgba(255,255,255,.03);
}

[data-theme="minimal"] {
  --bg-base:      #f6f7f9;
  --bg-surface:   rgba(255,255,255,.86);
  --bg-card:      #ffffff;
  --bg-hover:     #eef1f5;
  --bg-input:     #ffffff;
  --border:       rgba(15,23,42,.1);
  --border-focus: rgba(15,23,42,.34);

  --primary:      #111827;
  --primary-2:    #030712;
  --accent:       #2563eb;
  --grad:         linear-gradient(135deg, #111827 0%, #030712 100%);
  --grad-hover:   linear-gradient(135deg, #1f2937 0%, #09090b 100%);

  --text:         #111827;
  --text-2:       #4b5563;
  --text-3:       #8a94a6;

  --shadow-card:  0 18px 48px rgba(15,23,42,.08);
  --shadow-glow:  0 1px 0 rgba(255,255,255,.86) inset;
}

:root {
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --info:         #3b82f6;

  --radius:       16px;
  --radius-sm:    10px;
  --radius-full:  999px;

  --transition:   all .25s cubic-bezier(.4,0,.2,1);
  --spring:       all .4s cubic-bezier(.175,.885,.32,1.275);
}

/* -- Reset ----------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Noto Sans SC', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* -- Canvas Background -- */
#bg-canvas {
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: -1; pointer-events: none;
}
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea { font: inherit; }
a { color: var(--primary-2); text-decoration: none; }

/* ══════════════════════════════════════════════════════════
   HOME
══════════════════════════════════════════════════════════ */
.home-page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(250,250,250,.98), rgba(243,244,246,.94) 56%, rgba(236,238,242,.98)),
    #f7f8fa;
  color: #0a0a0b;
}

.home-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(12,13,15,.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(12,13,15,.045) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, transparent, black 14%, black 76%, transparent);
}

.home-brush-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  mix-blend-mode: normal;
  opacity: .82;
  filter: saturate(.9) brightness(.92);
  background: transparent;
}

.home-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 56px);
  color: #111214;
  background: rgba(247,248,250,.68);
  border-bottom: 1px solid rgba(12,13,15,.08);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.home-brand,
.home-nav-actions {
  display: inline-flex;
  align-items: center;
}

.home-brand {
  gap: 10px;
  color: #111214;
  font-size: 15px;
  font-weight: 750;
}

.home-brand-mark {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #111214;
  color: #f8fafc;
  font-size: 18px;
  line-height: 1;
}

.home-brand-mark svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-logo-img {
  display: block;
  object-fit: contain;
}

.home-brand-logo {
  width: clamp(116px, 13vw, 168px);
  height: auto;
  max-height: 38px;
}

.auth-cover-logo {
  width: min(260px, 70%);
  height: auto;
  max-height: 78px;
}

.auth-card-logo {
  width: min(230px, 86%);
  height: auto;
  max-height: 70px;
}

.topbar-logo {
  width: clamp(112px, 10vw, 154px);
  height: auto;
  max-height: 42px;
}

.home-nav-actions {
  gap: 8px;
}

.home-nav-link,
.home-login-btn {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 14px;
  color: rgba(17,18,20,.72);
  font-size: 13px;
  font-weight: 650;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.home-nav-link:hover,
.home-login-btn:hover {
  color: #0a0a0b;
  background: rgba(17,18,20,.06);
  transform: translateY(-1px);
}

.home-login-btn {
  color: #f8fafc;
  background: #111214;
  padding: 0 17px;
}

.home-login-btn:hover {
  color: #fff;
  background: #000;
}

.home-main {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(430px, 1fr) auto;
  align-items: end;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 112px 0 42px;
}

.home-hero {
  max-width: 870px;
  padding-bottom: clamp(36px, 7vh, 92px);
}

.home-kicker {
  margin: 0 0 18px;
  color: rgba(17,18,20,.52);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}

.home-hero h1 {
  margin: 0;
  color: #070708;
  font-size: clamp(68px, 12vw, 164px);
  line-height: .86;
  letter-spacing: 0;
  font-weight: 850;
}

.home-title-logo-wrap {
  position: relative;
  display: block;
  width: min(760px, 86vw);
  aspect-ratio: 2500 / 552;
  min-height: clamp(118px, 18vw, 168px);
  --logo-mx: 50%;
  --logo-my: 50%;
  --logo-mask: url("/logo-web-sharp.png");
  --logo-glow-opacity: .72;
  filter: drop-shadow(0 22px 46px rgba(15,23,42,.12));
  cursor: none;
}

.home-title-logo-wrap::before,
.home-title-logo-wrap::after {
  content: "";
  position: absolute;
  inset: -18% -7%;
  pointer-events: none;
  opacity: var(--logo-glow-opacity);
  transition: opacity .34s ease, transform .34s ease;
}

.home-title-logo-wrap::before {
  z-index: 0;
  background:
    radial-gradient(circle at var(--logo-mx) var(--logo-my), rgba(99,102,241,.32), transparent 18%),
    radial-gradient(circle at 20% 30%, rgba(14,165,233,.2), transparent 28%),
    radial-gradient(circle at 76% 66%, rgba(236,72,153,.18), transparent 30%);
  filter: blur(22px) saturate(1.18);
  mix-blend-mode: multiply;
}

.home-title-logo-wrap::after {
  z-index: 2;
  background: radial-gradient(circle at var(--logo-mx) var(--logo-my), rgba(255,255,255,.9), rgba(147,197,253,.35) 10%, transparent 23%);
  filter: blur(7px);
  mix-blend-mode: screen;
  opacity: calc(var(--logo-glow-opacity) * .58);
}

.home-title-logo-wrap.is-logo-active {
  --logo-glow-opacity: 1;
}

.home-title-logo-wrap.is-logo-active::before {
  transform: scale(1.012);
}

.home-title-logo {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  opacity: .93;
  filter: contrast(1.04);
}

.home-title-logo-gradient {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(115deg, #05070a 0%, #1f2937 18%, #2563eb 36%, #7c3aed 50%, #db2777 64%, #f59e0b 78%, #05070a 100%);
  background-size: 240% 240%;
  animation: homeLogoGradientDrift 9s ease-in-out infinite;
  -webkit-mask-image: var(--logo-mask);
  mask-image: var(--logo-mask);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  opacity: .32;
  pointer-events: none;
  mix-blend-mode: screen;
  transition: opacity .28s ease, filter .28s ease;
}

.home-title-logo-wrap.is-logo-active .home-title-logo-gradient {
  opacity: .66;
  filter: saturate(1.24) contrast(1.08);
}

.home-logo-particles {
  position: absolute;
  inset: -10% -4%;
  z-index: 3;
  width: 108%;
  height: 120%;
  pointer-events: none;
  opacity: .86;
  mix-blend-mode: multiply;
}

@keyframes homeLogoGradientDrift {
  0%, 100% { background-position: 0% 42%; }
  50% { background-position: 100% 58%; }
}

.home-copy {
  width: min(650px, 100%);
  margin: 30px 0 0;
  color: rgba(17,18,20,.62);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.65;
  font-weight: 420;
}

.home-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
  flex-wrap: wrap;
}

.home-primary,
.home-secondary {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 999px;
  padding: 0 22px;
  font-size: 15px;
  font-weight: 760;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}

.home-primary svg,
.home-secondary svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-primary {
  color: #fff;
  background: #08090a;
  box-shadow: 0 18px 40px rgba(0,0,0,.16);
}

.home-primary:hover,
.home-secondary:hover {
  transform: translateY(-2px);
}

.home-primary:hover {
  box-shadow: 0 22px 54px rgba(0,0,0,.2);
}

.home-secondary {
  color: #111214;
  background: rgba(255,255,255,.56);
  border: 1px solid rgba(17,18,20,.1);
  box-shadow: 0 12px 34px rgba(17,18,20,.07);
}

.home-entry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.home-entry {
  --mx: 50%;
  --my: 50%;
  position: relative;
  min-height: 190px;
  display: grid;
  align-content: end;
  gap: 10px;
  overflow: hidden;
  text-align: left;
  padding: 24px;
  border-radius: 8px;
  color: #101113;
  background:
    radial-gradient(circle at var(--mx) var(--my), rgba(255,255,255,.78), transparent 34%),
    rgba(255,255,255,.5);
  border: 1px solid rgba(17,18,20,.1);
  box-shadow: 0 20px 50px rgba(17,18,20,.08);
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.home-entry::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .7;
  background:
    linear-gradient(135deg, rgba(15,23,42,.08), transparent 42%),
    linear-gradient(180deg, transparent, rgba(255,255,255,.72));
  pointer-events: none;
}

.home-entry:hover {
  transform: translateY(-4px);
  border-color: rgba(17,18,20,.18);
  box-shadow: 0 26px 70px rgba(17,18,20,.13);
}

.home-entry span {
  position: relative;
  z-index: 1;
}

.home-entry-index {
  color: rgba(17,18,20,.45);
  font-size: 12px;
  font-weight: 800;
}

.home-entry-title {
  color: #08090a;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
  font-weight: 820;
}

.home-entry-copy {
  max-width: 460px;
  color: rgba(17,18,20,.58);
  font-size: 14px;
  line-height: 1.65;
}

.home-entry-meta {
  color: rgba(17,18,20,.45);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

#app.home-hidden,
.home-page.home-hidden {
  display: none;
}

/* ══════════════════════════════════════════════════════════
   AUTH
══════════════════════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: none;
  background: rgba(0,0,0,.15);
  place-items: center;
  padding: 24px;
}
.overlay.active { display: grid; }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(320px, 560px) 400px;
  align-items: stretch;
  gap: 18px;
  width: min(1000px, 96vw);
}

.auth-cover {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 560px;
  padding: 48px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.018)),
    radial-gradient(circle at 16% 20%, rgba(110,231,183,.16), transparent 34%),
    radial-gradient(circle at 86% 72%, rgba(99,102,241,.2), transparent 38%),
    #111318;
  color: #f8fafc;
  box-shadow: 0 26px 80px rgba(0,0,0,.32);
  -webkit-backdrop-filter: blur(24px) saturate(1.05);
  backdrop-filter: blur(24px) saturate(1.05);
}

.auth-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, rgba(8,10,14,.92), rgba(17,19,26,.86));
  pointer-events: none;
}

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

.auth-cover-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 42px;
  color: var(--text);
  font-weight: 800;
  font-size: 1.1rem;
}

.auth-cover h1 {
  max-width: 520px;
  margin: 0 0 18px;
  color: #f8fafc;
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  line-height: .98;
  letter-spacing: 0;
}

.auth-cover p {
  max-width: 520px;
  margin: 0 0 32px;
  color: rgba(248,250,252,.72);
  line-height: 1.75;
}

.auth-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 460px;
}

.auth-feature-grid div {
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: rgba(248,250,252,.86);
  font-size: .86rem;
}

.auth-card {
  width: 400px; max-width: 95vw;
  background: var(--bg-surface);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  animation: slideUp .4s cubic-bezier(.34,1.56,.64,1);
}

.auth-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 32px; justify-content: center;
}
.auth-logo span {
  font-size: 1.5rem; font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.auth-tabs {
  display: flex; gap: 4px; margin-bottom: 28px;
  background: var(--bg-input); border-radius: var(--radius-sm); padding: 4px;
}
.auth-tab {
  flex: 1; padding: 8px 16px; border-radius: 6px;
  color: var(--text-2); font-size: .875rem; font-weight: 500;
  transition: var(--transition);
}
.auth-tab.active {
  background: var(--bg-card); color: var(--text);
  box-shadow: 0 1px 8px rgba(0,0,0,.3);
}

.form-group { margin-bottom: 18px; }
.form-group label {
  display: flex; align-items: center; gap: 6px;
  font-size: .8rem; font-weight: 500; color: var(--text-2); margin-bottom: 6px;
}
.optional { font-size: .72rem; color: var(--text-3); font-weight: 400; }

.form-group input {
  width: 100%; padding: 12px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  outline: none; transition: var(--transition);
}
.form-group input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }

.auth-error {
  font-size: .8rem; color: var(--danger);
  min-height: 18px; margin-bottom: 14px; text-align: center;
}

/* 邮箱输入行（输入框 + 发送按钮并排） */
.email-input-row {
  display: flex; gap: 8px; align-items: stretch;
}
.email-input-row input {
  flex: 1; min-width: 0;
  padding: 12px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  outline: none; transition: var(--transition);
}
.email-input-row input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }

.btn-send-code {
  flex-shrink: 0; padding: 0 14px;
  background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.3);
  border-radius: var(--radius-sm); color: var(--primary-2);
  font-size: .78rem; font-weight: 600; white-space: nowrap;
  transition: var(--transition);
}
.btn-send-code:hover:not(:disabled) {
  background: rgba(99,102,241,.25); border-color: rgba(99,102,241,.5);
}
.btn-send-code:disabled { opacity: .5; pointer-events: none; }

/* Recharge modal viewport fix: keep the Alipay button reachable on short Mac/Safari viewports. */
.recharge-overlay.active {
  align-items: start;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.recharge-card-wide {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-height: 760px) {
  .recharge-card-wide {
    padding-top: 24px;
    padding-bottom: 18px;
  }
  .recharge-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
  }
  .payment-plan {
    min-height: 104px;
  }
}

/* ══════════════════════════════════════════════════════════
   STUDIO WHITE REDESIGN V2
══════════════════════════════════════════════════════════ */
[data-theme="minimal"] {
  color-scheme: light;
}

[data-theme="minimal"] body,
body[data-theme="minimal"] {
  background:
    radial-gradient(circle at 74% 0%, rgba(210,219,232,.72), transparent 34%),
    linear-gradient(180deg, #fbfbfc 0%, #f4f6f9 54%, #eef1f5 100%);
}

[data-theme="minimal"] #app {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(17,24,39,.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(17,24,39,.03) 1px, transparent 1px),
    radial-gradient(circle at 78% 8%, rgba(148,163,184,.18), transparent 30%),
    #f6f7f9;
  background-size: 76px 76px, 76px 76px, auto, auto;
}

[data-theme="minimal"] .topbar {
  height: 72px;
  padding: 0 clamp(18px, 3.6vw, 54px);
  background: rgba(250,251,253,.82);
  border-bottom: 1px solid rgba(15,23,42,.075);
  backdrop-filter: blur(28px) saturate(1.18);
  -webkit-backdrop-filter: blur(28px) saturate(1.18);
  box-shadow: 0 18px 46px rgba(15,23,42,.055);
}

[data-theme="minimal"] .topbar-left,
[data-theme="minimal"] .topbar-right {
  gap: 12px;
}

[data-theme="minimal"] .logo-mark {
  gap: 10px;
}

[data-theme="minimal"] .logo-mark svg {
  width: 30px;
  height: 30px;
  padding: 6px;
  border-radius: 999px;
  color: #fff !important;
  background: #111827;
  box-shadow: 0 12px 28px rgba(15,23,42,.18);
}

[data-theme="minimal"] .logo-text {
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 760;
}

[data-theme="minimal"] .main-nav {
  min-height: 38px;
  padding: 4px;
  gap: 3px;
  background: rgba(15,23,42,.04);
  border-color: rgba(15,23,42,.075);
}

[data-theme="minimal"] .nav-link {
  padding: 8px 14px;
  color: #667085;
  font-size: .82rem;
  font-weight: 720;
}

[data-theme="minimal"] .nav-link:hover,
[data-theme="minimal"] .nav-link.active {
  color: #111827;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15,23,42,.085);
}

[data-theme="minimal"] .workspace {
  grid-template-columns: minmax(338px, 24vw) minmax(0, 1fr);
  min-height: 100vh;
  padding-top: 72px;
}

[data-theme="minimal"] .control-panel {
  top: 72px;
  height: calc(100vh - 72px);
  padding: 28px 20px 28px clamp(20px, 2.8vw, 42px);
  background: rgba(255,255,255,.74);
  border-right: 1px solid rgba(15,23,42,.08);
  backdrop-filter: blur(30px) saturate(1.08);
  -webkit-backdrop-filter: blur(30px) saturate(1.08);
  box-shadow: 24px 0 70px rgba(15,23,42,.045);
}

[data-theme="minimal"] .panel-section {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(15,23,42,.07);
  border-radius: 8px;
  background: rgba(255,255,255,.58);
  box-shadow: 0 12px 34px rgba(15,23,42,.04);
}

[data-theme="minimal"] .prompt-section {
  display: flex;
  min-height: 260px;
  flex-direction: column;
}

[data-theme="minimal"] .section-title {
  margin-bottom: 12px;
  color: #8a94a6;
  font-size: .68rem;
  font-weight: 820;
  letter-spacing: .12em;
}

[data-theme="minimal"] .model-cards {
  gap: 10px;
}

[data-theme="minimal"] .model-card {
  min-height: 74px;
  padding: 14px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 8px;
  box-shadow: none;
}

[data-theme="minimal"] .model-card:hover {
  transform: translateY(-2px);
}

[data-theme="minimal"] .model-card.active {
  background: #fff;
  border-color: rgba(15,23,42,.28);
  box-shadow: 0 18px 42px rgba(15,23,42,.09);
}

[data-theme="minimal"] .model-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #f1f4f8;
  color: #111827;
}

[data-theme="minimal"] .model-card.active .model-icon {
  background: #111827;
  color: #fff;
}

[data-theme="minimal"] .model-name {
  color: #111827;
  font-size: .92rem;
  font-weight: 740;
}

[data-theme="minimal"] .model-desc {
  color: #8993a4;
}

[data-theme="minimal"] .ratio-grid {
  gap: 8px;
}

[data-theme="minimal"] .ratio-btn,
[data-theme="minimal"] .res-btn,
[data-theme="minimal"] .count-btn {
  background: rgba(255,255,255,.76);
  border-color: rgba(15,23,42,.08);
  color: #526071;
  box-shadow: none;
}

[data-theme="minimal"] .ratio-btn {
  min-height: 38px;
  border-radius: 999px;
  font-weight: 720;
}

[data-theme="minimal"] .ratio-btn:hover,
[data-theme="minimal"] .res-btn:hover,
[data-theme="minimal"] .count-btn:hover {
  color: #111827;
  background: #fff;
  border-color: rgba(15,23,42,.18);
  transform: translateY(-1px);
}

[data-theme="minimal"] .ratio-btn.active,
[data-theme="minimal"] .res-btn.active {
  color: #fff;
  background: #111827;
  border-color: #111827;
  box-shadow: 0 16px 32px rgba(15,23,42,.16);
}

[data-theme="minimal"] .res-group {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

[data-theme="minimal"] .res-btn {
  min-height: 58px;
  border-radius: 8px;
}

[data-theme="minimal"] .count-group {
  min-height: 48px;
}

[data-theme="minimal"] .count-val {
  color: #111827;
}

[data-theme="minimal"] .count-tip,
[data-theme="minimal"] .char-count {
  color: #7a8494;
}

[data-theme="minimal"] .count-tip strong {
  color: #111827;
}

[data-theme="minimal"] .ref-upload-area {
  padding: 22px 14px;
  border: 1px dashed rgba(15,23,42,.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.84), rgba(248,250,252,.76));
  color: #7a8494;
}

[data-theme="minimal"] .ref-upload-area:hover,
[data-theme="minimal"] .ref-upload-area.drag-over {
  border-color: rgba(15,23,42,.34);
  color: #111827;
  background: #fff;
}

[data-theme="minimal"] .ref-thumb {
  border-color: rgba(15,23,42,.1);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15,23,42,.1);
}

[data-theme="minimal"] .prompt-textarea {
  flex: 1;
  min-height: 180px;
  border-radius: 8px;
  background: #fff;
  border-color: rgba(15,23,42,.09);
  color: #111827;
  box-shadow: inset 0 1px 0 rgba(15,23,42,.03);
}

[data-theme="minimal"] .prompt-textarea:focus {
  border-color: rgba(15,23,42,.32);
  box-shadow: 0 0 0 4px rgba(15,23,42,.055);
}

[data-theme="minimal"] .btn-generate {
  min-height: 56px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: .96rem;
  font-weight: 760;
  box-shadow: 0 22px 48px rgba(15,23,42,.2);
}

[data-theme="minimal"] .btn-generate:hover:not(:disabled) {
  background: #030712;
  transform: translateY(-2px);
  box-shadow: 0 28px 60px rgba(15,23,42,.24);
}

[data-theme="minimal"] .output-stream {
  position: relative;
  padding: clamp(26px, 3.2vw, 48px);
  background:
    radial-gradient(circle at 86% 6%, rgba(255,255,255,.94), transparent 28%),
    radial-gradient(circle at 18% 18%, rgba(226,232,240,.56), transparent 28%);
}

[data-theme="minimal"] .stream-header {
  min-height: 54px;
  margin-bottom: 28px;
  padding: 0 0 18px;
  border-bottom: 1px solid rgba(15,23,42,.08);
}

[data-theme="minimal"] .stream-title {
  color: #0f172a;
  font-size: clamp(1.6rem, 2.8vw, 2.45rem);
  font-weight: 820;
  letter-spacing: 0;
}

[data-theme="minimal"] .btn-ghost {
  background: rgba(255,255,255,.66);
  border-color: rgba(15,23,42,.08);
  color: #536071;
}

[data-theme="minimal"] .btn-ghost:hover {
  background: #fff;
  color: #111827;
  box-shadow: 0 12px 28px rgba(15,23,42,.08);
}

[data-theme="minimal"] .task-list {
  gap: 22px;
}

[data-theme="minimal"] .task-card {
  overflow: hidden;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 24px 70px rgba(15,23,42,.08);
  backdrop-filter: blur(24px) saturate(1.08);
  -webkit-backdrop-filter: blur(24px) saturate(1.08);
}

[data-theme="minimal"] .task-card-header {
  padding: 18px 20px;
  border-bottom-color: rgba(15,23,42,.08);
  background: rgba(255,255,255,.54);
}

[data-theme="minimal"] .task-prompt {
  color: #111827;
  font-size: .94rem;
  font-weight: 650;
}

[data-theme="minimal"] .task-tag,
[data-theme="minimal"] .task-action-btn {
  border-color: rgba(15,23,42,.08);
  background: rgba(15,23,42,.035);
  color: #667085;
}

[data-theme="minimal"] .task-action-btn:hover {
  color: #111827;
  background: #fff;
  border-color: rgba(15,23,42,.16);
}

[data-theme="minimal"] .task-imgs {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  padding: 18px 20px 20px;
}

[data-theme="minimal"] .task-img-item {
  border-radius: 8px;
  background: #edf0f4;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.055);
}

[data-theme="minimal"] .task-img-item:hover .img-overlay {
  background: rgba(15,23,42,.36);
}

[data-theme="minimal"] .img-btn {
  background: rgba(255,255,255,.9);
  border-color: rgba(255,255,255,.72);
  color: #111827;
  box-shadow: 0 12px 30px rgba(15,23,42,.18);
}

[data-theme="minimal"] .empty-state {
  min-height: 460px;
  justify-content: center;
  padding: 80px 20px;
  border: 1px dashed rgba(15,23,42,.13);
  border-radius: 8px;
  background: rgba(255,255,255,.44);
  color: #8a94a6;
}

[data-theme="minimal"] .toast {
  background: rgba(255,255,255,.92);
  border-color: rgba(15,23,42,.1);
  color: #111827;
  box-shadow: 0 18px 48px rgba(15,23,42,.12);
}

[data-theme="minimal"] .recharge-card {
  background: rgba(255,255,255,.94);
  border-color: rgba(15,23,42,.1);
  box-shadow: 0 30px 90px rgba(15,23,42,.18);
}

[data-theme="minimal"] .payment-plan,
[data-theme="minimal"] .payment-summary > div,
[data-theme="minimal"] .recharge-balance,
[data-theme="minimal"] .redeem-panel,
[data-theme="minimal"] .recharge-record-item,
[data-theme="minimal"] .invoice-panel {
  background: #fff;
  border-color: rgba(15,23,42,.1);
}

[data-theme="minimal"] .recharge-records-head button,
[data-theme="minimal"] .invoice-panel-head button,
[data-theme="minimal"] .invoice-form-grid input,
[data-theme="minimal"] .invoice-form-grid textarea {
  background: #fff;
  border-color: rgba(15,23,42,.12);
}

[data-theme="minimal"] .redeem-row input {
  background: #fff;
  border-color: rgba(15,23,42,.12);
}

[data-theme="minimal"] .redeem-row button {
  background: #111827;
  color: #fff;
}

[data-theme="minimal"] .invoice-type-tabs {
  background: rgba(15,23,42,.045);
  border-color: rgba(15,23,42,.08);
}

[data-theme="minimal"] .invoice-type-tabs button.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 8px 22px rgba(15,23,42,.12), inset 0 1px 0 rgba(255,255,255,.9);
}

[data-theme="minimal"] .recharge-card-wide,
[data-theme="minimal"] .recharge-record-list {
  scrollbar-color: rgba(15,23,42,.2) transparent;
}

[data-theme="minimal"] .recharge-card-wide::-webkit-scrollbar-thumb,
[data-theme="minimal"] .recharge-record-list::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,.18);
}

@media (max-width: 980px) {
  [data-theme="minimal"] .workspace {
    grid-template-columns: 1fr;
  }
  [data-theme="minimal"] .control-panel {
    position: static;
    height: auto;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid rgba(15,23,42,.08);
  }
  [data-theme="minimal"] .panel-section {
    padding: 14px;
  }
}

@media (max-width: 560px) {
  [data-theme="minimal"] .topbar {
    height: 64px;
    padding: 0 12px;
  }
  [data-theme="minimal"] .workspace {
    padding-top: 64px;
  }
  [data-theme="minimal"] .control-panel {
    padding: 12px;
  }
  [data-theme="minimal"] .output-stream {
    padding: 16px 12px 24px;
  }
  [data-theme="minimal"] .task-imgs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
  }
}

/* 验证码输入行 */
.code-input-row {
  display: flex; flex-direction: column; gap: 6px;
}
.code-input-row input {
  width: 100%; padding: 12px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  outline: none; transition: var(--transition);
  font-size: 1.1rem; letter-spacing: 4px; font-weight: 600;
}
.code-input-row input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.code-input-row input::placeholder { letter-spacing: normal; font-weight: 400; font-size: .85rem; }
.code-hint {
  font-size: .75rem; color: var(--text-3); padding: 0 2px;
  transition: color .3s;
}

/* 注册必填标记 */
.reg-required {
  font-size: .72rem; color: var(--danger); font-weight: 500;
}

/* ══════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════ */
.btn-primary {
  width: 100%; padding: 13px;
  background: var(--grad); border-radius: var(--radius-sm);
  color: #fff; font-weight: 600; font-size: .9rem;
  transition: var(--transition);
}
.btn-primary:hover { background: var(--grad-hover); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(99,102,241,.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; pointer-events: none; }

.btn-ghost {
  padding: 7px 14px; border-radius: var(--radius-full);
  color: var(--text-2); font-size: .825rem; font-weight: 500;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }
.btn-sm { padding: 5px 12px; font-size: .78rem; }

.btn-generate {
  width: 100%; padding: 16px;
  background: var(--text); border-radius: var(--radius-sm);
  color: #000; font-size: .95rem; font-weight: 600; letter-spacing: -0.01em;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: var(--transition);
  margin-top: 12px;
  box-shadow: 0 4px 20px rgba(255,255,255,.1);
}
.btn-generate:hover:not(:disabled) { background: #fff; transform: translateY(-1px); box-shadow: 0 8px 30px rgba(255,255,255,.15); }
.btn-generate:active:not(:disabled) { transform: translateY(1px); }
.btn-generate:disabled { opacity: .4; pointer-events: none; }

/* ══════════════════════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════════════════════ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-surface);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}

.theme-switch-container {
  display: flex; align-items: center; cursor: pointer;
  padding: 4px;
}
.theme-switch {
  width: 44px; height: 24px; border-radius: 12px;
  background: rgba(255,255,255, 0.1); border: 1px solid var(--border);
  position: relative; transition: var(--transition);
}
.theme-switch-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text); position: absolute;
  top: 2px; left: 2px; transition: var(--spring);
}
[data-theme="minimal"] .theme-switch {
  background: #fff;
  border-color: rgba(15,23,42,.12);
  box-shadow: 0 10px 28px rgba(15,23,42,.08);
}
[data-theme="minimal"] .theme-switch-thumb {
  transform: translateX(20px);
  background: #111827;
  box-shadow: 0 6px 14px rgba(15,23,42,.18);
}

.topbar-left, .topbar-right {
  display: flex; align-items: center; gap: 16px;
}

.logo-mark {
  display: flex; align-items: center; gap: 8px;
}
.logo-text {
  font-size: 1.15rem; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.03);
}

.nav-link {
  padding: 7px 12px;
  border-radius: var(--radius-full);
  color: var(--text-2);
  font-size: .82rem;
  font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,.09);
  color: var(--text);
}

.quota-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.25);
  border-radius: var(--radius-full);
  font-size: .8rem; font-weight: 600; color: var(--primary-2);
}

.user-menu {
  display: flex; align-items: center; gap: 10px;
}
#user-name {
  font-size: .85rem; font-weight: 500; color: var(--text-2);
}

/* ══════════════════════════════════════════════════════════
   WORKSPACE LAYOUT
══════════════════════════════════════════════════════════ */
.workspace {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
  padding-top: 60px;
}

/* -- Control Panel -- */
.control-panel {
  position: sticky; top: 60px; height: calc(100vh - 60px);
  overflow-y: auto; overflow-x: hidden;
  padding: 24px 20px;
  background: var(--bg-surface);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.control-panel::-webkit-scrollbar { width: 4px; }
.control-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.panel-section { margin-bottom: 20px; }
.section-title {
  font-size: .75rem; font-weight: 600; letter-spacing: .08em;
  color: var(--text-3); text-transform: uppercase; margin-bottom: 10px;
}

/* Model Cards */
.model-cards { display: flex; flex-direction: column; gap: 8px; }
.model-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  background: rgba(255,255,255,.02); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition);
}
.model-card:hover { border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.04); }
.model-card.active {
  border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.06);
}
.model-icon { flex-shrink: 0; color: var(--text-2); display: flex; align-items: center; }
.model-card.active .model-icon { color: var(--text); }
.model-info { flex: 1; }
.model-name { font-size: .9rem; font-weight: 500; letter-spacing: -0.01em; color: var(--text); }
.model-desc { font-size: .75rem; color: var(--text-3); margin-top: 4px; }
.model-check {
  display: flex; align-items: center; justify-content: center;
  color: var(--text); opacity: 0; transform: scale(.8);
  transition: var(--spring);
}
.model-card.active .model-check { opacity: 1; transform: scale(1); }

/* Ratio Grid */
.ratio-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.ratio-btn {
  padding: 8px 4px; font-size: .78rem; font-weight: 500;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-2);
  transition: var(--transition);
}
.ratio-btn:hover { color: var(--text); border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.04); }
.ratio-btn.active {
  background: var(--text); border-color: var(--text); color: #000;
}

/* Resolution */
.res-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.res-btn {
  padding: 10px; font-size: .85rem; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-2);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: var(--transition);
}
.res-btn:hover { border-color: rgba(255,255,255,.15); color: var(--text); background: rgba(255,255,255,.04); }
.res-btn.active { border-color: var(--text); color: #000; background: var(--text); }
.res-tag { font-size: .65rem; font-weight: 400; color: var(--text-3); }
.res-btn.active .res-tag { color: #333; opacity: .8; }

/* Count */
.count-group {
  display: flex; align-items: center; gap: 12px;
}
.count-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: 1.1rem; font-weight: 700;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.count-btn:hover { border-color: var(--primary); color: var(--primary-2); }
.count-val {
  font-size: 1.4rem; font-weight: 700; min-width: 28px; text-align: center;
}
.count-tip { font-size: .75rem; color: var(--text-2); }
.count-tip strong { color: var(--primary-2); }

/* Video Options */
.video-only-ratio,
.video-only-res,
.gpt-only-res,
#video-options-section,
#video-url-section { display: none; }
.duration-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
  margin-bottom: 12px;
}
.duration-btn,
.video-url-add,
.video-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.duration-btn { padding: 8px 4px; font-size: .78rem; font-weight: 600; }
.duration-btn:hover,
.video-url-add:hover,
.video-btn:hover { border-color: rgba(255,255,255,.15); color: var(--text); background: rgba(255,255,255,.04); }
.duration-btn.active { border-color: var(--text); background: var(--text); color: #000; }
.video-cost-preview {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-size: .82rem;
  font-weight: 700;
  text-align: center;
}
.video-toggle-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; font-size: .78rem; color: var(--text-2);
}
.video-toggle-row input { accent-color: var(--primary); }
.video-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.video-upload-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 13px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}
.video-upload-card:hover,
.video-upload-card:focus-within {
  border-color: rgba(255,255,255,.42);
  color: var(--text);
  background: rgba(255,255,255,.06);
  box-shadow: 0 0 0 3px rgba(255,255,255,.08) inset;
}
.video-upload-card:active { transform: scale(.98); }
.video-upload-card input { display: none; }
.video-upload-card span { font-size: .8rem; font-weight: 700; }
.video-upload-card small { font-size: .68rem; color: var(--text-2); }
.video-url-row { display: flex; gap: 8px; margin-bottom: 8px; }
.video-url-input {
  flex: 1; min-width: 0; padding: 9px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); font-size: .78rem;
}
.video-url-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.video-url-add { padding: 0 10px; font-size: .75rem; white-space: nowrap; }
.video-url-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.video-ref-empty { color: var(--text-3); font-size: .74rem; }
.video-ref-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: rgba(255,255,255,.03);
  font-size: .72rem;
}
.video-ref-pill span { color: var(--text); }
.video-ref-pill strong { flex: 1; min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-ref-pill button { color: var(--text-3); background: transparent; }
.task-tag.model-video { color: var(--text-2); }

/* Ref Upload */
.ref-upload-area {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px; text-align: center;
  cursor: pointer; transition: var(--transition);
  color: var(--text-3);
}
.ref-upload-area:hover, .ref-upload-area.drag-over {
  border-color: var(--primary); color: var(--primary-2);
  background: rgba(99,102,241,.05);
}
.ref-upload-area svg { margin-bottom: 6px; }
.ref-upload-area p { font-size: .78rem; }

.ref-preview-list {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.ref-thumb {
  position: relative; width: 64px; height: 64px;
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border);
}
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ref-thumb-del {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,.7); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; cursor: pointer;
  transition: var(--transition);
}
.ref-thumb-del:hover { background: var(--danger); }

/* Prompt */
.prompt-section { flex: 1; }
.prompt-textarea {
  width: 100%; resize: vertical;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 12px 14px; line-height: 1.6; font-size: .875rem;
  outline: none; transition: var(--transition);
  min-height: 120px;
}
.prompt-textarea:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.prompt-textarea::placeholder { color: var(--text-3); }
.prompt-footer {
  display: flex; justify-content: flex-end;
  margin-top: 6px;
}
.char-count { font-size: .72rem; color: var(--text-3); }

.gen-error {
  text-align: center; font-size: .8rem; color: var(--danger);
  min-height: 18px; margin-top: 8px;
}

/* ══════════════════════════════════════════════════════════
   OUTPUT STREAM
══════════════════════════════════════════════════════════ */
.output-stream {
  padding: 28px;
  background: transparent;
  min-height: calc(100vh - 60px);
}

.stream-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.stream-title {
  font-size: 1.1rem; font-weight: 700;
}

.task-list {
  display: flex; flex-direction: column; gap: 20px;
}

.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 80px 0; color: var(--text-3);
}
.empty-state p { font-size: .875rem; }

/* -- Task Card -- */
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: fadeInCard .4s ease;
}

.task-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.task-meta { flex: 1; }
.task-prompt {
  font-size: .9rem; font-weight: 500; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 6px;
}
.task-info-row {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.task-tag {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: .7rem; font-weight: 500;
  background: rgba(255,255,255,.04); border: 1px solid var(--border); color: var(--text-2);
}
.task-tag.model-1 { color: #a1a1aa; }
.task-tag.model-2 { color: #d4d4d8; }

.task-actions {
  display: flex; gap: 6px; flex-shrink: 0;
}
.task-action-btn {
  padding: 5px 11px; border-radius: var(--radius-full);
  font-size: .75rem; font-weight: 500;
  border: 1px solid var(--border); color: var(--text-2);
  transition: var(--transition);
}
.task-action-btn:hover { background: var(--bg-hover); color: var(--text); }
.task-action-btn.danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(239,68,68,.08); }

/* Status pill */
.task-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: .72rem; font-weight: 600;
}
.task-status.PENDING, .task-status.RUNNING {
  background: rgba(245,158,11,.1); color: var(--warning);
}
.task-status.SUCCESS { background: rgba(34,197,94,.1); color: var(--success); }
.task-status.FAILED  { background: rgba(239,68,68,.1);  color: var(--danger); }

.status-dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.task-status.PENDING .status-dot,
.task-status.RUNNING .status-dot { animation: pulse 1.2s infinite; }

/* Image Grid */
.task-imgs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px; padding: 14px 20px;
}

.task-img-item {
  position: relative; border-radius: var(--radius-sm); overflow: hidden;
  aspect-ratio: 1; cursor: zoom-in;
  background: var(--bg-hover);
}
.task-img-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease;
}
.task-img-item:hover img,
.task-img-item.show-actions img { transform: scale(1.03); }

.img-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0);
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap;
  gap: 10px; transition: background .2s;
  padding: 12px;
}
.task-img-item:hover .img-overlay,
.task-img-item.show-actions .img-overlay { background: rgba(0,0,0,.45); }
.img-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.16); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); border: 1px solid rgba(255,255,255,.24);
  opacity: 0; transform: scale(.8);
}
.task-img-item:hover .img-btn,
.task-img-item.show-actions .img-btn { opacity: 1; transform: scale(1); }
.img-btn:hover { background: rgba(255,255,255,.3); }
.img-btn.revision { background: rgba(245,158,11,.24); border-color: rgba(245,158,11,.42); }
.img-btn.revision:hover { background: rgba(245,158,11,.38); }

.task-videos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 12px; padding: 14px clamp(10px, 4vw, 20px);
  min-width: 0;
}
.task-video-item {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(0,0,0,.25);
}
.task-video-item video {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: contain;
  background: #000;
}
.video-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 9px; border-top: 1px solid var(--border);
}
.video-btn {
  padding: 7px 11px;
  font-size: .75rem;
  text-decoration: none;
}

/* ════════════════════════════════════════════════════════
   VIDEO STUDIO PAGE — 独立视频生成页
   ════════════════════════════════════════════════════════ */
.video-workspace {
  display: grid;
  grid-template-columns: 400px 1fr;
  min-height: 100vh;
  padding-top: 60px;
}

.video-panel {
  position: sticky; top: 60px; height: calc(100vh - 60px);
  overflow-y: auto; overflow-x: hidden;
  padding: 26px 22px 40px;
  background: var(--bg-surface);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 22px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.video-panel::-webkit-scrollbar { width: 4px; }
.video-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.video-panel-head { padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.video-panel-kicker {
  font-size: .68rem; font-weight: 600; letter-spacing: .22em;
  color: var(--text-3); text-transform: uppercase;
}
.video-panel-title {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em;
  color: var(--text); margin: 6px 0 4px;
}
.video-panel-sub { font-size: .78rem; color: var(--text-3); line-height: 1.5; }

.video-field { display: flex; flex-direction: column; gap: 10px; }
.video-field-label {
  font-size: .75rem; font-weight: 600; letter-spacing: .08em;
  color: var(--text-3); text-transform: uppercase;
}
.video-field-label .optional {
  text-transform: none; letter-spacing: 0; font-weight: 400;
  color: var(--text-3); opacity: .8; margin-left: 4px;
}
.video-field-foot { display: flex; justify-content: flex-end; }

.video-prompt-textarea {
  width: 100%; resize: vertical; min-height: 110px;
  padding: 13px 14px; font-size: .9rem; line-height: 1.6;
  font-family: inherit; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); transition: var(--transition);
}
.video-prompt-textarea:focus {
  border-color: rgba(255,255,255,.48);
  box-shadow: 0 0 0 3px rgba(255,255,255,.12), 0 12px 34px rgba(255,255,255,.06);
}
.video-prompt-textarea::placeholder { color: var(--text-3); }

.video-chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.video-chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; font-size: .82rem; font-weight: 650;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-2); cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}
.video-chip small { font-size: .64rem; font-weight: 600; color: var(--text-3); }
.video-chip:hover { border-color: rgba(255,255,255,.28); color: var(--text); background: rgba(255,255,255,.06); }
.video-chip:active { transform: scale(.97); }
.video-chip:focus-visible {
  outline: none;
  border-color: rgba(255,255,255,.7);
  box-shadow: 0 0 0 3px rgba(255,255,255,.16);
}
.video-chip.active {
  padding-left: 34px;
  border-color: #fff;
  background: #fff;
  color: #050505;
  box-shadow: 0 0 0 1px rgba(255,255,255,.2) inset, 0 10px 26px rgba(255,255,255,.14);
}
.video-chip.active::before {
  content: "✓";
  position: absolute; left: 13px; top: 50%; transform: translateY(-52%);
  font-size: .82rem; font-weight: 800; line-height: 1;
}
.video-chip.active small { color: rgba(0,0,0,.62); }

.video-switch-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .86rem; font-weight: 600; color: var(--text-2); cursor: pointer;
  transition: var(--transition);
}
.video-switch-row:hover { color: var(--text); background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
.video-switch-row input { width: 18px; height: 18px; accent-color: #f8fafc; cursor: pointer; }
.video-switch-row:has(input:checked) {
  color: var(--text);
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.22);
}

.video-ref-upload {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 22px 14px; text-align: center;
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text-3); cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
}
.video-ref-upload:hover, .video-ref-upload.drag-over {
  border-color: rgba(255,255,255,.42); color: var(--text);
  background: rgba(255,255,255,.06);
  box-shadow: 0 0 0 3px rgba(255,255,255,.08) inset;
}
.video-ref-upload:active { transform: scale(.99); }
.video-ref-upload p { font-size: .82rem; font-weight: 600; }

.video-generate-btn {
  margin-top: 4px;
  box-shadow: 0 10px 30px rgba(255,255,255,.10);
}
.video-generate-btn:active:not(:disabled) {
  transform: translateY(2px) scale(.99);
  box-shadow: 0 0 0 4px rgba(255,255,255,.16), 0 6px 18px rgba(255,255,255,.12);
}

.video-output-stream {
  display: flex; flex-direction: column;
  min-height: calc(100vh - 60px);
  background: var(--bg);
}

/* 视频页白色主题：按钮跟随图片生成页的深色主按钮 / 克制描边风格 */
[data-theme="minimal"] .video-chip {
  background: rgba(255,255,255,.76);
  border-color: rgba(15,23,42,.1);
  color: #526071;
  box-shadow: none;
}
[data-theme="minimal"] .video-chip:hover {
  background: #fff;
  border-color: rgba(15,23,42,.2);
  color: #111827;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15,23,42,.08);
}
[data-theme="minimal"] .video-chip:focus-visible {
  border-color: rgba(15,23,42,.38);
  box-shadow: 0 0 0 4px rgba(15,23,42,.07);
}
[data-theme="minimal"] .video-chip.active {
  border-color: #111827;
  background: #111827;
  color: #fff;
  box-shadow: 0 14px 34px rgba(15,23,42,.18);
}
[data-theme="minimal"] .video-chip.active small {
  color: rgba(255,255,255,.66);
}
[data-theme="minimal"] .video-switch-row:hover {
  color: #111827;
  background: rgba(15,23,42,.035);
  border-color: rgba(15,23,42,.08);
}
[data-theme="minimal"] .video-switch-row input {
  accent-color: #111827;
}
[data-theme="minimal"] .video-switch-row:has(input:checked) {
  color: #111827;
  background: rgba(15,23,42,.055);
  border-color: rgba(15,23,42,.14);
}
[data-theme="minimal"] .video-upload-card,
[data-theme="minimal"] .video-ref-upload {
  background: rgba(255,255,255,.76);
  border-color: rgba(15,23,42,.1);
  color: #667085;
}
[data-theme="minimal"] .video-upload-card:hover,
[data-theme="minimal"] .video-upload-card:focus-within,
[data-theme="minimal"] .video-ref-upload:hover,
[data-theme="minimal"] .video-ref-upload.drag-over {
  background: #fff;
  border-color: rgba(15,23,42,.22);
  color: #111827;
  box-shadow: 0 14px 34px rgba(15,23,42,.08), inset 0 0 0 1px rgba(255,255,255,.7);
}
[data-theme="minimal"] .video-generate-btn {
  background: #111827;
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 18px 38px rgba(15,23,42,.18);
}
[data-theme="minimal"] .video-generate-btn:hover:not(:disabled) {
  background: #030712;
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(15,23,42,.22);
}
[data-theme="minimal"] .video-generate-btn:active:not(:disabled) {
  transform: translateY(1px) scale(.99);
  box-shadow: 0 0 0 4px rgba(15,23,42,.08), 0 10px 24px rgba(15,23,42,.18);
}

/* 复用图片页的 .ref-thumb / .ref-preview-list / .task-* / .empty-state / .gen-error 样式 */

@media (max-width: 880px) {
  .video-workspace { grid-template-columns: 1fr; }
  .video-panel {
    position: static; height: auto;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .video-output-stream { min-height: 50vh; }
}

.revision-overlay {
  position: fixed;
  inset: 0;
  z-index: 2300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.revision-overlay.open { display: flex; }
.revision-modal {
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--bg-card);
  box-shadow: var(--shadow-xl);
  padding: 18px;
}
.revision-head,
.revision-footer,
.revision-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.revision-head { justify-content: space-between; }
.revision-head div { display: grid; gap: 3px; }
.revision-head span,
.revision-hint { color: var(--text-3); font-size: .78rem; }
.revision-head strong { color: var(--text); font-size: 1.05rem; }
.revision-close {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--text-2); background: var(--bg-hover);
}
.revision-stage {
  position: relative;
  min-height: 320px;
  max-height: 58vh;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #050505;
  overflow: hidden;
}
.revision-stage img,
.revision-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.revision-stage canvas { cursor: crosshair; touch-action: none; }
.revision-note {
  min-height: 70px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-input);
  color: var(--text);
  padding: 11px 12px;
  resize: vertical;
}
.revision-tools {
  flex-wrap: wrap;
  color: var(--text-2);
  font-size: .82rem;
}
.revision-tools button,
.revision-footer button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  color: var(--text-2);
  padding: 7px 12px;
  font-weight: 650;
}
.revision-tools button.active {
  border-color: rgba(245,158,11,.55);
  background: rgba(245,158,11,.14);
  color: var(--warning);
}
.revision-tools label { display: inline-flex; align-items: center; gap: 8px; }
.revision-tools input { accent-color: var(--warning); }
.revision-footer { justify-content: flex-end; }

/* Loading skeleton */
.task-loading {
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-card) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%; border-radius: var(--radius-sm);
  animation: shimmer 1.4s infinite;
}
.skeleton-text { height: 14px; width: 80%; }
.skeleton-img  { height: 200px; }

/* Error state */

/* ══════════════════════════════════════════════════════════
   MINIMAL LIGHT STUDIO THEME
══════════════════════════════════════════════════════════ */
[data-theme="minimal"] #bg-canvas {
  opacity: .22;
}

[data-theme="minimal"] .topbar {
  background: rgba(255,255,255,.82);
  border-bottom-color: rgba(15,23,42,.08);
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 12px 34px rgba(15,23,42,.05);
}

[data-theme="minimal"] .main-nav {
  background: rgba(15,23,42,.035);
  border-color: rgba(15,23,42,.08);
}

[data-theme="minimal"] .nav-link:hover,
[data-theme="minimal"] .nav-link.active {
  background: #fff;
  box-shadow: 0 8px 18px rgba(15,23,42,.08);
}

[data-theme="minimal"] .quota-badge {
  color: #111827;
  background: #fff;
  border-color: rgba(15,23,42,.1);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}

[data-theme="minimal"] .btn-recharge {
  background: #111827;
  border-color: #111827;
  color: #fff;
  box-shadow: 0 12px 26px rgba(15,23,42,.16);
}

[data-theme="minimal"] .btn-recharge svg {
  color: #fff;
}

[data-theme="minimal"] .btn-recharge:hover {
  background: #030712;
  border-color: #030712;
  color: #fff;
  box-shadow: 0 16px 32px rgba(15,23,42,.2);
}

[data-theme="minimal"] .control-panel {
  background: rgba(255,255,255,.78);
  border-right-color: rgba(15,23,42,.08);
  box-shadow: 20px 0 60px rgba(15,23,42,.04);
}

[data-theme="minimal"] .section-title {
  color: #7a8494;
}

[data-theme="minimal"] .model-card,
[data-theme="minimal"] .ratio-btn,
[data-theme="minimal"] .res-btn,
[data-theme="minimal"] .count-btn,
[data-theme="minimal"] .task-card,
[data-theme="minimal"] .toast {
  background: rgba(255,255,255,.86);
  border-color: rgba(15,23,42,.09);
  box-shadow: 0 12px 34px rgba(15,23,42,.055);
}

[data-theme="minimal"] .model-card:hover,
[data-theme="minimal"] .ratio-btn:hover,
[data-theme="minimal"] .res-btn:hover,
[data-theme="minimal"] .task-action-btn:hover {
  background: #fff;
  border-color: rgba(15,23,42,.16);
  box-shadow: 0 16px 36px rgba(15,23,42,.08);
}

[data-theme="minimal"] .model-card.active {
  background: #fff;
  border-color: rgba(17,24,39,.32);
  box-shadow: 0 18px 44px rgba(15,23,42,.1);
}

[data-theme="minimal"] .ratio-btn.active,
[data-theme="minimal"] .res-btn.active {
  background: #111827;
  border-color: #111827;
  color: #fff;
  box-shadow: 0 14px 30px rgba(15,23,42,.18);
}

[data-theme="minimal"] .res-btn.active .res-tag {
  color: rgba(255,255,255,.72);
}

[data-theme="minimal"] .ref-upload-area,
[data-theme="minimal"] .prompt-textarea,
[data-theme="minimal"] .form-group input,
[data-theme="minimal"] .email-input-row input,
[data-theme="minimal"] .code-input-row input {
  background: #fff;
  border-color: rgba(15,23,42,.1);
  box-shadow: 0 1px 0 rgba(255,255,255,.86) inset;
}

[data-theme="minimal"] .ref-upload-area:hover,
[data-theme="minimal"] .ref-upload-area.drag-over,
[data-theme="minimal"] .prompt-textarea:focus,
[data-theme="minimal"] .form-group input:focus,
[data-theme="minimal"] .email-input-row input:focus,
[data-theme="minimal"] .code-input-row input:focus {
  border-color: rgba(17,24,39,.34);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15,23,42,.06);
}

[data-theme="minimal"] .btn-generate {
  background: #111827;
  color: #fff;
  box-shadow: 0 18px 38px rgba(15,23,42,.18);
}

[data-theme="minimal"] .btn-generate:hover:not(:disabled) {
  background: #030712;
  box-shadow: 0 22px 48px rgba(15,23,42,.22);
}

[data-theme="minimal"] .output-stream {
  background:
    radial-gradient(circle at 72% 0%, rgba(148,163,184,.18), transparent 32%),
    linear-gradient(180deg, rgba(255,255,255,.45), rgba(246,247,249,0));
}

[data-theme="minimal"] .task-card-header {
  border-bottom-color: rgba(15,23,42,.08);
}

[data-theme="minimal"] .task-tag,
[data-theme="minimal"] .task-action-btn {
  background: rgba(15,23,42,.035);
  border-color: rgba(15,23,42,.08);
  color: #526071;
}

[data-theme="minimal"] .task-img-item {
  background: #eef1f5;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.06);
}

[data-theme="minimal"] .skeleton {
  background: linear-gradient(90deg, #edf0f4 25%, #fff 50%, #edf0f4 75%);
  background-size: 200% 100%;
}
.task-errors {
  padding: 12px 20px;
}
.error-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.2); border-radius: var(--radius-sm);
  font-size: .8rem; color: var(--danger); margin-bottom: 6px;
}

/* ══════════════════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════════════════ */
.lightbox {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(4px);
  display: none; place-items: center;
  cursor: zoom-out;
}
.lightbox.open { display: grid; }
.lightbox img {
  max-width: 90vw; max-height: 90vh;
  border-radius: var(--radius); object-fit: contain;
  animation: scaleIn .25s ease;
}
.lightbox-close {
  position: absolute; top: 20px; right: 24px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.1); color: #fff; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.lightbox-close:hover { background: var(--danger); }

/* ══════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px; z-index: 3000;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: .85rem; font-weight: 500;
  box-shadow: var(--shadow-card);
  animation: slideInRight .3s ease;
  max-width: 320px;
}
.toast.success { border-color: rgba(34,197,94,.3); }
.toast.error   { border-color: rgba(239,68,68,.3); }
.toast.info    { border-color: rgba(99,102,241,.3); }
.toast.fadeOut { animation: fadeOut .3s ease forwards; }

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════════ */
@keyframes logoSweep {
  0% { transform: translateX(-115%) skewX(-12deg); }
  100% { transform: translateX(115%) skewX(-12deg); }
}
@keyframes logoGradientDrift {
  0% { background-position: center, 0% 50%; }
  50% { background-position: center, 58% 44%; }
  100% { background-position: center, 100% 50%; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeInCard {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateX(20px); }
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spin { animation: spin .8s linear infinite; }
.hidden { display: none; }

/* ══════════════════════════════════════════════════════════
   RECHARGE BUTTON
══════════════════════════════════════════════════════════ */
.btn-recharge {
  display: flex; align-items: center; gap: 5px;
  min-height: 30px;
  padding: 5px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.025));
  border: 1px solid rgba(185,248,212,.24);
  border-radius: var(--radius-full);
  color: var(--text); font-size: .78rem; font-weight: 700;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  transition: var(--transition);
  white-space: nowrap;
}
.btn-recharge svg {
  color: var(--primary-2);
  opacity: .9;
}
.btn-recharge:hover {
  background: linear-gradient(135deg, rgba(185,248,212,.14), rgba(143,215,255,.08));
  border-color: rgba(185,248,212,.46);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(185,248,212,.12);
}
.btn-recharge:active { transform: translateY(0); }

/* ══════════════════════════════════════════════════════════
   RECHARGE MODAL
══════════════════════════════════════════════════════════ */
.recharge-overlay {
  position: fixed; inset: 0; z-index: 2500;
  display: none; place-items: center;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.recharge-overlay.active { display: grid; }

.recharge-card {
  position: relative;
  width: 360px; max-width: 95vw;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  padding: 40px 32px 32px;
  box-shadow: 0 24px 70px rgba(0,0,0,.72), inset 0 1px 0 rgba(255,255,255,.08);
  animation: slideUp .4s cubic-bezier(.34,1.56,.64,1);
  text-align: center;
}

.recharge-card-wide {
  width: 560px;
  padding: 34px 30px 28px;
}

.recharge-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.06); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.recharge-close:hover { background: rgba(239,68,68,.15); color: var(--danger); }

.recharge-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(248,250,252,.13), rgba(185,248,212,.12) 52%, rgba(143,215,255,.1));
  border: 1px solid rgba(185,248,212,.28);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--primary-2);
  box-shadow: 0 14px 34px rgba(185,248,212,.1), inset 0 1px 0 rgba(255,255,255,.1);
}

.recharge-title {
  font-size: 1.3rem; font-weight: 700;
  letter-spacing: -.02em; margin-bottom: 8px;
  color: var(--text);
  background: none;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  -webkit-text-fill-color: currentColor;
}

.recharge-subtitle {
  font-size: .875rem; color: var(--text-2);
  margin-bottom: 18px; line-height: 1.5;
}

.recharge-balance {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.035);
  color: var(--text-2);
  font-size: .82rem;
}
.recharge-balance strong {
  color: var(--text);
  font-size: 1.05rem;
}

.redeem-panel {
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.035);
}
.redeem-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-2);
  font-size: .78rem;
  font-weight: 700;
}
.redeem-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 8px;
}
.redeem-row input {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,.16);
  color: var(--text);
  outline: none;
}
.redeem-row input:focus {
  border-color: rgba(185,248,212,.58);
  box-shadow: 0 0 0 3px rgba(185,248,212,.1);
}
.redeem-row button {
  min-height: 38px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #07110c;
  font-size: .85rem;
  font-weight: 800;
}
.redeem-row button:disabled {
  opacity: .56;
  cursor: not-allowed;
}
.redeem-status {
  min-height: 18px;
  margin-top: 8px;
  color: var(--text-3);
  font-size: .76rem;
}
.redeem-status.success { color: var(--success); }
.redeem-status.error { color: var(--danger); }

.payment-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.payment-loading {
  grid-column: 1 / -1;
  padding: 22px;
  color: var(--text-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
}
.payment-loading.error { color: var(--danger); }

.payment-plan {
  position: relative;
  min-height: 128px;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.035);
  color: var(--text);
  transition: var(--transition);
}
.payment-plan:hover {
  border-color: rgba(185,248,212,.34);
  background: linear-gradient(135deg, rgba(185,248,212,.08), rgba(143,215,255,.045));
}
.payment-plan.active {
  border-color: rgba(185,248,212,.68);
  background: linear-gradient(135deg, rgba(185,248,212,.15), rgba(143,215,255,.07), rgba(255,255,255,.035));
  box-shadow: 0 0 0 1px rgba(185,248,212,.18), 0 12px 30px rgba(0,0,0,.3);
}

.payment-plan-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.payment-plan-top strong {
  font-size: 1.15rem;
}
.payment-plan-top em {
  max-width: 104px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(185,248,212,.12);
  color: var(--primary-2);
  font-size: .68rem;
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.payment-plan-points {
  color: var(--primary-2);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
}

.payment-plan-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  color: var(--text-3);
  font-size: .74rem;
}

.payment-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.payment-summary > div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,.16);
  text-align: left;
}
.payment-summary span {
  display: block;
  color: var(--text-3);
  font-size: .72rem;
  margin-bottom: 4px;
}
.payment-summary strong {
  color: var(--text);
  font-size: 1.05rem;
}

.btn-pay, .btn-refresh-payment {
  width: 100%;
  min-height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 800;
  transition: var(--transition);
}
.btn-pay {
  background: linear-gradient(135deg, rgba(248,250,252,.96), rgba(185,248,212,.92) 58%, rgba(143,215,255,.86));
  color: #050507;
  box-shadow: 0 10px 28px rgba(185,248,212,.16);
}
.btn-pay:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(185,248,212,.23);
}
.btn-pay:disabled { opacity: .5; cursor: not-allowed; }

.wechat-pay-panel {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.06);
  text-align: left;
}
.wechat-pay-panel img {
  width: 132px;
  height: 132px;
  padding: 8px;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
}
.wechat-pay-panel strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: .9rem;
}
.wechat-pay-panel button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: rgba(255,255,255,.06);
}

.btn-refresh-payment {
  margin-top: 8px;
  border: 1px solid rgba(185,248,212,.2);
  background: rgba(255,255,255,.045);
  color: var(--text);
}
.btn-refresh-payment:hover {
  background: rgba(185,248,212,.08);
}

.payment-status {
  min-height: 20px;
  margin: 10px 0 12px;
  color: var(--text-2);
  font-size: .8rem;
  line-height: 1.45;
}
.payment-status.success { color: var(--success); }
.payment-status.error { color: var(--danger); }
.payment-status.info { color: var(--text-2); }
.payment-status:empty { margin: 8px 0; min-height: 0; }

.recharge-records {
  margin: 12px 0;
  text-align: left;
}
.recharge-records-head,
.invoice-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
.recharge-records-head strong,
.invoice-panel-head strong {
  color: var(--text);
  font-size: .86rem;
}
.recharge-records-head button,
.invoice-panel-head button {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.04);
  color: var(--text-2);
  font-size: .74rem;
}
.recharge-record-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(248,250,252,.22) transparent;
}
.recharge-card-wide,
.recharge-record-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(248,250,252,.22) transparent;
}
.recharge-card-wide::-webkit-scrollbar,
.recharge-record-list::-webkit-scrollbar {
  width: 6px;
}
.recharge-card-wide::-webkit-scrollbar-track,
.recharge-record-list::-webkit-scrollbar-track {
  background: transparent;
}
.recharge-card-wide::-webkit-scrollbar-thumb,
.recharge-record-list::-webkit-scrollbar-thumb {
  background: rgba(248,250,252,.18);
  border-radius: 999px;
}
.recharge-card-wide::-webkit-scrollbar-thumb:hover,
.recharge-record-list::-webkit-scrollbar-thumb:hover {
  background: rgba(248,250,252,.32);
}
.recharge-record-empty {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: .8rem;
  text-align: center;
}
.recharge-record-empty.error { color: var(--danger); }
.recharge-record-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.035);
}
.recharge-record-main,
.recharge-record-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  min-width: 0;
}
.recharge-record-main strong {
  color: var(--text);
  font-size: .9rem;
}
.recharge-record-main span,
.recharge-record-meta span,
.invoice-muted {
  color: var(--text-3);
  font-size: .72rem;
}
.recharge-record-meta {
  grid-column: 1 / -1;
}
.record-status.paid { color: var(--success); }
.record-status.pending { color: var(--text-2); }
.record-status.failed { color: var(--danger); }
.recharge-record-action {
  grid-row: 1;
  grid-column: 2;
  align-self: start;
}
.btn-invoice-open,
.invoice-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-weight: 700;
}
.btn-invoice-open {
  border: 1px solid rgba(185,248,212,.26);
  background: rgba(185,248,212,.08);
  color: var(--primary-2);
}
.invoice-badge {
  border: 1px solid rgba(143,215,255,.22);
  background: rgba(143,215,255,.08);
  color: var(--text-2);
}
.invoice-badge.issued {
  border-color: rgba(16,185,129,.24);
  background: rgba(16,185,129,.1);
  color: var(--success);
}
.invoice-panel {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.035);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.invoice-type-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,.18);
}
.invoice-type-tabs button {
  min-height: 32px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: .76rem;
  font-weight: 700;
  transition: var(--transition);
}
.invoice-type-tabs button.active {
  background: rgba(248,250,252,.92);
  color: #050507;
  box-shadow: 0 8px 20px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.7);
}
.invoice-type-tabs button:hover:not(.active) {
  background: rgba(255,255,255,.055);
  color: var(--text);
}
.invoice-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.invoice-form-grid input,
.invoice-form-grid textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.055);
  color: var(--text);
  font-size: .8rem;
  outline: none;
  transition: var(--transition);
}
.invoice-form-grid input::placeholder,
.invoice-form-grid textarea::placeholder {
  color: var(--text-3);
}
.invoice-form-grid textarea {
  grid-column: 1 / -1;
  resize: vertical;
}
.invoice-form-grid input:focus,
.invoice-form-grid textarea:focus {
  border-color: var(--border-focus);
  background: rgba(255,255,255,.075);
  box-shadow: 0 0 0 3px rgba(248,250,252,.06);
}
.btn-invoice-submit {
  width: 100%;
  min-height: 36px;
  margin-top: 10px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(226,232,240,.9));
  color: #050507;
  font-size: .82rem;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.7);
}
.btn-invoice-submit:disabled { opacity: .55; cursor: not-allowed; }
.invoice-status {
  min-height: 18px;
  margin-top: 8px;
  color: var(--text-2);
  font-size: .76rem;
  text-align: center;
}
.invoice-status.success { color: var(--success); }
.invoice-status.error { color: var(--danger); }
.invoice-status:empty { display: none; }

.recharge-qr-wrap {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}

.recharge-qr {
  width: 200px; height: 200px;
  object-fit: contain;
  display: block; margin: 0 auto 10px;
  border-radius: 8px;
}

.recharge-qr-label {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: .75rem; font-weight: 600; color: #333;
}

.recharge-tips {
  display: flex; flex-direction: column; gap: 8px;
}

.recharge-tip-item {
  font-size: .8rem; color: var(--text-3);
  padding: 8px 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .home-nav {
    height: 58px;
    padding: 0 16px;
  }
  .home-nav-actions {
    gap: 4px;
  }
  .home-nav-link {
    display: none;
  }
  .home-main {
    width: min(100% - 28px, 680px);
    padding: 96px 0 24px;
    grid-template-rows: minmax(390px, 1fr) auto;
  }
  .home-hero {
    padding-bottom: 34px;
  }
  .home-copy {
    margin-top: 22px;
  }
  .home-actions {
    margin-top: 26px;
  }
  .home-entry-grid {
    grid-template-columns: 1fr;
  }
  .home-entry {
    min-height: 156px;
    padding: 20px;
  }
  .auth-shell { grid-template-columns: 1fr; width: min(520px, 96vw); }
  .auth-cover { min-height: auto; padding: 28px; }
  .auth-cover h1 { font-size: 2.5rem; }
  .auth-card { width: 100%; }
  .workspace { grid-template-columns: 1fr; }
  .control-panel {
    position: static; height: auto;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .ratio-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 480px) {
  .home-brand {
    font-size: 14px;
  }
  .home-brand-mark {
    width: 26px;
    height: 26px;
  }
  .home-login-btn {
    min-height: 32px;
    padding: 0 13px;
  }
  .home-main {
    width: calc(100% - 24px);
    padding-top: 86px;
  }
  .home-brand-logo {
    width: 116px;
    height: auto;
    max-height: 34px;
  }
  .home-title-logo-wrap {
    width: min(100%, 340px);
    min-height: 86px;
  }
  .home-title-logo {
    max-height: 118px;
  }
  .home-copy {
    font-size: 16px;
  }
  .home-primary,
  .home-secondary {
    width: 100%;
  }
  .overlay { padding: 12px; overflow: auto; }
  .auth-cover { padding: 24px 20px; }
  .auth-cover-brand { margin-bottom: 22px; }
  .auth-cover h1 { font-size: 2rem; }
  .auth-feature-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
  .topbar { padding: 0 14px; }
  .main-nav { display: none; }
  .output-stream { padding: 16px; }
  .task-imgs { grid-template-columns: repeat(2, 1fr); }
  .recharge-card-wide { padding: 30px 18px 22px; }
  .payment-plan-grid { grid-template-columns: 1fr; }
  .payment-summary { grid-template-columns: 1fr; }
  .invoice-form-grid { grid-template-columns: 1fr; }
  .recharge-record-item { grid-template-columns: 1fr; }
  .recharge-record-action { grid-row: auto; grid-column: 1; }
}


/* ══════════════════════════════════════════════════════════
   PREMIUM AUTH FORM OVERRIDES
══════════════════════════════════════════════════════════ */
.register-fields {
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}
.mode-login .register-fields {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}
.mode-register .register-fields,
.mode-reset .register-fields {
  max-height: 300px;
  opacity: 1;
}
.mode-reset .auth-username-group {
  display: none;
}
.auth-inline-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}
.auth-inline-actions button {
  color: var(--text-3);
  background: transparent;
  border: 0;
  font-size: .78rem;
  font-weight: 650;
  padding: 4px 6px;
}
.auth-inline-actions button:hover {
  color: var(--primary-2);
}
.mode-login #back-login-link,
.mode-register #back-login-link,
.mode-reset #forgot-password-link {
  display: none;
}

.auth-code-input {
  letter-spacing: 12px !important;
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  text-align: center;
}
.auth-code-input::placeholder {
  letter-spacing: normal !important;
  font-size: 0.85rem !important;
  font-weight: 400 !important;
  text-align: left;
}

.code-hint {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 6px;
  margin-bottom: 2px;
  transition: color 0.3s ease;
}
.code-hint.success { color: var(--success); }

/* Email row tweak */
.email-input-row {
  display: flex; gap: 8px; align-items: stretch;
}
.email-input-row input {
  flex: 1; min-width: 0;
}
.btn-send-code {
  flex-shrink: 0; padding: 0 16px;
  background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.3);
  border-radius: var(--radius-sm); color: var(--primary-2);
  font-size: .8rem; font-weight: 600; white-space: nowrap;
  transition: var(--transition);
}
.btn-send-code:hover:not(:disabled) {
  background: rgba(99,102,241,.25); border-color: rgba(99,102,241,.5);
}
.btn-send-code:disabled { opacity: .5; pointer-events: none; }
