/* Canvas, flow nodes, generate, design */

.workspace-stage {
  position: fixed;
  top: var(--workspace-top);
  right: var(--workspace-inset);
  bottom: var(--workspace-inset);
  left: var(--workspace-inset);
  z-index: 1;
  display: flex;
  min-width: 0;
}

.workspace-shell {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--workspace-border);
  border-radius: var(--workspace-radius);
  background: var(--workspace-bg);
}

.chat-panel-slot {
  flex: 0 0 auto;
  width: 0;
  max-width: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  opacity: 0;
  margin-left: 0;
  pointer-events: none;
  transition:
    max-width 0.34s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.34s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.24s ease,
    margin-left 0.34s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-panel-slot.is-open {
  width: var(--chat-column-width);
  max-width: var(--chat-column-width);
  opacity: 1;
  margin-left: var(--workspace-gap);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .chat-panel-slot {
    transition-duration: 0.01ms;
  }
}

.node-sidebar {
  position: fixed;
  top: 78px;
  left: 18px;
  z-index: var(--dock-panel-z);
  display: flex;
  width: min(320px, calc(100vw - 36px));
  max-height: calc(100vh - 104px);
  min-height: auto;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 14px;
  background: var(--dock-panel-bg);
  border: 1px solid var(--dock-panel-border);
  border-radius: 16px;
}

.node-sidebar[hidden] {
  display: none;
}

.node-board {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.node-board .react-flow {
  width: 100%;
  height: 100%;
  background: var(--canvas-bg);
}

.node-board .react-flow__pane {
  cursor: default;
}

.node-board .react-flow.is-lasso-ready .react-flow__pane,
.node-board .react-flow.is-lasso-drawing .react-flow__pane {
  cursor: crosshair;
}

.node-board .react-flow.is-draw-mode,
.node-board .react-flow.is-draw-mode .react-flow__pane,
.node-board .react-flow.is-draw-mode .react-flow__node,
.node-board .react-flow.is-draw-mode .design-draw-drag-handle,
.node-board .react-flow.is-draw-drawing,
.node-board .react-flow.is-draw-drawing .react-flow__pane,
.node-board .react-flow.is-draw-drawing .react-flow__node {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' stroke='%23000' stroke-width='1.4' stroke-linejoin='round' d='M3 21l1.3-4.6L16.8 3.9l3.3 3.3L7.6 19.7z'/%3E%3Cpath fill='%23000' d='M3 21l1.5-1.5.8 2.3z'/%3E%3Cpath fill='none' stroke='%23000' stroke-width='1.2' d='M15.6 5.8l2.6 2.6'/%3E%3C/svg%3E") 3 21, crosshair;
}

.node-board .react-flow.is-lasso-drawing,
.node-board .react-flow.is-draw-mode,
.node-board .react-flow.is-draw-drawing,
.node-board .react-flow.is-text-mode,
.node-board .react-flow.is-postit-mode,
.node-board .react-flow.is-frame-mode,
.node-board .react-flow.is-frame-drawing {
  user-select: none;
}

.node-board .design-text-placement-preview,
.node-board .design-postit-placement-preview,
.node-board .design-frame-placement-preview {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 25;
}

.node-board .design-text-placement-preview {
  padding: 4px 2px;
  color: var(--text);
  font-size: 3.375rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: pre;
  opacity: 0.42;
}

.node-board .design-postit-placement-preview {
  width: 280px;
  height: 260px;
  border: 1px solid var(--border-emphasis);
  border-radius: 14px;
  background: #f9d857;
  box-shadow: var(--node-shadow);
  opacity: 0.55;
}

.node-board .design-frame-placement-preview {
  box-sizing: border-box;
  border: 2px solid var(--accent-strong);
  border-radius: 20px;
  background: rgb(154 131 255 / 8%);
  box-shadow: inset 0 0 0 1px rgb(154 131 255 / 16%);
  opacity: 0.55;
}

.node-board .design-frame-placement-preview.is-drawing {
  opacity: 0.85;
}

.node-board .freehand-draw-preview {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: 25;
}

.node-board .freehand-draw-preview path {
  fill: var(--text);
}

.node-board .react-flow__selection,
.node-board .react-flow__nodesselection {
  display: none;
}

.node-board .lasso-selection-overlay {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 20;
  width: 100%;
  height: 100%;
  transform-origin: top left;
}

.node-board .react-flow__node {
  border: 0;
  background: transparent;
}

.node-board .react-flow__node.design-frame-layer {
  z-index: -1 !important;
  overflow: visible;
}

.node-board .react-flow__node.design-frame-layer .react-flow__resize-control {
  overflow: visible;
}

.node-board .react-flow__node:not(.design-frame-layer) {
  z-index: 10 !important;
}

.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
}

.canvas-toolbar p:last-child {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.node-canvas {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: none;
  background: var(--canvas-bg);
  cursor: grab;
}

.node-canvas::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, var(--surface-subtle), transparent 22%);
}

