.product-clone-page[data-tool="clone"] .product-clone-preview--video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-content: initial;
  justify-items: initial;
  gap: 0;
  overflow: auto;
  background: #0e1014;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.product-clone-page[data-tool="clone"] .product-clone-preview--video::-webkit-scrollbar {
  display: none;
}

.ecom-video-workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #0e1014;
  color: #e5ebf4;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ecom-video-workspace::-webkit-scrollbar {
  display: none;
}

.ecom-video-flowbar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: auto minmax(96px, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  border-bottom: 1px solid #242a33;
  background: #11151b;
  padding: 10px 16px;
}

.ecom-video-flowbar__title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ecom-video-flowbar__pulse {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #48505c;
}

.ecom-video-flowbar__pulse.is-active {
  background: #00ff88;
}

.ecom-video-flowbar__wave {
  display: inline-flex;
  align-items: end;
  gap: 3px;
  width: 24px;
  height: 18px;
}

.ecom-video-flowbar__wave i {
  display: block;
  width: 4px;
  height: 8px;
  border-radius: 999px;
  background: #5b6675;
  animation: ecom-video-wave 1.1s ease-in-out infinite;
}

.ecom-video-flowbar__wave i:nth-child(2) {
  height: 15px;
  animation-delay: 120ms;
}

.ecom-video-flowbar__wave i:nth-child(3) {
  height: 11px;
  animation-delay: 240ms;
}

.ecom-video-step-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.ecom-video-step-dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #343b46;
}

.ecom-video-step-dot.is-done {
  background: #00ff88;
}

.ecom-video-step-dot.is-active {
  background: #53e5ff;
  animation: ecom-video-node-breathe 1.2s ease-in-out infinite;
}

.ecom-video-flowbar__actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Flowbar zoom controls ─────────────────────────── */
.ecom-video-flowbar__zoom {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.ecom-video-flowbar__zoom button {
  width: 26px;
  height: 26px;
  border: 1px solid #2c3038;
  border-radius: 6px;
  background: #1a1d24;
  color: #8890a0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 150ms ease, color 150ms ease;
}
.ecom-video-flowbar__zoom button:hover:not(:disabled) {
  border-color: #00ff88;
  color: #00ff88;
}
.ecom-video-flowbar__zoom button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.ecom-video-flowbar__zoom span {
  min-width: 38px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #6a7282;
}

.ecom-video-flowbar__error {
  max-width: min(260px, 28vw);
  overflow: hidden;
  color: #ff9f9f;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ecom-video-flowbar__stage-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #53e5ff;
  font-size: 12px;
  font-weight: 800;
  animation: ecom-video-node-breathe 1.6s ease-in-out infinite;
}

.ecom-video-flow-action {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #1c4d3a;
  border-radius: 8px;
  background: #00ff88;
  color: #06110e;
  padding: 0;
  font-size: 17px;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease;
}

.ecom-video-flow-action:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ecom-video-flow-action--ghost {
  background: #0e2b26;
  color: #baf6ff;
  border-color: #1a4d40;
}

.ecom-video-flow-action--danger {
  border-color: #4d1a1a;
  background: #2b1212;
  color: #ffb1b1;
}

.ecom-video-flow-action:disabled {
  border-color: #303743;
  background: #20252d;
  color: #697486;
  cursor: not-allowed;
}

.ecom-video-flow-canvas {
  position: relative;
  min-height: 0;
  overflow: auto;
  background: #101318;
  padding: 32px 40px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ecom-video-flow-canvas::-webkit-scrollbar {
  display: none;
}

.ecom-video-flow-map {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 3vw, 48px);
  min-width: 0;
  min-height: 100%;
}

.ecom-video-flow-lines {
  position: absolute;
  inset: 50% 0 auto;
  z-index: 0;
  width: 100%;
  height: min(72%, 420px);
  overflow: visible;
  pointer-events: none;
  transform: translateY(-50%);
}

.ecom-video-flow-lines path {
  fill: none;
  stroke: #485365;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 12 14;
}

.ecom-video-flow-lines path.is-active {
  stroke: #00ff88;
  animation: ecom-video-path-dash 1.8s linear infinite;
}

.ecom-video-flow-map > :not(.ecom-video-flow-lines) {
  position: relative;
  z-index: 1;
}

.ecom-video-scene-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vw, 24px);
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  padding: 28px 4px;
  scrollbar-width: thin;
  scrollbar-color: #414958 #101318;
}

.ecom-video-flow-node {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid #333a45;
  border-radius: 8px;
  background: #172027;
  animation: ecom-video-node-in 360ms ease both;
}

