:root {
  --ink: #0b0b0c;
  --ink-soft: #5c5c66;
  --accent: #111111;
  --accent-hot: #e8ff47;
  --surface: #ffffff;
  --bg: #f2f2f4;
  --bg-deep: #e6e6ea;
  --line: rgba(11, 11, 12, 0.1);
  --line-strong: rgba(11, 11, 12, 0.22);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.12);
  --radius: 4px;
  --radius-lg: 12px;
  --font-display: "Syne", sans-serif;
  --font-body: "Sora", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(232, 255, 71, 0.08) 0%, transparent 28%),
    linear-gradient(180deg, #fafafa 0%, var(--bg) 42%, var(--bg-deep) 100%);
  line-height: 1.55;
  letter-spacing: -0.01em;
}

img,
video {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  z-index: 0;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.nav,
main,
.footer {
  position: relative;
  z-index: 1;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 5vw;
  max-width: 1440px;
  margin: 0 auto;
}

.nav nav {
  display: flex;
  gap: 1.6rem;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.nav nav a {
  position: relative;
}

.nav nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.25rem;
  width: 0;
  height: 1px;
  background: var(--ink);
  transition: width 0.25s ease;
}

.nav nav a:hover::after,
.nav nav a[aria-current="page"]::after {
  width: 100%;
}

.nav nav a[aria-current="page"] {
  color: var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--ink);
  flex-shrink: 0;
  white-space: nowrap;
}

.brand .brand-word {
  display: block;
  line-height: 1;
  /* Syne 视觉重心略偏上，微移与按钮基线对齐 */
  transform: translateY(0.04em);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.72rem 1.2rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
}

.btn-primary:hover {
  background: #000;
  box-shadow: 0 0 0 1px var(--accent-hot), 0 12px 32px rgba(0, 0, 0, 0.18);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  border-color: var(--ink);
  color: var(--ink);
}

.btn-lg {
  padding: 0.95rem 1.45rem;
}

.hero {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: end;
  min-height: calc(100svh - 88px);
  padding: 1.2rem 5vw 3.5rem;
  max-width: 1440px;
  margin: 0 auto;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 0.9rem;
}

.brand-hero {
  font-family: var(--font-display);
  font-size: clamp(4rem, 10vw, 7.4rem);
  line-height: 0.88;
  margin: 0 0 1.1rem;
  letter-spacing: -0.05em;
  animation: rise 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.lede {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 32rem;
  margin: 0 0 1.7rem;
  animation: rise 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) 0.06s both;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.12s both;
}

.hero-visual {
  animation: fade-scale 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.08s both;
  position: relative;
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: auto auto -1rem -1rem;
  width: 42%;
  height: 42%;
  background: var(--accent-hot);
  z-index: 0;
  animation: slide-block 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both;
}

.hero-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 0;
  box-shadow: var(--shadow);
}

.hero-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.05) saturate(0.92);
  transform: scale(1.03);
  animation: drift 14s ease-in-out infinite alternate;
}

.section {
  padding: 4.5rem 5vw;
  max-width: 1440px;
  margin: 0 auto;
}

.section-head {
  margin-bottom: 2rem;
  max-width: 34rem;
}

.section-head h2,
.cta-band h2,
.panel-title h2,
.stage-head h2,
.accordion > summary h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}

.section-head p,
.cta-band p,
.panel-title p,
.stage-head p {
  margin: 0;
  color: var(--ink-soft);
}

.look-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.look-tile {
  margin: 0;
  overflow: hidden;
  background: #111;
}

.look-tile img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  transition: transform 0.55s ease, opacity 0.55s ease;
  opacity: 0.96;
}

.look-tile:hover img {
  transform: scale(1.04);
  opacity: 1;
}