.node-canvas.is-panning {
  cursor: grabbing;
}

.canvas-content {
  position: relative;
  min-width: 10000px;
  min-height: 10000px;
}

.canvas-world {
  position: relative;
  transform-origin: 0 0;
}

.canvas-world::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background-color: var(--canvas-bg);
  background-image: radial-gradient(circle, rgb(140 146 158 / 28%) 1px, transparent 1.2px);
  background-size: 24px 24px;
}

.connections-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: auto;
}

.connection-path {
  fill: none;
  stroke: var(--node-selected);
  stroke-linecap: round;
  stroke-width: 4;
  pointer-events: stroke;
}

.connection-path.is-selected {
  stroke: #f5c46b;
  stroke-width: 4;
}

.connection-path.is-preview {
  stroke: #f5c46b;
  stroke-dasharray: 10 7;
  pointer-events: none;
}

#zoomLevel {
  display: inline-flex;
  min-width: 54px;
  justify-content: center;
  border: 1px solid var(--border-medium);
  border-radius: 999px;
  margin-left: 6px;
  padding: 3px 8px;
  color: var(--text);
  background: var(--chip-bg);
  font-weight: 800;
}

.flow-node {
  position: relative;
  z-index: 1;
  width: var(--node-width);
  border: 1px solid var(--node-border);
  border-radius: var(--node-radius);
  background: var(--node-bg);
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
  box-shadow: var(--node-shadow);
}

.flow-node:not(.design-postit-node)::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 0;
  border-radius: calc(var(--node-radius) - 1px);
  pointer-events: none;
  box-shadow: var(--node-volume);
}

.references-node {
  width: 370px;
}

.generate-node {
  width: 370px;
  --generate-port-start: 118px;
  --generate-port-spacing: 34px;
  --generate-extra-height: 0px;
  min-height: calc(330px + var(--generate-extra-height));
  display: flex;
  flex-direction: column;
}

.generate-node .node-header {
  gap: 10px;
}

.generate-image-node {
  min-height: 310px;
}

.generate-description-node .node-body {
  --generate-label-clearance: 14px;
}

.camera-node {
  width: 320px;
  min-height: 0;
}

.camera-node .node-body {
  justify-content: flex-start;
  padding-top: 14px;
}

.camera-focal-input {
  display: flex;
  gap: 6px;
  align-items: center;
}

.camera-node .camera-focal-input input {
  width: calc(4ch + 1.75rem);
  min-width: 0;
  flex: none;
  appearance: textfield;
}

