/* ════════════════════════════════════════════════════════════════════
   Seedance Studio — 调色台风格主题
   暖炭底色 + 钨丝琥珀主操作色 + 等宽“时间码”数字
   ════════════════════════════════════════════════════════════════════ */
:root {
  --ink:      #16181d;   /* 应用底色 */
  --panel:    #1e2128;   /* 卡片 */
  --panel-2:  #262a33;   /* 浮起层 / 输入框 */
  --line:     #343945;   /* 细线 */
  --line-soft:#2b2f39;
  --text:     #e8e6e0;   /* 暖纸白 */
  --muted:    #8a8f9b;
  --amber:    #f2a33c;   /* 钨丝琥珀 = 主操作 */
  --amber-deep:#d88a1f;
  --rec:      #e5484d;   /* 录制 / 错误 */
  --ok:       #4cc38a;
  --radius:   10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(242,163,60,.05), transparent 60%),
    var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--muted); font-weight: 400; }
.center { text-align: center; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
code {
  font-family: var(--mono); font-size: .85em;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  padding: .05em .35em; border-radius: 4px;
}

/* ── 布局骨架 ─────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.rail {
  width: 216px; flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 28px;
  padding: 26px 18px;
  border-right: 1px solid var(--line-soft);
  position: sticky; top: 0; height: 100vh;
}
.main { flex: 1; min-width: 0; padding: 34px clamp(18px, 4vw, 56px) 80px; }

/* 品牌区：取景环 + 字标 */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  display: grid; place-items: center; flex: 0 0 auto;
}
.brand-mark .ring {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3.5px solid var(--amber); position: relative;
}
.brand-mark .ring::after {
  content: ""; position: absolute; inset: 4px;
  border-radius: 50%; background: var(--rec);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 750; letter-spacing: .14em; font-size: 15px; }
.brand-tier { font-family: var(--mono); font-size: 10.5px; color: var(--muted); letter-spacing: .18em; }

/* 导航 */
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-btn {
  display: flex; align-items: baseline; gap: 10px;
  background: none; border: 1px solid transparent; border-radius: 8px;
  padding: 10px 12px; text-align: left; color: var(--muted);
  transition: background .15s, color .15s;
}
.nav-btn:hover { background: var(--panel); color: var(--text); }
.nav-btn.is-active {
  background: var(--panel); color: var(--text);
  border-color: var(--line-soft);
  box-shadow: inset 3px 0 0 var(--amber);
}
.nav-zh { font-size: 15px; font-weight: 600; }
.nav-en { font-family: var(--mono); font-size: 10px; letter-spacing: .22em; opacity: .55; }
.nav-count {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  background: var(--amber); color: #1a1206; font-weight: 700;
  border-radius: 999px; padding: 1px 7px;
}

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.lamp-row { display: flex; align-items: center; gap: 8px; }
.lamp {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted); box-shadow: 0 0 0 3px rgba(138,143,155,.15);
}
.lamp.ok  { background: var(--ok);  box-shadow: 0 0 0 3px rgba(76,195,138,.18); }
.lamp.bad { background: var(--rec); box-shadow: 0 0 0 3px rgba(229,72,77,.18); }
.lamp-text { font-size: 12.5px; color: var(--muted); }
.model-chip {
  font-size: 11px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 6px;
  padding: 5px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-btn {
  background: none; border: none; color: var(--muted);
  font-size: 12.5px; padding: 0; text-align: left; text-decoration: underline;
}
.link-btn:hover { color: var(--text); }

/* ── 视图头部 ─────────────────────────────────────────────── */
.view-head { margin-bottom: 22px; }
.view-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.eyebrow {
  font-size: 11px; letter-spacing: .26em; color: var(--amber);
  margin: 0 0 6px;
}
.view-head h2 { margin: 0; font-size: clamp(20px, 2.6vw, 26px); font-weight: 700; letter-spacing: .01em; }

/* ── 卡片与字段 ───────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row > input, .field-row > select { flex: 1; }
.field-error { color: var(--rec); font-size: 12.5px; margin: 6px 0 0; }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.divider { border-top: 1px solid var(--line-soft); margin: 18px 0; }
.plain-list { margin: 0; padding-left: 18px; }
.plain-list li { margin-bottom: 6px; }

input[type="text"], input[type="url"], input[type="number"],
input[type="password"], input:not([type]), select, textarea {
  width: 100%; color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; font-size: 14px; font-family: inherit;
}
textarea { resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #6a6f7b; }
input:focus, select:focus, textarea:focus { border-color: var(--amber); outline: none; }
select { appearance: auto; }

/* ── 按钮 ────────────────────────────────────────────────── */
.btn {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 16px;
  font-size: 14px; font-weight: 600;
  transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--amber), var(--amber-deep));
  border-color: var(--amber-deep); color: #1a1206;
}
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-danger-ghost { border-color: rgba(229,72,77,.5); color: #f08a8d; background: transparent; }
.btn-launch {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  font-size: 15px; padding: 12px; margin-top: 6px; letter-spacing: .06em;
}
.rec-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--rec); box-shadow: 0 0 0 3px rgba(229,72,77,.25);
}

