/* 素材工作流：独立页视图（与主画布切换，互不清空） */

.toolbar-logo-btn {
  display: inline-flex;
  align-items: center;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
}

.toolbar-logo-btn:hover {
  opacity: 0.92;
}

.toolbar-logo-btn:focus-visible {
  outline: 2px solid rgba(63, 208, 200, 0.55);
  outline-offset: 2px;
}

body.wf-open .workspace {
  /* 只藏起来，不要改成 0 尺寸，否则 canvas 缓冲会被 resize 成 1px，切回主画布图就没了 */
  visibility: hidden !important;
  pointer-events: none !important;
}

/* 工作流全屏层会盖住顶栏下拉与弹框：抬高工具栏与全局 modal */
body.wf-open .toolbar {
  position: relative;
  z-index: 120;
}

body.wf-open .toolbar-menu {
  z-index: 130;
}

body.wf-open .auth-modal {
  z-index: 300;
}

body.wf-open .auth-modal .auth-modal-backdrop {
  z-index: 0;
}

body.wf-open .auth-modal .auth-modal-dialog,
body.wf-open .auth-modal .auth-modal-card {
  position: relative;
  z-index: 1;
}

body.wf-open #sceneDock,
body.wf-open #seqDock,
body.wf-open #charDock,
body.wf-open #fxDock {
  display: none !important;
}

body.wf-open .statusbar {
  display: none !important;
}

#workflowWorkspace {
  position: fixed;
  inset: 56px 0 0 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: #12151c;
  color: #d7e0ea;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

#workflowWorkspace[hidden] {
  display: none !important;
}

.wf-footerbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid rgba(80, 220, 220, 0.18);
  background: linear-gradient(0deg, #1a1f2a 0%, #141820 100%);
  flex-shrink: 0;
  order: 2;
}

.wf-footerbar .btn {
  font-size: 12px;
  flex-shrink: 0;
}

#wfStatus {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: #7dcea0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

#wfStatus.is-busy {
  color: #7de0d6;
}

.wf-spent {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f0c56e;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(240, 197, 110, 0.1);
  border: 1px solid rgba(240, 197, 110, 0.22);
  white-space: nowrap;
}

/* 节点执行中：仅该节点自身遮罩，不锁画布 / 其它节点 */

.wf-node-busy-mask {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: rgba(10, 12, 18, 0.72);
  backdrop-filter: blur(1px);
  pointer-events: auto;
  padding: 10px;
  box-sizing: border-box;
}

.wf-busy-panel {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 200, 87, 0.35);
  background: rgba(22, 26, 36, 0.96);
  color: #ffd98a;
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.wf-busy-panel-stack {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: min(100%, 160px);
  padding: 10px 12px;
}

.wf-busy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.wf-busy-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

.wf-busy-pct {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: #ffe2a8;
  opacity: 0.9;
}

.wf-busy-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 200, 87, 0.18);
  overflow: hidden;
}

.wf-busy-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffc857 0%, #ffe29a 100%);
  transition: width 0.35s ease;
}

.wf-busy-progress.is-indeterminate .wf-busy-progress-bar {
  width: 40%;
  transition: none;
  animation: wf-busy-bar-slide 1.1s ease-in-out infinite;
}

@keyframes wf-busy-bar-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(280%);
  }
}

.wf-busy-spinner,
.wf-run-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 217, 138, 0.25);
  border-top-color: #ffc857;
  animation: wf-spin 0.75s linear infinite;
  flex-shrink: 0;
  box-sizing: border-box;
}

.wf-run-spinner {
  width: 12px;
  height: 12px;
  border-color: rgba(158, 240, 232, 0.22);
  border-top-color: #9ef0e8;
}

@keyframes wf-spin {
  to {
    transform: rotate(360deg);
  }
}

.wf-stage {
  position: relative;
  flex: 1;
  order: 1;
  overflow: hidden;
  cursor: grab;
  background-color: #0e1117;
  background-image: radial-gradient(rgba(120, 200, 200, 0.16) 1px, transparent 1px);
  background-size: 18px 18px;
}