.camera-node .camera-focal-input input::-webkit-outer-spin-button,
.camera-node .camera-focal-input input::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.camera-focal-unit {
  color: var(--node-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.result-node {
  width: 360px;
  overflow: visible;
}

.result-node .node-header {
  gap: 10px;
  justify-content: space-between;
}

.result-node.is-running {
  border-color: var(--border-emphasis);
}

.flow-node.result-node.is-running {
  border-color: var(--border-emphasis);
}

.result-node-border-glow {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: visible;
  pointer-events: none;
}

.result-node-border-glow-trail {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-node-progress {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 6;
  transform: translateX(-50%);
  color: #fff;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}

.result-node-progress-percent {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 10px rgb(0 0 0 / 45%);
}

.reference-flow-node {
  width: 340px;
}

.reference-flow-node .node-header {
  gap: 10px;
}

.reference-node-kind-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--node-muted);
  pointer-events: none;
}

.reference-node-kind-icon .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}

.flow-node.is-selected .reference-node-kind-icon {
  color: var(--node-selected);
}

.flow-node.image-reference-node.is-selected .reference-node-kind-icon {
  color: var(--image-color);
}

.flow-node.video-reference-node.is-selected .reference-node-kind-icon {
  color: var(--video-color);
}

.image-reference-node {
  width: 360px;
}

.video-reference-node {
  width: 360px;
}

.audio-reference-node {
  width: 360px;
}

.design-postit-node {
  width: 280px;
  height: 260px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border-emphasis);
  background: #f9d857;
  box-shadow: var(--node-shadow);
  cursor: grab;
}

.design-postit-node:active {
  cursor: grabbing;
}

.design-postit-node.is-editing,
.design-postit-node.is-editing:active {
  cursor: default;
}

.design-postit-node.is-selected {
  overflow: visible;
}

.design-postit-node .node-header {
  display: none;
  border-bottom: 1px solid rgb(0 0 0 / 18%);
  color: rgb(33 29 12 / 82%);
  font-size: 1rem;
  padding: 12px 14px;
}

.design-postit-node .node-title-input {
  border-color: var(--overlay-soft);
  background: rgb(255 255 255 / 45%);
  color: rgb(33 29 12 / 92%);
}

.design-postit-node .node-body {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 32px;
}

.design-postit-drag-edge {
  position: absolute;
  z-index: 2;
  cursor: grab;
}

.design-postit-drag-edge-top {
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
}

.design-postit-drag-edge-right {
  top: 0;
  right: 0;
  bottom: 0;
  width: 16px;
}

.design-postit-drag-edge-bottom {
  left: 0;
  right: 0;
  bottom: 0;
  height: 16px;
}

.design-postit-drag-edge-left {
  top: 0;
  left: 0;
  bottom: 0;
  width: 16px;
}

.design-color-swatches {
  position: absolute;
  left: -28px;
  top: 50%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateY(-50%);
  pointer-events: auto;
}

