/* 创意玩法可视化节点编辑器 —— 避免与侧栏/工作区互相叠压 */

#panel-creative-plays {
  position: relative;
  isolation: isolate;
  min-width: 0;
  overflow: auto;
}

#panel-creative-plays .cpe-layout {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  min-width: 0;
  --cpe-sidebar-w: 280px;
}

#panel-creative-plays .cpe-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 0 0 var(--cpe-sidebar-w);
  width: var(--cpe-sidebar-w);
  max-width: 50%;
  min-width: 200px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 14px;
  box-sizing: border-box;
}

#panel-creative-plays .cpe-sidebar-resizer {
  flex: 0 0 6px;
  margin: 0 4px;
  border-radius: 999px;
  background: transparent;
  cursor: col-resize;
  align-self: stretch;
  transition: background 0.15s ease;
}

#panel-creative-plays .cpe-sidebar-resizer:hover,
#panel-creative-plays .cpe-sidebar-resizer:active {
  background: rgba(138, 122, 92, 0.35);
}

#panel-creative-plays .cpe-play-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

#panel-creative-plays .cpe-list-hint {
  margin: 0;
  font-size: 11px;
}

#panel-creative-plays .cpe-play-card {
  position: relative;
  padding-left: 28px;
}

#panel-creative-plays .cpe-play-drag {
  position: absolute;
  left: 8px;
  top: 12px;
  color: var(--muted, #999);
  font-size: 12px;
  letter-spacing: -2px;
  cursor: grab;
  user-select: none;
}

#panel-creative-plays .cpe-play-card.is-dragging {
  opacity: 0.5;
}

#panel-creative-plays .cpe-play-card.is-drop-before {
  box-shadow: inset 0 2px 0 #8a7a5c;
}

#panel-creative-plays .cpe-play-card.is-drop-after {
  box-shadow: inset 0 -2px 0 #8a7a5c;
}

#panel-creative-plays .cpe-play-card.is-active {
  border-color: #8a7a5c;
  background: #f7f4ee;
}

#panel-creative-plays .cpe-play-list .experience-pick-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
}

.cpe-editor-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.cpe-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.cpe-meta-grid .field-full {
  grid-column: 1 / -1;
}

.cpe-workspace {
  display: grid;
  grid-template-rows: auto minmax(480px, 1fr);
  gap: 0;
  min-height: 520px;
  max-width: 100%;
  border: 1px solid var(--line, #d8d6d0);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card, #fff);
  isolation: isolate;
}

.cpe-workspace-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line, #d8d6d0);
  background: #f7f5f0;
}

.cpe-workspace-bar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink, #222);
}

.cpe-workspace-bar-hint {
  flex: 1 1 160px;
  margin: 0;
  font-size: 12px;
}

.cpe-workspace-body {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(240px, 300px);
  gap: 0;
  min-height: 0;
  min-width: 0;
}

/* 全屏编排：占满视口，便于连线 */
body.cpe-workspace-expanded {
  overflow: hidden;
}

body.cpe-workspace-expanded .cpe-workspace {
  position: fixed;
  inset: 0;
  z-index: 1100;
  margin: 0 !important;
  width: 100vw;
  height: 100vh;
  max-width: none;
  min-height: 100vh;
  border-radius: 0;
  border: none;
  box-shadow: none;
  grid-template-rows: auto 1fr;
}

body.cpe-workspace-expanded .cpe-workspace-bar {
  padding: 10px 16px;
  background: #efebe3;
}

body.cpe-workspace-expanded .cpe-workspace-body {
  min-height: 0;
  height: 100%;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr) minmax(280px, 360px);
}

body.cpe-workspace-expanded .cpe-canvas-stage {
  min-height: 0;
  height: 100%;
}

body.cpe-workspace-expanded .cpe-palette,
body.cpe-workspace-expanded .cpe-inspector {
  max-height: none;
  height: 100%;
}