.look-tile figcaption {
  margin-top: 0.55rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.steps li {
  padding: 1.35rem 0;
  border-top: 1px solid var(--line-strong);
}

.step-num {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 0.55rem;
}

.steps h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.steps p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.cta-band {
  text-align: left;
  padding-bottom: 5rem;
  border-top: 1px solid var(--line);
}

.cta-band .btn {
  margin-top: 1.35rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 5vw 2.4rem;
  max-width: 1440px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

/* ModelArk-style traditional composer */
.ark-shell {
  margin-bottom: 1.4rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.ark-modelbar {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--line);
  background: #0b0b0c;
  color: #fff;
}

.ark-model-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1rem;
}

.ark-model-id {
  margin: 0.15rem 0 0;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
  word-break: break-all;
}

.ark-mode-toggle {
  display: flex;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.2rem;
  border-radius: 999px;
}

.ark-mode {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.ark-mode.active {
  background: var(--accent-hot);
  color: #111;
}

.ark-mode:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ark-prompt-box,
.ark-upload-box {
  padding: 0.95rem;
}

.ark-prompt-box {
  border-bottom: 1px solid var(--line);
}

.ark-prompt-box textarea {
  min-height: 160px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.55;
}

.linkish {
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.16em;
  cursor: pointer;
  padding: 0;
}

.ref-spec {
  margin: 0.55rem 0 0.85rem;
  padding: 0.7rem 0.8rem;
  background: #f6f6f8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.ref-spec strong {
  display: block;
  color: var(--ink);
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
}

.ref-spec ul {
  margin: 0;
  padding-left: 1.1rem;
}

.ref-spec li {
  margin: 0.2rem 0;
}

.ref-slots {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.55rem;
}

.ref-slot {
  position: relative;
  display: block;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 120px;
  background: #fafafa;
  cursor: pointer;
}

.ref-slot.required-slot {
  grid-row: span 2;
  min-height: 260px;
}

.ref-slot:hover {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent-hot);
}

.ref-tag {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 2;
  background: #111;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.18rem 0.4rem;
  border-radius: 2px;
  letter-spacing: 0.02em;
}

.ref-slot img {
  width: 100%;
  height: 100%;
  min-height: 120px;
  object-fit: cover;
}

.ref-slot img[hidden],
#resultImage[hidden],
#resultVideo[hidden] {
  display: none !important;
  min-height: 0 !important;
}

.ref-slot.required-slot img {
  min-height: 260px;
}

.ref-slot.required-slot img[hidden] {
  min-height: 0 !important;
}

.upload-placeholder.slim {
  min-height: 120px;
}

.hint-inline {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.field-head em {
  font-style: normal;
  color: var(--ink);
  font-weight: 600;
}

/* Studio */
.studio-page .nav {
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
  max-width: none;
}

.studio {
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
  gap: 0;
  min-height: calc(100svh - 74px);
}

.studio-panel {
  padding: 1.2rem 1.1rem 3rem;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  overflow: auto;
  max-height: calc(100svh - 74px);
}

.studio-stage {
  padding: 1.2rem 1.4rem 3rem;
  background:
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.02)),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 47px,
      rgba(0, 0, 0, 0.025) 47px,
      rgba(0, 0, 0, 0.025) 48px
    );
}

.panel-block {
  margin-bottom: 1.5rem;
}

.panel-block[data-locked="true"],
#customizeBlock[data-locked="true"] {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.35);
}

.panel-title em {
  font-style: normal;
  color: var(--ink);
  font-size: 0.75rem;
  margin-left: 0.35rem;
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.upload-zone {
  display: block;
  margin-top: 0.85rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  min-height: 220px;
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent-hot);
}

.upload-placeholder {
  min-height: 220px;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.35rem;
  color: var(--ink-soft);
  padding: 1rem;
}

.upload-zone img {
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.status-line {
  margin: 0.55rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.status-line.ok {
  color: var(--ink);
}

.field {
  margin-top: 1.1rem;
}

.field > label,
.field-head label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mini-upload {
  font-size: 0.8rem;
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.hair-row,
.chip-row,
.mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hair-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line-strong);
  cursor: pointer;
}

.hair-swatch[data-id="keep"] {
  background: conic-gradient(from 90deg, #222, #eee, #222);
}

.hair-swatch.selected {
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--accent-hot);
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}

.picker-grid.compact {
  grid-template-columns: repeat(3, 1fr);
}

.pick-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.pick-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  filter: saturate(0.95);
}

.pick-card span {
  display: block;
  padding: 0.4rem 0.5rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.pick-card.selected {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent-hot);
}

.chip,
.mode-card {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
}

.chip.selected,
.mode-card:has(input:checked) {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.mode-card {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.mode-card input {
  accent-color: var(--accent-hot);
}

textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.85rem;
  font: inherit;
  resize: vertical;
  background: var(--surface);
}

.hint {
  margin: 0.4rem 0 0;
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.accordion {
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.accordion > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  gap: 0.15rem;
  padding: 0.35rem 0;
}

.accordion > summary::-webkit-details-marker {
  display: none;
}

.accordion > summary h2 {
  font-size: 1.05rem;
  margin: 0;
}

.accordion > summary span {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.accordion[open] > summary h2 {
  color: var(--ink);
}

.accordion-body {
  padding: 0.35rem 0 0.75rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.form-grid label,
.color-fields label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.84rem;
  font-weight: 600;
}

.form-grid select,
.form-grid input[type="number"],
.form-grid input[type="text"],
.color-fields input[type="text"] {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.52rem 0.65rem;
  font: inherit;
  background: var(--surface);
}

.range-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 600;
  font-size: 0.84rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--ink);
}

.check-line {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.3rem;
}

.color-fields {
  display: grid;
  gap: 0.65rem;
}

.color-fields label {
  grid-template-columns: 4.2rem 40px 1fr;
  align-items: center;
}

.color-fields input[type="color"] {
  width: 40px;
  height: 32px;
  border: 1px solid var(--line-strong);
  background: transparent;
  padding: 0;
}

.stage-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  min-height: calc(100svh - 140px);
  display: flex;
  flex-direction: column;
}