.design-color-swatch {
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid rgb(255 255 255 / 28%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--overlay-medium);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.design-color-swatch:hover {
  transform: scale(1.08);
}

.design-color-swatch.is-active {
  border-color: rgb(255 255 255 / 92%);
  box-shadow: 0 0 0 2px rgb(245 196 107 / 45%), 0 4px 12px rgb(0 0 0 / 32%);
}

.design-frame-node {
  position: relative;
  box-sizing: border-box;
  border: 2px solid var(--accent-strong);
  border-radius: 20px;
  background: rgb(154 131 255 / 8%);
  box-shadow: inset 0 0 0 1px rgb(154 131 255 / 16%);
}

.design-frame-node.is-selected {
  border-color: rgb(245 196 107 / 92%);
  box-shadow: inset 0 0 0 1px rgb(245 196 107 / 35%), 0 0 0 1px rgb(245 196 107 / 28%);
}

.design-frame-title {
  position: absolute;
  top: -80px;
  left: 8px;
  max-width: calc(100% - 16px);
  transform: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.design-frame-title .node-title-wrap {
  overflow: visible;
}

.design-frame-title .node-title {
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.45em 0.55em;
  margin: -0.45em -0.55em;
  color: var(--frame-title-color);
  font-size: 3.375rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: var(--frame-title-shadow);
}

.design-frame-title .node-title-input {
  min-width: 120px;
  padding: 2px 4px;
  border-color: var(--accent-border);
  border-radius: 8px;
  font-size: 3.375rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--frame-title-color);
  background: var(--frame-title-input-bg);
}

.node-board .react-flow__resize-control.handle.design-frame-resize-handle {
  --frame-resize-arc: rgb(245 196 107 / 90%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.node-board .react-flow__resize-control.handle.design-frame-resize-handle:hover {
  --frame-resize-arc: rgb(255 236 180 / 98%);
}

.node-board .react-flow__resize-control.handle.design-frame-resize-handle::before,
.node-board .react-flow__resize-control.handle.design-frame-resize-handle::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
  pointer-events: none;
  background: transparent;
  border-style: solid;
  filter: var(--frame-resize-shadow);
}

.node-board .react-flow__resize-control.handle.design-frame-resize-handle::before {
  width: 20px;
  height: 20px;
  border-width: 2.5px;
}

.node-board .react-flow__resize-control.handle.design-frame-resize-handle::after {
  width: 12px;
  height: 12px;
  border-width: 2px;
}

.node-board .react-flow__resize-control.handle.design-frame-resize-handle.top.left::before,
.node-board .react-flow__resize-control.handle.design-frame-resize-handle.top.left::after {
  top: 2px;
  left: 2px;
  border-color: var(--frame-resize-arc) transparent transparent var(--frame-resize-arc);
  border-radius: 100% 0 0 0;
}

.node-board .react-flow__resize-control.handle.design-frame-resize-handle.top.right::before,
.node-board .react-flow__resize-control.handle.design-frame-resize-handle.top.right::after {
  top: 2px;
  right: 2px;
  border-color: var(--frame-resize-arc) var(--frame-resize-arc) transparent transparent;
  border-radius: 0 100% 0 0;
}

.node-board .react-flow__resize-control.handle.design-frame-resize-handle.bottom.left::before,
.node-board .react-flow__resize-control.handle.design-frame-resize-handle.bottom.left::after {
  bottom: 2px;
  left: 2px;
  border-color: transparent transparent var(--frame-resize-arc) var(--frame-resize-arc);
  border-radius: 0 0 0 100%;
}

.node-board .react-flow__resize-control.handle.design-frame-resize-handle.bottom.right::before,
.node-board .react-flow__resize-control.handle.design-frame-resize-handle.bottom.right::after {
  right: 2px;
  bottom: 2px;
  border-color: transparent var(--frame-resize-arc) var(--frame-resize-arc) transparent;
  border-radius: 0 0 100% 0;
}

.node-board .react-flow__resize-control.line.design-frame-resize-line {
  border-color: transparent;
  pointer-events: none;
}

.node-board .react-flow__node-designDraw {
  padding: 0;
}

.design-draw-node {
  width: 100%;
  height: 100%;
  padding: 0;
  background: transparent;
  cursor: grab;
}

.design-draw-svg {
  display: block;
  overflow: visible;
}

.design-draw-path {
  fill: var(--text);
}

.design-draw-node.is-selected .design-draw-path {
  filter: drop-shadow(0 0 6px rgb(245 196 107 / 72%));
}

.design-text-floating {
  width: max-content;
  max-width: 100%;
  padding: 0;
  background: transparent;
}

.design-text-floating.is-selected .design-text-display {
  text-shadow: 0 0 14px rgb(245 196 107 / 35%);
}

.design-text-display {
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: 8px;
  padding: 4px 2px;
  background: transparent;
  color: rgb(244 246 252 / 95%);
  text-align: left;
  font-size: 3.375rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: pre-wrap;
  cursor: grab;
}

.design-text-editor {
  max-width: 100%;
  min-height: 72px;
  border: 1px solid var(--surface-hover-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgb(10 14 20 / 88%);
  color: rgb(244 246 252 / 95%);
  font-size: 3.375rem;
  font-weight: 700;
  line-height: 1.2;
  resize: both;
}

.design-postit-display,
.design-postit-editor {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgb(38 32 8 / 90%);
  font-size: 1.2rem;
  line-height: 1.5;
  padding: 4px;
  font-weight: 700;
}

.design-postit-display {
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: none;
  cursor: grab;
}

.design-postit-display:active {
  cursor: grabbing;
}

.design-postit-display-placeholder {
  color: var(--postit-placeholder-color, rgb(38 32 8 / 45%));
}

.design-postit-editor {
  resize: none;
  cursor: text;
}

.design-postit-editor::placeholder {
  color: var(--postit-placeholder-color, rgb(38 32 8 / 45%));
}

.design-postit-resize-handle {
  position: absolute;
  z-index: 3;
  right: 2px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 6px;
  background:
    linear-gradient(135deg, transparent 38%, rgb(0 0 0 / 24%) 40%, rgb(0 0 0 / 24%) 52%, transparent 54%),
    linear-gradient(135deg, transparent 56%, var(--overlay-medium) 58%, var(--overlay-medium) 70%, transparent 72%);
  cursor: nwse-resize;
  opacity: 0.85;
}

.design-postit-resize-handle:hover {
  opacity: 1;
}

.design-text-editor:focus-visible,
.design-postit-editor:focus-visible,
.design-text-display:focus-visible {
  outline: 2px solid rgb(124 92 255 / 70%);
  outline-offset: 1px;
}

.flow-node.is-dragging {
  z-index: 5;
  border-color: var(--node-selected);
  box-shadow: 0 16px 40px rgb(0 0 0 / 48%), 0 4px 10px rgb(0 0 0 / 30%);
}

.flow-node.is-running {
  border-color: rgb(45 212 191 / 72%);
}

.flow-node.is-selected {
  border-color: var(--node-selected);
  box-shadow: var(--node-shadow);
}

.flow-node.image-reference-node.is-selected,
.flow-node.image-reference-node.is-dragging {
  border-color: var(--image-color);
}

.flow-node.video-reference-node.is-selected,
.flow-node.video-reference-node.is-dragging {
  border-color: var(--video-color);
}

.flow-node.is-selected:not(.design-postit-node)::before {
  box-shadow:
    var(--node-volume),
    inset 0 0 0 1px rgb(255 255 255 / 6%);
}

.generate-node.is-connection-target {
  border-color: #f5c46b;
}

.generate-input-ports {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.reference-flow-node.is-connected {
  border-color: rgb(45 212 191 / 58%);
}

.reference-flow-node.is-selected {
  box-shadow: var(--node-shadow);
}

.node-board .react-flow__edge path {
  transition: stroke 140ms ease, stroke-width 140ms ease, filter 140ms ease;
}

.node-board .react-flow__edge.selected path,
.node-board .react-flow__edge:focus-visible path {
  stroke: #72d6ff !important;
  stroke-width: 5px !important;
}

.reference-flow-node.is-pending-connection {
  border-color: #f5c46b;
}

.node-header {
  display: flex;
  gap: 12px;
  border-bottom: 0;
  box-shadow: var(--node-hr);
  padding: 20px 20px;
  cursor: grab;
  user-select: none;
  align-content: center;
  justify-content: flex-start;
  align-items: center;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--node-title);
  overflow: visible;
}

.prompt-node .node-header {
  gap: 10px;
  justify-content: space-between;
}

.node-header:active {
  cursor: grabbing;
}

.node-header strong {
  display: block;
  color: inherit;
}

.node-title-wrap {
  flex: 1;
  min-width: 0;
}

.node-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: text;
}

.node-title-input {
  width: 100%;
  border: 1px solid var(--node-border);
  border-radius: 10px;
  background: var(--node-input-bg);
  color: inherit;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  padding: 6px 10px;
}

.node-title-input:focus,
.node-title-input:focus-visible {
  outline: none;
  border-color: var(--node-input-focus);
  box-shadow: 0 0 0 1px var(--node-input-focus);
}

.node-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -4px -6px -4px auto;
  overflow: visible;
}

.node-header-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--node-action-border);
  border-radius: 11px;
  color: var(--node-action-icon);
  background: var(--node-action-bg);
  box-shadow: var(--node-action-inset);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