/* 全屏编排时试跑面板浮在工作区之上，避免被挡住看不到逐步输出 */
body.cpe-workspace-expanded .cpe-dry-run-panel {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 1110;
  margin: 0 !important;
  max-height: min(42vh, 420px);
  overflow: auto;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.cpe-palette {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  border-right: 1px solid var(--line, #d8d6d0);
  padding: 10px;
  background: #f3f0e8;
  overflow: auto;
  box-sizing: border-box;
}

.cpe-palette-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink, #222);
}

.cpe-palette-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line, #d8d6d0);
  border-radius: 8px;
  background: #fff;
  cursor: grab;
  text-align: left;
  box-sizing: border-box;
  user-select: none;
}

.cpe-palette-item:active {
  cursor: grabbing;
}

.cpe-palette-item.is-dragging {
  opacity: 0.55;
}

.cpe-palette-hint {
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.4;
}

.cpe-canvas-stage.is-drop-target {
  outline: 2px dashed #8a7a5c;
  outline-offset: -6px;
  background: #ebe7dc;
}

body.cpe-dragging-node #cpe-canvas .cpe-canvas-stage {
  cursor: copy;
}

.cpe-palette-item strong {
  font-size: 13px;
  color: var(--ink, #222);
}

.cpe-palette-item span {
  font-size: 11px;
  color: var(--muted, #777);
  line-height: 1.35;
}

.cpe-more-settings {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line, #d8d6d0);
  border-radius: 8px;
  background: #faf9f6;
}

.cpe-more-settings summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted, #666);
  user-select: none;
}

.cpe-more-settings[open] summary {
  margin-bottom: 8px;
}

.cpe-input-key {
  font-size: 12px;
  opacity: 0.75;
}

.cpe-palette-item:hover {
  border-color: #8a7a5c;
}

.cpe-canvas-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: #f0eee8;
  overflow: hidden;
}

.cpe-canvas-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line, #d8d6d0);
  background: #fff;
  z-index: 2;
}

.cpe-canvas-hint {
  font-size: 12px;
  color: var(--muted, #777);
}

.cpe-canvas-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 420px;
  overflow: hidden;
  cursor: grab;
  z-index: 1;
}

.cpe-canvas-stage:active {
  cursor: grabbing;
}

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

.cpe-edge {
  fill: none;
  stroke: #8a7a5c;
  stroke-width: 2;
  pointer-events: stroke;
  cursor: pointer;
}

.cpe-edge.is-forced {
  stroke: #a89878;
  stroke-dasharray: 2 0;
}

.cpe-edge.is-selected {
  stroke: #c45c26;
  stroke-width: 3;
}

.cpe-edge.is-temp {
  stroke-dasharray: 6 4;
  opacity: 0.7;
  pointer-events: none;
}

.cpe-viewport {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  z-index: 2;
  overflow: visible;
  pointer-events: none;
}

.cpe-node {
  position: absolute;
  width: 220px;
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 1px solid #cfc8bb;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  user-select: none;
  z-index: 3;
  pointer-events: auto;
  box-sizing: border-box;
}

.cpe-node.is-kind-text {
  border-color: #b7c4a8;
}

.cpe-node.is-kind-image {
  border-color: #c4b49a;
}

.cpe-node-io {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted, #666);
}

.cpe-io-needs::before,
.cpe-io-out::before {
  display: none;
}

.cpe-node-io .cpe-io-out {
  color: #5a6b4a;
  font-weight: 600;
}

.cpe-node.is-kind-image .cpe-node-io .cpe-io-out {
  color: #6b5a3e;
}

.cpe-node-delete {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 5;
  width: 22px;
  height: 22px;
  border: 1px solid #cfc8bb;
  border-radius: 50%;
  background: #fff;
  color: #8a4a3a;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.cpe-node-delete:hover {
  background: #f8e9e4;
  border-color: #8a4a3a;
}

.cpe-node.is-selected {
  border-color: #6b5a3e;
  box-shadow: 0 0 0 2px rgba(107, 90, 62, 0.25);
  z-index: 4;
}

.cpe-node.is-locked-input {
  border-style: dashed;
  border-color: #9aab8a;
  background: #f5f8f2;
}

.cpe-node.is-locked-output .cpe-node-title {
  color: #6b5a3e;
}

.cpe-node.is-locked-output.is-kind-text {
  border-style: dashed;
  border-color: #9aab8a;
  background: #f7faf4;
}

.cpe-node.is-locked-output.is-kind-image {
  border-style: dashed;
  background: #faf8f4;
}