.wf-stage:active {
  cursor: grabbing;
}

.wf-world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  width: 1px;
  height: 1px;
  z-index: 2;
}

.wf-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}

.wf-edge {
  fill: none;
  stroke: #3fd0c8;
  stroke-width: 2;
  opacity: 0.85;
  pointer-events: stroke;
  cursor: pointer;
}

.wf-edge-temp {
  stroke-dasharray: 6 4;
  opacity: 0.55;
}

.wf-nodes {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
}

.wf-node {
  position: absolute;
  width: 248px;
  background: #161c26;
  border: 1px solid rgba(70, 210, 205, 0.35);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  color: #d5dee8;
  user-select: none;
  overflow: visible;
}

.wf-node.is-running {
  /* 遮罩裁圆角；非运行时 overflow visible 以免裁端口 */
  overflow: hidden;
  border-color: #ffc857;
}

.wf-node.is-selected {
  border-color: #6dffd6;
  box-shadow: 0 0 0 1px rgba(109, 255, 214, 0.35), 0 10px 32px rgba(0, 0, 0, 0.5);
}

.wf-node.is-done {
  border-color: rgba(90, 220, 150, 0.65);
}

.wf-node.is-error {
  border-color: #ff6b7a;
}

.wf-node.is-stale {
  border-color: rgba(180, 160, 80, 0.7);
  opacity: 0.88;
}

.wf-node-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(80, 200, 200, 0.12);
  cursor: move;
}

.wf-node-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}

.wf-node-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5a6575;
}

.wf-node.is-running .wf-node-status {
  background: #ffc857;
  box-shadow: 0 0 8px #ffc857;
}

.wf-node.is-done .wf-node-status {
  background: #5ad896;
}

.wf-node.is-error .wf-node-status {
  background: #ff6b7a;
}

.wf-node.is-stale .wf-node-status {
  background: #c4a84a;
}

.wf-node-run {
  border: 0;
  background: rgba(63, 208, 200, 0.15);
  color: #9ef0e8;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.wf-node-run:hover:not(:disabled) {
  background: rgba(63, 208, 200, 0.28);
}

.wf-node-run:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.wf-node-run.is-loading {
  opacity: 1;
  background: rgba(255, 200, 87, 0.18);
  color: #ffc857;
  cursor: wait;
}

.wf-node.is-running .wf-node-title::after {
  content: " · 执行中";
  font-weight: 500;
  font-size: 11px;
  color: #ffc857;
}

.wf-node-body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wf-node-ports-in,
.wf-node-ports-out {
  padding: 4px 0;
}

.wf-port-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-size: 11px;
  color: #8fa0b3;
}

.wf-port-row[data-side="out"] {
  justify-content: flex-end;
}

.wf-port {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #12151c;
  border: 2px solid #3fd0c8;
  cursor: crosshair;
  flex-shrink: 0;
}

.wf-port:hover {
  background: #3fd0c8;
}

.wf-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0d12;
  border: 1px solid rgba(80, 200, 200, 0.15);
}

.wf-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.wf-preview-empty {
  height: 100%;
  min-height: 72px;
  display: grid;
  place-items: center;
  color: #6a7788;
  font-size: 12px;
}

.wf-preview-empty[hidden],
.wf-seq-empty[hidden] {
  display: none !important;
}

.wf-branch-src {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  border-radius: 8px;
  border: 1px solid rgba(80, 200, 200, 0.18);
  background: rgba(10, 14, 20, 0.55);
}

.wf-branch-src-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  background: #0a0d12;
  border: 1px solid rgba(80, 200, 200, 0.15);
  flex: 0 0 auto;
}

.wf-branch-src-empty {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #0a0d12;
  color: #6a7788;
  font-size: 10px;
  flex: 0 0 auto;
}

.wf-branch-src-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wf-branch-src-label {
  font-size: 10px;
  color: #7a8899;
}