a.node-header-action {
  text-decoration: none;
}

.node-header-action:disabled,
.node-header-action[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

.node-header-action:hover {
  border-color: var(--node-action-border);
  color: var(--node-action-icon-hover);
  background: var(--node-action-hover);
}

.node-header-action:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.node-header-action .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  font-variation-settings: "wght" 400;
}

.node-copy {
  color: var(--node-muted);
  font-size: 0.8125rem;
}

.node-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.result-node .node-body {
  gap: 14px;
}

.prompt-mention-menu {
  position: absolute;
  z-index: 24;
  display: grid;
  gap: 6px;
  min-width: 210px;
  max-width: min(320px, calc(100% - 24px));
  max-height: 180px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border-emphasis);
  border-radius: 12px;
  background: var(--card-translucent);
  box-shadow: var(--shadow);
}

.prompt-mention-option {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
}

.prompt-mention-option strong {
  font-size: 0.86rem;
  font-weight: 700;
}

.prompt-mention-option small {
  font-size: 0.75rem;
  color: var(--muted);
}

.prompt-mention-option:hover,
.prompt-mention-option.is-active {
  border-color: var(--accent-border);
  background: var(--accent-surface-strong);
}

.generate-node .node-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  justify-content: flex-end;
  padding-top: calc(14px );
}

