/* 节点画布 v3 样式 —— 专业级：点阵网格 / 强调条节点 / 端口状态 / 小地图 / 缩放条 */
#workflowWorkspace { position: relative; }

.wf-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #0a0d15;
  color: #e6e9f0;
  overflow: hidden;
}

/* ---------- 顶部工具条 ---------- */
.wf-toolbar {
  display: flex; align-items: center; gap: 9px; row-gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(13, 17, 26, 0.96);
  flex-wrap: wrap;
  flex-shrink: 0;
  position: relative; z-index: 20;
}
.wf-title { font-weight: 700; font-size: 15px; color: #fff; display: flex; align-items: center; gap: 8px; letter-spacing: .3px; }
.wf-title svg { color: var(--accent, #B4532A); }
.wf-spacer { flex: 1; }
.wf-hint { font-size: 12px; color: #7d879b; }

.wf-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: #d6dce8;
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s ease;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
}
.wf-btn:hover { border-color: var(--accent, #B4532A); color: #fff; background: rgba(180, 83, 42, 0.14); }
.wf-btn.primary { background: linear-gradient(180deg, #c4622f, #a8491f); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(180, 83, 42, 0.3); }
.wf-btn.primary:hover { filter: brightness(1.1); }
.wf-btn.on { border-color: var(--accent, #B4532A); color: #fff; background: rgba(180, 83, 42, 0.18); }

.wf-select {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e6e9f0;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  max-width: 200px;
  font-family: inherit;
}
.wf-select:focus { outline: none; border-color: var(--accent, #B4532A); }
.wf-select option { background: #12161e; color: #e6e9f0; }
.wf-divider { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.11); flex-shrink: 0; }

/* ---------- 调色板 ---------- */
.wf-palette {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(13, 17, 26, 0.6);
  flex-wrap: wrap;
  flex-shrink: 0;
  position: relative; z-index: 20;
}
.wf-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 8px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #cfd6e4;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s ease;
  font-weight: 600;
  font-family: inherit;
}
.wf-chip:hover { border-color: var(--accent, #B4532A); color: #fff; transform: translateY(-1px); }
.wf-chip-ico {
  width: 18px; height: 18px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #0a0d15;
  flex-shrink: 0; line-height: 0;
}
.wf-chip-ico svg { display: block; width: 14px; height: 14px; }

/* ---------- 画布 ---------- */
.wf-body { position: relative; flex: 1; overflow: hidden; }
.wf-viewport { position: absolute; inset: 0; overflow: hidden; cursor: grab; background: #0a0d15; }
.wf-viewport.panning { cursor: grabbing; }
.wf-viewport.linking { cursor: crosshair; }
.wf-viewport.dropping { outline: 2px dashed var(--accent, #B4532A); outline-offset: -6px; }

.wf-grid {
  position: absolute; inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 24px 24px;
}
.wf-world { position: absolute; top: 0; left: 0; transform-origin: 0 0; width: 1px; height: 1px; }
.wf-edges { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; width: 10px; height: 10px; }

.wf-edge {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  opacity: .8;
  transition: opacity .15s, stroke-width .15s;
}
.wf-edges g:hover .wf-edge { opacity: 1; stroke-width: 3.4; }
.wf-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  pointer-events: stroke;
  cursor: pointer;
}
.wf-edge-knob {
  fill: rgba(255, 255, 255, 0.14);
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 1.5;
  pointer-events: all;
  cursor: pointer;
  opacity: .5;
  transition: opacity .14s, fill .14s, stroke .14s;
}
.wf-edges g:hover .wf-edge-knob { opacity: 1; fill: rgba(255, 90, 90, 0.85); stroke: #ff9b9b; }
.wf-edge-knob {
  position: absolute;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  cursor: pointer;
  opacity: .5;
  z-index: 6;
  transition: opacity .14s, background .14s, border-color .14s;
}
.wf-edge-knob:hover { opacity: 1; background: rgba(255, 90, 90, 0.85); border-color: #ff9b9b; }
.wf-temp { stroke: #fff !important; stroke-dasharray: 6 5; opacity: .85; animation: wfdash .55s linear infinite; }
@keyframes wfdash { to { stroke-dashoffset: -22px; } }

/* ---------- 节点 ---------- */
.wf-node {
  position: absolute;
  width: 268px;
  background: linear-gradient(180deg, rgba(24, 29, 43, 0.98), rgba(17, 21, 32, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  color: #e6e9f0;
  user-select: none;
  transition: box-shadow .16s, border-color .16s;
}
.wf-node::before {
  content: '';
  position: absolute; left: 12px; right: 12px; top: 0; height: 2px;
  background: var(--node-accent, #B4532A);
  border-radius: 0 0 3px 3px;
  opacity: .92;
}
.wf-node:hover { border-color: rgba(255, 255, 255, 0.18); }
.wf-node.selected { border-color: var(--node-accent, #B4532A); box-shadow: 0 0 0 2px rgba(180, 83, 42, 0.32), 0 16px 40px rgba(0, 0, 0, 0.6); z-index: 12; }
.wf-node.running { animation: wfpulse 1.4s ease-in-out infinite; }
@keyframes wfpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 180, 80, 0.3), 0 12px 32px rgba(0, 0, 0, .5); }
  50% { box-shadow: 0 0 0 8px rgba(255, 180, 80, 0), 0 12px 32px rgba(0, 0, 0, .5); }
}

.wf-node-head {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 12px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: move;
  border-radius: 14px 14px 0 0;
}
.wf-node-head .name { font-weight: 700; color: #fff; flex: 1; font-size: 13.5px; letter-spacing: .3px; }
.wf-node-head .del { cursor: pointer; color: #6f798d; font-size: 12px; line-height: 1; padding: 3px 6px; border-radius: 6px; font-weight: 700; }
.wf-node-head .del:hover { background: rgba(255, 80, 80, 0.16); color: #ff9b9b; }

.wf-node-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 9px; }
.wf-field label { font-size: 10.5px; color: #7d879b; display: block; margin-bottom: 4px; letter-spacing: .3px; }
.wf-field textarea, .wf-field input, .wf-field select {
  width: 100%;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 7px 9px;
  color: #fff;
  font-size: 12px;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color .14s;
}
.wf-field textarea:focus, .wf-field input:focus, .wf-field select:focus { outline: none; border-color: var(--accent, #B4532A); }
.wf-field select option { background: #12161e; color: #e6e9f0; }
.wf-field select optgroup { background: #12161e; color: #9aa5b8; font-style: normal; }

/* 上传区 */
.wf-upload {
  margin: 0 12px 10px;
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 11px 10px;
  display: flex; align-items: center; gap: 9px; justify-content: center;
  cursor: pointer;
  transition: all .15s;
  background: rgba(255, 255, 255, 0.02);
}
.wf-upload:hover { border-color: var(--node-accent, #B4532A); background: rgba(180, 83, 42, 0.09); }
.wf-upload.over { border-color: var(--node-accent, #B4532A); background: rgba(180, 83, 42, 0.18); }
.wf-upload-ico {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #cfd6e4; flex-shrink: 0;
}
.wf-upload-txt { font-size: 11.5px; color: #9aa5b8; }

.wf-node-actions { display: flex; gap: 6px; padding: 0 12px 10px; flex-wrap: wrap; }
.wf-mini-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: #cfd6e4;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  cursor: pointer;
  font-weight: 600;
  transition: all .14s;
  font-family: inherit;
  white-space: nowrap;
}
.wf-mini-btn:hover { border-color: var(--accent, #B4532A); color: #fff; background: rgba(180, 83, 42, 0.16); }

/* ---------- 端口（命中区放大到 30px，好点好连） ---------- */
.wf-node-ports { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0 10px; position: relative; }
.wf-in, .wf-out { display: flex; flex-direction: column; gap: 2px; }
.wf-in { margin-left: -14px; }
.wf-out { margin-right: -14px; align-items: flex-end; }
.wf-port-row { display: flex; align-items: center; gap: 0; height: 30px; }
.wf-out .wf-port-row { flex-direction: row-reverse; }

.wf-port-hit {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: crosshair;
  flex-shrink: 0;
  border-radius: 50%;
}
.wf-port-dot {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #0a0d15;
  border: 2.5px solid var(--pk, #8892a6);
  box-shadow: 0 0 0 2px rgba(10, 13, 21, 0.9);
  transition: all .13s ease;
  pointer-events: none;
}
.wf-port-hit:hover .wf-port-dot { background: var(--pk, #8892a6); transform: scale(1.2); }
.wf-port-hit.cand .wf-port-dot { background: var(--pk, #8892a6); box-shadow: 0 0 0 3px rgba(79, 214, 160, 0.26), 0 0 0 2px rgba(10, 13, 21, .9); }
.wf-port-hit.hover .wf-port-dot { transform: scale(1.55); box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.2), 0 0 0 2px rgba(10, 13, 21, .9); }
.wf-port-hit.dim { opacity: .25; cursor: not-allowed; }
.wf-port-hit.active .wf-port-dot { background: #fff; border-color: #fff; transform: scale(1.3); }
.wf-port-label { font-size: 10.5px; color: #7d879b; white-space: nowrap; padding: 0 4px; }

/* ---------- 结果 / 状态 ---------- */
.wf-node-result { padding: 0 12px 12px; }
.wf-status { font-size: 10.5px; padding: 3px 9px; border-radius: 20px; display: inline-block; margin-bottom: 8px; font-weight: 700; letter-spacing: .3px; }
.wf-status.idle { background: rgba(255, 255, 255, 0.06); color: #8d97ab; }
.wf-status.running { background: rgba(255, 180, 80, 0.16); color: #ffce8a; }
.wf-status.done { background: rgba(80, 214, 160, 0.16); color: #7df0bd; }
.wf-status.failed { background: rgba(255, 90, 90, 0.16); color: #ff9b9b; }
.wf-status.stub { background: rgba(255, 209, 102, 0.14); color: #ffe39a; }
.wf-node-result img, .wf-node-result video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  margin: auto;
  object-fit: contain;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.wf-text-out { font-size: 11.5px; color: #cfd6e4; background: rgba(0, 0, 0, 0.28); border-radius: 8px; padding: 8px; white-space: pre-wrap; word-break: break-word; line-height: 1.55; border: 1px solid rgba(255, 255, 255, 0.05); }

/* 角色节点：人像 + 身份卡（卡片化，告别长条表单） */
.wf-char-portrait {
  margin: 0 12px 9px;
  height: 118px;
  border-radius: 11px;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 209, 102, 0.12), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 209, 102, 0.24);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.wf-char-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wf-char-ph { display: flex; flex-direction: column; align-items: center; gap: 7px; color: rgba(255, 209, 102, 0.5); }
.wf-char-ph svg { width: 42px; height: 42px; }
.wf-char-init { font-size: 24px; font-weight: 800; color: #ffd166; line-height: 1; }

.wf-identity-preview {
  margin: 0 12px 10px;
  border: 1px solid rgba(255, 209, 102, 0.28);
  background: rgba(255, 209, 102, 0.07);
  border-radius: 10px;
  padding: 9px 11px;
  transition: border-color .12s, background .12s;
}
.wf-identity-preview:hover { border-color: rgba(255, 209, 102, 0.55); background: rgba(255, 209, 102, 0.14); }
.wf-ip-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.wf-ip-name { font-size: 14px; font-weight: 800; color: #fff; letter-spacing: .3px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-ip-age { font-size: 10.5px; color: #0a0d15; background: #ffd166; padding: 1px 9px; border-radius: 20px; font-weight: 700; flex-shrink: 0; }
.wf-ip-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.wf-ip-chip { font-size: 10.5px; color: #ecd9a8; background: rgba(255, 209, 102, 0.12); border: 1px solid rgba(255, 209, 102, 0.2); padding: 2px 9px; border-radius: 20px; }
.wf-ip-empty { font-size: 11px; color: #c9b27e; }

/* 身份卡/人像放进 node-body 后，取消左右 margin，与头部对齐 */
.wf-node-body .wf-char-portrait,
.wf-node-body .wf-identity-preview { margin-left: 0; margin-right: 0; }

/* ---------- 右键菜单 ---------- */
.wf-menu {
  position: absolute; z-index: 200;
  min-width: 176px;
  background: rgba(20, 25, 37, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.6);
  padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.wf-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; color: #cfd6e4; cursor: pointer;
  transition: background .12s;
  font-weight: 600; background: none; border: 0; text-align: left; width: 100%;
  font-family: inherit;
}
.wf-menu-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

/* ---------- 空状态 / 快速模板 ---------- */
.wf-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  gap: 12px; color: #7d879b; pointer-events: none;
}
.wf-empty-title { font-size: 16px; font-weight: 700; color: #d6dce8; letter-spacing: .4px; }
.wf-tpl-row { display: flex; gap: 10px; margin-top: 4px; pointer-events: auto; }
.wf-tpl-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: #cfd6e4;
  padding: 9px 16px; border-radius: 10px;
  font-size: 12.5px; cursor: pointer; font-weight: 600;
  transition: all .15s; font-family: inherit;
}
.wf-tpl-btn:hover { border-color: var(--accent, #B4532A); color: #fff; background: rgba(180, 83, 42, 0.16); transform: translateY(-2px); }

/* ---------- 缩放条 / 小地图 ---------- */
.wf-zoombar {
  position: absolute; left: 14px; bottom: 14px;
  display: flex; align-items: center; gap: 2px;
  background: rgba(18, 22, 33, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 3px;
  z-index: 15;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}
.wf-zoom-btn {
  width: 26px; height: 26px;
  background: none; border: 0; border-radius: 7px;
  color: #cfd6e4; cursor: pointer; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.wf-zoom-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.wf-zoom-val { font-size: 11.5px; color: #9aa5b8; min-width: 44px; text-align: center; font-weight: 600; }

.wf-minimap {
  position: absolute; right: 14px; bottom: 14px;
  width: 180px; height: 118px;
  background: rgba(14, 18, 27, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  z-index: 15;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}
.wf-mini-view { position: absolute; inset: 0; }
.wf-mini-view i { position: absolute; border-radius: 2px; opacity: .85; }
.wf-mini-view u {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  text-decoration: none;
}

/* ---------- 品牌化弹窗（替代原生 prompt / confirm，暗色纸墨风，无 emoji） ---------- */
.wf-modal-mask {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(4, 8, 20, 0.62);
  display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  font-family: inherit;
}
.wf-modal {
  width: min(420px, 90vw);
  background: rgba(18, 22, 33, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  padding: 20px;
  color: #e6e9f0;
}
.wf-modal.warn { border-color: rgba(255, 180, 80, 0.5); }
.wf-modal-title { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 10px; letter-spacing: .3px; }
.wf-modal-body { font-size: 13px; color: #c4ccdb; line-height: 1.6; margin-bottom: 16px; white-space: pre-wrap; word-break: break-word; }
.wf-modal-input {
  width: 100%; min-height: 64px; resize: vertical; box-sizing: border-box;
  background: rgba(0, 0, 0, 0.36); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px; padding: 9px 11px; color: #fff; font-size: 13px;
  font-family: inherit; line-height: 1.6; margin-bottom: 16px;
}
.wf-modal-input:focus { outline: none; border-color: var(--accent, #B4532A); }
.wf-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.wf-modal-actions .wf-btn { min-width: 76px; justify-content: center; }

/* 身份卡弹窗网格 */
.wf-id-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-bottom: 18px; }
.wf-id-grid .wf-field:nth-child(1), .wf-id-grid .wf-field:nth-child(2) { grid-column: span 1; }
.wf-id-grid .wf-field { margin: 0; }
.wf-id-grid .wf-field label { font-size: 11px; color: #9aa5b8; margin-bottom: 4px; }
.wf-id-input {
  width: 100%; box-sizing: border-box;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px; padding: 8px 10px; color: #fff; font-size: 13px;
  font-family: inherit; transition: border-color .14s;
}
.wf-id-input:focus { outline: none; border-color: #ffd166; }

/* ---------- 图片节点：对标竞品的高级卡片（大圆角玻璃卡 + 视觉占位 + 尝试动作 + 参数条 + 圆形生成键） ---------- */
.wf-node-image, .wf-node-text, .wf-node-script, .wf-node-character, .wf-node-video {
  width: 460px;
  border-radius: 22px;
  background: linear-gradient(158deg, rgba(38, 46, 68, 0.62), rgba(16, 20, 32, 0.80));
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 24px rgba(255, 255, 255, 0.03);
}
/* 大视觉占位区：所有节点统一的主视觉（图/视频复用 .wf-img-stage） */
.wf-visual {
  position: relative;
  margin: 10px 12px 0;
  height: 138px;
  border-radius: 13px;
  overflow: hidden;
  background:
    radial-gradient(130% 100% at 50% 0%, rgba(255, 255, 255, 0.10), transparent 55%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.24));
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
}
.wf-visual .wf-visual-ico { width: 50px; height: 50px; opacity: .5; color: var(--node-accent, #4fd6a0); filter: drop-shadow(0 5px 12px rgba(0, 0, 0, .45)); }
.wf-visual .wf-visual-cap { position: absolute; left: 10px; right: 10px; bottom: 9px; text-align: center; font-size: 11px; line-height: 1.45; letter-spacing: .2px; color: rgba(255, 255, 255, .5); }
.wf-visual .wf-visual-cap b { color: rgba(255, 255, 255, .85); font-weight: 600; }
.wf-node-image::before, .wf-node-text::before, .wf-node-script::before, .wf-node-character::before, .wf-node-video::before {
  height: 3px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--node-accent, #4fd6a0), rgba(255, 255, 255, 0.2));
}
.wf-nimg-head { display: flex; align-items: center; gap: 11px; padding: 16px 18px 13px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); cursor: move; }
.wf-type-ico {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--node-accent, #4fd6a0); color: #0a0d15;
  box-shadow: 0 4px 12px rgba(79, 214, 160, 0.28);
}
.wf-type-ico svg { width: 17px; height: 17px; }
.wf-type-label { font-weight: 700; color: #fff; font-size: 15px; letter-spacing: .3px; flex: 1; display: flex; align-items: center; gap: 9px; }
.wf-type-label i { font-style: normal; font-size: 9px; font-weight: 800; letter-spacing: .8px; color: rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); padding: 1px 6px; border-radius: 5px; }
.wf-nimg-head .del { cursor: pointer; color: #6f798d; font-size: 12px; line-height: 1; padding: 3px 6px; border-radius: 6px; font-weight: 700; }
.wf-nimg-head .del:hover { background: rgba(255, 80, 80, 0.16); color: #ff9b9b; }

.wf-img-prompt { padding: 0 0 8px; }
.wf-img-prompt textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: rgba(0, 0, 0, 0.34); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px; padding: 14px 16px; color: #fff; font-size: 15px;
  font-family: inherit; line-height: 1.65; min-height: 130px;
}
.wf-img-prompt textarea:focus { outline: none; border-color: var(--node-accent, #4fd6a0); }

.wf-img-stage {
  margin: 14px 18px 0; height: 300px; border-radius: 16px; position: relative; overflow: hidden;
  background: radial-gradient(120% 120% at 50% 0%, rgba(79, 214, 160, 0.10), rgba(255,255,255,0.02)), rgba(6, 9, 15, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.10);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.wf-img-stage:hover { border-color: rgba(255, 255, 255, 0.22); }
.wf-img-stage.over { border-color: var(--node-accent, #4fd6a0); background: rgba(79, 214, 160, 0.14); }
.wf-stage-inner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.wf-img-result { width: 100%; height: 100%; object-fit: cover; display: block; }
.wf-img-ph { display: flex; flex-direction: column; align-items: center; gap: 12px; color: rgba(255, 255, 255, 0.4); font-size: 13px; }
.wf-img-ph svg { width: 54px; height: 54px; opacity: .8; }
.wf-spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,0.2); border-top-color: var(--node-accent, #4fd6a0); animation: wfspin .8s linear infinite; }
@keyframes wfspin { to { transform: rotate(360deg); } }
.wf-img-ph.wf-failed { color: #ff9b9b; }
.wf-stage-badge {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  font-size: 12px; padding: 4px 12px; border-radius: 20px; font-weight: 700;
  background: rgba(20, 25, 37, 0.85); border: 1px solid rgba(255, 255, 255, 0.14); color: #cfd6e4;
}
.wf-stage-badge.running { color: #ffce8a; border-color: rgba(255, 180, 80, 0.4); }
.wf-stage-badge.done { color: #7df0bd; border-color: rgba(80, 214, 160, 0.4); }
.wf-stage-badge.failed { color: #ff9b9b; border-color: rgba(255, 90, 90, 0.4); }

.wf-try { display: flex; align-items: center; gap: 8px; padding: 2px 14px 10px; flex-wrap: wrap; }
.wf-try-title { font-size: 11.5px; color: #8d97ab; font-weight: 600; flex-shrink: 0; }
.wf-try-list { display: flex; gap: 6px; flex-wrap: wrap; }
.wf-try-item {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cfd6e4; padding: 5px 10px; border-radius: 20px; font-size: 11.5px;
  cursor: pointer; font-weight: 600; transition: all .14s; font-family: inherit;
}
.wf-try-item:hover { border-color: var(--node-accent, #4fd6a0); color: #fff; background: rgba(79, 214, 160, 0.14); }
.wf-try-ico { display: inline-flex; }
.wf-try-ico svg { width: 13px; height: 13px; }

.wf-parambar { display: flex; align-items: center; gap: 7px; padding: 0 14px 13px; }
.wf-pb-sel {
  flex: 1 1 auto; min-width: 0; width: 100%; box-sizing: border-box;
  background: rgba(0, 0, 0, 0.34); border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e6e9f0; padding: 10px 11px; border-radius: 11px; font-size: 13px;
  font-weight: 600; cursor: pointer; font-family: inherit;
}
.wf-pb-sel:focus { outline: none; border-color: var(--node-accent, #4fd6a0); }
.wf-pb-sel:first-child { flex: 1.4; }
.wf-pb-sel option { background: #12161e; color: #e6e9f0; }
.wf-gen-btn {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%; border: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: linear-gradient(180deg, #4fd6a0, #2bbf86); color: #06120d;
  box-shadow: 0 6px 18px rgba(79, 214, 160, 0.45); transition: filter .14s, transform .14s;
}
.wf-gen-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.wf-gen-btn svg { width: 22px; height: 22px; }

/* 提示词头部 + AI 帮写（直接调用会话模型起草/扩写内容） */
.wf-prompt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.wf-prompt-head > span { font-size: 11px; color: #8d97ab; font-weight: 600; }
.wf-assist-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(79, 214, 160, 0.12); border: 1px solid rgba(79, 214, 160, 0.3);
  color: #9af0c8; padding: 3px 9px; border-radius: 18px; font-size: 11px; cursor: pointer;
  font-weight: 600; font-family: inherit; transition: all .14s; flex-shrink: 0;
}
.wf-assist-btn:hover { background: rgba(79, 214, 160, 0.2); color: #cffae6; }
.wf-assist-btn:disabled, .wf-assist-btn.loading { opacity: .6; cursor: default; }
.wf-assist-ico { display: inline-flex; } .wf-assist-ico svg { width: 12px; height: 12px; }
/* 角色卡片内人像/身份卡与高级头部对齐（14px 而非 12px） */
.wf-node-character .wf-char-portrait, .wf-node-character .wf-identity-preview { margin-left: 14px; margin-right: 14px; }

/* ---------- 角色节点：对齐新版式（大图卡 + 下方独立参数卡） ---------- */
/* 立绘铺满整个 stage，取消旧版 118px 小人像的尺寸与 margin */
.wf-char-stage .wf-char-portrait {
  position: absolute; inset: 0; margin: 0; height: 100%;
  border-radius: 0; border: 0; background: transparent;
}
/* 身份卡浮层约占 stage 底部 ~92px：仅把「无图占位」上移让位，
   立绘图仍铺满整个 stage（不能动 .wf-stage-inner，否则图会被压矮） */
.wf-char-stage .wf-char-ph { transform: translateY(-46px); }
.wf-char-stage .wf-char-ph svg { width: 54px; height: 54px; }
.wf-char-stage .wf-char-init { font-size: 34px; }
/* 身份卡浮层：覆盖在 stage 底部，鼠标移上去才完全显形，避免遮挡立绘 */
.wf-char-idlayer {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 3;
  margin: 0 !important; padding: 9px 12px;
  background: linear-gradient(180deg, rgba(12, 16, 26, 0.62), rgba(12, 16, 26, 0.88));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 209, 102, 0.30); border-radius: 12px;
  transition: border-color .14s, background .14s;
}
.wf-char-idlayer:hover { border-color: rgba(255, 209, 102, 0.62); background: rgba(255, 209, 102, 0.16); }
.wf-char-idlayer .wf-ip-top { margin-bottom: 0; }
.wf-char-idlayer .wf-ip-chips, .wf-char-idlayer .wf-ip-empty { margin-top: 6px; }
.wf-char-idlayer .wf-ip-empty { color: rgba(255, 224, 160, 0.72); }
.wf-btn.stop { border-color: rgba(255, 120, 120, 0.5); color: #ff9b9b; }
.wf-btn.stop:hover { background: rgba(255, 90, 90, 0.16); color: #fff; border-color: #ff8a8a; }

/* ---------- 空状态引导 ---------- */
.wf-empty-tips { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: #8d97ab; margin-top: 4px; pointer-events: none; }
.wf-empty-tips div { line-height: 1.5; }
.wf-empty-cta { margin-top: 6px; pointer-events: auto; }

/* ---------- LibLib 风格重构：大容器主体 + 底部操作栏 + 点击展开的输入面板 ---------- */
/* 大预览容器即入口：点击展开 / 收起下方面板 */
.wf-img-stage .wf-img-ph span { max-width: 320px; text-align: center; line-height: 1.55; }
.wf-stage-upload {
  position: absolute; top: 12px; right: 12px; z-index: 4;
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(13, 17, 26, 0.82); color: #cfd6e4; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .14s, border-color .14s, color .14s;
}
.wf-stage-upload:hover { background: rgba(79, 214, 160, 0.18); border-color: var(--node-accent, #4fd6a0); color: #fff; }

/* 分体式输入面板：点击节点后在其下方弹出的独立参数卡片 */
.wf-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 100%;
  z-index: 10;
  background: linear-gradient(180deg, rgba(32, 39, 58, 0.98), rgba(20, 25, 38, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
  pointer-events: none;
}
.wf-panel.open { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
.wf-panel-inner { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.wf-panel-footer { display: flex; justify-content: flex-end; padding-top: 4px; }
.wf-panel-footer .wf-gen-btn { width: 52px; height: 52px; }

.wf-panel-params { display: flex; gap: 9px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.wf-panel-params .wf-pb-sel { flex: 1 1 84px; }
.wf-panel-params .wf-pb-sel:first-child { flex: 1.6; }

/* 底部操作栏：左侧动作图标，右侧生成圆钮 */
.wf-footbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 16px; }
.wf-foot-left { display: flex; gap: 8px; flex-wrap: wrap; }
.wf-foot-act {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05); color: #cfd6e4; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .14s; font-family: inherit;
}
.wf-foot-act svg { width: 17px; height: 17px; }
.wf-foot-act:hover { border-color: var(--node-accent, #4fd6a0); color: #fff; background: rgba(79, 214, 160, 0.14); }
.wf-foot-right { display: flex; align-items: center; gap: 10px; }
.wf-foot-sel { width: auto; flex: 0 0 auto; padding: 8px 12px; }
.wf-gen-btn { width: 50px; height: 50px; }

/* 文本节点：textarea 即主体，无占位区 */
.wf-text-main { padding: 14px 18px 4px; }
.wf-text-main textarea { min-height: 240px; font-size: 14px; line-height: 1.6; }
.wf-node-text .wf-node-result, .wf-node-script .wf-node-result { display: none; }
