:root {
  --bg: #06080f;
  --panel: rgba(19, 24, 40, 0.72);
  --panel-solid: #121728;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #e9edfa;
  --muted: #8e97b3;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --danger: #ff5f7a;
  --warn: #fbbf24;
  --radius: 20px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

/* 保证 hidden 属性始终生效，避免被 display 样式覆盖 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(124, 92, 255, 0.18), transparent 65%),
    radial-gradient(800px 480px at 90% 0%, rgba(34, 211, 238, 0.1), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, rgba(124, 92, 255, 0.08), transparent 70%);
}

/* ---------------- 动态 AI 背景 ---------------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  pointer-events: none;
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  will-change: transform;
  animation: auroraDrift 24s ease-in-out infinite alternate;
}

.aurora-1 {
  width: 520px;
  height: 520px;
  top: -180px;
  left: -140px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.55), transparent 68%);
}

.aurora-2 {
  width: 640px;
  height: 640px;
  top: -160px;
  right: -200px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.3), transparent 68%);
  animation-delay: -8s;
}

.aurora-3 {
  width: 760px;
  height: 760px;
  bottom: -360px;
  left: 28%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.26), transparent 70%);
  animation-delay: -15s;
}

@keyframes auroraDrift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(40px, 30px, 0) scale(1.08); }
  100% { transform: translate3d(-30px, 60px, 0) scale(0.96); }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(circle at 50% 12%, rgba(0, 0, 0, 0.7), transparent 72%);
  mask-image: radial-gradient(circle at 50% 12%, rgba(0, 0, 0, 0.7), transparent 72%);
  opacity: 0.5;
}

#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 68px;
  padding: 0 32px;
  background: rgba(6, 8, 15, 0.72);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124, 92, 255, 0.8), rgba(34, 211, 238, 0.8), transparent);
  background-size: 200% 100%;
  animation: scanLine 7s linear infinite;
  pointer-events: none;
}

@keyframes scanLine {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 22px rgba(124, 92, 255, 0.35);
  animation: markGlow 4.5s ease-in-out infinite;
}

@keyframes markGlow {
  0%, 100% { box-shadow: 0 8px 22px rgba(124, 92, 255, 0.35); }
  50% { box-shadow: 0 8px 30px rgba(34, 211, 238, 0.45); }
}

.brand-mark svg { width: 19px; height: 19px; }

.nav {
  display: flex;
  gap: 6px;
  margin-right: auto;
}

.nav a {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--muted);
  transition: all 0.2s;
}

.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.nav a.active {
  color: var(--text);
  background: rgba(124, 92, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.35);
}

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

.credit-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.credit-pill strong {
  font-size: 15px;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}

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

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 12px rgba(0, 0, 0, 0.35);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.icon-btn svg { width: 17px; height: 17px; }

/* ---------------- 首屏 ---------------- */
main {
  padding-bottom: 72px;
}

.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 64px 32px 34px;
  text-align: center;
}

.hero.compact { padding: 52px 32px 26px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.6px;
  color: #c9c2ff;
  background: rgba(124, 92, 255, 0.14);
  border: 1px solid rgba(124, 92, 255, 0.35);
  box-shadow: 0 0 24px rgba(124, 92, 255, 0.18);
}

.agent-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

.hero h1 {
  margin: 18px 0 12px;
  font-size: 42px;
  line-height: 1.18;
  letter-spacing: -0.5px;
  background: linear-gradient(100deg, #ffffff 20%, #b6a8ff 55%, #7ce7f7 95%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textFlow 9s ease-in-out infinite;
}

@keyframes textFlow {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

.hero.compact h1 { font-size: 34px; }

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

/* ---------------- 布局 ---------------- */
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
}

.profile-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
}