.wf-branch-src-name {
  font-size: 12px;
  color: #d7e0ea;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-branch-facing {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 44px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(63, 208, 200, 0.35);
  background: rgba(18, 40, 44, 0.75);
  flex: 0 0 auto;
}

.wf-branch-facing-glyph {
  font-size: 16px;
  line-height: 1;
  color: #9ef0e0;
}

.wf-branch-facing-hint {
  font-size: 10px;
  color: #8fa0b5;
  max-width: 4.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 朝向/抽帧支路：更矮更窄，多支路时更紧凑 */
.wf-node.is-branch {
  width: 200px;
  border-radius: 10px;
}

.wf-node.is-branch .wf-node-head {
  padding: 5px 8px;
  gap: 6px;
}

.wf-node.is-branch .wf-node-title {
  font-size: 11px;
  font-weight: 600;
}

.wf-node.is-branch .wf-node-run {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.wf-node.is-branch .wf-node-body {
  padding: 6px 8px;
  gap: 4px;
}

.wf-node.is-branch .wf-branch-src {
  padding: 4px 6px;
  margin-bottom: 4px;
  gap: 6px;
}

.wf-node.is-branch .wf-branch-src-img,
.wf-node.is-branch .wf-branch-src-empty {
  width: 36px;
  height: 36px;
}

.wf-node.is-branch .wf-branch-src-name {
  font-size: 11px;
}

.wf-node.is-branch .wf-branch-facing {
  min-width: 36px;
  padding: 2px 4px;
}

.wf-node.is-branch .wf-branch-facing-glyph {
  font-size: 13px;
}

.wf-node.is-branch .wf-branch-facing-hint {
  font-size: 9px;
}

.wf-node.is-branch .wf-preview {
  aspect-ratio: 16 / 9;
  min-height: 0;
  max-height: 72px;
  border-radius: 6px;
}

.wf-node.is-branch .wf-preview-empty {
  min-height: 48px;
  font-size: 11px;
}

/* 视频抽帧：预览画布加宽 */
.wf-node.is-branch.is-anim {
  width: 300px;
}

.wf-node.is-anim .wf-node-body {
  gap: 4px;
  padding: 4px 6px 6px;
}

.wf-node.is-anim .wf-branch-src {
  margin-bottom: 0;
  padding: 3px 5px;
}

.wf-node.is-anim .wf-branch-src-label {
  display: none;
}

.wf-node.is-anim .wf-branch-src-img,
.wf-node.is-anim .wf-branch-src-empty {
  width: 28px;
  height: 28px;
}

.wf-node.is-anim .wf-anim-cue {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(8, 18, 24, 0.72);
  border: 1px solid rgba(80, 200, 200, 0.16);
  min-width: 0;
}

.wf-node.is-anim .wf-anim-cue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  line-height: 1.2;
  color: #7a93a8;
}

.wf-node.is-anim .wf-anim-cue-action {
  color: #5eead4;
  font-weight: 600;
  flex-shrink: 0;
}

.wf-node.is-anim .wf-anim-cue-text {
  font-size: 11px;
  line-height: 1.35;
  color: #d7e6f0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  white-space: pre-wrap;
}

.wf-node.is-anim .wf-anim-cue-text.is-empty {
  color: #7a93a8;
  font-style: italic;
}

.wf-node.is-anim .wf-branch-facing-hint {
  display: none;
}

.wf-node.is-anim .wf-meta:empty {
  display: none;
}

.wf-seq-player {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wf-seq-stage {
  position: relative;
  width: 200px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 6px;
  overflow: hidden;
  background: #0a0d12;
  border: 1px solid rgba(80, 200, 200, 0.22);
  cursor: pointer;
  flex-shrink: 0;
}

.wf-seq-stage.has-frame {
  /* 固定正方形，避免切帧时高度跳动 */
}

.wf-seq-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #0a0d12;
}

.wf-seq-protect {
  position: absolute;
  inset: auto;
  z-index: 2;
  pointer-events: none;
  touch-action: none;
  display: block;
}

.wf-seq-protect.is-brush {
  pointer-events: auto;
  cursor: crosshair;
}

.wf-seq-protect.is-crop,
.wf-seq-stage.is-crop {
  cursor: crosshair;
}

.wf-seq-stage.is-brush {
  cursor: crosshair;
  border-color: rgba(80, 220, 180, 0.55);
}

.wf-seq-stage.is-crop {
  border-color: rgba(255, 170, 60, 0.65);
}

.wf-seq-ctx-menu .compose-ctx-fill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 12px;
}