.ecom-video-flow-node.is-ready,
.ecom-video-flow-node.is-completed {
  border-color: #1c4d3a;
  background: #162820;
}

.ecom-video-flow-node.is-running,
.ecom-video-flow-node.is-pending {
  border-color: #1a4d4d;
  animation: ecom-video-node-breathe 1.6s ease-in-out infinite;
}

.ecom-video-flow-node.is-failed {
  border-color: #4d1a1a;
  background: #2a1b1d;
}

.ecom-video-flow-node--source,
.ecom-video-flow-node--final {
  width: min(100%, 142px);
  aspect-ratio: 9 / 13;
}

.ecom-video-flow-node--final {
  border-color: #3d3020;
}

.ecom-video-flow-node--final.is-completed {
  border-color: #4d3a1a;
  background: #2a2116;
}

.ecom-video-flow-node--scene {
  width: clamp(76px, 7vw, 104px);
  aspect-ratio: 9 / 16;
}

.ecom-video-flow-node__media,
.ecom-video-flow-node__media img,
.ecom-video-flow-node__media video {
  display: block;
  width: 100%;
  height: 100%;
}

.ecom-video-flow-node__media img,
.ecom-video-flow-node__media video {
  object-fit: cover;
}

.ecom-video-flow-node__placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: #18231f;
  color: #7eeecf;
  font-size: 30px;
}

.ecom-video-flow-node__status-orb {
  position: absolute;
  left: 9px;
  top: 9px;
  z-index: 4;
  width: 12px;
  height: 12px;
  border: 2px solid #0c1016;
  border-radius: 999px;
  background: #687386;
}

.ecom-video-flow-node.is-ready .ecom-video-flow-node__status-orb,
.ecom-video-flow-node.is-completed .ecom-video-flow-node__status-orb {
  background: #00ff88;
}

.ecom-video-flow-node.is-running .ecom-video-flow-node__status-orb,
.ecom-video-flow-node.is-pending .ecom-video-flow-node__status-orb {
  background: #53e5ff;
}

.ecom-video-flow-node.is-failed .ecom-video-flow-node__status-orb {
  background: #ff5e5e;
}

.ecom-video-flow-node--final.is-completed .ecom-video-flow-node__status-orb {
  background: #ffb84d;
}

.ecom-video-flow-node__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 4px;
  overflow: hidden;
  background: #242830;
}

.ecom-video-flow-node__progress i {
  display: block;
  height: 100%;
  background: #53e5ff;
  transition: width 240ms ease;
}

.ecom-video-flow-node__retry {
  position: absolute;
  right: 9px;
  top: 9px;
  z-index: 5;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #4d1a1a;
  border-radius: 999px;
  background: #241417;
  color: #ffb1b1;
  cursor: pointer;
}

.ecom-video-flow-connector,
.ecom-video-scene-link {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: #303843;
}

.ecom-video-flow-connector {
  flex: 0 0 clamp(30px, 3vw, 56px);
}

.ecom-video-scene-link {
  flex: 0 0 clamp(26px, 3vw, 44px);
}

.ecom-video-flow-connector i,
.ecom-video-scene-link i {
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: #00ff88;
}

.ecom-video-flow-connector.is-active i,
.ecom-video-scene-link.is-active i {
  animation: ecom-video-flow-line 1.55s linear infinite;
}

.ecom-video-flow-dock {
  position: sticky;
  z-index: 4;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding-top: 20px;
}

.ecom-video-flow-dock button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #00cc6a;
  border-radius: 9px;
  background: #00ff88;
  color: #06130d;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 150ms ease,
    filter 150ms ease,
    box-shadow 150ms ease;
}

.ecom-video-flow-dock button:hover {
  filter: brightness(1.08);
  box-shadow: 0 2px 12px rgba(0, 255, 136, 0.25);
  transform: translateY(-2px);
}

.ecom-video-flow-notice {
  position: absolute;
  right: 22px;
  bottom: 18px;
  z-index: 5;
  border: 1px solid #1c3d2a;
  border-radius: 999px;
  background: #08110f;
  color: #a8ffe3;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 900;
}

