:root {
  --bg: #0c0e0f;
  --panel: #15191b;
  --panel-2: #1b2022;
  --line: #2a3134;
  --line-soft: #202629;
  --ink: #f2f0ea;
  --muted: #9ba4a6;
  --muted-2: #6d7779;
  --accent: #d7ff63;
  --accent-ink: #14180b;
  --danger: #ff8f7a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% -10%, rgba(215, 255, 99, .08), transparent 32rem),
    radial-gradient(circle at 8% 20%, rgba(89, 196, 255, .05), transparent 26rem),
    var(--bg);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}
button, input { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.topbar {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 26px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 900; font-size: 20px; letter-spacing: -.02em;
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.08; }
.brand-copy strong { font-size: 13px; letter-spacing: .09em; }
.brand-copy small { font-size: 9px; color: var(--muted-2); letter-spacing: .22em; margin-top: 4px; }
.topbar-meta { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(215,255,99,.08); }

.page { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding-bottom: 64px; }
.hero { padding: 56px 0 40px; max-width: 760px; }
.eyebrow { margin: 0 0 18px; color: var(--accent); font-size: 10px; letter-spacing: .24em; font-weight: 700; }
.hero h1 { margin: 0; font-size: clamp(38px, 6vw, 76px); line-height: .98; letter-spacing: -.03em; font-weight: 750; }
.hero h1 em { color: var(--muted); font-style: normal; }
.hero-copy { max-width: 540px; margin: 24px 0 0; color: var(--muted); font-size: 15px; }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
.hero-tags span { border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 5px 11px; font-size: 11px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line-soft); margin-bottom: 24px; }
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 13px 16px 14px; border-bottom: 2px solid transparent;
  font-weight: 650; font-size: 14px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-color: var(--accent); }