.wf-seq-ctx-menu .compose-ctx-fill-color {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}

.wf-seq-ctx-menu .compose-ctx-fill-color input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 36px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.wf-seq-ctx-menu .compose-ctx-fill-btn {
  flex: 1;
  padding: 8px 6px 8px 0 !important;
}

.wf-seq-btn.is-on {
  border-color: rgba(63, 208, 170, 0.75);
  background: rgba(28, 72, 62, 0.95);
  color: #e8fff6;
}

.wf-seq-icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  padding: 0;
}

.wf-seq-brush-icon {
  display: block;
  pointer-events: none;
}

.wf-seq-brush-clear {
  color: #c9d4de;
}

.wf-seq-tool-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.wf-seq-tool-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 4px);
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 96px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(80, 200, 200, 0.28);
  background: #122028;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.wf-seq-tool-menu[hidden] {
  display: none !important;
}

.wf-seq-tool-item {
  appearance: none;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #d7e6f0;
  font-size: 11px;
  line-height: 1.2;
  text-align: left;
  padding: 6px 8px;
  cursor: pointer;
  white-space: nowrap;
}

.wf-seq-tool-item:hover {
  background: rgba(80, 200, 200, 0.16);
  color: #fff;
}

.wf-seq-crop-confirm {
  color: #ffe0a8;
  border-color: rgba(255, 170, 60, 0.45);
  min-width: auto;
  padding: 0 6px;
  font-size: 10px;
  white-space: nowrap;
}

.wf-seq-crop-confirm:hover {
  color: #fff8e8;
  border-color: rgba(255, 180, 70, 0.8);
  background: rgba(120, 70, 10, 0.45);
}

.wf-seq-empty {
  position: absolute;
  inset: 0;
  min-height: 0;
  font-size: 11px;
  z-index: 1;
  pointer-events: none;
}

.wf-seq-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 22px;
}

.wf-seq-badge {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 10px;
  line-height: 1.2;
  color: #c9d4de;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-seq-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  flex: 0 0 auto;
}

.wf-seq-btn {
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid rgba(80, 200, 200, 0.28);
  background: rgba(16, 22, 30, 0.9);
  color: #d7e6e2;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.wf-seq-btn:hover {
  border-color: rgba(63, 208, 200, 0.55);
  color: #fff;
}

.wf-seq-play {
  min-width: 28px;
  font-size: 10px;
}

.wf-seq-del {
  color: #f0b4b8;
  border-color: rgba(220, 100, 110, 0.35);
  min-width: 22px;
  padding: 0;
}

.wf-seq-del:hover {
  color: #fff;
  border-color: rgba(255, 110, 120, 0.65);
  background: rgba(160, 40, 50, 0.45);
}

.wf-anim-actions {
  display: flex;
  align-items: stretch;
  gap: 5px;
}

.wf-anim-actions .wf-nobg-combo,
.wf-anim-actions .wf-anim-gens {
  flex: 1 1 0;
  min-width: 0;
}

.wf-anim-actions .wf-anim-gens {
  padding: 3px 5px;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-nobg-combo {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 5px 2px 3px;
  border-radius: 7px;
  border: 1px solid rgba(120, 140, 160, 0.28);
  background: rgba(12, 16, 22, 0.72);
  min-height: 26px;
  box-sizing: border-box;
}

.wf-key-color-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.wf-key-eyedrop {
  --key-swatch: #00ff00;
  appearance: none;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  margin: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: var(--key-swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  color: #fff;
  line-height: 1;
  cursor: pointer;
}

.wf-key-eyedrop:hover {
  border-color: rgba(255, 255, 255, 0.55);
  filter: brightness(1.06);
}

.wf-key-eyedrop-icon {
  display: block;
  width: 10px;
  height: 10px;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.65));
}