.stage-canvas {
  margin-top: 0.9rem;
  flex: 1;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #111 0%, #1a1a1e 100%);
  display: grid;
  place-items: center;
  overflow: hidden;
  min-height: 520px;
  position: relative;
}

.stage-empty {
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: 2rem;
}

#resultImage,
#resultVideo {
  width: 100%;
  height: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #0b0b0c;
}

.progress {
  margin-top: 0.9rem;
  height: 3px;
  background: rgba(11, 11, 12, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 24%;
  background: linear-gradient(90deg, var(--ink), var(--accent-hot));
  animation: progress 1.2s ease-in-out infinite;
}

.stage-actions {
  margin-top: 0.9rem;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.result-gallery {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.7rem;
  width: 100%;
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
}

.gallery-thumb {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  overflow: hidden;
  padding: 0;
  width: 64px;
  height: 86px;
  cursor: pointer;
  background: #111;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb.selected {
  border-color: var(--accent-hot);
  box-shadow: 0 0 0 1px var(--accent-hot);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-scale {
  from {
    opacity: 0;
    transform: scale(1.02);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slide-block {
  from {
    opacity: 0;
    transform: translate(-12px, 12px);
  }
  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

@keyframes drift {
  from {
    transform: scale(1.03) translateY(0);
  }
  to {
    transform: scale(1.07) translateY(-1.2%);
  }
}

@keyframes progress {
  0% {
    transform: translateX(-50%);
  }
  100% {
    transform: translateX(320%);
  }
}

/* ===== Seedance-style create UI：浅色 / 深色变量 ===== */
body.seedance-ui {
  --ink: #111118;
  --ink-soft: #5c5c66;
  --accent-blue: #2563eb;
  --accent-grad: linear-gradient(90deg, #7c3aed 0%, #db2777 100%);
  --panel: #ffffff;
  --panel-2: #f4f4f6;
  --surface: #ffffff;
  --page-bg: #f2f2f5;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --line: rgba(17, 17, 24, 0.1);
  --line-strong: rgba(17, 17, 24, 0.18);
  --dash: rgba(17, 17, 24, 0.22);
  --pill-bg: rgba(124, 58, 237, 0.12);
  --pill-fg: #5b21b6;
  --tab-active-bg: #111118;
  --tab-active-fg: #fff;
  --canvas-bg: #1a1a1e;
  --dot: #d4d4d8;
  --help-bg: #ffffff;
  background: var(--page-bg) !important;
  color: var(--ink);
}

body.seedance-ui.theme-dark {
  --ink: #f4f4f5;
  --ink-soft: #9ca3af;
  --accent-blue: #60a5fa;
  --accent-grad: linear-gradient(90deg, #7c3aed 0%, #db2777 100%);
  --panel: #141418;
  --panel-2: #1a1a1f;
  --surface: #1a1a1f;
  --page-bg: #0c0c0f;
  --nav-bg: rgba(12, 12, 15, 0.92);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --dash: rgba(255, 255, 255, 0.22);
  --pill-bg: rgba(124, 58, 237, 0.25);
  --pill-fg: #ddd6fe;
  --tab-active-bg: #fff;
  --tab-active-fg: #111;
  --canvas-bg: #111114;
  --dot: #3f3f46;
  --help-bg: #1f1f24;
  background: var(--page-bg) !important;
  color: var(--ink);
}

body.seedance-ui .noise {
  display: none;
}

.studio-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.25rem;
  min-height: 3.75rem;
  padding: 0.65rem 1.25rem;
  max-width: none;
  border-bottom: 1px solid var(--line);
  background: var(--nav-bg) !important;
  backdrop-filter: blur(12px);
}

.studio-nav .brand {
  width: 7rem;
  min-width: 7rem;
  height: 2.5rem;
  font-size: 1.25rem;
}

.studio-nav > nav,
.studio-nav .studio-nav-links {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  min-height: 2.5rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.studio-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  min-height: 2.5rem;
}

.studio-nav-actions .btn {
  height: 2.25rem;
  padding: 0 0.85rem;
  font-size: 0.8rem;
  border-radius: 999px;
  box-sizing: border-box;
}

.seedance-ui .btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.create-layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  min-height: calc(100svh - 74px);
  background: var(--page-bg);
}

.create-panel {
  padding: 1rem 1rem 2.5rem;
  border-right: 1px solid var(--line);
  overflow: auto;
  max-height: calc(100svh - 74px);
  background: var(--page-bg);
}

.mode-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.mode-tab {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
}

.mode-tab.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-fg);
}

.create-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  padding: 1rem 1rem 1.15rem;
}

.model-select {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: var(--panel-2);
}

.model-select strong {
  display: block;
  font-size: 0.95rem;
}

.model-select p {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.pill {
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-fg);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.28rem 0.55rem;
}

.ref-drop {
  border: 1px dashed var(--dash);
  border-radius: 14px;
  padding: 1.4rem 1rem;
  text-align: center;
  cursor: pointer;
  background: var(--panel-2);
  margin-bottom: 0.75rem;
}

.ref-drop:hover,
.ref-drop.dragover {
  border-color: var(--accent-blue);
  background: color-mix(in srgb, var(--accent-blue) 8%, var(--panel-2));
}

.ref-icons {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 0.45rem;
  opacity: 0.85;
}

.ref-drop-title {
  margin: 0;
  font-weight: 600;
  font-size: 0.9rem;
}

.ref-drop-sub {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.ref-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.more-refs {
  margin-top: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.35rem 0.65rem 0.65rem;
  background: var(--panel-2);
}

.more-refs > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0.45rem 0.15rem;
}

.more-refs > summary::-webkit-details-marker {
  display: none;
}

.more-refs[open] > summary {
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.ref-slots-more {
  grid-template-columns: repeat(3, 1fr);
}

.ref-slot {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  cursor: pointer;
  min-height: 104px;
}

.ref-slot.required-slot {
  grid-column: span 2;
  min-height: 140px;
}

.ref-tag {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  z-index: 2;
  font-size: 0.66rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 999px;
  padding: 0.16rem 0.42rem;
}

.ref-slot img {
  width: 100%;
  height: 100%;
  min-height: 104px;
  object-fit: cover;
}

.ref-slot img[hidden] {
  display: none !important;
  min-height: 0 !important;
}

.ref-slot .upload-placeholder {
  min-height: 104px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: transparent;
}

/* 左侧长面板：系统白滚动条在暗色主题里像「生硬竖条」，改成细暗色 */
.create-panel,
.studio-panel,
.seedance-ui {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink) 28%, transparent) transparent;
}

.create-panel::-webkit-scrollbar,
.studio-panel::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.create-panel::-webkit-scrollbar-track,
.studio-panel::-webkit-scrollbar-track {
  background: transparent;
}

.create-panel::-webkit-scrollbar-thumb,
.studio-panel::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 28%, transparent);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.create-panel::-webkit-scrollbar-thumb:hover,
.studio-panel::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--ink) 45%, transparent);
  background-clip: padding-box;
}