.workspace { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 22px; align-items: start; }
.controls, .stage { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.controls { padding: 22px; }
.stage { min-height: 556px; padding: 18px; background: linear-gradient(160deg, #171c1e 0%, #111516 100%); box-shadow: var(--shadow); }

.section-head { display: flex; gap: 11px; align-items: flex-start; }
.section-head.spaced { margin-top: 26px; }
.section-head h2 { margin: 0; font-size: 14px; letter-spacing: -.01em; }
.section-head p { margin: 3px 0 0; color: var(--muted-2); font-size: 11px; }
.step { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .12em; padding-top: 3px; }

.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.model-card {
  position: relative; border: 1px solid var(--line); background: var(--panel-2);
  border-radius: var(--radius-sm); overflow: hidden; text-align: left; color: var(--ink);
  padding: 0; transition: border-color .18s, transform .18s;
}
.model-card:hover { border-color: #4b575a; transform: translateY(-1px); }
.model-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.model-card img { display: block; width: 100%; aspect-ratio: 1 / 1.1; object-fit: cover; background: #22292b; }
.model-card .placeholder {
  width: 100%; aspect-ratio: 1 / 1.1; display: grid; place-items: center;
  color: var(--muted-2); font-size: 24px; font-weight: 800; background: #22292b;
}
.model-card .model-name {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  padding: 8px 9px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.model-card .check { color: var(--accent); font-weight: 900; opacity: 0; }
.model-card.is-selected .check { opacity: 1; }
.skeleton { aspect-ratio: 1 / 1.1; border-radius: var(--radius-sm); background: linear-gradient(90deg, #1b2022, #252c2e, #1b2022); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.drop {
  position: relative; margin-top: 12px; min-height: 132px;
  border: 1px dashed #465154; border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 16px; text-align: center; color: var(--muted);
  background: rgba(255,255,255,.015); cursor: pointer; overflow: hidden;
  transition: border-color .18s, background .18s;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: rgba(215,255,99,.04); }
.drop.compact { min-height: 104px; }
.drop-icon { font-size: 23px; line-height: 1; color: var(--accent); font-weight: 300; }
.drop-title { color: var(--ink); font-size: 12px; font-weight: 650; }
.drop-hint { color: var(--muted-2); font-size: 10px; }
.drop-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop.has-file .drop-icon, .drop.has-file .drop-title, .drop.has-file .drop-hint { display: none; }
.micro { margin: 10px 0 18px; color: var(--muted-2); font-size: 10px; line-height: 1.5; }

.primary {
  width: 100%; border: 0; border-radius: 10px; padding: 13px 14px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: space-between;
  transition: filter .18s, opacity .18s;
}
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.primary:disabled { opacity: .35; cursor: not-allowed; }
.primary span { font-size: 18px; font-weight: 400; }
.rate-note { margin: 9px 0 0; color: var(--muted-2); font-size: 10px; text-align: center; }

.stage-empty { min-height: 518px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; }
.stage-orbit { width: 84px; height: 84px; border-radius: 50%; border: 1px solid #354043; display: grid; place-items: center; margin-bottom: 24px; position: relative; }
.stage-orbit:before { content: ""; width: 48px; height: 48px; border-radius: 50%; border: 1px dashed #536164; animation: spin 14s linear infinite; }
.stage-orbit span { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); top: 5px; left: 50%; transform: translateX(-50%); box-shadow: 0 0 16px var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.stage-kicker { color: var(--accent); font-size: 9px; letter-spacing: .2em; margin: 0 0 10px; font-weight: 700; }
.stage-empty h3 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.stage-empty p:last-child { margin: 9px 0 0; color: var(--muted-2); font-size: 12px; }

.job-card { min-height: 518px; display: flex; flex-direction: column; gap: 14px; padding: 10px; }
.job-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted-2); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.status-pill { color: var(--accent); border: 1px solid rgba(215,255,99,.25); background: rgba(215,255,99,.07); padding: 3px 8px; border-radius: 999px; font: 10px system-ui, "Microsoft YaHei", sans-serif; }
.status-pill.failed { color: var(--danger); border-color: rgba(255,143,122,.3); background: rgba(255,143,122,.07); }
.progress { height: 3px; background: #242b2d; border-radius: 99px; overflow: hidden; }
.progress span { display: block; width: 12%; height: 100%; background: var(--accent); border-radius: inherit; transition: width .35s ease; }
.job-card > p { margin: 0; color: var(--muted); font-size: 12px; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; flex: 1; }
.result-grid.single { grid-template-columns: 1fr 1fr; }
.result-grid figure { margin: 0; background: #0f1213; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); overflow: hidden; min-width: 0; }
.result-grid img { display: block; width: 100%; height: 100%; min-height: 330px; max-height: 440px; object-fit: contain; background: #0b0d0e; }
.result-grid figcaption { padding: 8px 10px; color: var(--muted); font-size: 10px; border-top: 1px solid var(--line-soft); }
.download { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); color: var(--ink); text-decoration: none; border-radius: 8px; padding: 10px 12px; font-size: 12px; font-weight: 650; }
.download:hover { border-color: var(--accent); color: var(--accent); }
.download.small { margin: 0 8px 8px; padding: 7px 8px; font-size: 10px; }
.error { color: var(--danger) !important; background: rgba(255,143,122,.06); border: 1px solid rgba(255,143,122,.18); border-radius: 8px; padding: 10px 12px; font-size: 12px !important; }

.source-switch { display: flex; gap: 4px; margin-top: 12px; background: #0f1213; padding: 3px; border-radius: 9px; border: 1px solid var(--line-soft); }
.source-btn { flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 7px; padding: 7px 8px; font-size: 11px; }
.source-btn.is-active { color: var(--ink); background: #252c2e; }
.face-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.face-card { border: 1px solid var(--line); background: var(--panel-2); border-radius: 9px; padding: 0; overflow: hidden; color: var(--ink); }
.face-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.face-card span { display: block; padding: 5px 6px; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.face-card.is-selected { border-color: var(--accent); }
.empty-small { grid-column: 1 / -1; color: var(--muted-2); font-size: 11px; padding: 10px 2px; }

.footer { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 22px 0 30px; border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 14px; color: var(--muted-2); font-size: 10px; }

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

@media (max-width: 900px) {
  .topbar, .page, .footer { width: min(100% - 28px, 720px); }
  .hero { padding-top: 34px; }
  .workspace { grid-template-columns: 1fr; }
  .stage { min-height: 430px; }
  .stage-empty { min-height: 390px; }
  .job-card { min-height: 390px; }
  .result-grid img { min-height: 240px; }
}
@media (max-width: 520px) {
  .topbar-meta { display: none; }
  .hero h1 { font-size: 44px; }
  .controls { padding: 16px; }
  .stage { padding: 10px; }
  .result-grid, .result-grid.single { grid-template-columns: 1fr; }
  .result-grid img { min-height: 220px; max-height: 340px; }
  .footer { flex-direction: column; }
}
