:root {
  --bg: #0b0d12;
  --bg-soft: #11141b;
  --panel: rgba(20, 24, 33, 0.82);
  --panel-solid: #141821;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e8e9ee;
  --muted: #8d93a6;
  --dim: #626a7e;
  --accent: #ffd666;
  --accent-soft: rgba(255, 214, 102, 0.14);
  --ok: #52d18b;
  --warn: #ffb454;
  --err: #ff6b6b;
  --radius: 14px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
          "Source Han Sans SC", "WenQuanYi Zen Hei", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", "DejaVu Sans Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/* hidden 属性必须胜过任何组件自身的 display 规则(.modal 是 display:grid 等) */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(255, 214, 102, 0.07), transparent 62%),
    radial-gradient(900px 520px at 92% 4%, rgba(90, 130, 255, 0.08), transparent 60%),
    var(--bg);
}

/* ───────────────────────── 顶栏 ───────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 18, 0.78);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo { font-size: 26px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); }
.brand h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: .2px; }
.brand p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

.engine-strip { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.03);
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
}
.pill .state { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.pill.ready { color: var(--text); border-color: rgba(82,209,139,.4); background: rgba(82,209,139,.08); }
.pill.ready .state { background: var(--ok); box-shadow: 0 0 10px rgba(82,209,139,.8); }
.pill.active { border-color: rgba(255,214,102,.5); background: var(--accent-soft); color: var(--accent); }
.pill.active .state { background: var(--accent); box-shadow: 0 0 10px rgba(255,214,102,.8); }

/* ───────────────────────── 布局 ───────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(380px, 460px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px 28px 40px;
  align-items: start;
}
@media (max-width: 1080px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(10px);
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 14.5px; font-weight: 640; letter-spacing: .3px; }
.hint, .job-meta { font-size: 11.5px; color: var(--dim); }

/* ───────────────────────── 表单 ───────────────────────── */
.field { margin-bottom: 20px; }
.field-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: #cfd3de; margin-bottom: 9px;
}
.idx {
  display: inline-grid; place-items: center;
  width: 19px; height: 19px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700;
}
.req {
  margin-left: auto; font-size: 10.5px; font-weight: 500;
  color: var(--err); opacity: .85;
}

.drop {
  position: relative;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: rgba(255,255,255,.018);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
}
.drop:hover { border-color: rgba(255,214,102,.45); background: rgba(255,214,102,.035); }
.drop.dragging { border-color: var(--accent); background: rgba(255,214,102,.08); transform: scale(1.005); }
.drop.has-file { padding: 14px; cursor: default; border-style: solid; border-color: rgba(82,209,139,.4); }
.drop-empty .drop-icon { font-size: 22px; display: block; margin-bottom: 6px; }
.drop-empty p { margin: 0 0 4px; font-size: 13px; color: #d6d9e3; }
.drop-empty small { font-size: 11px; color: var(--dim); }
.drop-filled { text-align: left; }
.file-name { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-all; }
.file-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin-top: 10px; }
.thumb {
  position: relative; aspect-ratio: 4/3; border-radius: 9px; overflow: hidden;
  border: 1px solid var(--line-strong); background: #0f1218;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .order {
  position: absolute; left: 5px; top: 5px;
  background: rgba(0,0,0,.68); color: var(--accent);
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px;
}
.thumb .rm {
  position: absolute; right: 4px; top: 4px;
  width: 19px; height: 19px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.66); color: #fff; cursor: pointer; font-size: 12px; line-height: 1;
}

textarea, input[type="text"], input[type="password"], select {
  width: 100%; padding: 11px 12px;
  background: rgba(0,0,0,.28); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 10px;
  font-family: inherit; font-size: 13px; line-height: 1.6;
  resize: vertical; transition: border-color .16s, box-shadow .16s;
}
textarea:focus, input:focus, select:focus {
  outline: none; border-color: rgba(255,214,102,.55);
  box-shadow: 0 0 0 3px rgba(255,214,102,.1);
}
textarea::placeholder { color: #4d5466; }
.counter { margin-top: 7px; font-size: 11.5px; color: var(--dim); text-align: right; }

.advanced {
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,.018); padding: 0 14px; margin-bottom: 18px;
}
.advanced summary {
  list-style: none; cursor: pointer; padding: 12px 0;
  display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "▸"; color: var(--accent); transition: transform .18s; }