/* ── 创作页 ──────────────────────────────────────────────── */
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  background: transparent; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted);
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.is-on { color: #1a1206; background: var(--amber); border-color: var(--amber); font-weight: 700; }

.create-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.col-deck .deck { position: sticky; top: 24px; }

#prompt { font-size: 14.5px; }

.drop-zone {
  border: 1.5px dashed var(--line); border-radius: 8px;
  padding: 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone p { margin: 3px 0; font-size: 13.5px; }
.drop-zone:hover, .drop-zone.is-over { border-color: var(--amber); background: rgba(242,163,60,.05); }
.url-add { display: flex; gap: 8px; margin-top: 10px; }
.url-add input { flex: 1; }

.asset-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.asset-item {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 8px;
}
.asset-thumb {
  width: 52px; height: 52px; border-radius: 6px; overflow: hidden;
  background: var(--ink); border: 1px solid var(--line-soft);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
}
.asset-thumb img, .asset-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-mid { min-width: 0; }
.asset-tag {
  display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--amber); border: 1px solid rgba(242,163,60,.45);
  border-radius: 4px; padding: 0 6px; margin-right: 8px;
}
.asset-name { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.asset-mid select { width: auto; margin-top: 6px; padding: 4px 8px; font-size: 12.5px; }
.asset-actions { display: flex; flex-direction: column; gap: 6px; }

/* 参数台 */
.deck-group { border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: 14px; }
.deck-group:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.deck-label {
  font-size: 10.5px; letter-spacing: .24em; color: var(--muted);
  margin: 0 0 12px;
}
details.adv summary { cursor: pointer; list-style: none; }
details.adv summary::before { content: "▸ "; color: var(--amber); }
details.adv[open] summary::before { content: "▾ "; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv[open] summary { margin-bottom: 12px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}
.seg button.is-on { background: var(--amber); border-color: var(--amber); color: #1a1206; font-weight: 700; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 7px 0; font-size: 14px; cursor: pointer;
}
.switch { position: relative; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
  display: block; width: 40px; height: 22px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  transition: background .15s, border-color .15s;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform .15s, background .15s;
}
.switch input:checked + i { background: rgba(242,163,60,.25); border-color: var(--amber); }
.switch input:checked + i::after { transform: translateX(18px); background: var(--amber); }
.switch input:focus-visible + i { outline: 2px solid var(--amber); outline-offset: 2px; }

/* 时长滑杆 */
.dur-readout { font-size: 26px; font-weight: 700; margin-bottom: 2px; }
input[type="range"] {
  width: 100%; appearance: none; -webkit-appearance: none; height: 22px; background: transparent; padding: 0;
  border: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--amber) var(--fill, 9%), var(--panel-2) var(--fill, 9%));
  border: 1px solid var(--line);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%; margin-top: -7px;
  background: var(--amber); border: 2px solid #1a1206; box-shadow: 0 0 0 2px var(--amber);
}
input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--line);
}
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--amber); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--amber); border: 2px solid #1a1206;
}
.dur-ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
#duration-block.is-disabled { opacity: .35; pointer-events: none; }