/* 防止空 video / 空 img 顶出原生控件条（中间那条「硬控件」） */
.seedance-ui [hidden] {
  display: none !important;
}

.seedance-ui #resultVideo:not([src]),
.seedance-ui #resultVideo[src=""] {
  display: none !important;
}

.hint-inline {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.linkish {
  border: 0;
  background: none;
  color: #c4b5fd;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.help-i {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 0.3rem;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
  padding: 0;
  line-height: 1;
}

.help-i:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.help-popover {
  position: fixed;
  z-index: 40;
  width: min(320px, calc(100vw - 2rem));
  background: var(--help-bg);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.9rem 1rem 1rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  color: var(--ink);
}

.help-popover h3 {
  margin: 0 1.4rem 0.4rem 0;
  font-size: 0.95rem;
}

.help-popover p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.5;
}

.help-close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 1.2rem;
  cursor: pointer;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.85rem;
  font-size: 0.88rem;
  font-weight: 500;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  display: inline-block;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--dot);
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}

.switch .slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: var(--accent-blue);
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
}

.seg {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.seg button {
  border: 1px solid var(--line-strong);
  background: transparent;
  border-radius: 999px;
  padding: 0.42rem 0.85rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-soft);
}

.seg button.active {
  background: var(--tab-active-bg);
  border-color: var(--tab-active-bg);
  color: var(--tab-active-fg);
}

.ratio-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}

.ratio-grid button {
  display: grid;
  place-items: center;
  gap: 0.3rem;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 10px;
  padding: 0.55rem 0.3rem;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.ratio-grid button.active {
  border-color: var(--accent-blue);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-blue) 40%, transparent);
  background: color-mix(in srgb, var(--accent-blue) 12%, var(--panel-2));
}

.ratio-icon {
  display: block;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  opacity: 0.9;
}

.ratio-icon.auto {
  width: 18px;
  height: 18px;
  border-style: dashed;
}
.ratio-icon.r169 {
  width: 22px;
  height: 12px;
}
.ratio-icon.r916 {
  width: 12px;
  height: 20px;
}
.ratio-icon.r43 {
  width: 20px;
  height: 15px;
}
.ratio-icon.r34 {
  width: 15px;
  height: 20px;
}
.ratio-icon.r219 {
  width: 24px;
  height: 10px;
}
.ratio-icon.r11 {
  width: 16px;
  height: 16px;
}