.advanced[open] summary::before { transform: rotate(90deg); }
.advanced summary em { font-style: normal; font-weight: 400; color: var(--dim); font-size: 11.5px; }
.advanced .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; padding-bottom: 14px; }
.mini-field { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--muted); }
.mini-field b { color: var(--accent); font-variant-numeric: tabular-nums; }
.mini-field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.cloud-row {
  display: grid; grid-template-columns: auto 1fr 1fr auto; gap: 8px; align-items: center;
  padding: 12px 0 14px; border-top: 1px solid var(--line);
}
.cloud-tag { font-size: 11px; color: var(--dim); }
.cloud-row input { padding: 7px 10px; font-size: 12px; }

button, .mini {
  font-family: inherit; cursor: pointer; border-radius: 9px;
  border: 1px solid var(--line-strong); background: rgba(255,255,255,.04);
  color: var(--text); font-size: 12px; padding: 7px 12px;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: background .16s, border-color .16s, transform .12s;
}
button:hover, .mini:hover { background: rgba(255,255,255,.08); border-color: var(--line-strong); }
.mini.ghost { background: transparent; color: var(--muted); }
.mini.ghost:hover { color: var(--text); }

.primary {
  width: 100%; padding: 14px; flex-direction: column; gap: 3px;
  border: none; border-radius: 12px;
  background: linear-gradient(135deg, #ffd666, #f5b942);
  color: #1a1405; font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 26px rgba(245, 185, 66, .22);
}
.primary:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; filter: saturate(.4); }
.primary:not(:disabled):hover { transform: translateY(-1px); }
.primary .btn-sub { font-size: 10.5px; font-weight: 500; opacity: .72; }
.error { margin: 10px 0 0; color: var(--err); font-size: 12px; }