.wf-nobg-main {
  appearance: none;
  border: none;
  background: transparent;
  color: #d5dde6;
  font: inherit;
  font-size: 10px;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-nobg-main:hover {
  color: #fff;
}

.wf-nobg-main:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wf-nobg-restore {
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid rgba(120, 140, 160, 0.35);
  background: rgba(20, 28, 38, 0.85);
  color: #c9d6e2;
  font: inherit;
  font-size: 10px;
  padding: 2px 6px;
  margin: 0 0 0 2px;
  border-radius: 5px;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}

.wf-nobg-restore:hover {
  color: #fff;
  border-color: rgba(63, 208, 200, 0.5);
}

.wf-frame-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 148px;
  overflow: auto;
  padding: 2px 0;
  align-content: flex-start;
}

.wf-frame-thumb {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 5px;
  border: 1px solid rgba(80, 200, 200, 0.22);
  background: #0a0d12;
  overflow: hidden;
}

.wf-frame-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.wf-frame-idx {
  position: absolute;
  right: 2px;
  bottom: 1px;
  font-size: 9px;
  line-height: 1;
  color: #cfe8e4;
  background: rgba(8, 12, 18, 0.72);
  border-radius: 3px;
  padding: 1px 3px;
  pointer-events: none;
}

.wf-node.is-branch .wf-frame-strip {
  max-height: 120px;
  gap: 3px;
}

.wf-node.is-branch .wf-frame-thumb {
  width: 40px;
  height: 40px;
}

.wf-node.is-branch .wf-meta {
  font-size: 10px;
  margin-top: 2px;
}

.wf-node.is-branch .wf-port-row {
  padding: 2px 6px;
}

.wf-node.is-branch .wf-facing-row {
  margin: 2px 0 4px;
  gap: 6px 8px;
}

.wf-node.is-branch .wf-facing-pad {
  grid-template-columns: repeat(3, 24px);
  grid-template-rows: repeat(3, 24px);
  gap: 2px;
}

.wf-node.is-branch .wf-facing-cell {
  font-size: 11px;
  border-radius: 5px;
}

.wf-node.is-branch .wf-facing-label {
  font-size: 10px;
}

.wf-node.is-branch .wf-facing-hint {
  font-size: 10px;
  min-width: 3em;
}

.wf-node.is-compose {
  width: 820px;
}

.wf-node.is-export {
  width: 460px;
}

.wf-split-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  align-items: stretch;
}

.wf-compose-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wf-orig-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wf-orig-label {
  font-size: 11px;
  color: rgba(180, 220, 215, 0.75);
  letter-spacing: 0.02em;
}

.wf-orig-stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--wf-compose-ar, 3 / 4);
  max-height: 380px;
  height: auto;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(80, 200, 200, 0.22);
  background: #0c1018;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}

.wf-orig-stage.is-dragging {
  cursor: crosshair;
}

.wf-orig-stage.is-busy {
  cursor: wait;
}

.wf-orig-img {
  position: absolute;
  display: block;
  max-width: none;
  pointer-events: none;
}

.wf-orig-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  cursor: inherit;
}

.wf-orig-sel-bar {
  position: absolute;
  z-index: 3;
  display: flex;
  gap: 6px;
  align-items: center;
  pointer-events: auto;
}

.wf-orig-redraw-btn,
.wf-orig-clear-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(80, 220, 210, 0.55);
  background: rgba(18, 40, 42, 0.92);
  color: #9ef0e8;
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.wf-orig-clear-btn {
  border-color: rgba(160, 180, 190, 0.45);
  background: rgba(24, 28, 34, 0.92);
  color: rgba(210, 220, 225, 0.92);
}

.wf-orig-redraw-btn:hover:not(:disabled) {
  background: rgba(28, 70, 72, 0.95);
}