/* 锁定输出节点仍保留出线圆点，便于把文字/图像接到 gptimage 等后续步骤 */

.cpe-port.cpe-port-locked {
  pointer-events: none;
  opacity: 0.55;
}

.cpe-node-body {
  flex: 1;
  padding: 10px 8px;
  min-width: 0;
}

.cpe-node-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #222);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cpe-node-type {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted, #777);
}

.cpe-port {
  width: 14px;
  flex: 0 0 14px;
  border: 0;
  padding: 0;
  background: transparent;
  position: relative;
  cursor: crosshair;
}

.cpe-port::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b5a3e;
  transform: translateY(-50%);
}

.cpe-port-in::after {
  left: 2px;
}

.cpe-port-out::after {
  right: 2px;
}

/* 连线中：放大输入口命中区，吸附目标高亮 */
.cpe-canvas-stage.is-linking .cpe-port-in:not(.cpe-port-locked)::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: transparent;
  z-index: 1;
}

.cpe-port.is-snap-target::after {
  width: 14px;
  height: 14px;
  background: var(--accent, #0071e3);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.28);
}

.cpe-node.is-snap-target {
  outline: 2px solid rgba(0, 113, 227, 0.55);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.cpe-edge.is-temp.is-snapped {
  stroke: var(--accent, #0071e3);
  stroke-dasharray: none;
  opacity: 0.95;
}

.cpe-inspector {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  border-left: 1px solid var(--line, #d8d6d0);
  padding: 12px;
  overflow: auto;
  background: #fff;
  box-sizing: border-box;
}

.cpe-inspector .field {
  margin-bottom: 10px;
}

.cpe-input-editor {
  border: 1px solid var(--line, #d8d6d0);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
  overflow: auto;
  max-width: 100%;
  box-sizing: border-box;
}

.cpe-input-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.cpe-input-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.cpe-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(72px, 90px) minmax(72px, 90px) auto minmax(0, 0.9fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.cpe-input-row .cpe-input-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.cpe-advanced details {
  border: 1px solid var(--line, #d8d6d0);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  max-width: 100%;
  box-sizing: border-box;
}

.cpe-advanced summary {
  cursor: pointer;
  font-weight: 600;
}

.cpe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cpe-actions .btn-danger,
#btn-creative-play-delete {
  margin-left: auto;
}

@media (max-width: 1280px) {
  #panel-creative-plays .cpe-layout {
    grid-template-columns: 1fr;
  }

  #panel-creative-plays .cpe-sidebar {
    max-height: none;
  }

  .cpe-workspace {
    min-height: auto;
  }

  .cpe-workspace-body {
    grid-template-columns: 1fr;
  }

  body:not(.cpe-workspace-expanded) .cpe-palette,
  body:not(.cpe-workspace-expanded) .cpe-inspector {
    border: 0;
    max-height: 200px;
  }

  .cpe-canvas-stage {
    min-height: 360px;
  }
}

@media (max-width: 720px) {
  .cpe-meta-grid {
    grid-template-columns: 1fr;
  }

  .cpe-input-row {
    grid-template-columns: 1fr;
  }
}

/* 管理端试跑调试区（默认收起，开始试跑时自动展开） */
.cpe-dry-run-panel {
  border: 1px solid var(--line, #d8d6d0);
  border-radius: 10px;
  background: #faf8f3;
  padding: 10px 14px;
}

.cpe-dry-run-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 0;
}

.cpe-dry-run-head-btn {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 10px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  flex: 1 1 auto;
}

.cpe-dry-run-head-btn:hover strong {
  color: var(--accent, #0071e3);
}

.cpe-dry-run-chevron {
  display: inline-block;
  width: 1em;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

.cpe-dry-run-body {
  margin-top: 10px;
}

.cpe-dry-run-panel.is-collapsed {
  padding-top: 8px;
  padding-bottom: 8px;
}

.cpe-dry-run-panel.is-collapsed .cpe-dry-run-body {
  display: none;
}

.cpe-dry-run-panel.is-collapsed .cpe-dry-run-head-hint {
  display: inline;
  color: var(--accent, #0071e3);
  font-weight: 600;
}

body.cpe-workspace-expanded .cpe-dry-run-panel.is-collapsed {
  max-height: none;
  overflow: visible;
}

.cpe-dry-run-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 14px;
}

.cpe-dry-run-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cpe-dry-run-progress {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow: auto;
}

.cpe-dry-run-step {
  border: 1px solid var(--line, #d8d6d0);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.cpe-dry-run-step.is-done {
  border-color: #b7c9a8;
  background: #f4f8ef;
}

.cpe-dry-run-step-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink, #222);
  margin-bottom: 6px;
}

.cpe-dry-run-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.5;
  max-height: 220px;
  overflow: auto;
  background: #f3f0e8;
  border-radius: 6px;
  padding: 8px 10px;
}

.cpe-dry-run-thumb,
.cpe-dry-run-out-img,
.cpe-dry-run-artifact img {
  display: block;
  margin-top: 8px;
  max-width: min(100%, 320px);
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--line, #d8d6d0);
  background: #fff;
}

.cpe-dry-run-artifact {
  margin: 0;
}

.cpe-dry-run-artifact figcaption {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted, #666);
}

.cpe-test-box {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line, #d8d6d0);
}

.field-hint.is-error {
  color: #b42318;
}

/* 节点内嵌试跑输入 */
.cpe-node.is-embed-text,
.cpe-node.is-embed-image {
  width: 260px;
}

.cpe-node-embed {
  margin-top: 8px;
  user-select: text;
}

.cpe-node-prompt {
  display: block;
  width: 100%;
  min-height: 52px;
  max-height: 320px;
  resize: none;
  box-sizing: border-box;
  border: 1px solid #cfc8bb;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink, #222);
  background: #fffef9;
  overflow: hidden;
}

.cpe-node-prompt:focus {
  outline: none;
  border-color: #6b5a3e;
  box-shadow: 0 0 0 2px rgba(107, 90, 62, 0.15);
}

.cpe-node-dropzone,
.cpe-dry-run-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  border: 1.5px dashed #c4b49a;
  border-radius: 8px;
  background: #faf7f1;
  cursor: pointer;
  padding: 8px;
  box-sizing: border-box;
  text-align: center;
}

.cpe-node-dropzone.is-dragover,
.cpe-dry-run-dropzone.is-dragover {
  border-color: #6b5a3e;
  background: #f3ebe0;
}

.cpe-node-dropzone.has-file,
.cpe-dry-run-dropzone.has-file {
  border-style: solid;
  background: #fff;
}

.cpe-node-drop-hint {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted, #777);
}

.cpe-node-drop-preview,
.cpe-dry-run-dropzone .cpe-dry-run-thumb {
  display: block;
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  border-radius: 6px;
}

/* 试跑输出内嵌到画布节点 */
.cpe-node-run-out {
  display: none;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #e0d8c9;
}
.cpe-node-run-out.has-content {
  display: block;
}
.cpe-node-run-text {
  margin: 0 0 6px;
  padding: 6px 8px;
  width: 100%;
  box-sizing: border-box;
  font-size: 11px;
  line-height: 1.4;
  /* 高度随文字增多而变长，超长后内部滚动 */
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f7f3ea;
  border: 1px solid #e6ddcd;
  border-radius: 6px;
  color: var(--ink, #222);
  user-select: text;
}
.cpe-node-run-img {
  display: block;
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e0d8c9;
  cursor: zoom-in;
}
.cpe-zoomable {
  cursor: zoom-in;
}

/* 节点运行状态角标 */
.cpe-node.is-run-running {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
  animation: cpe-node-pulse 1.6s ease-in-out infinite;
}
@keyframes cpe-node-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.28);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.12);
  }
}
.cpe-node.is-run-running::before {
  content: "● 运行中";
  position: absolute;
  top: -9px;
  left: 10px;
  font-size: 10px;
  line-height: 1;
  color: #fff;
  background: #3b82f6;
  border-radius: 999px;
  padding: 3px 8px;
  z-index: 3;
}
.cpe-node.is-run-done {
  border-color: #22a06b;
  box-shadow: 0 0 0 2px rgba(34, 160, 107, 0.22);
}
.cpe-node.is-run-failed {
  border-color: #dc5b5b;
  box-shadow: 0 0 0 2px rgba(220, 91, 91, 0.28);
}

/* 节点上的进度条 */
.cpe-node-progress {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.cpe-node-progress.is-visible {
  display: flex;
}
.cpe-node-progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #ece5d8;
  overflow: hidden;
}
.cpe-node-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5b8def, #3b82f6);
  transition: width 0.35s ease;
}
.cpe-node-progress.is-done .cpe-node-progress-fill {
  background: linear-gradient(90deg, #34b27b, #22a06b);
}
.cpe-node-progress.is-failed .cpe-node-progress-fill {
  background: #dc5b5b;
}
.cpe-node-progress-text {
  font-size: 10px;
  color: var(--muted, #777);
  min-width: 30px;
  text-align: right;
}

/* 画布右上角「详细进度」按钮 */
.cpe-canvas-debug-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ink, #222);
  background: rgba(255, 253, 247, 0.94);
  border: 1px solid #d8d2c4;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(60, 50, 30, 0.12);
}
.cpe-canvas-debug-btn:hover {
  border-color: #8a7a5c;
}
.cpe-canvas-debug-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c9c2b4;
}
.cpe-canvas-debug-btn.is-live .cpe-canvas-debug-dot {
  background: #3b82f6;
  animation: cpe-debug-dot-blink 1s ease-in-out infinite;
}
@keyframes cpe-debug-dot-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* 调试弹窗里的进度行 */
.cpe-debug-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid #e6ddcd;
  border-radius: 8px;
  background: #faf7f1;
}
.cpe-debug-progress-label {
  flex: 0 1 auto;
  font-size: 12px;
  color: var(--ink, #222);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cpe-debug-progress-track {
  flex: 1;
  height: 6px;
  min-width: 80px;
  border-radius: 999px;
  background: #ece5d8;
  overflow: hidden;
}
.cpe-debug-progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5b8def, #3b82f6);
  transition: width 0.35s ease;
}
.cpe-debug-progress-pct {
  font-size: 11px;
  color: var(--muted, #777);
  min-width: 36px;
  text-align: right;
}

/* 调试弹窗 */
.cpe-debug-modal-card {
  max-width: 860px;
  width: min(860px, calc(100vw - 32px));
}
.cpe-debug-modal-progress {
  max-height: 60vh;
  overflow-y: auto;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cpe-debug-modal-progress .cpe-dry-run-out-img {
  max-height: 180px;
}

/* 调试记录弹窗须盖住全屏编排工作区（1100）与试跑面板（1110） */
#cpe-debug-modal.page-modal {
  z-index: 2300;
}

/* 大图灯箱 */
.cpe-image-lightbox {
  z-index: 2400;
}
.cpe-image-lightbox .page-modal-backdrop {
  background: rgba(15, 12, 8, 0.82);
}
.cpe-image-lightbox-figure {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(92vw, 1200px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.cpe-image-lightbox-figure img {
  max-width: 100%;
  max-height: 84vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}
.cpe-image-lightbox-figure figcaption {
  color: #f3ede2;
}

.cpe-dry-run-style-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.cpe-dry-run-style-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.cpe-dry-run-style-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--line, #d8d6d0);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
}

.cpe-dry-run-style-chip img {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border-radius: 50%;
}

/* 风格封面选择弹窗（全屏编排时也要盖住工作区） */
body.cpe-workspace-expanded #cpe-style-modal {
  z-index: 1200;
}

.cpe-style-modal-card {
  max-width: min(920px, 96vw);
}

.cpe-style-cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin-top: 12px;
  max-height: min(52vh, 480px);
  overflow: auto;
}

.cpe-style-cover {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #f7f5f0;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.cpe-style-cover.is-selected {
  border-color: #6b5a3e;
  box-shadow: 0 0 0 2px rgba(107, 90, 62, 0.2);
}

.cpe-style-cover-media {
  display: block;
  aspect-ratio: 1;
  background: #ebe6dc;
  overflow: hidden;
}

.cpe-style-cover-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cpe-style-cover-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 12px;
  color: var(--muted, #777);
}

.cpe-style-cover-name {
  padding: 0 8px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #222);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
