:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #17181c;
  --panel-2: #1e2026;
  --line: #2a2d34;
  --text: #e7e7ea;
  --muted: #8d929c;
  --blue: #3b82f6;
  --blue-2: #60a5fa;
  --green: #6fbf8b;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  font-size: 13px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0c0d10; color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app {
  height: 100vh;
  min-height: 640px;
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr) 360px;
  grid-template-rows: 42px minmax(0, 1fr) 78px;
  background: var(--bg);
}
.app.editing {
  grid-template-columns: 228px minmax(0, 1fr) 276px;
  grid-template-rows: 42px minmax(0, 1fr) var(--tl-h, 248px);
}
.app.directing {
  grid-template-columns: 228px minmax(0, 1fr) 276px;
  grid-template-rows: 42px minmax(0, 1fr) 168px;
}
.app.living {
  grid-template-columns: 228px minmax(0, 1fr) 276px;
}

.top {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 0;
  background: #141518;
  border-bottom: 1px solid var(--line);
}
.brand {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  margin-right: 4px;
  border-right: 1px solid var(--line);
  color: #f3f5f8;
  font-weight: 750;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-decoration: none;
  background: #101218;
  white-space: nowrap;
}
.brand span { color: #7eb6ff; }
.brand .ver {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.04em;
  color: #8b919c;
  align-self: center;
}
.modes { display: flex; height: 100%; gap: 0; overflow: auto; }
.mode {
  border: 0;
  background: transparent;
  color: #b7bcc6;
  padding: 0 8px;
  height: 100%;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  white-space: nowrap;
  flex: none;
}
.mode.active { color: #fff; border-bottom-color: var(--blue); background: #1c2433; }
.top-meta { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #d7dbe3;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #2e333d;
  border-radius: 999px;
  background: #14161c;
}
.badge, .text-btn, .icon-btn {
  border: 1px solid #343842;
  background: #1a1c21;
  color: #c5c8d0;
  border-radius: 4px;
}
.badge { font-size: 11px; padding: 3px 7px; }
.badge.ready { color: var(--green); border-color: #2c5a40; background: #15241c; }
.text-btn, .icon-btn { padding: 4px 8px; }
a.text-btn { text-decoration: none; display: inline-flex; align-items: center; }
.icon-btn { font-size: 12px; }

.top { grid-column: 1 / -1; grid-row: 1; }
.library { grid-column: 1; grid-row: 2 / 4; }
.stage { grid-column: 2; grid-row: 2; }
.inspector { grid-column: 3; grid-row: 2 / 4; }
.film-wrap { grid-column: 2; grid-row: 3; }

/* 桌面壳（?desktop=1）：尽早隐藏工作台网页顶栏，避免闪一下旧菜单 */
html.desktop-native #webTopBar,
html.desktop-native #modes {
  display: none !important;
}
html.desktop-native .app:not(.admin-page) > .top {
  display: none !important;
}
html.desktop-native .app {
  grid-template-rows: minmax(0, 1fr) 78px;
}
html.desktop-native .app.editing {
  grid-template-rows: minmax(0, 1fr) var(--tl-h, 248px);
}
html.desktop-native .app.directing {
  grid-template-rows: minmax(0, 1fr) 168px;
}
html.desktop-native .library { grid-row: 1 / 3; }
html.desktop-native .stage { grid-row: 1; }
html.desktop-native .inspector { grid-row: 1 / 3; }
html.desktop-native .film-wrap { grid-row: 2; }
html.desktop-native .app.editing .library,
html.desktop-native .app.editing .inspector,
html.desktop-native .app.directing .library,
html.desktop-native .app.directing .inspector { grid-row: 1; }
html.desktop-native .app.living .library { grid-row: 1 / 3; }
html.desktop-native .app.editing .film-wrap,
html.desktop-native .app.directing .film-wrap {
  grid-column: 1 / -1;
  grid-row: 2;
}
.app.editing .library,
.app.editing .inspector,
.app.directing .library,
.app.directing .inspector,
.app.living .library { grid-row: 2; }
.app.living .library { grid-row: 2 / 4; }
.app.editing .film-wrap,
.app.directing .film-wrap { grid-column: 1 / -1; grid-row: 3; }

.library {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px;
  gap: 6px;
}
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.face-tabs {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 0;
}
.face-tabs button {
  border: 0;
  background: transparent;
  color: #9aa0aa;
  padding: 4px 8px;
  border-bottom: 2px solid transparent;
}
.face-tabs button.active {
  color: #f3f4f6;
  border-bottom-color: #e7e7ea;
}
.face-actions {
  display: flex;
  gap: 6px;
}
.face-actions .face-upload {
  flex: 1;
  width: 100%;
  justify-content: center;
  min-height: 30px;
  border: 1px solid #343842;
  border-radius: 8px;
  background: #1a1c21;
  color: #d7dae0;
}
.face-actions .face-upload:hover {
  border-color: #4b6fb8;
  color: #fff;
  background: #22262e;
}
.face-actions[hidden] { display: none !important; }
.col-head h2, .block h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #c8ccd4;
}
.target-head { margin-top: 4px; }
.face-grid, .target-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-content: start;
}
#faceCol { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.face-grid { overflow: auto; flex: 1; min-height: 0; padding-right: 2px; }
.target-list { max-height: 168px; overflow: auto; }
.app.editing .target-list { max-height: none; flex: 1; min-height: 0; }
.app.living .face-grid { grid-template-columns: 1fr; }
.app.living #faceCol { flex: 1; min-height: 0; }
.app.living .face-tabs { flex-wrap: nowrap; overflow-x: auto; }
.app.living .face-tabs button { padding: 4px 7px; font-size: 12px; white-space: nowrap; }
.app.living .face-actions { margin-top: 2px; }
.face, .target {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 2px;
  background: #111;
  overflow: hidden;
}
.face img, .target img, .face video, .target video { width: 100%; height: 100%; object-fit: cover; display: block; }
.target .audio-ph {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #243044, #1a222e);
  color: #9eb6d4;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.face.selected, .target.selected { border-color: var(--blue); }
.face span, .target span {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 4px 3px;
  font-size: 10px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.72));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
}
.face:hover span, .target:hover span, .face.selected span, .target.selected span { opacity: 1; }
.x {
  position: absolute;
  top: 3px; right: 3px;
  width: 16px; height: 16px;
  border: 0; border-radius: 2px;
  background: rgba(0,0,0,.65);
  color: #fff;
  line-height: 16px;
  padding: 0;
  opacity: 0;
}
.face:hover .x, .target:hover .x { opacity: 1; }
.empty { grid-column: 1 / -1; margin: 8px 2px; color: var(--muted); font-size: 12px; }

.stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 40px;
  background: #0b0c0e;
}
.stage-frame {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #090a0c;
}
.stage-frame > video, .stage-frame > img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  background: #000;
  justify-self: center;
  align-self: center;
}
.face-layer {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}
.face-box {
  position: absolute;
  pointer-events: auto;
  border: 2px solid rgba(88, 166, 255, 0.85);
  background: rgba(37, 99, 235, 0.12);
  cursor: pointer;
  padding: 0;
}
.face-box.selected {
  border-color: #3dd68c;
  background: rgba(61, 214, 140, 0.16);
}
.face-box span {
  position: absolute;
  left: 0;
  top: -18px;
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  padding: 0 5px;
  white-space: nowrap;
}
.stage-controls {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 8px;
}
.stage-controls button {
  min-width: 76px;
  border: 0;
  border-radius: 4px;
  padding: 8px 16px;
  background: rgba(20, 21, 24, 0.9);
  color: #fff;
  font-weight: 650;
}
#stagePlay { background: var(--blue); }
#stageStop { border: 1px solid #343842; }
.play, .ghost-play {
  border: 0;
  background: transparent;
  width: 0; height: 0;
  border-style: solid;
  border-width: 18px 0 18px 30px;
  border-color: transparent transparent transparent #f4f4f5;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.45));
  padding: 0;
}
.ghost-play { border-width: 22px 0 22px 36px; opacity: 0.85; }
.empty-stage { text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 18px; position: relative; z-index: 1; }
.empty-stage p { margin: 0; font-size: 14px; }
#speaker { width: min(420px, 80%); }
.tool-list { display: grid; gap: 8px; }
.tool-card {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid #343842;
  background: #101114;
  border-radius: 6px;
  padding: 10px;
}
.tool-card:hover { border-color: #4c628a; }
.tool-card strong { font-size: 13px; }
.tool-card span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.skill-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid #262930; }
.transport {
  display: grid;
  grid-template-columns: 110px auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: #141518;
  border-top: 1px solid var(--line);
  color: #c9cdd4;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.transport-actions { display: flex; gap: 6px; align-items: center; }
.transport-actions button { padding: 4px 10px; }
.job-status { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
#jobState { color: var(--muted); }
.text-link {
  border: 0;
  background: none;
  padding: 0;
  color: #c9cdd4;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.text-link:hover { color: #fff; text-decoration: underline; }
.inspector-scroll .text-link { margin: 4px 0 0; font-size: 12px; }

.inspector {
  background: #141518;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.insp-tabs {
  display: flex;
  gap: 0;
  margin: -8px -10px 10px;
  border-bottom: 1px solid #262930;
}
.insp-tabs button {
  flex: 1;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #9aa0aa;
  padding: 8px 6px;
  font-size: 12px;
}
.insp-tabs button.active {
  color: #fff;
  background: #1e3a8a;
  box-shadow: inset 0 -2px 0 #3b82f6;
}
.missing-models {
  display: grid;
  gap: 0;
  margin: 0 0 12px;
  padding: 12px 12px 8px;
  border: 1px solid #2a2e38;
  border-radius: 10px;
  background: #12141a;
  text-align: left;
}
.missing-models[hidden] { display: none !important; }
.missing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.missing-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.missing-badge {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #f97316;
  color: #111;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}
.missing-title {
  margin: 0;
  color: #f3f4f6;
  font-size: 13px;
  font-weight: 650;
}
.missing-head-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}
.missing-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
}
.missing-icon-btn:hover { background: #1c2030; color: #fff; }
.missing-hint {
  margin: 0 0 10px;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
}
.missing-list { display: grid; gap: 0; }
.missing-list[hidden] { display: none !important; }
.missing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #242830;
}
.missing-meta {
  min-width: 0;
  text-align: left;
}
.missing-file {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #f3f4f6;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-all;
}
.missing-file a,
.missing-link {
  color: #9ca3af;
  text-decoration: none;
  flex: none;
}
.missing-file a:hover { color: #fff; }
.missing-kind {
  margin: 3px 0 0;
  color: #9ca3af;
  font-size: 12px;
  text-align: left;
}
.missing-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.missing-actions .dl-btn {
  min-width: 56px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid #3a3f4b;
  border-radius: 6px;
  background: #1a1d24;
  color: #f3f4f6;
  font-size: 12px;
  cursor: pointer;
}
.missing-actions .dl-btn:hover:not(:disabled) { background: #242833; }
.missing-actions .dl-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.missing-actions .dl-btn.is-ready {
  border-color: #14532d;
  color: #86efac;
  background: #102018;
}
.missing-progress {
  margin: 0;
  padding: 4px 0 6px;
  color: #9ca3af;
  font-size: 11px;
  text-align: left;
}
.rope-downloads { display: contents; }
.rope-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  min-height: 26px;
  margin: 3px 0;
  color: #c5c8d0;
  font-size: 11px;
}
.rope-row > span:first-child {
  color: #b7bcc6;
  white-space: nowrap;
  flex: 1 1 auto;
}
.rope-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.rope-row select, .rope-row input[type="number"] {
  width: 128px;
  height: 24px;
  padding: 1px 6px;
  font-size: 11px;
}
.provider-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 220px;
}
.provider-pills label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #343842;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  color: #c5c8d0;
}
.provider-pills label:has(input:checked) {
  border-color: #3b82f6;
  background: #13233f;
  color: #fff;
}
.provider-pills input {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: #3b82f6;
}
.segment {
  display: flex;
  border: 1px solid #343842;
  border-radius: 4px;
  overflow: hidden;
}
.segment label {
  padding: 2px 6px;
  font-size: 10px;
  color: #9aa0aa;
  border-right: 1px solid #343842;
}
.segment label:last-child { border-right: 0; }
.segment label:has(input:checked) { background: #1e3a8a; color: #fff; }
.segment input { display: none; }
.switch {
  position: relative;
  width: 34px;
  height: 18px;
  flex: none;
}
.switch input {
  opacity: 0;
  width: 34px;
  height: 18px;
  margin: 0;
  padding: 0;
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
  background: none;
  border: 0;
}
.switch i {
  display: block;
  width: 34px;
  height: 18px;
  border-radius: 99px;
  background: #3a3e46;
  pointer-events: none;
}
.switch i::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #d7dbe3;
  transition: left 0.12s ease;
}
.switch input:checked + i { background: #2563eb; }
.switch input:checked + i::after { left: 18px; }
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 148px;
}
.slider-wrap input[type="range"] {
  width: 110px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: #3b82f6;
}
.slider-wrap em {
  font-style: normal;
  min-width: 28px;
  text-align: right;
  color: #8d929c;
  font-variant-numeric: tabular-nums;
}
#ropeStatus { margin: 0 0 8px; }
.input-state { color: #8d929c; font-style: normal; font-size: 11px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.input-state.ready { color: var(--green); }
.inspector-scroll { overflow: auto; padding: 8px 10px 12px; }
.block { padding: 8px 0 10px; border-bottom: 1px solid #262930; }
.block h3 { margin-bottom: 8px; }
.blurb { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.field {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 32px;
}
.field > span { color: #b7bcc6; font-size: 12px; }
input, select, textarea {
  width: 100%;
  background: #101114;
  border: 1px solid #343842;
  border-radius: 4px;
  padding: 5px 8px;
  outline: none;
}
input[type="checkbox"], input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  flex: none;
  accent-color: var(--blue);
  background: none;
  border: 0;
}
input:focus, select:focus, textarea:focus { border-color: #4c628a; }
select {
  height: 28px;
  padding-top: 0;
  padding-bottom: 0;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #9aa0aa 50%), linear-gradient(135deg, #9aa0aa 50%, transparent 50%);
  background-position: calc(100% - 14px) 12px, calc(100% - 9px) 12px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
textarea { min-height: 72px; resize: vertical; line-height: 1.45; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.steps li {
  background: #101114;
  border: 1px solid #2e323a;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 12px;
}
.steps b { color: var(--blue-2); font-weight: 600; }
.steps span { display: block; color: var(--muted); margin-top: 2px; }
#log {
  margin: 0;
  max-height: 140px;
  overflow: auto;
  background: #0d0e12;
  border-radius: 4px;
  padding: 8px;
  color: #c5cad3;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.inspector-foot { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.run, .ghost, .primary { border-radius: 4px; padding: 8px 12px; }
.run, .primary { flex: 1; border: 0; background: var(--blue); color: #fff; font-weight: 650; }
.ghost { background: #1a1c21; border: 1px solid #343842; color: var(--text); }

.film-wrap {
  background: #101114;
  border-top: 1px solid var(--line);
  min-width: 0;
  overflow: hidden;
}
.film { display: flex; gap: 6px; height: 100%; align-items: center; padding: 8px 10px; overflow: auto; }
.film figure { margin: 0; height: 100%; flex: none; }
.film img { height: 62px; width: 110px; object-fit: cover; border-radius: 2px; background: #000; display: block; }
.film figcaption { display: none; }
.film.story { align-items: stretch; }
.film.story figure { width: 140px; padding: 8px; background: #101114; border: 1px solid #343842; border-radius: 4px; }
.film.story figcaption { display: block; font-size: 11px; color: var(--muted); line-height: 1.4; }
.film.timeline { gap: 4px; align-items: stretch; }
.film.timeline .clip {
  position: relative;
  min-width: 88px;
  max-width: 280px;
  height: 100%;
  padding: 0;
  border: 1px solid #343842;
  background: #101114;
  overflow: hidden;
}
.film.timeline .clip.selected { border-color: var(--blue); }
.film.timeline .clip video,
.film.timeline .clip img {
  width: 100%;
  height: 70px;
  object-fit: cover;
  display: block;
}
.film.timeline .empty { margin: 0; color: var(--muted); font-size: 12px; }
.film.timeline .clip em {
  display: block;
  padding: 2px 6px;
  font-style: normal;
  font-size: 11px;
  color: #c9cdd4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.edit-move { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.edit-move .ghost { padding: 4px 10px; }

dialog { border: 0; padding: 0; background: transparent; color: inherit; }
dialog::backdrop { background: rgba(0, 0, 0, 0.62); }
.modal {
  width: min(720px, calc(100vw - 40px));
  max-height: min(820px, calc(100vh - 40px));
  overflow: auto;
  background: #17181c;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.modal.narrow { width: min(520px, calc(100vw - 40px)); }
.modal h2 { margin: 0; font-size: 16px; }
.modal h3 { margin: 14px 0 8px; font-size: 12px; color: #d5d8de; }
.modal-head, .check { display: flex; align-items: center; gap: 8px; }
.modal-head { justify-content: space-between; }
.check {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 8px;
  width: auto;
  max-width: 100%;
  margin: 8px 0;
  color: #c5c8d0;
  font-size: 12px;
  text-align: left;
  line-height: 1.45;
}
.check input[type="checkbox"],
.check input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  flex: none;
  margin: 2px 0 0;
}
.check span {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  word-break: normal;
}
.stack { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.presets button { border: 1px solid #343842; background: #101114; border-radius: 4px; padding: 4px 8px; }
.hint, .skill-card p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.admin-page { display: block; height: auto; min-height: 100vh; overflow: auto; background: #0c0d11; }
.admin-page .top { border-bottom: 1px solid #242830; background: #12131a; }
.admin-main { max-width: 420px; margin: 56px auto; padding: 16px; }
.admin-shell { display: grid; grid-template-columns: 176px minmax(0, 1fr); min-height: calc(100vh - 44px); width: 100%; }
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 12px;
  border-right: 1px solid #242830;
  background: linear-gradient(180deg, #14161d 0%, #101218 100%);
}
.admin-nav a {
  color: #b8bec8;
  text-decoration: none;
  border-radius: 8px;
  text-align: left;
  padding: 9px 12px;
  font-size: 13px;
  transition: background .15s ease, color .15s ease;
}
.admin-nav a:hover { background: #1c2030; color: #fff; }
.admin-nav a.active { background: #2b6de8; color: #fff; font-weight: 600; }
.admin-body {
  padding: 20px 24px 40px;
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
  background:
    radial-gradient(900px 320px at 12% -10%, rgba(59, 130, 246, 0.08), transparent 60%),
    #0c0d11;
}
.admin-body .page.modal {
  width: 100%;
  max-width: none;
  max-height: none;
  box-sizing: border-box;
  background: #15171e;
  border: 1px solid #2a2e38;
  border-radius: 12px;
  padding: 20px 22px 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  text-align: left;
}
.admin-body .page.modal > h2 {
  margin: 0 0 4px;
  letter-spacing: 0.01em;
  text-align: left;
}
.admin-body .page.modal > .hint {
  margin: 0 0 14px;
  max-width: 640px;
  text-align: left;
}
.admin-body .page.modal > h3 {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #262a33;
  max-width: 560px;
  text-align: left;
}
/* 表单控件限宽，文字与按钮一律左对齐 */
.admin-body .stack,
.admin-body .row,
.admin-body .presets,
.admin-body .modal-actions,
.admin-body .admin-option-list,
.admin-body #skillCatalog,
.admin-body #voiceAdmin,
.admin-body #skillAdmin {
  max-width: 560px;
  text-align: left;
}
.admin-body .stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-bottom: 10px;
  text-align: left;
}
.admin-body .row {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 260px);
  justify-content: start;
  justify-items: stretch;
  gap: 8px;
}
.admin-body .row > .stack { width: 100%; margin-bottom: 0; }
.admin-body input:not([type="checkbox"]):not([type="radio"]),
.admin-body select,
.admin-body textarea {
  width: 100%;
  max-width: 560px;
  border-radius: 7px;
  background: #0f1116;
  border-color: #343842;
  text-align: left;
}
.admin-body input[type="checkbox"],
.admin-body input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  max-width: 16px;
  margin: 2px 0 0;
  flex: none;
  accent-color: #2b6de8;
}
.admin-body textarea { min-height: 72px; margin-bottom: 0; resize: vertical; }
.admin-body .modal-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.admin-body .primary,
.admin-body .ghost,
.admin-body .run {
  flex: 0 0 auto;
  width: auto;
  min-width: 88px;
  border-radius: 7px;
  padding: 8px 16px;
  margin: 0;
}
.admin-body .presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin-bottom: 12px;
}
.admin-body .presets button {
  border-radius: 7px;
  padding: 5px 12px;
  background: #12141a;
  text-align: left;
}
.admin-body .check {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  max-width: 560px;
  margin: 10px 0;
  padding: 0;
  text-align: left;
  white-space: normal;
}
.admin-body .check span {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  color: #c5c8d0;
  font-size: 13px;
  line-height: 1.45;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}
.admin-body .admin-option-list {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
}
.admin-body .admin-option {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #2a2e38;
  border-radius: 10px;
  background: #12141a;
  text-align: left;
}
.admin-body .admin-option-title {
  color: #f3f4f6;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}
.admin-body .admin-option-sub {
  color: #9ca3af;
  font-size: 12px;
  text-align: left;
  margin-bottom: 4px;
}
.admin-body .admin-option textarea {
  max-width: none;
}
.admin-body .skill-row {
  max-width: 560px;
  border: 1px solid #2e333d;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #101218;
}
.admin-body #planAdmin {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 300px));
  gap: 12px;
  max-width: none;
  align-items: start;
}
.admin-body .plan-row {
  max-width: none;
  width: 100%;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin: 0;
  padding: 14px;
}
.admin-body .plan-row .stack { max-width: none; margin-bottom: 0; }
.admin-body .plan-row input { max-width: none; }
.admin-body .plan-row .primary { align-self: flex-start; }
.admin-body .admin-table-wrap,
.admin-body .pack-admin {
  max-width: none;
}
.admin-body .admin-filters {
  max-width: 560px;
  grid-template-columns: minmax(0, 180px) minmax(0, 220px) auto;
}
.admin-body .member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.admin-body .member-actions select {
  width: auto;
  min-width: 120px;
  max-width: 160px;
}
.admin-body .member-actions .primary,
.admin-body .member-actions .ghost {
  min-width: 0;
  padding: 6px 10px;
}
.admin-body #deskStatus,
.admin-page #deskStatus {
  max-width: 560px;
}
#authTabs button.active { border-color: var(--blue, #3b82f6); color: #fff; }
img.qr { width: 180px; height: 180px; background: #fff; display: block; margin: 8px 0; border-radius: 6px; }
#payLink { display: inline-block; text-decoration: none; margin-top: 6px; }
.pay-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 8, 12, 0.72);
  backdrop-filter: blur(6px);
}
.pay-overlay[hidden] { display: none !important; }
.pay-card {
  width: min(360px, 100%);
  background: #15171d;
  border: 1px solid #343842;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  padding: 18px 18px 16px;
}
.pay-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.pay-card-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.pay-card .qr {
  width: 220px;
  height: 220px;
  margin: 14px auto;
  border-radius: 10px;
  padding: 10px;
  box-sizing: border-box;
  background: #fff;
  object-fit: contain;
}
.pay-card .pay-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}
.pay-card #payLink {
  margin-top: 0;
  text-align: center;
}
.skill-row button { margin-left: 6px; }
.admin-filters { align-items: end; margin-bottom: 10px; }
.pack-admin {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.pack-admin article {
  position: relative;
  background: #101114;
  border: 1px solid #343842;
  border-radius: 6px;
  overflow: hidden;
}
.pack-admin img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #000; }
.pack-admin span { display: block; padding: 6px 8px 8px; font-size: 12px; color: #c5c8d0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pack-admin button {
  position: absolute;
  top: 6px;
  right: 6px;
  border: 0;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 2px 6px;
}
.admin-table-wrap { overflow: auto; border: 1px solid #343842; border-radius: 6px; margin-top: 8px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th, .admin-table td { padding: 8px 10px; border-bottom: 1px solid #262930; text-align: left; vertical-align: top; }
.admin-table th { color: #b7bcc6; background: #101114; position: sticky; top: 0; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .mono { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: #aeb4bf; }
.admin-table .pos { color: var(--green); }
.admin-table .neg { color: #f08a8a; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.status-line { min-height: 1.2em; color: var(--green); font-size: 12px; }
.order-page { display: block; min-height: 100vh; background: #0c0d10; }
.order-page .top { position: sticky; top: 0; }
.order-main { max-width: 560px; margin: 24px auto; padding: 0 16px 40px; display: grid; gap: 16px; }
.order-main .modal { width: auto; max-height: none; }
.skill-row.wanted { border-color: #3b82f6; background: #152033; }
.order-main .skill-row { border: 1px solid #343842; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.order-main a.primary { text-decoration: none; display: inline-flex; justify-content: center; }

.lib-tabs {
  display: flex;
  gap: 0;
  margin: -8px -8px 6px;
  border-bottom: 1px solid var(--line);
}
.lib-tabs button {
  flex: 1;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #9aa0aa;
  padding: 8px 4px;
  font-size: 12px;
}
.lib-tabs button.active {
  color: #f3f4f6;
  border-bottom: 2px solid #e7e7ea;
  background: transparent;
}
.app.editing .library { padding-top: 0; }
.app.editing .insp-tabs button.active {
  background: #1c2433;
  box-shadow: inset 0 -2px 0 var(--blue);
}
.app.editing #run { background: #2563eb; }

.tl-editor {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #121317;
  user-select: none;
}
.tl-resizer {
  height: 5px;
  cursor: ns-resize;
  background: transparent;
  flex: none;
}
.tl-resizer:hover, .tl-resizer.dragging { background: #3b82f6; }
.tl-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-bottom: 1px solid #262930;
  flex: none;
}
.tl-tools { display: flex; align-items: center; gap: 6px; }
.tl-btn {
  border: 1px solid #343842;
  background: #1a1c21;
  color: #d5d8de;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
}
.tl-btn:hover { border-color: #4c628a; color: #fff; }
.tl-time {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: #c9cdd4;
  font-size: 12px;
}
.tl-zoom {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #8d929c;
  font-size: 12px;
}
.tl-zoom input[type="range"] {
  width: 110px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--blue);
}
.tl-board {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background:
    linear-gradient(#1a1b20, #1a1b20) 0 0 / 56px 100% no-repeat,
    #15161a;
}
.tl-head, .tl-track {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  min-width: 100%;
}
.tl-head { position: sticky; top: 0; z-index: 4; background: #15161a; }
.tl-gutter {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #262930;
  border-bottom: 1px solid #262930;
  color: #9aa0aa;
  font-size: 11px;
  background: #17181c;
}
.tl-ruler {
  position: relative;
  height: 24px;
  border-bottom: 1px solid #262930;
  cursor: pointer;
  background: #121317;
}
.tl-tick {
  position: absolute;
  top: 0;
  width: 1px;
  height: 8px;
  background: #4a4e58;
}
.tl-tick.major { height: 14px; background: #6b7280; }
.tl-tick span {
  position: absolute;
  left: 4px;
  top: 8px;
  font-size: 10px;
  color: #8d929c;
  white-space: nowrap;
}
.tl-track { height: 58px; }
.tl-track.audio { height: 42px; }
.tl-track.text { height: 36px; }
.tl-lane {
  position: relative;
  border-bottom: 1px solid #262930;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent calc(var(--pps, 48px) - 1px),
    #1e2026 calc(var(--pps, 48px) - 1px),
    #1e2026 var(--pps, 48px)
  );
}
.tl-empty {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  color: #6b7280;
  font-size: 12px;
  pointer-events: none;
}
.tl-clip {
  position: absolute;
  top: 6px;
  bottom: 6px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #2a5f7a;
  background: #163445;
  cursor: grab;
}
.tl-clip.selected {
  border-color: #fff;
  box-shadow: 0 0 0 1px #3b82f6;
  z-index: 2;
}
.tl-clip video, .tl-clip img {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 88px;
  object-fit: cover;
  pointer-events: none;
}
.tl-strip {
  display: flex;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}
.tl-strip img {
  position: static;
  flex: none;
  width: 72px;
  height: 100%;
  object-fit: cover;
  opacity: 1;
}
.tl-clip.video > video { display: none; }
.overlay-layer {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}
.ov {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  text-align: center;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 2px #000, 0 0 8px #000;
  line-height: 1.25;
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}
.ov.dragging { cursor: grabbing; z-index: 6; }
.ov.selected {
  outline: 1px dashed rgba(255,255,255,.9);
  outline-offset: 6px;
  z-index: 5;
}
.ov.text, .ov.subtitle { white-space: nowrap; }
.ov-label { display: block; pointer-events: none; }
.ov.sticker {
  width: auto;
  max-width: 48%;
  max-height: 48%;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.45));
}
.ov.sticker img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}
.ov-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1px solid #2563eb;
  border-radius: 1px;
  display: none;
  z-index: 2;
}
.ov.selected .ov-handle { display: block; }
.ov-handle.nw { left: -7px; top: -7px; cursor: nwse-resize; }
.ov-handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.ov-handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.ov-handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.ov-handle.rot {
  left: 50%;
  top: -32px;
  margin-left: -6px;
  border-radius: 50%;
  cursor: grab;
}
.block-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  cursor: grab;
  display: block;
  background: #1b1c1f;
  touch-action: none;
}
.block-view:active { cursor: grabbing; }
.director-views {
  position: absolute;
  top: 10px;
  right: 10px;
  left: auto;
  z-index: 5;
  display: flex;
  gap: 6px;
}
.director-views button {
  border: 0;
  border-radius: 4px;
  background: rgba(12, 13, 16, 0.72);
  color: #d7dbe3;
  padding: 6px 10px;
  font-weight: 700;
}
.director-views button.active { background: rgba(59, 130, 246, 0.92); color: #fff; }
.director-strip {
  height: 100%;
  display: grid;
  grid-template-rows: 36px minmax(0, 1fr);
  background: #141518;
  border-top: 1px solid var(--line);
}
.shot-list, .shot-board {
  display: flex;
  gap: 8px;
  overflow: auto;
  min-height: 0;
  padding: 8px;
}
.shot-list {
  flex-direction: column;
  flex: 1;
}
.shot-card {
  flex: none;
  width: 148px;
  border: 1px solid #343842;
  background: #1a1c21;
  border-radius: 4px;
  padding: 0;
  text-align: left;
  overflow: hidden;
}
.shot-list .shot-card { width: 100%; display: grid; grid-template-columns: 64px minmax(0, 1fr); min-height: 56px; }
.shot-card.selected { border-color: #3b82f6; box-shadow: 0 0 0 1px #3b82f6; }
.shot-card img, .shot-card .ph {
  width: 100%;
  height: 84px;
  object-fit: cover;
  background: #0d0e12;
  color: #6b7280;
  display: grid;
  place-items: center;
  font-size: 11px;
}
.shot-list .shot-card img, .shot-list .shot-card .ph { height: 56px; }
.shot-card .meta {
  padding: 6px 8px 8px;
  font-size: 11px;
  color: #d1d5db;
}
.shot-card .meta b { display: block; color: #fff; font-size: 12px; }
.ov-handle.rot::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 12px;
  width: 1px;
  height: 20px;
  background: #fff;
}
.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.color-row .check { margin: 0; }
input[type="color"] {
  width: 36px;
  min-width: 36px;
  height: 28px;
  padding: 2px;
  cursor: pointer;
}
.tl-clip.sticker {
  background: #1e3a8a;
  border-color: #3b82f6;
}
.tl-clip.sticker img {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 100%;
  object-fit: cover;
}
.tl-clip.subtitle { background: #6a4a12; }
.tl-clip .name {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-clip.audio {
  background: repeating-linear-gradient(
    90deg,
    #1d4d3a 0 3px,
    #246048 3px 6px
  );
  border-color: #2d6b4f;
}
.tl-clip.audio.muted { opacity: 0.38; }
.tl-clip.text {
  background: #8a6a14;
  border-color: #c9a227;
  top: 4px;
  bottom: 4px;
}
.tl-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  z-index: 3;
  background: rgba(255, 255, 255, 0.16);
}
.tl-handle.left { left: 0; }
.tl-handle.right { right: 0; }
.tl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  z-index: 6;
  pointer-events: none;
}
.tl-playhead i {
  position: absolute;
  top: 0;
  left: -6px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #f3f4f6;
}
.tl-playhead b {
  position: absolute;
  top: 8px;
  bottom: 0;
  left: -1px;
  width: 2px;
  background: #f3f4f6;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.live-modes {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.live-modes button {
  border: 1px solid #343842;
  background: linear-gradient(180deg, #23262d, #1a1c21);
  border-radius: 10px;
  padding: 9px 6px;
  color: #b8bcc6;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.live-modes button:hover {
  color: #fff;
  border-color: #4a5568;
}
.live-modes button.active {
  color: #fff;
  border-color: #4f7fe0;
  background: linear-gradient(180deg, #2d4166, #22314c);
  box-shadow: inset 0 0 0 1px rgba(79, 127, 224, 0.25);
}
.live-beauty { display: grid; gap: 6px; margin: 4px 0 8px; }
.live-beauty .field span { width: 36px; }
.live-beauty input[type="range"] { width: 100%; }
#fluxPane a { color: var(--blue-2); }
.live-actions {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 10px;
  margin: 12px 0 10px;
}
.live-go, .live-stop {
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}
.live-go {
  background: linear-gradient(180deg, #4aa3ff, #2f6fd6);
}
.live-go:hover { filter: brightness(1.05); }
.live-go:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}
.live-stop {
  background: linear-gradient(180deg, #5a616d, #3d424c);
  color: #e8eaee;
  box-shadow: none;
  border: 1px solid #4a505c;
}
.live-stop:hover {
  background: linear-gradient(180deg, #6a727f, #464c56);
}
.live-pip {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 196px;
  z-index: 4;
  border: 1px solid #343842;
  border-radius: 10px;
  overflow: hidden;
  background: #111318;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.live-pip span {
  display: block;
  padding: 6px 8px 4px;
  font-size: 11px;
  color: #9aa0ab;
}
.live-pip video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #000;
  transform-origin: center;
}
.live-pip.mirror video { transform: scaleX(-1); }
.live-out {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #090a0c;
  z-index: 3;
}