.wf-orig-clear-btn:hover:not(:disabled) {
  background: rgba(48, 54, 62, 0.95);
}

.wf-orig-redraw-btn:disabled,
.wf-orig-clear-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.wf-orig-busy,
.wf-orig-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: #9ef0e8;
  background: rgba(10, 12, 18, 0.55);
  z-index: 2;
  pointer-events: none;
}

.wf-orig-empty {
  color: rgba(180, 200, 210, 0.7);
  background: rgba(10, 12, 18, 0.35);
}

.wf-orig-busy[hidden],
.wf-orig-empty[hidden],
.wf-orig-sel-bar[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .wf-node.is-compose {
    width: min(820px, 92vw);
  }
  .wf-node.is-export {
    width: min(460px, 92vw);
  }
  .wf-split-dual {
    grid-template-columns: 1fr;
  }
}

.wf-node.is-export .wf-node-body {
  gap: 8px;
}

.wf-export-preview {
  position: relative;
  width: 100%;
  aspect-ratio: var(--wf-export-ar, 4 / 3);
  max-height: 320px;
  height: auto;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(80, 200, 200, 0.22);
  background: #0a0d12;
}

.wf-export-canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wf-export-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: #8a9aa8;
  background: rgba(10, 12, 18, 0.72);
  z-index: 1;
}

.wf-export-empty[hidden] {
  display: none !important;
}

.wf-export-loading {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 18, 0.55);
  color: #9ef0e8;
  font-size: 12px;
  pointer-events: none;
  z-index: 2;
}

.wf-export-preview.is-loading .wf-export-loading {
  display: flex;
}

.wf-export-meta {
  font-size: 10px;
  line-height: 1.3;
  color: #9aa8b6;
  margin: 0;
}

.wf-node.is-pick {
  width: 320px;
}

.wf-node.is-pick .wf-pick-list {
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 320px;
}

.wf-node.is-pick .wf-check {
  font-size: 11px;
}

.wf-node.is-pick .wf-check img {
  border-radius: 6px;
}

.wf-node.is-setup {
  width: 236px;
}

.wf-node.is-setup .wf-node-body {
  gap: 5px;
  padding: 5px 7px 7px;
}

.wf-node.is-setup .wf-branch-src {
  margin-bottom: 0;
  padding: 3px 5px;
  gap: 6px;
}

.wf-node.is-setup .wf-branch-src-img,
.wf-node.is-setup .wf-branch-src-empty {
  width: 30px;
  height: 30px;
}

.wf-node.is-setup .wf-setup-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.wf-node.is-setup .wf-setup-row .wf-field {
  flex: 1 1 0;
  min-width: 0;
  gap: 2px;
}

.wf-node.is-setup .wf-setup-row .wf-field-fps {
  flex: 0 0 58px;
}

.wf-node.is-setup .wf-field-videobg .wf-videobg-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wf-node.is-setup .wf-videobg-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.wf-node.is-setup .wf-field-videobg select {
  flex: 1 1 auto;
  min-width: 0;
}

.wf-node.is-setup .wf-setup-row .wf-field input,
.wf-node.is-setup .wf-setup-row .wf-field select {
  padding: 3px 5px;
  font-size: 11px;
}

.wf-node.is-setup .wf-facing-row {
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 3px;
  margin: 0;
}

.wf-node.is-setup .wf-facing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.wf-node.is-setup .wf-facing-label {
  font-size: 10px;
}