.generate-video-node .node-body {
  justify-content: flex-start;
}

.generate-mode-row {
  padding: 0 16px;
  margin-top: 20px;
}

.generate-mode-row label {
  display: grid;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--node-muted);
}

.generate-options {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.generate-node .settings-grid {
  gap: 10px;
}

.generate-video-node .settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.generate-node label {
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--node-muted);
  text-indent: 12px;
}

.generate-node label > * {
  text-indent: 0;
}

.generate-node input,
.generate-node select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--node-border);
  border-radius: 12px;
  background-color: var(--node-input-bg);
  color: var(--node-title);
  font-size: 0.8125rem;
  box-shadow: inset 0 1px 0 rgb(0 0 0 / 38%);
}

.generate-node select {
  padding-right: 34px;
}

.generate-duration-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.generate-duration-controls select {
  flex: 1;
  min-width: 0;
}

.generate-duration-controls input {
  flex: 1;
  min-width: 0;
}

.generate-toggle-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--node-border);
  border-radius: 12px;
  background: var(--node-input-bg);
  cursor: pointer;
}

.generate-toggle-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-surface);
}

.generate-toggle-control .generate-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.generate-toggle-state {
  color: var(--node-title);
  font-size: 0.8125rem;
  font-weight: 600;
}

.generate-toggle-track {
  position: relative;
  flex: 0 0 36px;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-medium);
  transition: background 0.2s ease;
}

.generate-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s ease;
}

.generate-toggle-input:checked + .generate-toggle-track {
  background: var(--accent);
}

.generate-toggle-input:checked + .generate-toggle-track::after {
  transform: translateX(16px);
}

.generate-node .primary-button {
  margin-top: 12px;
  border: 1px solid var(--node-selected-border);
  border-radius: 12px;
  color: #fff;
  background: var(--node-selected);
  box-shadow: var(--node-cta-shadow);
  font-weight: 600;
  text-shadow: 0 0px 16px var(--node-selected-glow);
}

.generate-node .primary-button:not(:disabled):hover {
  filter: brightness(1.06);
}

.generate-node .primary-button.is-stop {
  border-color: transparent;
  color: #fff;
  background: var(--danger, #e5484d);
  box-shadow: none;
  text-shadow: none;
}

.generate-input-label {
  position: absolute;
  left: 25px;
  z-index: 2;
  transform: translateY(-50%);
  color: var(--node-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.image-preview {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--node-border);
  border-radius: 12px;
  aspect-ratio: var(--media-ratio, 16 / 9);
  background: var(--node-input-bg);
  max-height: 70vh;
}

.image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--media-preview-letterbox);
}

