.video-flow-node--director-stage-3d {
  min-width: 430px;
  min-height: 560px;
}

.director-stage-node {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(100, 131, 171, 0.28);
  border-radius: 8px;
  background: #171b24;
  color: #edf4ff;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
}

.director-stage-node__head {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 13px;
  border-bottom: 1px solid rgba(112, 140, 177, 0.18);
  background: #1d222d;
  cursor: move;
}

.director-stage-node__title {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.director-stage-node__title strong { font-size: 13px; font-weight: 700; }
.director-stage-node__title span { color: rgba(180, 197, 221, 0.62); font-size: 10px; }
.director-stage-node__head-meta { display: flex; min-width: 0; align-items: center; gap: 6px; }
.director-stage-node__timer,
.director-stage-node__status {
  height: 22px;
  padding: 0 7px;
  overflow: hidden;
  border: 1px solid rgba(119, 150, 191, 0.24);
  border-radius: 5px;
  background: rgba(9, 15, 24, 0.62);
  color: rgba(193, 209, 233, 0.76);
  font-size: 10px;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.director-stage-node__timer { min-width: 40px; text-align: center; }
.director-stage-node__timer.is-running { border-color: rgba(63, 200, 163, 0.48); color: #79e5c1; }
.director-stage-node__status.is-success { color: #74e0ae; }

.director-stage-node__asset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 5px;
  color: rgba(196, 211, 232, 0.72);
  font-size: 10px;
}
.director-stage-node__asset-head strong { color: #79d8bd; font-weight: 650; }
.director-stage-node__assets { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; padding: 0 10px 8px; }
.director-stage-node__asset {
  position: relative;
  display: grid;
  min-width: 0;
  height: 50px;
  overflow: hidden;
  place-items: center;
  border: 1px dashed rgba(121, 151, 190, 0.25);
  border-radius: 6px;
  background: #111720;
}
.director-stage-node__asset.is-ready { border-style: solid; border-color: rgba(83, 170, 230, 0.4); }
.director-stage-node__asset img { width: 100%; height: 100%; object-fit: cover; }
.director-stage-node__asset > span { color: rgba(127, 158, 196, 0.48); font-size: 16px; font-weight: 700; }
.director-stage-node__asset strong {
  position: absolute;
  right: 3px;
  bottom: 3px;
  left: 3px;
  padding: 2px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(5, 10, 17, 0.78);
  color: #eef6ff;
  font-size: 8px;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.director-stage-node__preview {
  position: relative;
  display: grid;
  min-height: 178px;
  margin: 0 10px 8px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(86, 139, 196, 0.34);
  border-radius: 7px;
  background:
    linear-gradient(rgba(120, 161, 205, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 161, 205, 0.055) 1px, transparent 1px),
    #0d141d;
  background-size: 22px 22px;
}
.director-stage-node__preview > div { display: grid; max-width: 290px; gap: 5px; padding: 20px; text-align: center; }
.director-stage-node__preview > div strong { font-size: 13px; }
.director-stage-node__preview > div span { color: rgba(172, 194, 222, 0.62); font-size: 10px; line-height: 1.5; }
.director-stage-node__preview img { width: 100%; height: 100%; object-fit: contain; background: #090e15; }
.director-stage-node__preview button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  min-width: 104px;
  height: 30px;
  border: 1px solid rgba(120, 190, 240, 0.55);
  border-radius: 6px;
  background: rgba(21, 83, 126, 0.92);
  color: #f5fbff;
  font-size: 11px;
  font-weight: 650;
}
.director-stage-node__preview button:disabled { opacity: 0.45; }

.director-stage-node__prompt {
  display: flex;
  flex: 1 1 150px;
  min-height: 150px;
  flex-direction: column;
  gap: 5px;
  padding: 0 10px 8px;
}
.director-stage-node__prompt > span { color: rgba(204, 219, 238, 0.76); font-size: 10px; }
.director-stage-node__prompt textarea {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  resize: none;
  border: 1px solid rgba(115, 143, 180, 0.26);
  border-radius: 6px;
  outline: none;
  background: #10151d;
  color: #aab6c7;
  font: 400 11px/1.55 "Microsoft YaHei UI", sans-serif;
  padding: 8px 9px;
  box-sizing: border-box;
}
.director-stage-node__prompt textarea:focus { border-color: rgba(72, 169, 231, 0.68); box-shadow: 0 0 0 2px rgba(49, 141, 204, 0.12); }
.director-stage-node__prompt textarea::placeholder { color: rgba(152, 168, 191, 0.45); font-weight: 400; }

.director-stage-node__params { display: grid; grid-template-columns: minmax(0, 1.6fr) 74px 66px; gap: 6px; padding: 0 10px 8px; }
.director-stage-node__params select {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid rgba(114, 144, 183, 0.28);
  border-radius: 6px;
  outline: none;
  background: #252d3a;
  color: #dce8f8;
  font-size: 10px;
  padding: 0 7px;
}
.director-stage-node__error {
  box-sizing: border-box;
  flex: 0 1 84px;
  min-width: 0;
  min-height: 0;
  max-height: 84px;
  margin: 0 10px 8px;
  padding: 7px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(232, 93, 93, 0.34);
  border-radius: 5px;
  background: rgba(91, 28, 32, 0.32);
  color: #f0a6aa;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 166, 170, 0.5) rgba(255, 255, 255, 0.05);
}

.director-stage-node__error::-webkit-scrollbar { width: 5px; }
.director-stage-node__error::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.04); }
.director-stage-node__error::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(240, 166, 170, 0.48);
}
.director-stage-node__actions { display: grid; grid-template-columns: minmax(0, 1fr) 108px; gap: 7px; padding: 0 10px 10px; }
.director-stage-node__actions button {
  height: 34px;
  border: 1px solid rgba(118, 148, 188, 0.28);
  border-radius: 6px;
  background: #242c38;
  color: #dce7f6;
  font-size: 11px;
  font-weight: 650;
}
.director-stage-node__actions button.is-primary { border-color: rgba(44, 197, 139, 0.42); background: #237a59; color: #f5fffb; }
.director-stage-node__actions button:disabled { cursor: not-allowed; opacity: 0.42; }
.director-stage-node__loading { display: grid; height: 100%; min-height: 420px; place-items: center; color: rgba(181, 201, 226, 0.65); font-size: 12px; }

.director-stage-overlay {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  background: #080d13;
  color: #eef5ff;
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  /* The app window is frameless: its original top bar is draggable in Electron.
     Explicitly opt this overlay out so its top-row controls receive mouse input. */
  -webkit-app-region: no-drag;
}
.director-stage-overlay button,
.director-stage-overlay input,
.director-stage-overlay select { font-family: inherit; -webkit-app-region: no-drag; }
.director-stage-overlay__topbar {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(270px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid rgba(124, 153, 190, 0.2);
  background: #111720;
}
.director-stage-overlay__brand { display: flex; align-items: center; gap: 10px; }
.director-stage-overlay__brand > span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 6px; background: #d99b35; color: #111820; font-size: 16px; font-weight: 800; }
.director-stage-overlay__brand div { display: grid; gap: 1px; }
.director-stage-overlay__brand strong { font-size: 14px; }
.director-stage-overlay__brand small { color: rgba(178, 196, 220, 0.58); font-size: 9px; }
.director-stage-overlay__view-switch { position: relative; z-index: 3; display: grid; grid-template-columns: repeat(2, 108px); padding: 3px; border: 1px solid rgba(112, 144, 183, 0.24); border-radius: 7px; background: #090e15; pointer-events: auto; }
.director-stage-overlay__view-switch button,
.director-stage-overlay__top-actions button { height: 32px; border: 0; border-radius: 5px; background: transparent; color: rgba(190, 207, 230, 0.7); font-size: 11px; }
.director-stage-overlay__view-switch button { position: relative; z-index: 1; cursor: pointer; touch-action: manipulation; }
.director-stage-overlay__view-switch button.is-active { background: #263445; color: #fff; }
.director-stage-overlay__top-actions { position: relative; display: flex; justify-content: flex-end; gap: 7px; }
.director-stage-overlay__top-actions button { min-width: 86px; padding: 0 12px; border: 1px solid rgba(118, 148, 188, 0.28); background: #202936; color: #dce7f6; }
.director-stage-overlay__top-actions button.is-primary { border-color: rgba(45, 201, 141, 0.42); background: #237a59; color: #fff; }
.director-stage-overlay__top-actions .director-stage-overlay__close { min-width: 32px; width: 32px; padding: 0; font-size: 18px; }
.director-stage-overlay__body { display: grid; min-height: 0; grid-template-columns: 238px minmax(0, 1fr) 278px; }
.director-stage-assets-panel,
.director-stage-inspector { min-height: 0; overflow: auto; background: #111720; }
.director-stage-assets-panel { border-right: 1px solid rgba(123, 153, 190, 0.18); padding: 14px 12px; }
.director-stage-inspector { border-left: 1px solid rgba(123, 153, 190, 0.18); padding: 14px 14px 22px; }
.director-stage-panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.director-stage-panel-title strong { font-size: 12px; }
.director-stage-panel-title span { color: #73d4b1; font-size: 9px; }
.director-stage-scene-card { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 9px; align-items: center; min-height: 62px; margin-bottom: 10px; border-bottom: 1px solid rgba(116, 146, 184, 0.17); padding-bottom: 10px; }
.director-stage-scene-card img { width: 58px; height: 46px; object-fit: cover; border-radius: 5px; }
.director-stage-scene-card div,
.director-stage-role-card span { display: grid; min-width: 0; gap: 3px; }
.director-stage-scene-card strong,
.director-stage-role-card strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.director-stage-scene-card span,
.director-stage-role-card small { overflow: hidden; color: rgba(174, 194, 219, 0.58); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.director-stage-role-list { display: grid; gap: 7px; }
.director-stage-role-card { display: grid; grid-template-columns: 25px 42px minmax(0, 1fr); align-items: center; gap: 7px; min-width: 0; height: 56px; padding: 6px; border: 1px solid rgba(111, 142, 180, 0.2); border-radius: 6px; background: #171f2a; color: #edf5ff; text-align: left; }
.director-stage-role-card.is-active { border-color: rgba(76, 177, 238, 0.72); background: #1c3143; box-shadow: inset 3px 0 0 #52b7f0; }
.director-stage-role-card > i { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--role-color); color: #081018; font-size: 10px; font-style: normal; font-weight: 800; }
.director-stage-role-card img { width: 42px; height: 42px; object-fit: cover; border-radius: 4px; }
.director-stage-camera-card { margin-bottom: 3px; border-color: rgba(221, 158, 55, 0.34); }
.director-stage-camera-card > i { border-radius: 5px; background: #e7a139; }
.director-stage-camera-card__icon {
  position: relative;
  display: block;
  width: 40px;
  height: 30px;
  border-radius: 4px;
  background: #e49b2f;
  box-shadow: inset 0 0 0 1px rgba(255, 226, 165, 0.38);
}
.director-stage-camera-card__icon::before {
  content: "";
  position: absolute;
  top: 7px;
  right: -5px;
  width: 9px;
  height: 16px;
  border-radius: 0 4px 4px 0;
  background: #202a35;
}
.director-stage-camera-card__icon::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 10px;
  width: 20px;
  height: 6px;
  border-radius: 3px 3px 0 0;
  background: #202a35;
}
.director-stage-camera-card__icon b { position: absolute; top: 9px; left: 14px; width: 12px; height: 12px; border-radius: 50%; background: #244e70; box-shadow: inset 0 0 0 3px #18212b; }
.director-stage-role-empty { padding: 24px 8px; color: rgba(172, 193, 218, 0.48); font-size: 10px; text-align: center; }
.director-stage-viewport-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #080d13; }
.director-stage-viewport { position: absolute; inset: 0; overflow: hidden; }
.director-stage-viewport canvas { display: block; width: 100%; height: 100%; }
.director-stage-viewport__mode { position: absolute; top: 14px; left: 14px; padding: 6px 9px; border: 1px solid rgba(152, 188, 226, 0.25); border-radius: 5px; background: rgba(7, 13, 21, 0.74); color: rgba(232, 241, 252, 0.84); font-size: 10px; pointer-events: none; }
.director-stage-transform-bar { position: absolute; top: 14px; left: 50%; display: flex; gap: 4px; padding: 4px; border: 1px solid rgba(126, 157, 195, 0.22); border-radius: 7px; background: rgba(10, 16, 24, 0.8); transform: translateX(-50%); }
.director-stage-transform-bar button { min-width: 52px; height: 29px; padding: 0 8px; border: 0; border-radius: 5px; background: transparent; color: rgba(188, 205, 228, 0.68); font-size: 10px; }
.director-stage-transform-bar button.is-active { background: #285c7a; color: #fff; }
.director-stage-transform-bar button:disabled { cursor: not-allowed; opacity: 0.3; }
.director-stage-guides { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.director-stage-guides polygon { fill: none; stroke: rgba(255, 255, 255, 0.64); stroke-width: 1; vector-effect: non-scaling-stroke; }
.director-stage-guides line { stroke: rgba(255, 255, 255, 0.28); stroke-width: 1; vector-effect: non-scaling-stroke; }
.director-stage-inspector section { display: grid; gap: 10px; }
.director-stage-inspector__role { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.director-stage-inspector__role i { width: 9px; height: 9px; border-radius: 50%; }
.director-stage-inspector__role strong { font-size: 11px; }
.director-stage-inspector label { display: grid; gap: 5px; color: rgba(186, 203, 226, 0.72); font-size: 9px; }
.director-stage-inspector select { width: 100%; height: 29px; border: 1px solid rgba(111, 143, 182, 0.26); border-radius: 5px; outline: none; background: #202a37; color: #e7f0fc; font-size: 10px; padding: 0 7px; }
.director-stage-range > span { display: flex; justify-content: space-between; gap: 8px; }
.director-stage-range output { color: #8fc9ed; font-size: 9px; }
.director-stage-range input { width: 100%; margin: 0; accent-color: #4aaee7; }
.director-stage-camera-controls label:has(input[data-stage-camera-field="distance"]) { display: none; }
.director-stage-inspector__divider { margin-top: 3px; padding-top: 12px; border-top: 1px solid rgba(118, 147, 184, 0.18); color: rgba(220, 232, 247, 0.82); font-size: 10px; font-weight: 650; }
.director-stage-camera-controls { margin-top: 12px; }

@media (max-width: 1080px) {
  .director-stage-overlay__body { grid-template-columns: 196px minmax(0, 1fr) 238px; }
  .director-stage-overlay__topbar { grid-template-columns: minmax(160px, 1fr) auto minmax(220px, 1fr); }
}

@media (max-width: 820px) {
  .director-stage-overlay__body { grid-template-columns: minmax(0, 1fr) 220px; }
  .director-stage-assets-panel { display: none; }
  .director-stage-overlay__brand small { display: none; }
  .director-stage-overlay__top-actions > button:not(.is-primary):not(.director-stage-overlay__close) { display: none; }
}