@keyframes ecom-video-flow-line {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@keyframes ecom-video-path-dash {
  to { stroke-dashoffset: -52; }
}

@keyframes ecom-video-node-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ecom-video-node-breathe {
  0%, 100% { border-color: #1a4d4d; }
  50% { border-color: #53e5ff; }
}

@keyframes ecom-video-pulse {
  from {
    opacity: 0.8;
    transform: scale(0.7);
  }
  to {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes ecom-video-wave {
  0%, 100% {
    opacity: 0.45;
    transform: scaleY(0.72);
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

/* ── Empty state ─────────────────────────────── */
.ecom-video-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #697486;
  font-size: 13px;
}

/* ── Flow map vertical stacking ────────────────── */
.ecom-video-flow-map {
  flex-wrap: wrap;
  justify-content: center;
  padding: 20px 0 40px;
}

/* ── Text nodes (plan steps) ──────────────────── */
.ecom-video-flow-node--text {
  display: grid;
  place-items: center;
  gap: 6px;
  width: clamp(64px, 7vw, 90px);
  min-height: 74px;
  padding: 12px 8px;
  border-color: #2a3d30;
  background: #131d1a;
  text-align: center;
}

.ecom-video-flow-node--text.is-completed {
  border-color: #1c4d3a;
  background: #162820;
}

.ecom-video-flow-node--text.is-pulsing {
  border-color: #53e5ff;
  animation: ecom-video-node-breathe 1.2s ease-in-out infinite;
}

.ecom-video-flow-node__text-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #1c4d3a;
  color: #00ff88;
  font-size: 12px;
  font-weight: 900;
}

.ecom-video-flow-node--text.is-pulsing .ecom-video-flow-node__text-icon {
  background: #1a4d4d;
  color: #53e5ff;
}

/* ── Node labels ──────────────────────────────── */
.ecom-video-flow-node__label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #9fadb8;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ecom-video-flow-node--source .ecom-video-flow-node__label,
.ecom-video-flow-node--text .ecom-video-flow-node__label {
  margin-top: 2px;
}

/* ── Image nodes (storyboard images) ───────────── */
.ecom-video-flow-node--image {
  width: clamp(88px, 9vw, 128px);
  aspect-ratio: 9 / 13;
}

.ecom-video-flow-node--image .ecom-video-flow-node__media {
  position: relative;
  width: 100%;
  height: 100%;
}

.ecom-video-flow-node--image .ecom-video-flow-node__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  text-align: center;
}

.ecom-video-flow-node--image .ecom-video-flow-node__progress {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  height: auto;
  background: none;
  color: #53e5ff;
  font-size: 15px;
  font-weight: 1000;
}

.ecom-video-flow-node--image .ecom-video-flow-node__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #18231f;
  color: #7eeecf;
  font-size: 24px;
}

/* ── Video nodes ──────────────────────────────── */
.ecom-video-flow-node--video {
  width: clamp(88px, 9vw, 128px);
  aspect-ratio: 9 / 16;
}

.ecom-video-flow-node--video .ecom-video-flow-node__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  text-align: center;
}

.ecom-video-flow-node--video .ecom-video-flow-node__progress {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  height: auto;
  background: none;
  color: #53e5ff;
  font-size: 15px;
  font-weight: 1000;
}

.ecom-video-flow-node--video .ecom-video-flow-node__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #18231f;
  color: #7eeecf;
  font-size: 24px;
}

.ecom-video-flow-node--video .ecom-video-flow-node__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Error label ──────────────────────────────── */
.ecom-video-flow-node__error {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 24px;
  overflow: hidden;
  color: #ff9f9f;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Scene strip overflow ─────────────────────── */
.ecom-video-scene-strip--text {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #414958 transparent;
}

.ecom-video-scene-strip--text::-webkit-scrollbar {
  height: 3px;
}

.ecom-video-scene-strip--text::-webkit-scrollbar-thumb {
  background: #414958;
  border-radius: 999px;
}

@media (max-width: 900px) {
  .ecom-video-flowbar {
    grid-template-columns: auto 1fr;
    gap: 12px;
  }

  .ecom-video-step-dots {
    justify-content: flex-start;
    order: 3;
    grid-column: 1 / -1;
  }

  .ecom-video-flowbar__actions {
    justify-content: flex-end;
  }

  .ecom-video-flow-canvas {
    padding: 20px;
  }

  .ecom-video-flow-node--scene {
    width: 118px;
  }

  .ecom-video-tree {
    flex-direction: column;
    align-items: center;
  }

  .ecom-video-tree__trunk {
    display: none;
  }

  .ecom-video-tree__row {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ═══════════════════════════════════════════════════
   Tree Layout — 分支树状流程图 (参考图风格)
   原图 → 分支连接线 → [分镜文本 → 分镜图 → 分镜视频] × N
   ═══════════════════════════════════════════════════ */

.ecom-video-tree {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  min-height: 100%;
}

/* ── Source node ── */
.ecom-video-tree__source {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
}

.ecom-video-tree-node {
  position: relative;
  overflow: hidden;
  border: 1.5px solid #2c3038;
  border-radius: 10px;
  background: #171c22;
  transition: border-color 280ms ease, box-shadow 280ms ease, transform 280ms ease;
  animation: ecom-tree-node-in 420ms var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1)) both;
}

.ecom-video-tree-node--source {
  width: 180px;
  height: 230px;
  flex-shrink: 0;
  border-color: #1c4d3a;
  background: #162820;
}

.ecom-video-tree-node--source img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ecom-video-tree-node__label {
  color: #a0b0aa;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

/* ── Text node (分镜文本) ── */
.ecom-video-tree-node--text {
  min-width: 140px;
  max-width: 170px;
  padding: 16px 14px;
  cursor: default;
  border-color: #2a3d30;
  background: #131d1a;
}

.ecom-video-tree-node--text.is-completed {
  border-color: #1c4d3a;
  background: #162820;
}

.ecom-video-tree-node--text.is-active {
  border-color: #1a4d4d;
  animation: ecom-tree-breathe 1.8s ease-in-out infinite;
}

.ecom-video-tree-node__inner {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ecom-video-tree-node__title {
  color: #e2eaf4;
  font-size: 13px;
  font-weight: 800;
}

.ecom-video-tree-node__desc {
  color: #6b7a8a;
  font-size: 11px;
  line-height: 1.4;
}

/* ── Image node (分镜图) ── */
.ecom-video-tree-node--image,
.ecom-video-tree-node--video {
  width: 170px;
  height: 136px;
  flex-shrink: 0;
}

.ecom-video-tree-node--image img,
.ecom-video-tree-node--image video,
.ecom-video-tree-node--video img,
.ecom-video-tree-node--video video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ecom-video-tree-node--image.is-completed,
.ecom-video-tree-node--video.is-completed {
  border-color: #1c4d3a;
  background: #162820;
}

.ecom-video-tree-node--image.is-active,
.ecom-video-tree-node--video.is-active {
  border-color: #1a4d4d;
  animation: ecom-tree-breathe 1.8s ease-in-out infinite;
}

.ecom-video-tree-node--video.is-failed {
  border-color: #4d1a1a;
  background: #2a1b1d;
}

.ecom-video-tree-node__placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: linear-gradient(135deg, #171c22 0%, #12161b 100%);
  color: #5a6a78;
  font-size: 24px;
}

.ecom-video-tree-node__placeholder span {
  font-size: 12px;
  font-weight: 600;
}

.ecom-video-tree-node__tag {
  position: absolute;
  left: 8px;
  top: 8px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  border: 1px solid #303540;
  border-radius: 999px;
  background: rgba(18, 20, 26, 0.9);
  backdrop-filter: blur(6px);
  color: #c8d4e0;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ecom-video-tree-node__progress {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #53e5ff;
  font-size: 14px;
  font-weight: 900;
}

.ecom-video-tree-node__retry {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 5;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #4d1a1a;
  border-radius: 999px;
  background: #241417;
  color: #ffb1b1;
  font-size: 12px;
  cursor: pointer;
}

/* ── Trunk connector (分支连接线) ── */
.ecom-video-tree__trunk {
  position: relative;
  width: 56px;
  flex-shrink: 0;
  align-self: stretch;
}

.ecom-video-tree__trunk-line {
  position: absolute;
  left: 0;
  top: 50%;
  width: 28px;
  height: 2px;
  background: #3a4550;
  transform: translateY(-50%);
}

.ecom-video-tree__trunk-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #00ff88, transparent);
  animation: ecom-tree-trunk-flow 2.4s ease-in-out infinite;
  border-radius: 2px;
}

.ecom-video-tree__branches-line {
  position: absolute;
  left: 28px;
  top: 0;
  bottom: 0;
  width: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  padding: 0;
}

.ecom-video-tree__branches-line::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #3a4550;
}

.ecom-video-tree__branch-tap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.ecom-video-tree__branch-tap::before {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  background: #3a4550;
}

.ecom-video-tree__branch-tap::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00ff88, transparent);
  animation: ecom-tree-branch-flow 2.4s ease-in-out infinite;
}