/* ───────────────────────── 生产台 ───────────────────────── */
.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; margin-bottom: 16px; }
.stage {
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px;
  background: rgba(255,255,255,.02); position: relative; overflow: hidden;
}
.stage .s-name { font-size: 12px; font-weight: 600; color: #cfd3de; }
.stage .s-detail { font-size: 10.8px; color: var(--dim); margin-top: 4px; line-height: 1.45; min-height: 15px; }
.stage .s-mark { position: absolute; right: 10px; top: 9px; font-size: 12px; opacity: .55; }
.stage.running { border-color: rgba(255,214,102,.45); background: rgba(255,214,102,.06); }
.stage.running .s-mark { color: var(--accent); opacity: 1; animation: spin 1.1s linear infinite; }
.stage.done { border-color: rgba(82,209,139,.32); }
.stage.done .s-mark { color: var(--ok); opacity: 1; }
.stage.failed { border-color: rgba(255,107,107,.45); }
.stage.failed .s-mark { color: var(--err); opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.terminal {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #070910; margin-bottom: 16px;
}
.term-head {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  border-bottom: 1px solid var(--line); background: rgba(255,255,255,.02);
}
.term-head .dot { width: 9px; height: 9px; border-radius: 50%; background: #2b3140; }
.term-head .dot:first-child { background: #3d4356; }
.term-head em { font-style: normal; margin-left: 6px; font-size: 11px; color: var(--dim); }
.terminal pre {
  margin: 0; padding: 12px 14px; height: 230px; overflow-y: auto;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.7; color: #9aa3b8;
  white-space: pre-wrap; word-break: break-word;
}

.result { border-top: 1px solid var(--line); padding-top: 16px; }
.result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.result-head h3 { margin: 0; font-size: 13.5px; font-weight: 640; }
.result-actions { display: flex; gap: 7px; }
.player-wrap {
  border-radius: 12px; overflow: hidden; border: 1px solid var(--line-strong);
  background: #000; max-width: 940px;
}
.player-wrap video { width: 100%; display: block; max-height: 60vh; background: #000; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 16px; }
.metric {
  border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px;
  background: rgba(255,255,255,.022);
}
.metric .m-label { font-size: 10.8px; color: var(--dim); letter-spacing: .3px; }
.metric .m-value { font-size: 16px; font-weight: 650; margin-top: 5px; font-variant-numeric: tabular-nums; }
.metric .m-sub { font-size: 10.8px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.metric.score .m-value { font-size: 27px; color: var(--accent); }
.metric.score.good .m-value { color: var(--ok); }

.history { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.history-note { font-size: 10.8px; color: var(--dim); }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.hist-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px;
  background: rgba(255,255,255,.022);
}
.hist-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hist-meta b { font-size: 12.5px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta span { font-size: 10.6px; color: var(--dim); font-variant-numeric: tabular-nums; }
.hist-sim { font-size: 18px; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }
.hist-sim.good { color: var(--ok); }
.hist-links { display: flex; gap: 6px; flex-shrink: 0; }

.foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px 26px; color: var(--dim); font-size: 11px;
  border-top: 1px solid var(--line);
}
.foot span.warn { color: var(--warn); }

/* 文件输入:视觉隐藏但保留在可访问树中,便于自动化与辅助技术操作 */
.vh {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; opacity: 0; pointer-events: none; border: 0;
  z-index: -1;
}

/* ───────────────────────── 顶栏右侧:语言 / 账户 ───────────────────────── */
.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.lang-wrap { display: flex; align-items: center; }
.lang-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 9px;
  padding: 6px 9px;
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  min-width: 118px;
}
.lang-select:focus { outline: none; border-color: rgba(255, 214, 102, .5); }
.lang-select option { background: var(--panel-solid); color: var(--text); }

.auth-bar { display: flex; align-items: center; gap: 9px; }
.auth-actions { display: flex; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 7px 5px 13px;
}
.user-chip .u-email { font-size: 12px; color: var(--text); max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quota-pill {
  font-size: 11px; color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 214, 102, .32);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.mini.solid {
  background: var(--accent);
  color: #201a06;
  border-color: transparent;
  font-weight: 620;
}
.mini.solid:hover { filter: brightness(1.06); }

/* ───────────────────────── 访客提示条 ───────────────────────── */
.guest-banner {
  display: flex; align-items: center; gap: 18px; justify-content: space-between;
  margin: 0 auto 16px; max-width: 1560px; padding: 12px 18px;
  background: linear-gradient(90deg, rgba(255, 214, 102, .13), rgba(255, 214, 102, .04));
  border: 1px solid rgba(255, 214, 102, .28);
  border-radius: var(--radius);
}
.gb-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gb-text b { font-size: 13px; color: var(--accent); }
.gb-text span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.gb-actions { flex-shrink: 0; }

/* ───────────────────────── 访客锁定 ───────────────────────── */
.panel.inputs.locked { position: relative; }
.panel.inputs.locked .drop,
.panel.inputs.locked textarea,
.panel.inputs.locked #optTitle,
.panel.inputs.locked #optSubtitle,
.panel.inputs.locked #optLowerThird,
.panel.inputs.locked #optLowerThirdRole,
.panel.inputs.locked #optRefText { opacity: .42; pointer-events: none; }
.panel.inputs.locked::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: var(--radius);
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.022) 0 12px, transparent 12px 24px);
  pointer-events: none;
}

/* ───────────────────────── 流程 / 案例(宽面板) ───────────────────────── */
.panel.wide { grid-column: 1 / -1; }
.flow-steps { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 10px; }
.flow-steps li {
  display: flex; align-items: flex-start; gap: 11px;
  font-size: 12.5px; color: var(--muted); line-height: 1.55;
}
.fs-num {
  flex-shrink: 0; width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); border: 1px solid rgba(255, 214, 102, .35);
  color: var(--accent); font-size: 11px; font-weight: 700;
}
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.case-card {
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.case-card video { width: 100%; border-radius: 8px; background: #000; display: block; }
.case-card b { font-size: 13px; color: var(--text); }
.case-card span { font-size: 11.5px; color: var(--dim); }
.cases-empty { font-size: 12.5px; color: var(--dim); margin: 0; }

/* ───────────────────────── 注册 / 登录 弹窗 ───────────────────────── */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(6, 8, 12, .72); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; width: min(430px, calc(100vw - 32px));
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 26px 22px;
  display: flex; flex-direction: column; gap: 13px;
  max-height: calc(100vh - 48px); overflow-y: auto;
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--dim);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.auth-tabs { display: flex; gap: 6px; background: rgba(255,255,255,.04); padding: 4px; border-radius: 10px; }
.auth-tabs .tab {
  flex: 1; background: none; border: none; color: var(--muted);
  padding: 7px; border-radius: 7px; font-size: 12.5px; cursor: pointer; font-family: var(--font);
}
.auth-tabs .tab.active { background: rgba(255, 214, 102, .16); color: var(--accent); font-weight: 620; }
.modal-card h3 { margin: 0; font-size: 17px; }
.auth-sub { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.55; }
.modal-card .primary { margin-top: 4px; }
.modal-card .error.ok { color: var(--ok); }
.activation-link { color: var(--accent); font-size: 11.5px; word-break: break-all; }
.auth-switch { display: flex; justify-content: space-between; gap: 12px; margin: 2px 0 0; font-size: 12px; }
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

@media (max-width: 1080px) {
  .topbar-right { width: 100%; justify-content: space-between; }
  .guest-banner { flex-direction: column; align-items: flex-start; }
}