.seedance-ui textarea,
.seedance-ui select,
.seedance-ui input[type="number"],
.seedance-ui input[type="text"] {
  background: var(--panel-2);
  color: var(--ink);
  border-color: var(--line-strong);
}

.seedance-ui input[type="range"] {
  accent-color: var(--accent-blue);
}

.advanced-box {
  margin-top: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}

.advanced-box > summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  color: var(--ink-soft);
}

.advanced-box > summary::-webkit-details-marker {
  display: none;
}

.advanced-body {
  padding-top: 0.75rem;
}

.btn-generate {
  width: 100%;
  margin-top: 1.1rem;
  padding: 0.95rem 1.2rem;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent-grad);
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.35);
}

.btn-generate:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-generate .spark {
  margin-right: 0.35rem;
}

.seedance-ui .studio-stage {
  background: var(--page-bg);
  padding: 1.2rem 1.4rem 2rem;
}

.seedance-ui .preview-card,
.seedance-ui .stage-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: calc(100svh - 140px);
}

.seedance-ui .stage-canvas {
  background: var(--canvas-bg);
  border-radius: 18px;
  border: 1px solid var(--line);
  min-height: min(70vh, 640px);
}

.seedance-ui .stage-empty {
  color: rgba(255, 255, 255, 0.55);
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.carousel-dots button {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: var(--dot);
  cursor: pointer;
}

.carousel-dots button.active {
  background: var(--accent-blue);
}

.seedance-ui .chip,
.seedance-ui .mode-card,
.seedance-ui .pick-card {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--ink);
}

.seedance-ui .chip.selected,
.seedance-ui .mode-card:has(input:checked) {
  background: var(--tab-active-bg);
  color: var(--tab-active-fg);
  border-color: var(--tab-active-bg);
}

.seedance-ui .btn-generate {
  background: var(--accent-grad);
  color: #fff;
}

.seedance-ui .linkish {
  color: var(--accent-blue);
}

.seedance-ui .ref-slot {
  background: var(--panel-2);
  border-color: var(--line);
}

.seedance-ui .status-line {
  color: var(--ink-soft);
}

.seedance-ui .status-line.ok {
  color: var(--ink);
}

.seedance-ui .hint,
.seedance-ui .hint-inline {
  color: var(--ink-soft);
}

.seedance-ui .advanced-box > summary {
  color: var(--ink-soft);
}