.image-preview img:fullscreen,
.image-preview img:-webkit-full-screen,
.result-image-frame img:fullscreen,
.result-image-frame img:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  background: #000;
}

.media-fullscreen-trigger {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--text-ghost);
  border-radius: 999px;
  color: white;
  background: rgb(9 11 18 / 70%);
  box-shadow: 0 10px 26px rgb(0 0 0 / 32%);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.image-reference-node:hover .media-fullscreen-trigger,
.result-node:hover .media-fullscreen-trigger,
.media-fullscreen-trigger:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.media-fullscreen-trigger:hover {
  background: rgb(124 92 255 / 84%);
}

.media-fullscreen-trigger .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}

.media-fullscreen-trigger[data-tooltip]::before,
.media-fullscreen-trigger[data-tooltip]::after {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
  z-index: 30;
}

.media-fullscreen-trigger[data-tooltip]::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 10px);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--tooltip-bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.media-fullscreen-trigger[data-tooltip]::before {
  content: "";
  bottom: calc(100% + 4px);
  border: 5px solid transparent;
  border-top-color: var(--tooltip-bg);
}

.media-fullscreen-trigger[data-tooltip]:hover::before,
.media-fullscreen-trigger[data-tooltip]:hover::after,
.media-fullscreen-trigger[data-tooltip]:focus-visible::before,
.media-fullscreen-trigger[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}

.image-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #000;
  cursor: zoom-out;
}

.image-fullscreen-overlay img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
}

.image-fullscreen-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--text-ghost);
  border-radius: 999px;
  color: white;
  background: rgb(9 11 18 / 70%);
  box-shadow: 0 10px 26px rgb(0 0 0 / 32%);
  backdrop-filter: blur(10px);
}

.image-fullscreen-close:hover {
  background: rgb(124 92 255 / 84%);
}

.image-fullscreen-close .material-symbols-outlined {
  font-size: 22px;
  line-height: 1;
}

.video-preview {
  position: relative;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--node-border);
  border-radius: 12px;
  aspect-ratio: var(--media-ratio, 16 / 9);
  max-height: 70vh;
  align-items: center;
  justify-content: center;
  background: var(--node-input-bg);
}

.video-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--media-preview-letterbox);
}

.audio-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--node-border);
  border-radius: 12px;
  background: var(--node-input-bg);
  padding: 12px;
  min-height: 82px;
}

.audio-preview audio {
  width: 100%;
}

.image-preview-empty {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: var(--node-input-bg);
}

.image-preview-empty.is-upload-target {
  cursor: pointer;
}

.image-preview-empty.is-upload-target:hover {
  background: var(--node-bg);
}

.image-preview-upload-icon {
  font-size: 36px;
  line-height: 1;
  color: var(--media-preview-icon);
  pointer-events: none;
}

.image-preview-empty.is-upload-target:hover .image-preview-upload-icon {
  color: var(--media-preview-icon-hover);
}

.media-preview-uploading {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--media-preview-text);
  letter-spacing: 0.02em;
  text-align: center;
  max-width: 88%;
}

.media-preview-loader {
  width: 28px;
  height: 28px;
  border: 3px solid var(--media-preview-loader-track);
  border-top-color: var(--media-preview-loader-accent);
  border-radius: 999px;
  animation: media-preview-spin 0.9s linear infinite;
}

.image-preview-dots {
  display: flex;
  gap: 8px;
}

.image-preview-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--media-preview-icon);
}

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

.node-copy {
  margin: 0;
  line-height: 1.45;
}

.port {
  position: absolute;
  z-index: 3;
  width: 20px;
  height: 20px;
  border: 3px solid var(--panel);
  border-radius: 999px;
  background: var(--node-selected);
}

.react-flow__handle {
  z-index: 5;
  width: 20px;
  height: 20px;
  border: 4px solid var(--node-bg);
  background: var(--node-selected);
  opacity: 1;
  box-shadow: none;
}