.ecom-video-tree__branch-tap:nth-child(2)::after { animation-delay: 0.3s; }
.ecom-video-tree__branch-tap:nth-child(3)::after { animation-delay: 0.6s; }

/* ── Arrow between nodes ── */
.ecom-video-tree__arrow {
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  color: #4a5565;
  transition: color 280ms ease;
}

.ecom-video-tree__arrow svg {
  width: 100%;
  height: 100%;
}

.ecom-video-tree__arrow svg path {
  transition: stroke 280ms ease;
}

.ecom-video-tree__row:hover .ecom-video-tree__arrow {
  color: #00ff88;
}

/* ── Rows container ── */
.ecom-video-tree__rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-width: 0;
  align-self: stretch;
  padding: 0;
}

.ecom-video-tree__row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 1;
  gap: 12px;
  animation: ecom-tree-row-in 480ms var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1)) both;
}

.ecom-video-tree__row--empty {
  opacity: 0.5;
  transition: opacity 320ms ease;
}

.ecom-video-tree__row--empty.is-planning {
  opacity: 0.75;
}

.ecom-video-tree__row--empty.is-planning .ecom-video-tree-node {
  border-color: rgba(var(--accent-rgb, 0, 255, 136), 0.15);
}

/* ── Animations ── */
@keyframes ecom-tree-node-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ecom-tree-row-in {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes ecom-tree-breathe {
  0%, 100% {
    border-color: #1a4d4d;
    box-shadow: 0 0 0 0 rgba(83, 229, 255, 0);
  }
  50% {
    border-color: #53e5ff;
    box-shadow: 0 0 16px 2px rgba(83, 229, 255, 0.12);
  }
}

@keyframes ecom-tree-trunk-flow {
  0% { opacity: 0; transform: translateX(-100%); }
  30% { opacity: 0.6; }
  70% { opacity: 0.6; }
  100% { opacity: 0; transform: translateX(100%); }
}

@keyframes ecom-tree-branch-flow {
  0% { opacity: 0; transform: translateX(-100%); }
  30% { opacity: 0.5; }
  70% { opacity: 0.5; }
  100% { opacity: 0; transform: translateX(100%); }
}

/* ── Preview lightbox overlay ────────────────────── */
.ecom-video-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  cursor: zoom-out;
  animation: ecom-preview-fade-in 200ms ease;
}