/* ── 任务页 ──────────────────────────────────────────────── */
.task-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.task-card { display: flex; flex-direction: column; margin-bottom: 0; }
.task-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tally {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .14em;
  border-radius: 5px; padding: 3px 9px; border: 1px solid;
}
.tally .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tally.queued    { color: var(--muted); border-color: var(--line); }
.tally.running   { color: var(--rec);   border-color: rgba(229,72,77,.5); }
.tally.running .dot { animation: blink 1s steps(2, start) infinite; }
.tally.succeeded { color: var(--ok);    border-color: rgba(76,195,138,.5); }
.tally.failed, .tally.expired { color: var(--rec); border-color: rgba(229,72,77,.5); }
.tally.cancelled { color: var(--muted); border-color: var(--line); }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .tally.running .dot { animation: none; }
  * { transition: none !important; }
}
.timecode { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }

.task-video {
  background: #0c0d10; border: 1px solid var(--line-soft); border-radius: 8px;
  overflow: hidden; margin-bottom: 10px; aspect-ratio: 16/9;
  display: grid; place-items: center; color: var(--muted); font-size: 13px;
}
.task-video video { width: 100%; height: 100%; display: block; background: #000; }
.task-prompt {
  font-size: 13px; color: var(--muted); margin: 0 0 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.param-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.param-chips span {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--line-soft); border-radius: 4px; padding: 1px 7px;
}
.task-error {
  background: rgba(229,72,77,.08); border: 1px solid rgba(229,72,77,.4);
  border-radius: 8px; padding: 9px 11px; font-size: 12.5px; color: #f3a6a8;
  margin-bottom: 10px; word-break: break-all;
}
.task-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }
.empty { text-align: center; color: var(--muted); padding: 70px 0; }
.empty .btn { margin-top: 14px; }

/* ── 设置页 ──────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

/* ── 登录遮罩 ─────────────────────────────────────────────── */
#login-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(13,14,17,.92); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
}
.login-card {
  width: min(360px, 100%);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 32px 28px; text-align: center;
}
.login-card .brand-mark { margin: 0 auto 14px; width: 52px; height: 52px; }
.login-title { margin: 0 0 4px; font-size: 17px; letter-spacing: .18em; }
.login-sub { margin: 0 0 20px; font-size: 13px; color: var(--muted); }
.login-card input { margin-bottom: 12px; text-align: center; }

/* ── Toast ───────────────────────────────────────────────── */
#toast-root {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(440px, 92vw);
}
.toast {
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 8px; padding: 11px 14px; font-size: 13.5px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
}
.toast.err { border-left-color: var(--rec); }
.toast.ok  { border-left-color: var(--ok); }

/* ── 响应式 ──────────────────────────────────────────────── */
@media (max-width: 1060px) {
  .create-grid { grid-template-columns: 1fr; }
  .col-deck .deck { position: static; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .rail {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 14px;
    padding: 12px 16px; border-right: none; border-bottom: 1px solid var(--line-soft);
  }
  .brand-tier { display: none; }
  .nav { flex-direction: row; gap: 4px; flex: 1; }
  .nav-btn { padding: 8px 10px; }
  .nav-en { display: none; }
  .rail-foot { margin-top: 0; }
  .model-chip, #logout-btn { display: none; }
  .main { padding: 22px 16px 60px; }
  .task-list { grid-template-columns: 1fr; }
}