.port-in {
  top: 50%;
  left: -10px;
  transform: translateY(-50%);
}

.port-in-main {
  top: 74px;
  transform: none;
}

.generate-input-port {
  top: calc(var(--generate-port-start) + var(--port-index, 0) * var(--generate-port-spacing));
  left: -10px;
  transform: none;
  pointer-events: auto;
}

.generate-input-port[data-input-state="available"] {
  background: #6262f4;
}

.generate-input-port[data-input-state="occupied"] {
  background: #38d4a3;
}

.port-out {
  top: 50%;
  right: -10px;
  transform: translateY(-50%);
}

.mini-button {
  margin-left: auto;
  min-height: 30px;
}

.reference-list,
.history-list,
.job-status {
  display: grid;
  gap: 10px;
}

.job-status.is-running {
  display: flex;
  align-items: center;
}

.job-status-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgb(45 212 191 / 22%);
  border-top-color: rgb(45 212 191 / 92%);
  border-radius: 999px;
  animation: media-preview-spin 0.75s linear infinite;
}

.reference-card,
.history-card {
  display: grid;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--node-border);
  border-radius: 12px;
  padding: 12px;
  background: var(--node-input-bg);
}

.reference-card {
  grid-template-columns: minmax(0, 1fr);
}

.reference-card strong,
.history-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-card span,
.history-card-meta,
.raw-hint,
.empty-state {
  color: var(--muted);
}

.warning-card {
  border-color: rgb(245 196 107 / 60%);
}

.warning-card span {
  color: var(--warning);
}

.job-details {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.job-details p {
  margin: 0;
  color: var(--muted);
}

.empty-state {
  margin: 0;
  border: 1px dashed var(--node-border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

video {
  width: 100%;
  border: 1px solid var(--node-border);
  border-radius: 12px;
  background: var(--media-preview-letterbox);
}

.result-video-frame {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

.result-image-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--node-border);
  border-radius: 12px;
  background: var(--media-preview-letterbox);
}

.result-image-frame img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: var(--media-preview-letterbox);
}

.result-video-frame video {
  display: block;
}

.result-video-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  pointer-events: none;
}

.result-video-nav {
  pointer-events: auto;
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--text-ghost);
  border-radius: 999px;
  color: white;
  background: rgb(9 11 18 / 70%);
  box-shadow: 0 10px 26px rgb(0 0 0 / 32%);
  backdrop-filter: blur(10px);
}

.result-video-nav:first-child {
  justify-self: start;
}

.result-video-nav:last-child {
  justify-self: end;
}

.result-video-nav:hover {
  background: rgb(124 92 255 / 84%);
}

.result-video-counter {
  justify-self: center;
  grid-column: 2;
  border: 1px solid var(--surface-hover-border);
  border-radius: 999px;
  padding: 4px 10px;
  color: white;
  background: rgb(9 11 18 / 72%);
  font-size: 0.78rem;
  font-weight: 800;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.history-card a {
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
}

.node-sidebar .section-heading {
  gap: 8px;
}

.node-sidebar .eyebrow {
  margin: 0 0 4px;
  font-size: 0.68rem;
}

.node-sidebar h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.node-sidebar .ghost-button:not(.panel-close-button) {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.node-sidebar .empty-state {
  padding: 10px;
  border-radius: 10px;
  font-size: 0.78rem;
}


.download-video-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-top: 0;
  padding: 0 16px;
  border: 1px solid var(--node-cta-border);
  border-radius: 12px;
  color: var(--node-cta-text);
  background: var(--node-cta-bg);
  box-shadow: var(--node-cta-shadow);
  font-weight: 600;
  text-decoration: none;
  text-shadow: var(--node-cta-text-shadow);
}

.download-video-button:hover {
  border-color: var(--node-selected-border);
  color: var(--node-cta-text-hover);
  background: var(--node-selected);
  text-shadow: none;
}

.download-video-button .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}