.ecom-video-preview-overlay__close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 10;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.ecom-video-preview-overlay img,
.ecom-video-preview-overlay video {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 8px;
  object-fit: contain;
  cursor: default;
}

@keyframes ecom-preview-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── History panel ──────────────────────────────── */

.ecom-video-history-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: #1a1d24;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
  animation: ecom-history-slide-in 0.25s ease-out;
}

@keyframes ecom-history-slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.ecom-video-history-panel__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
}

.ecom-video-history-panel__close {
  margin-left: auto;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  cursor: pointer;
}

.ecom-video-history-panel__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.ecom-video-history-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ecom-video-history-panel__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
}

.ecom-video-history-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
}

.ecom-video-history-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.ecom-video-history-card__title {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ecom-video-history-card__date {
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
  white-space: nowrap;
}

.ecom-video-history-card__delete {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
  cursor: pointer;
}

.ecom-video-history-card__delete:hover {
  background: rgba(255, 80, 80, 0.15);
  color: #ff5050;
}

.ecom-video-history-card__scenes {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.ecom-video-history-card__scene {
  position: relative;
  flex-shrink: 0;
  width: 80px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

.ecom-video-history-card__scene img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.15s;
}

.ecom-video-history-card__scene img:hover {
  opacity: 0.8;
}

.ecom-video-history-card__video-thumb {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.15s;
}

.ecom-video-history-card__video-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.ecom-video-history-panel__pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.ecom-video-history-panel__pager button {
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  cursor: pointer;
}

.ecom-video-history-panel__pager button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.ecom-video-history-panel__pager button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Delete confirmation dialog ─────────────────── */

.ecom-video-confirm-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.ecom-video-confirm-dialog {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 32px;
  border-radius: 12px;
  background: #1e2128;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  max-width: 340px;
  text-align: center;
}

.ecom-video-confirm-dialog__icon {
  font-size: 36px;
  color: #faad14;
}

.ecom-video-confirm-dialog__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
}

.ecom-video-confirm-dialog__actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.ecom-video-confirm-dialog__actions button {
  padding: 6px 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ecom-video-confirm-dialog__actions button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.ecom-video-confirm-dialog__actions button.is-danger {
  background: #ff4d4f;
  border-color: #ff4d4f;
  color: #fff;
}

.ecom-video-confirm-dialog__actions button.is-danger:hover {
  background: #ff7875;
  border-color: #ff7875;
}