@media (max-width: 980px) {
  .hero,
  .look-grid,
  .steps,
  .studio,
  .create-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 1.5rem;
  }

  .nav nav {
    display: none;
  }

  .studio-panel,
  .create-panel {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stage-card {
    min-height: auto;
  }

  .hero-visual::before {
    width: 36%;
    height: 28%;
  }

  .ref-slots {
    grid-template-columns: repeat(2, 1fr);
  }

  .ratio-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* === socece login === */

.login-page {
  min-height: 100svh;
}

.login-wrap {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: var(--page-bg, #0c0c0f);
}

.login-card {
  width: min(400px, 100%);
  border: 1px solid var(--line, rgba(255, 255, 255, 0.1));
  border-radius: 18px;
  background: var(--panel, #141418);
  padding: 1.6rem 1.4rem 1.5rem;
  display: grid;
  gap: 0.85rem;
}

.login-brand {
  width: auto;
  min-width: 0;
  height: 2.75rem;
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

.login-card h1 {
  margin: 0;
  font-size: 1.25rem;
  font-family: var(--font-display, inherit);
}

.login-sub {
  margin: -0.35rem 0 0.2rem;
  color: var(--ink-soft, #9ca3af);
  font-size: 0.9rem;
}

.login-card .field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--ink-soft, #9ca3af);
}

.login-card input {
  border: 1px solid var(--line-strong, rgba(255, 255, 255, 0.16));
  border-radius: 10px;
  background: var(--panel-2, #1a1a1f);
  color: var(--ink, #f4f4f5);
  padding: 0.7rem 0.8rem;
  font: inherit;
}

.login-card input:focus {
  outline: 2px solid rgba(124, 58, 237, 0.45);
  outline-offset: 1px;
}

.login-error {
  margin: 0;
  color: #f87171;
  font-size: 0.85rem;
}

.login-card .btn-generate {
  width: 100%;
  margin-top: 0.25rem;
}


/* === socece guide === */
.guide-main {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.guide-hero h1 {
  font-family: var(--font-display, inherit);
  font-size: clamp(2rem, 5vw, 2.8rem);
  margin: 0.2rem 0 0.6rem;
}

.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1.4rem 0 1.8rem;
}

.guide-toc a {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.guide-toc a:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.guide-article {
  border-top: 1px solid var(--line);
  padding: 1.4rem 0 0.4rem;
}

.guide-article h2 {
  font-size: 1.25rem;
  margin: 0 0 0.7rem;
}

.guide-article h3 {
  font-size: 1rem;
  margin: 1rem 0 0.45rem;
}

.guide-article p,
.guide-article li {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.65;
}

.guide-article ul,
.guide-article ol {
  padding-left: 1.2rem;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 0.8rem 0;
}

.guide-table th,
.guide-table td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.55rem;
  text-align: left;
  vertical-align: top;
  color: var(--ink-soft);
}

.guide-table th {
  color: var(--ink);
  background: var(--panel-2, rgba(255, 255, 255, 0.04));
}

.guide-pre {
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  background: var(--panel-2, #1a1a1f);
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow: auto;
}

.guide-foot {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.help-popover {
  width: min(380px, calc(100vw - 2rem));
  max-height: min(70vh, 480px);
  overflow: auto;
}

.help-popover .help-body {
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.55;
}

.help-popover .help-body p {
  margin: 0 0 0.55rem;
}

.help-popover .help-body ul,
.help-popover .help-body ol {
  margin: 0 0 0.55rem;
  padding-left: 1.1rem;
}

.help-popover .help-body li {
  margin: 0.2rem 0;
}

.help-popover .help-body a {
  color: var(--accent-blue, #60a5fa);
  text-decoration: underline;
}

.help-popover .help-body b {
  color: var(--ink);
  font-weight: 600;
}

.nav-help-link {
  font-size: 0.88rem;
  color: var(--ink-soft);
}



.chip-row.wrap {
  flex-wrap: wrap;
  gap: 0.45rem;
}

.help-i-link {
  font-size: 0.78rem;
}

/* —— 生成历史（对话式） —— */
.create-layout.has-history {
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr) minmax(280px, 340px);
}

.history-rail {
  border-left: 1px solid var(--line);
  background: var(--page-bg);
  max-height: calc(100svh - 74px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.75rem 1.25rem;
}

/* 桌面收起；移动端由 sheet 媒体查询覆盖为 transform 隐藏 */
.history-rail.is-collapsed {
  display: none;
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.history-head h2 {
  margin: 0;
  font-family: Syne, Sora, sans-serif;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.history-sub {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.history-head-actions {
  display: flex;
  gap: 0.3rem;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
}

.history-thread {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding-right: 0.15rem;
}

.history-empty {
  padding: 1.25rem 0.85rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.history-card.is-active {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 1px var(--line-strong);
}

.history-card-top {
  display: flex;
  gap: 0.55rem;
}

.history-thumb {
  width: 64px;
  height: 86px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--page-bg);
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.history-thumb.placeholder {
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  color: var(--ink-soft);
}

.history-meta {
  min-width: 0;
  flex: 1;
}

.history-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.history-time {
  margin: 0.25rem 0 0;
  font-size: 0.68rem;
  color: var(--ink-soft);
}

.history-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.history-badge {
  font-size: 0.62rem;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.history-badge.ok {
  color: #15803d;
  border-color: rgba(21, 128, 61, 0.35);
  background: rgba(21, 128, 61, 0.08);
}

.history-badge.fail {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.35);
  background: rgba(185, 28, 28, 0.08);
}

.history-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.history-ref {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  position: relative;
  background: var(--page-bg);
}

.history-ref img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-ref span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 0.5rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  line-height: 1.2;
  padding: 0.05rem 0;
}

.history-params {
  margin: 0;
  font-size: 0.68rem;
  color: var(--ink-soft);
  line-height: 1.45;
  word-break: break-word;
}

.history-prompt {
  margin: 0;
  font-size: 0.68rem;
  color: var(--ink);
  line-height: 1.4;
  max-height: 3.2em;
  overflow: hidden;
  opacity: 0.85;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.history-actions .btn {
  padding: 0.32rem 0.55rem;
  font-size: 0.68rem;
}

/* superseded by mobile history sheet block */



/* —— UI audit: contrast + hover (seedance studio) —— */
.seedance-ui .btn-ghost:hover {
  background: color-mix(in srgb, var(--ink) 10%, var(--panel));
  border-color: var(--ink);
  color: var(--ink);
}

.seedance-ui .btn-primary {
  background: var(--ink);
  color: var(--page-bg);
}

.seedance-ui .btn-primary:hover {
  background: var(--ink);
  color: var(--page-bg);
  filter: brightness(1.08);
  box-shadow: 0 0 0 1px var(--accent-blue), 0 10px 28px rgba(0, 0, 0, 0.22);
}

.seedance-ui .btn-generate:not(:disabled):hover {
  filter: brightness(1.07);
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.45);
  transform: translateY(-1px);
}

.seedance-ui .mode-tab:hover:not(.active) {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink);
}

.seedance-ui .chip:hover:not(.selected) {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--ink) 6%, var(--panel-2));
}

.seedance-ui .pick-card:hover:not(.selected) {
  border-color: var(--ink-soft);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.seedance-ui .seg button:hover:not(.active) {
  border-color: var(--line-strong);
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, var(--panel-2));
}

.seedance-ui .ratio-grid button:hover:not(.active) {
  border-color: color-mix(in srgb, var(--accent-blue) 55%, var(--line));
  color: var(--ink);
}

.seedance-ui .history-card:hover {
  border-color: var(--line-strong);
  background: var(--panel-2);
}

.seedance-ui .carousel-dots button:hover {
  background: var(--accent-blue);
  opacity: 0.7;
}

.seedance-ui .nav nav a:hover {
  color: var(--ink);
}

/* history badges: readable on light + dark */
.history-badge.ok {
  color: #15803d;
  border-color: rgba(21, 128, 61, 0.35);
  background: rgba(21, 128, 61, 0.08);
}

.history-badge.fail {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.35);
  background: rgba(185, 28, 28, 0.08);
}

body.seedance-ui.theme-dark .history-badge.ok {
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.4);
  background: rgba(134, 239, 172, 0.1);
}

body.seedance-ui.theme-dark .history-badge.fail {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.4);
  background: rgba(252, 165, 165, 0.1);
}

/* base ghost hover: never use unthemed --surface in dark contexts */
.btn-ghost:hover {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  border-color: var(--ink);
  color: var(--ink);
}


/* —— mobile history sheet —— */
.history-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  /* 不用 backdrop-filter：移动端会整页发糊，且盖住抽屉 */
  background: rgba(0, 0, 0, 0.55);
  border: 0;
  padding: 0;
  margin: 0;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.history-fab {
  display: none;
}

.history-sheet-handle {
  display: none;
}

@media (max-width: 1100px) {
  /* 历史脱离文档流，避免占满第三行把预览顶没 */
  .create-layout.has-history {
    grid-template-columns: 1fr !important;
    display: flex;
    flex-direction: column;
  }

  /* 抽屉在 body 层，z-index 高于遮罩，避免整页被糊住 */
  .history-rail {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: min(58svh, 520px);
    max-height: min(58svh, 520px);
    z-index: 70;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.35);
    padding: 0.35rem 0.85rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    transform: translateY(0);
    transition: transform 0.28s ease, visibility 0.28s ease;
    background: var(--panel);
  }

  .history-rail.is-collapsed {
    display: flex !important;
    transform: translateY(110%);
    visibility: hidden;
    pointer-events: none;
  }

  .history-sheet-handle {
    display: flex;
    justify-content: center;
    padding: 0.35rem 0 0.45rem;
    cursor: grab;
    flex-shrink: 0;
  }

  .history-sheet-handle span {
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ink) 28%, transparent);
  }

  .history-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: max(1rem, env(safe-area-inset-right, 0px));
    bottom: max(1.1rem, env(safe-area-inset-bottom, 0px));
    z-index: 35;
    min-width: 3.4rem;
    height: 3.4rem;
    padding: 0 1rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--ink);
    color: var(--page-bg);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    cursor: pointer;
  }

  .history-fab[hidden] {
    display: none !important;
  }

  body.history-open {
    overflow: hidden;
    touch-action: none;
  }

  .history-card {
    padding: 0.6rem;
  }

  .history-actions .btn {
    min-height: 2.1rem;
    padding: 0.4rem 0.65rem;
    font-size: 0.72rem;
  }

  .history-thumb {
    width: 56px;
    height: 74px;
  }

  /* 导航导航：防挤爆 */
  .studio-nav {
    padding: 0.7rem 0.75rem;
    gap: 0.45rem;
    flex-wrap: wrap;
    row-gap: 0.45rem;
  }

  .studio-nav .brand {
    font-size: 1.15rem;
  }

  .studio-nav .btn {
    padding: 0.4rem 0.65rem;
    font-size: 0.75rem;
  }

  .seedance-ui .studio-stage {
    padding: 0.85rem 0.85rem 5.5rem;
  }

  .seedance-ui .preview-card,
  .seedance-ui .stage-card {
    min-height: auto;
  }

  .seedance-ui .stage-canvas {
    min-height: min(48vh, 380px);
  }

  .create-panel {
    padding: 0.85rem 0.85rem 1.5rem;
  }

  .mode-tabs {
    gap: 0.25rem;
  }

  .mode-tab {
    padding: 0.45rem 0.7rem;
    font-size: 0.74rem;
  }

  .btn-generate {
    position: sticky;
    bottom: 0.5rem;
    z-index: 2;
  }

  .stage-actions {
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .stage-actions .btn {
    flex: 1 1 auto;
    min-width: 42%;
  }

  .ref-slots {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .help-popover {
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
  }
}

@media (max-width: 1100px) and (min-width: 721px) {
  /* 平板：右侧抽屉 */
  .history-rail {
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(380px, 86vw);
    height: 100svh;
    max-height: 100svh;
    border-radius: 0;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding-top: calc(0.85rem + env(safe-area-inset-top, 0px));
  }

  .history-rail.is-collapsed {
    display: flex !important;
    transform: translateX(105%);
    visibility: hidden;
    pointer-events: none;
  }

  .history-sheet-handle {
    display: none;
  }
}

@media (min-width: 1101px) {
  .history-scrim,
  .history-fab {
    display: none !important;
  }

  .history-rail.is-collapsed {
    display: none !important;
  }

  /* 桌面：历史在 main 外，用右侧固定栏 + 内容区让出宽度 */
  .history-rail:not(.is-collapsed) {
    position: fixed;
    top: 74px;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(340px, 28vw);
    height: auto;
    max-height: none;
    z-index: 8;
    border-left: 1px solid var(--line);
    border-top: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    background: var(--page-bg);
    padding: 0.85rem 0.75rem 1.25rem;
  }

  .create-layout.has-history {
    display: grid;
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    padding-right: min(340px, 28vw);
  }
}


/* mobile history compact + nav */
.history-details {
  margin: 0;
}

.history-details > summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.68rem;
  color: var(--ink-soft);
  padding: 0.15rem 0;
}

.history-details > summary::-webkit-details-marker {
  display: none;
}

.history-details[open] > summary {
  margin-bottom: 0.25rem;
  color: var(--ink);
}

.studio-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  flex-shrink: 0;
}

.studio-nav-links {
  display: flex;
  gap: 1rem;
}

@media (max-width: 1100px) {
  .studio-nav {
    display: grid;
    grid-template-columns: 7rem 1fr;
    grid-template-areas:
      "brand actions"
      "links links";
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.35rem;
    min-height: auto;
    padding: 0.55rem 0.9rem;
  }

  .studio-nav .brand {
    grid-area: brand;
    width: 7rem;
    min-width: 7rem;
    height: 2.25rem;
    font-size: 1.15rem;
  }

  .studio-nav-actions {
    grid-area: actions;
    justify-content: flex-end;
    min-height: 2.25rem;
  }

  .studio-nav-links,
  .studio-nav > nav {
    grid-area: links;
    display: flex !important;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.78rem;
    min-height: 1.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .studio-nav-actions .btn {
    height: 2.1rem;
    padding: 0 0.65rem;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .history-prompt {
    max-height: 4.5em;
  }

  .history-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .history-actions .btn {
    width: 100%;
    min-width: 0;
    justify-content: center;
    font-size: 0.7rem;
    padding: 0.45rem 0.2rem;
  }
}


/* —— slot replace + media switch —— */
.ref-slot {
  position: relative;
}

.ref-slot.has-asset .upload-placeholder {
  display: none;
}

.ref-slot-actions {
  position: absolute;
  left: 0.25rem;
  right: 0.25rem;
  bottom: 0.25rem;
  display: flex;
  gap: 0.2rem;
  z-index: 3;
}

.ref-slot-actions[hidden] {
  display: none !important;
}

.ref-act {
  flex: 1;
  border: 0;
  border-radius: 8px;
  padding: 0.28rem 0.2rem;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  backdrop-filter: blur(4px);
}

.ref-act.danger {
  background: rgba(185, 28, 28, 0.88);
}

.ref-slot img {
  cursor: pointer;
}

.media-switch {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.85rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  width: fit-content;
  max-width: 100%;
}

.media-switch-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink-soft);
  background: transparent;
  min-width: 5.5rem;
}

.media-switch-btn.active {
  background: var(--ink);
  color: var(--page-bg);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

.media-switch-btn.has-media:not(.active) {
  color: var(--ink);
}

.media-switch-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.media-thumbs {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}

.media-thumb {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 0;
  width: 56px;
  height: 74px;
  overflow: hidden;
  background: var(--panel);
  cursor: pointer;
  flex-shrink: 0;
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-thumb.active {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-blue) 35%, transparent);
}

/* 旧圆点默认隐藏 */
.carousel-dots {
  display: none !important;
}

@media (max-width: 1100px) {
  .media-switch {
    width: 100%;
  }
  .media-switch-btn {
    flex: 1;
  }
  .ref-act {
    font-size: 0.68rem;
    padding: 0.35rem 0.25rem;
  }
}



.ref-manifest {
  margin-top: 0.65rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.ref-manifest strong {
  font-weight: 650;
  margin-right: 0.1rem;
  color: var(--ink);
}
.ref-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 550;
  line-height: 1.2;
}
.ref-manifest-note {
  flex-basis: 100%;
  margin: 0.1rem 0 0;
  color: var(--ink-soft);
  opacity: 1;
  font-size: 0.72rem;
}

body.seedance-ui.theme-dark .ref-chip {
  background: color-mix(in srgb, var(--ink) 8%, var(--panel));
  border-color: var(--line-strong);
  color: var(--ink);
}