.wf-node.is-setup .wf-facing-hint {
  font-size: 10px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-node.is-setup .wf-facing-pad {
  grid-template-columns: repeat(3, 22px);
  grid-template-rows: repeat(3, 22px);
  gap: 2px;
}

.wf-node.is-setup .wf-facing-cell {
  font-size: 11px;
  border-radius: 4px;
}

.wf-node.is-setup textarea[data-param="prompt"] {
  width: 100%;
  min-height: 28px;
  max-height: 64px;
  resize: vertical;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid rgba(80, 200, 200, 0.22);
  background: #0e1520;
  color: #e8eef6;
  padding: 4px 6px;
  font-size: 11px;
  line-height: 1.3;
  font-family: inherit;
}

.wf-node.is-setup .wf-meta {
  font-size: 10px;
  margin: 0;
  line-height: 1.25;
}

.wf-field.is-emphasis {
  color: #9ef0e0;
}

.wf-field.is-emphasis textarea {
  border-color: rgba(63, 208, 200, 0.55);
}

.wf-compose-host {
  position: relative;
  width: 100%;
  aspect-ratio: var(--wf-compose-ar, 3 / 4);
  max-height: 380px;
  height: auto;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(80, 200, 200, 0.22);
  background: #12161f;
  touch-action: none;
  flex: 1;
}

.wf-compose-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.wf-compose-canvas:active {
  cursor: grabbing;
}

.wf-compose-loading {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 18, 0.55);
  color: #9ef0e8;
  font-size: 12px;
  pointer-events: none;
}

.wf-compose-host.is-loading .wf-compose-loading {
  display: flex;
}

.wf-compose-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wf-compose-toolbar .wf-btn {
  flex: 1;
  min-width: 0;
}

.wf-asset-pick-card {
  width: min(560px, 94vw);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
}

.wf-asset-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  overflow: auto;
  max-height: 42vh;
  padding: 4px 2px 10px;
}

.wf-asset-pick-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(80, 200, 200, 0.2);
  border-radius: 8px;
  background: #151a24;
  cursor: pointer;
  color: #c5d0dc;
  text-align: left;
}

.wf-asset-pick-item:hover {
  border-color: #6dffd6;
  background: #1a2230;
}

.wf-asset-pick-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #0a0d12;
  border-radius: 4px;
}

.wf-gen-pick-thumbs {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  align-items: stretch;
}

.wf-gen-pick-thumbs img.is-ref {
  width: 42px;
  aspect-ratio: 1;
  border: 1px solid rgba(232, 184, 74, 0.55);
}

.wf-asset-pick-item span {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-gen-pick-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}

.wf-gen-pick-toolbar[hidden] {
  display: none !important;
}

.wf-gen-pick-item-meta {
  font-size: 11px;
  color: #7a8899;
  line-height: 1.3;
}

.wf-asset-pick-empty {
  font-size: 12px;
  color: #8a97a8;
  margin: 8px 0;
}

.wf-thumbs,
.wf-pick-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  max-height: 140px;
  overflow: auto;
}

.wf-node.is-pick .wf-pick-list {
  max-height: 320px;
}

.wf-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #0a0d12;
  border-radius: 4px;
}

.wf-check {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  color: #9aabbc;
}

.wf-check.is-demo-locked {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.wf-check.is-demo-locked input {
  pointer-events: none;
}

.wf-check img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #0a0d12;
  border-radius: 4px;
}

.wf-check-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.wf-facing-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 2px 0 4px;
}

.wf-facing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.wf-facing-label {
  font-size: 11px;
  color: #9aabbc;
  flex: 0 0 auto;
}

.wf-facing-pad {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  grid-template-rows: repeat(3, 28px);
  gap: 3px;
  flex: 0 0 auto;
}

.wf-facing-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border-radius: 6px;
  border: 1px solid rgba(80, 200, 200, 0.22);
  background: #0e1520;
  color: #c5d0de;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  line-height: 1;
}

.wf-facing-cell:hover {
  border-color: rgba(109, 255, 214, 0.45);
  color: #e8eef6;
}

.wf-facing-cell:has(input:checked),
.wf-facing-cell.is-on {
  border-color: #3fd0c8;
  background: #122033;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(63, 208, 200, 0.35);
}

.wf-facing-cell.is-none {
  font-size: 11px;
  color: #8a97a8;
}

.wf-facing-cell.is-none:has(input:checked) {
  color: #9ef0e0;
}

.wf-facing-cell input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.wf-facing-hint {
  font-size: 11px;
  color: #8fa0b5;
  min-width: 3.5em;
}