.panel {
  position: relative;
  padding: 26px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(22, 27, 45, 0.82), rgba(12, 16, 29, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(124, 92, 255, 0.45), transparent 32%, transparent 68%, rgba(34, 211, 238, 0.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.65;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.panel-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-chip {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.status-chip.running {
  color: #cfc6ff;
  border-color: rgba(124, 92, 255, 0.4);
  background: rgba(124, 92, 255, 0.14);
}

.status-chip.success {
  color: #9df5d2;
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.12);
}

.status-chip.failed {
  color: #ffb3c1;
  border-color: rgba(255, 95, 122, 0.35);
  background: rgba(255, 95, 122, 0.12);
}

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 22px; }

.field-label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #c6cde2;
}

.optional {
  margin-left: 6px;
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}

textarea {
  width: 100%;
  min-height: 138px;
  padding: 15px 16px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea::placeholder { color: #5d6580; }

textarea:focus {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.12);
}

.char-count {
  margin-top: 6px;
  text-align: right;
  font-size: 11px;
  color: #5d6580;
  font-variant-numeric: tabular-nums;
}

.prompt-tip {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: #6b7390;
}

.preset-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -6px 0 22px;
}

.preset-label {
  font-size: 11px;
  color: var(--muted);
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 12px rgba(0, 0, 0, 0.3);
  color: #9aa3c0;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-chip svg { width: 15px; height: 15px; }

.preset-chip .preset-check {
  display: none;
  width: 14px;
  height: 14px;
}

.preset-chip:hover {
  color: #fff;
  border-color: rgba(251, 191, 36, 0.55);
  transform: translateY(-1px);
}

.preset-chip.active {
  color: #241a02;
  border: 1px solid #fbbf24;
  background: linear-gradient(180deg, #fde68a, #f59e0b);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18), 0 8px 22px rgba(251, 191, 36, 0.35);
  font-weight: 600;
  transform: translateY(-1px);
}

.preset-chip.active .preset-check { display: inline-block; }

.ratio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ratio-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 12px rgba(0, 0, 0, 0.32);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-align: left;
}

.ratio-btn:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.ratio-btn.active {
  border-color: rgba(124, 92, 255, 0.75);
  background: linear-gradient(180deg, rgba(124, 92, 255, 0.38), rgba(34, 211, 238, 0.1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 0 0 3px rgba(124, 92, 255, 0.12), 0 8px 20px rgba(124, 92, 255, 0.28);
  transform: translateY(-1px);
}

.ratio-shape {
  flex: none;
  border: 2px solid #7b83a0;
  border-radius: 4px;
}

.ratio-btn.active .ratio-shape { border-color: var(--accent-2); }

.ratio-shape.landscape { width: 34px; height: 20px; }
.ratio-shape.portrait { width: 18px; height: 30px; }

.ratio-text { display: flex; flex-direction: column; gap: 2px; }
.ratio-text strong { font-size: 14px; }
.ratio-text small { font-size: 11px; color: var(--muted); }

.style-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.style-btn {
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 12px rgba(0, 0, 0, 0.32);
  color: #c6cde2;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.style-btn:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.style-btn.active {
  color: #fff;
  border-color: rgba(124, 92, 255, 0.75);
  background: linear-gradient(180deg, rgba(124, 92, 255, 0.38), rgba(34, 211, 238, 0.1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 0 0 3px rgba(124, 92, 255, 0.12), 0 8px 20px rgba(124, 92, 255, 0.28);
  transform: translateY(-1px);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.select-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.select-wrap > span {
  font-size: 11px;
  color: var(--muted);
}

.select-wrap select {
  width: 100%;
  height: 40px;
  padding: 0 30px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: rgba(255, 255, 255, 0.03);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e97b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color 0.2s;
}

.select-wrap select:focus { border-color: rgba(124, 92, 255, 0.6); }
.select-wrap select option { background: #121728; color: var(--text); }

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 12px;
  color: #c6cde2;
  cursor: pointer;
  user-select: none;
}

.switch-row input { display: none; }

.switch {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.2s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.switch-row input:checked + .switch {
  background: linear-gradient(135deg, #7c5cff, #22d3ee);
}

.switch-row input:checked + .switch::after { transform: translateX(16px); }

/* ---------------- 上传 ---------------- */
.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 16px;
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: rgba(124, 92, 255, 0.7);
  background: rgba(124, 92, 255, 0.07);
}

.dz-empty { text-align: center; }

.dz-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: 13px;
  color: #9aa3c0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.dz-icon svg { width: 22px; height: 22px; }

.dz-empty p { margin: 0 0 4px; font-size: 13px; color: #c6cde2; }
.dz-empty small { font-size: 11px; color: var(--muted); }

.dz-preview {
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
}

.dz-preview img {
  max-width: 100%;
  max-height: 230px;
  border-radius: 12px;
  object-fit: contain;
}

.dz-remove {
  position: absolute;
  top: -6px;
  right: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(10, 13, 22, 0.9);
  color: var(--text);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.dz-uploading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  font-size: 13px;
  background: rgba(8, 10, 18, 0.68);
  backdrop-filter: blur(3px);
}

.upload-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--warn);
}

.frame-btn {
  margin-top: 10px;
  gap: 8px;
}

.frame-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------------- 按钮 ---------------- */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(180deg, #8b6fff 0%, #6a5cff 45%, #3f8cff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 12px 28px rgba(91, 108, 255, 0.32), 0 3px 0 rgba(36, 24, 96, 0.55);
  text-shadow: 0 1px 2px rgba(20, 10, 60, 0.45);
  transition: transform 0.16s, box-shadow 0.2s, opacity 0.2s;
}

.btn-primary::after {
  content: "";
  position: absolute;
  top: -20%;
  left: -60%;
  width: 45%;
  height: 140%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: skewX(-20deg);
  animation: btnShine 4.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes btnShine {
  0%, 65% { left: -60%; }
  100% { left: 130%; }
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 16px 34px rgba(91, 108, 255, 0.42), 0 4px 0 rgba(36, 24, 96, 0.55);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35), 0 6px 16px rgba(91, 108, 255, 0.3);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 13px; border-radius: 10px; }

.btn-generate {
  height: 52px;
  margin-top: 4px;
  font-size: 15px;
  letter-spacing: 0.5px;
}

.btn-ghost {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 18px;
  border-radius: 11px;
  font-size: 13px;
  color: #c6cde2;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
  font-family: inherit;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.btn-ghost:hover {
  color: #fff;
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26), 0 7px 18px rgba(0, 0, 0, 0.42);
  transform: translateY(-1px);
}

.btn-ghost:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.5);
}

/* 同一组功能按钮用不同色系区分 */
.btn-play,
.btn-download,
.btn-copy-link,
.btn-copy-prompt,
.btn-progress,
.btn-frame,
.btn-refresh,
.btn-star {
  color: rgb(var(--tone));
  border-color: rgba(var(--tone), 0.42);
  background: linear-gradient(180deg, rgba(var(--tone), 0.24), rgba(var(--tone), 0.06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 12px rgba(var(--tone), 0.18), 0 1px 0 rgba(0, 0, 0, 0.45);
}

.btn-play:hover,
.btn-download:hover,
.btn-copy-link:hover,
.btn-copy-prompt:hover,
.btn-progress:hover,
.btn-frame:hover,
.btn-refresh:hover,
.btn-star:hover {
  color: #fff;
  border-color: rgba(var(--tone), 0.7);
  background: linear-gradient(180deg, rgba(var(--tone), 0.36), rgba(var(--tone), 0.1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 8px 20px rgba(var(--tone), 0.32);
  transform: translateY(-1px);
}

.btn-play { --tone: 34, 211, 238; }
.btn-download { --tone: 52, 211, 153; }
.btn-copy-link { --tone: 124, 92, 255; }
.btn-copy-prompt { --tone: 251, 191, 36; }
.btn-progress { --tone: 91, 140, 255; }
.btn-frame { --tone: 34, 211, 238; }
.btn-refresh { --tone: 124, 92, 255; }
.btn-star { --tone: 244, 114, 182; }

.btn-star.is-on {
  color: #2a0a1c;
  border-color: #f472b6;
  background: linear-gradient(180deg, #f9a8d4, #ec4899);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 18px rgba(236, 72, 153, 0.4);
}

.cost-tip {
  margin: 12px 0 0;
  text-align: center;
  font-size: 12px;
  color: #6b7390;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 预览区 ---------------- */
.preview-panel { display: flex; flex-direction: column; }

.preview-stage {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 424px;
  padding: 26px;
  border-radius: 16px;
  background:
    radial-gradient(420px 240px at 50% 0%, rgba(124, 92, 255, 0.14), transparent 70%),
    rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  overflow: hidden;
}

.preview-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 18px 18px;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000, transparent 78%);
  mask-image: radial-gradient(circle at 50% 50%, #000, transparent 78%);
  pointer-events: none;
}

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

.stage-empty,
.stage-failed {
  text-align: center;
}

.stage-icon {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  border-radius: 22px;
  color: #8d96b5;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.stage-icon svg { width: 34px; height: 34px; }

.stage-empty p,
.stage-failed p { margin: 0 0 6px; font-size: 15px; color: #c6cde2; }
.stage-empty small,
.stage-failed small { font-size: 12px; color: var(--muted); }

.fail-icon {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
  border-radius: 50%;
  font-size: 26px;
  font-weight: 700;
  color: var(--danger);
  background: rgba(255, 95, 122, 0.12);
  border: 1px solid rgba(255, 95, 122, 0.4);
}

/* 进度 */
.stage-progress {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.ring {
  position: relative;
  width: 128px;
  height: 128px;
  margin: 0 auto 18px;
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}

.ring-fg {
  fill: none;
  stroke: #7c5cff;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.6s ease;
  filter: drop-shadow(0 0 8px rgba(124, 92, 255, 0.6));
}

.ring span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stage-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.stage-sub { margin: 0 0 18px; font-size: 12px; color: var(--muted); }

.bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.bar-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c5cff, #22d3ee);
  box-shadow: 0 0 14px rgba(124, 92, 255, 0.6);
  transition: width 0.6s ease;
}

.steps {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  position: relative;
  flex: 1;
  padding-top: 20px;
  font-size: 11px;
  color: #5d6580;
  text-align: center;
}

.steps li::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  transition: all 0.3s;
}

.steps li.active { color: #cfc6ff; }
.steps li.active::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.18);
}

.steps li.done { color: #9df5d2; }
.steps li.done::before { background: var(--ok); }

/* 视频 */
.stage-video {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.stage-video video {
  width: 100%;
  max-height: 520px;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.result-actions .btn-ghost { flex: 1; }

.result-warning {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  color: #ffe0a8;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

/* ---------------- 个人主页 ---------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px 22px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.5);
}

.stat-label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
}

.stat-card strong {
  display: inline-block;
  margin-right: 5px;
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, #fff, #b9adff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-card small { font-size: 12px; color: var(--muted); }

.history-panel { padding-bottom: 12px; }

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

.history-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.history-card:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.045);
}

.h-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.h-thumb {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 11px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.h-thumb.placeholder {
  display: grid;
  place-items: center;
  color: #6b7390;
  font-size: 18px;
}

.h-body { min-width: 0; }

.h-prompt {
  margin: 0 0 6px;
  font-size: 14px;
  color: #dfe4f5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.h-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
}

.h-meta i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #4a5170;
}

.tag-refund {
  padding: 2px 8px;
  border-radius: 999px;
  color: #9df5d2;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.tag-error {
  padding: 2px 8px;
  border-radius: 999px;
  color: #ffb3c1;
  background: rgba(255, 95, 122, 0.1);
  border: 1px solid rgba(255, 95, 122, 0.28);
}

.h-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.h-actions {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}

.badge.success { color: #9df5d2; background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.3); }
.badge.failed { color: #ffb3c1; background: rgba(255, 95, 122, 0.1); border: 1px solid rgba(255, 95, 122, 0.3); }
.badge.pending { color: #cfc6ff; background: rgba(124, 92, 255, 0.12); border: 1px solid rgba(124, 92, 255, 0.3); }
.badge.starred { color: #fbcfe8; background: rgba(236, 72, 153, 0.14); border: 1px solid rgba(236, 72, 153, 0.38); }

.frame-star {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  color: #fbcfe8;
  background: rgba(236, 72, 153, 0.14);
  border: 1px solid rgba(236, 72, 153, 0.38);
  white-space: nowrap;
}

.seq-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  color: #a5f3fc;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.32);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty-state p { margin: 0 0 6px; }
.empty-state small { font-size: 12px; color: #5d6580; }

/* ---------------- 弹窗 / Toast ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 5, 10, 0.72);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  padding: 32px 28px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(180deg, #171d31, #11162a);
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.24s;
}

.modal.open .modal-card { transform: translateY(0) scale(1); }

.modal-icon {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 16px;
  border-radius: 16px;
  color: #c9c2ff;
  background: rgba(124, 92, 255, 0.16);
  border: 1px solid rgba(124, 92, 255, 0.35);
}

.modal-icon svg { width: 26px; height: 26px; }

.modal-card h3 { margin: 0 0 8px; font-size: 20px; }

.modal-sub {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.modal-card input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 15px;
  letter-spacing: 1px;
  text-align: center;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-card input:focus {
  border-color: rgba(124, 92, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.14);
}

.modal-error {
  min-height: 20px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--danger);
}

.video-modal-card {
  position: relative;
  width: min(920px, 100%);
  padding: 18px;
  border-radius: 20px;
  background: #0d1120;
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  transform: scale(0.98);
  transition: transform 0.24s;
}

.modal.open .video-modal-card { transform: scale(1); }

.video-modal-card video {
  width: 100%;
  max-height: 68vh;
  border-radius: 12px;
  background: #000;
}

.modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 30;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: #1a2034;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.video-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 10px;
  font-size: 13px;
  color: var(--muted);
}

.video-modal-head .modal-close {
  position: static;
  flex: none;
  width: 32px;
  height: 32px;
  font-size: 18px;
}

.video-modal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px 2px;
}

.video-modal-meta p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.frame-modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(680px, 100%);
  max-height: 76vh;
  max-height: 76dvh;
  padding: 24px;
  border-radius: 20px;
  background: linear-gradient(180deg, #171d31, #11162a);
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
  transform: scale(0.98);
  transition: transform 0.24s;
}

.modal.open .frame-modal-card { transform: scale(1); }

.frame-modal-head {
  padding-right: 26px;
  margin-bottom: 16px;
}

.frame-modal-head h3 { margin: 0 0 6px; font-size: 18px; }
.frame-modal-head p { margin: 0; font-size: 12px; color: var(--muted); }

.frame-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.frame-item {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.frame-item:hover { border-color: var(--border-strong); }

.frame-thumb {
  flex: none;
  display: grid;
  place-items: center;
  width: 66px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  font-size: 11px;
  color: #6b7390;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.frame-info { flex: 1; min-width: 0; }

.frame-info p {
  margin: 0 0 4px;
  font-size: 13px;
  color: #dfe4f5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frame-info small { font-size: 11px; color: var(--muted); }

.frame-item .btn-ghost { flex: none; }

.frame-empty {
  padding: 46px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  z-index: 120;
  max-width: 88vw;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text);
  background: rgba(23, 29, 49, 0.96);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
}

.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.success { border-color: rgba(52, 211, 153, 0.5); }
.toast.error { border-color: rgba(255, 95, 122, 0.55); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1000px) {
  .studio { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-stage { min-height: 380px; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 8px; height: 58px; }
  .brand { flex: none; }
  .brand span:last-child { display: none; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .brand-mark svg { width: 17px; height: 17px; }
  .nav { gap: 4px; min-width: 0; }
  .nav a { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .topbar-right { gap: 6px; flex: none; }
  .credit-pill { height: 32px; padding: 0 8px; gap: 4px; font-size: 12px; }
  .credit-label { font-size: 10px; opacity: 0.85; }
  .topbar .icon-btn { width: 32px; height: 32px; }
  .hero { padding: 44px 18px 26px; }
  .hero h1 { font-size: 30px; }
  .hero.compact h1 { font-size: 27px; }
  .studio, .profile-wrap { padding: 0 16px; }
  .panel { padding: 20px 18px; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 16px; }
  .stat-card strong { font-size: 24px; }
  .history-card { flex-direction: column; align-items: flex-start; }
  .h-right { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .h-actions { width: 100%; justify-content: flex-start; }
  .result-actions .btn-ghost, .result-actions .btn-primary { flex: 1; }
  .steps li { font-size: 10px; }

  .modal { padding: 8px; }
  .frame-modal-card {
    width: 100%;
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 16px;
    border-radius: 16px;
  }
  .frame-modal-head { padding-right: 34px; margin-bottom: 12px; }
  .frame-modal-head h3 { font-size: 16px; }
  .frame-list { width: 100%; }
  .frame-item {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 8px 10px;
    padding: 10px;
  }
  .frame-thumb {
    width: 54px;
    height: 38px;
    grid-row: 1 / span 2;
  }
  .frame-item .btn-ghost {
    grid-column: 1 / -1;
    width: 100%;
    height: 34px;
  }
  .frame-modal-card .modal-close { top: 10px; right: 10px; }

  /* 手机端播放弹窗自适应 */
  .video-modal-card {
    width: 100%;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 12px;
    border-radius: 16px;
  }
  .video-modal-card video {
    width: 100%;
    height: auto;
    max-height: 62vh;
    max-height: 62dvh;
    object-fit: contain;
    border-radius: 10px;
  }
  .video-modal-meta {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 2px 2px;
  }
  .video-modal-meta p { white-space: normal; }
  .video-modal-actions { width: 100%; }
  .video-modal-actions .btn-ghost { flex: 1; height: 36px; }
  .video-modal-card .modal-close { top: 8px; right: 8px; }

  .option-grid { gap: 8px; }
  .select-wrap select { padding: 0 24px 0 10px; font-size: 12px; }
  .select-wrap > span { font-size: 10px; }

  /* 移动端降低毛玻璃开销，保证粒子背景流畅 */
  .panel { backdrop-filter: blur(10px); }
  .topbar { backdrop-filter: blur(12px); }
}

/* ---------------- 无障碍：减少动态效果 ---------------- */
@media (prefers-reduced-motion: reduce) {
  .aurora,
  .hero h1,
  .brand-mark,
  .topbar::after,
  .btn-primary::after,
  .agent-dot {
    animation: none !important;
  }
}