.wf-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: #9aabbc;
}

.wf-prompt-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}

.wf-prompt-row input[data-param="prompt"] {
  flex: 1;
  min-width: 0;
}

.wf-prompt-ai-btn,
.wf-prompt-view-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(80, 200, 200, 0.28);
  border-radius: 6px;
  background: #122028;
  color: #5eead4;
  font-size: 11px;
  font-weight: 700;
  padding: 0 8px;
  cursor: pointer;
  line-height: 1;
}

.wf-prompt-ai-btn:hover,
.wf-prompt-view-btn:hover {
  background: #1a3540;
  color: #99f6e4;
}

.wf-prompt-ai-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.wf-field input,
.wf-field select {
  background: #0d1118;
  border: 1px solid rgba(80, 200, 200, 0.22);
  color: #d7e0ea;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
}

.wf-field input[type="range"] {
  padding: 0;
  accent-color: var(--accent, #3fd0c8);
}

.wf-node.is-anim-hidden,
.wf-node[hidden] {
  display: none !important;
}

.wf-meta {
  font-size: 11px;
  color: #7f8ea0;
  line-height: 1.35;
}

.wf-cost {
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f0c56e;
  background: rgba(240, 197, 110, 0.12);
  border: 1px solid rgba(240, 197, 110, 0.28);
  line-height: 1.35;
}

.wf-row {
  display: flex;
  gap: 6px;
}

.wf-btn {
  flex: 1;
  border: 1px solid rgba(63, 208, 200, 0.45);
  background: rgba(63, 208, 200, 0.12);
  color: #b7f5ee;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}

.wf-btn:hover {
  background: rgba(63, 208, 200, 0.22);
}

.wf-btn.ghost {
  background: transparent;
  border-color: rgba(140, 160, 180, 0.35);
  color: #a8b6c6;
}

.wf-btn.is-on {
  background: rgba(63, 208, 200, 0.28);
  border-color: #6dffd6;
}

.wf-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wf-file-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px dashed rgba(63, 208, 200, 0.45);
  background: transparent;
  font-size: 12px;
  color: #9ef0e8;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.wf-file-btn:hover {
  background: rgba(63, 208, 200, 0.12);
}

.wf-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.wf-facing-modal .auth-modal-card {
  position: relative;
  z-index: 1;
  background: #1a2030;
  color: #d7e0ea;
  border: 1px solid rgba(63, 208, 200, 0.3);
  border-radius: 14px;
  padding: 22px 22px 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.wf-facing-preview {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #0a0d12;
  border-radius: 8px;
  margin: 8px 0;
}

.wf-save-card {
  width: min(520px, 94vw);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
}

.wf-dialog-card {
  width: min(420px, 92vw);
}

.wf-dialog-card .auth-field {
  margin: 12px 0 4px;
}

.wf-dialog-card .auth-field input {
  width: 100%;
  box-sizing: border-box;
}

.wf-save-list {
  flex: 1;
  overflow: auto;
  margin: 10px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

.wf-save-empty {
  color: #8a97a8;
  font-size: 13px;
  padding: 24px 8px;
  text-align: center;
}

.wf-save-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(80, 200, 200, 0.2);
  background: rgba(10, 14, 20, 0.55);
}

.wf-save-item-main {
  flex: 1;
  min-width: 0;
}

.wf-save-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #d7e0ea;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-save-item-meta {
  margin-top: 4px;
  font-size: 11px;
  color: #8a97a8;
}

.wf-save-tag {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 6px;
  border-radius: 4px;
  border: 1px solid rgba(63, 208, 200, 0.35);
  color: #9ef0e8;
  font-size: 10px;
}

.wf-save-tag.is-demo {
  border-color: rgba(255, 193, 7, 0.55);
  color: #ffc107;
  background: rgba(255, 193, 7, 0.08);
}

.wf-save-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.wf-save-item-actions .wf-btn {
  flex: none;
  padding: 5px 10px;
}

