/*
 * Workflow visual system: a graphite workbench, quiet paper consoles and warm
 * signal lines. Kept last in the cascade so legacy CSS can be retired safely.
 */
:root {
  --workbench-canvas: #eef2f1;
  --workbench-dot: rgba(66, 91, 84, .34);
  --workbench-surface: #fcfbf5;
  --workbench-surface-muted: #f1f2eb;
  --workbench-ink: #1b2a27;
  --workbench-muted: #667772;
  --workbench-line: #ccd6d0;
  --workbench-spruce: #245c4c;
  --workbench-moss: #6f967d;
  --workbench-amber: #d8a842;
  --workbench-amber-soft: #f6dfac;
  --workbench-danger: #9d574b;
  --workbench-shadow: 0 18px 38px rgba(28, 45, 40, .14);
  --workbench-ease: cubic-bezier(.16, 1, .3, 1);
}

/* The app is a tool, not a document viewer. Inputs remain selectable. */
body { color: var(--workbench-ink); background: var(--workbench-canvas); user-select: none; -webkit-user-select: none; }
input, textarea, select, [contenteditable="true"], [contenteditable=""] { user-select: text; -webkit-user-select: text; }

header {
  background: color-mix(in srgb, var(--workbench-surface) 92%, transparent);
  border-color: var(--workbench-line);
}

.workflow-canvas-shell { border-color: var(--workbench-line); background: var(--workbench-surface); }
.workflow-canvas-toolbar { background: color-mix(in srgb, var(--workbench-surface) 94%, var(--workbench-surface-muted)); border-color: var(--workbench-line); }
.workflow-canvas {
  background-color: var(--workbench-canvas);
  background-image: radial-gradient(circle, var(--workbench-dot) 1px, transparent 1.3px);
}

.flow-node { contain: layout paint style; }
.flow-node input, .flow-node select, .flow-node textarea, .flow-node output { color: var(--workbench-ink); }

/* Bare image nodes: the asset remains the node; chrome only appears for state. */
.image-result-node {
  width: fit-content !important;
  height: fit-content !important;
  display: inline-block !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow: visible !important;
}

.image-result-node .result-node-image {
  display: block;
  width: min(206px, 26vw);
  max-width: 100%;
  height: auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: 0 12px 24px rgba(31, 44, 39, .12);
  image-rendering: pixelated;
  transform: translateZ(0);
}

.image-result-node.normal-image-node .result-node-image { width: min(280px, 34vw); image-rendering: auto; }
.image-result-node .image-node-drag-hit {
  position: absolute;
  z-index: 2;
  inset: -10px;
  display: block;
  width: calc(100% + 20px);
  height: calc(100% + 20px);
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none !important;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
  color: transparent;
  font-size: 0;
  line-height: 0;
  cursor: grab;
  touch-action: none;
}
.image-result-node .image-node-drag-hit:active { cursor: grabbing; }
.image-result-node .result-node-image { position: relative; z-index: 1; pointer-events: none; }
.image-result-node .node-port { z-index: 4; }
.image-result-node.selected .result-node-image { outline: 2px solid var(--workbench-amber); outline-offset: 7px; box-shadow: 0 0 0 7px rgba(216, 168, 66, .14), 0 16px 28px rgba(31, 44, 39, .18); }
.image-result-node .node-port { opacity: 0; transition: opacity 150ms ease, transform 150ms ease; }
.image-result-node:hover .node-port, .image-result-node.selected .node-port { opacity: 1; }

/* Reference image becomes a bare source image until it is selected. */
.reference-image-node.is-collapsed {
  width: fit-content !important;
  height: auto !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow: visible !important;
}

.reference-image-node.is-collapsed .image-edit-hero {
  display: block;
  width: min(280px, 34vw) !important;
  height: auto;
  line-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.reference-image-node.is-collapsed .image-edit-source {
  display: block;
  width: min(280px, 34vw);
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: 0 12px 24px rgba(31, 44, 39, .12);
  pointer-events: none;
}

.reference-image-node.is-collapsed.selected .image-edit-source { outline: 2px solid var(--workbench-amber); outline-offset: 7px; box-shadow: 0 0 0 7px rgba(216, 168, 66, .14), 0 16px 28px rgba(31, 44, 39, .18); }
.reference-image-node.is-collapsed .node-port { opacity: 0; }
.reference-image-node.is-collapsed:hover .node-port, .reference-image-node.is-collapsed.selected .node-port { opacity: 1; }
.reference-image-node.is-collapsed .node-drag-strip { display: none; }

/* Expanded prompt editor: source image floats above a calm control console. */
.reference-image-node:not(.is-collapsed) {
  width: 420px;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.reference-image-node:not(.is-collapsed) .image-edit-hero {
  display: block;
  width: 236px;
  margin: 0 auto -18px;
  padding: 0;
  position: relative;
  z-index: 3;
  border: 3px solid var(--workbench-amber);
  border-radius: 20px 20px 8px 8px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 18px 30px rgba(31, 44, 39, .18);
}

.reference-image-node:not(.is-collapsed) .image-edit-source { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; }
.image-edit-details { position: relative; z-index: 2; }
.node-drag-strip {
  position: absolute;
  z-index: 8;
  top: 8px;
  left: 50%;
  width: 54px;
  height: 8px;
  border-radius: 99px;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--workbench-moss) 34%, transparent);
  cursor: grab;
  touch-action: none;
}
.node-drag-strip:active { cursor: grabbing; }
.node-prompt-console {
  display: grid;
  gap: 12px;
  padding: 42px 16px 16px;
  background: var(--workbench-surface);
  border: 2px solid var(--workbench-line);
  border-radius: 20px;
  box-shadow: var(--workbench-shadow);
}

.node-reference-deck { position: relative; z-index: 4; }
.reference-image-node:not(.is-collapsed) .node-reference-deck { margin: 0 34px -26px; }
.normal-image-generation-node .node-reference-deck { margin: 0 12px -24px; position: relative; z-index: 2; }
.node-reference-deck .node-reference-panel {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
}
.node-reference-deck .node-reference-panel > strong { display: none; }
.node-reference-deck .node-reference-grid { display: flex; gap: 8px; justify-content: center; }
.node-reference-deck .reference-tile { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 7px; background: var(--workbench-surface); box-shadow: 0 8px 16px rgba(31, 44, 39, .14); }
.node-reference-deck .reference-add { border: 1px dashed var(--workbench-moss); color: var(--workbench-spruce); }

.normal-image-generation-node {
  width: 420px;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.normal-image-generation-node > header { display: none; }
.normal-image-generation-node .node-prompt-console { padding-top: 44px; }
.normal-image-generation-node .node-prompt-console:before {
  content: "新图像";
  display: block;
  margin: -24px 0 2px;
  color: var(--workbench-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
}

.node-prompt { position: relative; gap: 7px; }
.node-prompt textarea { min-height: 126px; padding: 13px 82px 13px 13px; border-color: var(--workbench-line); border-radius: 10px; background: var(--workbench-surface-muted); }
.node-prompt textarea:focus { border-color: var(--workbench-moss); box-shadow: 0 0 0 3px rgba(111, 150, 125, .16); outline: 0; }
.node-prompt .polish-node { position: absolute; right: 9px; top: 31px; padding: 7px 9px; border-radius: 7px; font-size: 12px; }
.image-edit-options { grid-template-columns: 1.1fr 1fr .8fr !important; gap: 8px; }
.image-edit-options label { gap: 4px; color: var(--workbench-muted); font-size: 11px; }
.image-edit-options output, .image-edit-options select { min-height: 34px; padding: 7px 8px; border-color: var(--workbench-line); border-radius: 7px; background: var(--workbench-surface-muted); }
.node-prompt-console .generate-node { min-height: 42px; border-radius: 8px; }

/* Normal-image editor: keep the source asset clear and place its controls in
   one compact horizontal console beneath it, never beside or over the image. */
.reference-image-node:not(.is-collapsed) { width: 580px; }
.reference-image-node:not(.is-collapsed) {
  display: block !important;
  grid-template-columns: none !important;
  column-gap: 0 !important;
}
.reference-image-node:not(.is-collapsed) .image-edit-hero,
.reference-image-node:not(.is-collapsed) .image-edit-details {
  grid-column: auto !important;
  grid-row: auto !important;
}
.reference-image-node:not(.is-collapsed) .image-edit-details { display: block !important; min-width: 0; }
.reference-image-node:not(.is-collapsed) .node-prompt-console {
  grid-template-columns: minmax(0, 1fr) 164px;
  grid-template-areas:
    "prompt prompt"
    "options action";
  align-items: end;
  padding: 40px 18px 16px;
}
.reference-image-node:not(.is-collapsed) .image-edit-prompt { grid-area: prompt; }
.reference-image-node:not(.is-collapsed) .image-edit-options { grid-area: options; }
.reference-image-node:not(.is-collapsed) .generate-node {
  grid-area: action;
  width: 100%;
  min-height: 38px;
  margin: 0;
}
.reference-image-node:not(.is-collapsed) .node-prompt textarea { min-height: 88px; }

/* Structural reset for the normal-image reference editor. Earlier canvas
   styles used a two-column grid; this explicit flex stack prevents its
   reference slots and prompt controls being laid out as detached islands. */
#workflow-nodes > .reference-image-node:not(.is-collapsed) {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 580px !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-details {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  position: relative !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-reference-deck {
  width: calc(100% - 68px) !important;
  margin: 0 34px -26px !important;
  position: relative !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-prompt-console {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Ports are part of the node contract, not hover-only decoration.  They remain
   fully visible and sit above transparent image hit areas. */
.image-result-node .node-port,
.reference-image-node .node-port {
  opacity: 1 !important;
  z-index: 10 !important;
}
.image-result-node .node-port-in,
.reference-image-node .node-port-in { left: -15px !important; }
.image-result-node .node-port-out,
.reference-image-node .node-port-out { right: -15px !important; }

.reference-image-node.will-expand .image-edit-hero { animation: prompt-hero-rise 320ms var(--workbench-ease) both; }
.reference-image-node.will-expand .image-edit-details { animation: prompt-console-unfold 340ms var(--workbench-ease) both; transform-origin: top center; }
@keyframes prompt-hero-rise { from { opacity: .35; transform: translateY(16px) scale(.92); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes prompt-console-unfold { from { opacity: 0; transform: translateY(-14px) scaleY(.88); } to { opacity: 1; transform: translateY(0) scaleY(1); } }

/* One floating cut action is reliable and cheap even on a dense graph. */
.workflow-link-hit { stroke: transparent; stroke-width: 26px; fill: none; pointer-events: stroke; cursor: crosshair; }
.connection-cut-control { display: none; }
.connection-cut-float {
  position: absolute;
  z-index: 18;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 1px solid var(--workbench-amber);
  border-radius: 50%;
  background: var(--workbench-surface);
  color: var(--workbench-spruce);
  box-shadow: 0 8px 18px rgba(31, 44, 39, .22);
}

body.workflow-dark-mode {
  --workbench-canvas: #111618;
  --workbench-dot: rgba(214, 228, 220, .20);
  --workbench-surface: #20282a;
  --workbench-surface-muted: #171e20;
  --workbench-ink: #edf3ef;
  --workbench-muted: #a7b6af;
  --workbench-line: #40504c;
  --workbench-spruce: #95c3a1;
  --workbench-moss: #6f967d;
  --workbench-amber: #dcb65d;
  --workbench-amber-soft: #493d24;
  --workbench-danger: #e09a8e;
  --workbench-shadow: 0 20px 42px rgba(0, 0, 0, .36);
  background: #0d1112 !important;
  color: var(--workbench-ink);
}

body.workflow-dark-mode header,
body.workflow-dark-mode .workflow-canvas-toolbar,
body.workflow-dark-mode .workbench-menu,
body.workflow-dark-mode .panel,
body.workflow-dark-mode dialog { background: #151b1d !important; border-color: var(--workbench-line) !important; }
body.workflow-dark-mode .wide,
body.workflow-dark-mode .workflow-canvas-shell { background: #0d1112 !important; }
body.workflow-dark-mode .workflow-canvas {
  background-color: var(--workbench-canvas) !important;
  background-image: radial-gradient(circle, var(--workbench-dot) .85px, transparent 1.18px) !important;
}
body.workflow-dark-mode .flow-node,
body.workflow-dark-mode .node-prompt-console { color: var(--workbench-ink) !important; }
body.workflow-dark-mode .node-prompt-console,
body.workflow-dark-mode .node-reference-deck .reference-tile,
body.workflow-dark-mode .connection-cut-float { background: var(--workbench-surface) !important; border-color: var(--workbench-line) !important; }
body.workflow-dark-mode .flow-node input,
body.workflow-dark-mode .flow-node select,
body.workflow-dark-mode .flow-node textarea,
body.workflow-dark-mode .flow-node output,
body.workflow-dark-mode .image-edit-options output,
body.workflow-dark-mode .image-edit-options select { background: var(--workbench-surface-muted) !important; color: var(--workbench-ink) !important; border-color: var(--workbench-line) !important; }
body.workflow-dark-mode .image-result-node { background: transparent !important; }
body.workflow-dark-mode .workflow-link { stroke: #d6b46d !important; }
body.workflow-dark-mode .workflow-link-bubble { fill: #f5df9f !important; }
body.workflow-dark-mode .connection-cut-float { color: var(--workbench-amber); }

/* The prompt console deliberately has no redundant title chrome. */
.normal-image-generation-node .node-prompt-console::before { content: none !important; display: none !important; }

/* Light mode keeps the navigation as a readable paper rail, not faded chrome. */
body:not(.workflow-dark-mode) > header {
  background: linear-gradient(180deg, #fbfaf5 0%, #f2f3ed 100%) !important;
  border-right: 1px solid #d5ddd6 !important;
  box-shadow: 10px 0 26px rgba(42, 61, 53, .08) !important;
  color: var(--workbench-ink) !important;
}
body:not(.workflow-dark-mode) > header .workbench-switch {
  background: #f5f6ef !important;
  border: 1px solid #cbd7cf !important;
  box-shadow: none !important;
}
body:not(.workflow-dark-mode) > header .workbench-switch-copy small,
body:not(.workflow-dark-mode) > header .workbench-switch-copy em { color: #74837b !important; opacity: 1 !important; }
body:not(.workflow-dark-mode) > header .workbench-switch-copy b { color: #1e4035 !important; opacity: 1 !important; }
body:not(.workflow-dark-mode) > header .workbench-switch-mark { color: #4d7461 !important; }
body:not(.workflow-dark-mode) > header .nav { color: #456256 !important; opacity: 1 !important; }
body:not(.workflow-dark-mode) > header .nav::before { background: #8fa497 !important; opacity: 1 !important; }
body:not(.workflow-dark-mode) > header .nav:hover { background: #e8f0e8 !important; color: #1f4e3c !important; }
body:not(.workflow-dark-mode) > header .nav.active { background: #ffffff !important; color: #1a4536 !important; box-shadow: 0 8px 18px rgba(47, 73, 60, .12) !important; }
body:not(.workflow-dark-mode) > header .nav.active::before { background: var(--workbench-amber) !important; }

body.workflow-dark-mode > header { background: linear-gradient(180deg, #0d1414 0%, #121c1b 100%) !important; border-right-color: #2c3d38 !important; }
body.workflow-dark-mode > header .workbench-switch { background: #172120 !important; border-color: #394c45 !important; }
body.workflow-dark-mode > header .workbench-switch-copy b { color: #f0f4f0 !important; }
body.workflow-dark-mode > header .workbench-switch-copy small,
body.workflow-dark-mode > header .workbench-switch-copy em { color: #9db3a7 !important; opacity: 1 !important; }
body.workflow-dark-mode > header .nav { color: #afc3b8 !important; opacity: 1 !important; }
body.workflow-dark-mode > header .nav:hover { background: #1e2c29 !important; color: #f4f8f3 !important; }
body.workflow-dark-mode > header .nav.active { background: #e8eee7 !important; color: #173b2f !important; }
header, header * { user-select: none; -webkit-user-select: none; }

/* A result image is the node itself; source card paint never leaks through. */
#workflow-nodes > .flow-node.image-result-node,
#workflow-nodes > .flow-node.eightway-node {
  background: transparent !important;
  background-image: none !important;
  border: 0 !important;
  box-shadow: none !important;
}
.flow-node.image-result-node .node-port,
.flow-node.eightway-node .node-port,
.reference-image-node.is-collapsed .node-port {
  width: 30px !important;
  height: 30px !important;
}
.flow-node.image-result-node .node-port-in,
.flow-node.eightway-node .node-port-in,
.reference-image-node.is-collapsed .node-port-in { left: -36px !important; }
.flow-node.image-result-node .node-port-out,
.flow-node.eightway-node .node-port-out,
.reference-image-node.is-collapsed .node-port-out { right: -36px !important; }

@media (max-width: 820px) {
  .normal-image-generation-node, .reference-image-node:not(.is-collapsed) { width: 340px; }
  .image-result-node .result-node-image, .reference-image-node.is-collapsed .image-edit-source { width: min(228px, 62vw); }
}

/* Compact workbench selector: the active workspace is the only persistent detail. */
body:not(.workflow-dark-mode) > header .workbench-switch {
  grid-template-columns: 38px minmax(0, 1fr) 18px !important;
  min-height: 62px !important;
  gap: 9px !important;
  padding: 8px 10px !important;
  border-color: rgba(45, 89, 68, .18) !important;
  border-radius: 10px !important;
  background: rgba(250, 251, 246, .92) !important;
  box-shadow: 0 1px 2px rgba(21, 45, 34, .04) !important;
}
body:not(.workflow-dark-mode) > header .workbench-switch:hover,
body:not(.workflow-dark-mode) > header .workbench-switch[aria-expanded="true"] {
  border-color: rgba(63, 116, 83, .42) !important;
  background: #fffef9 !important;
  box-shadow: 0 5px 14px rgba(21, 45, 34, .09) !important;
}
body:not(.workflow-dark-mode) > header .workbench-switch-glyph {
  width: 36px !important;
  height: 36px !important;
  padding: 5px !important;
  border-radius: 9px !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .42), 0 3px 8px rgba(92, 72, 25, .16) !important;
}
body:not(.workflow-dark-mode) > header .workbench-switch-copy {
  display: grid !important;
  gap: 1px !important;
  min-width: 0 !important;
}
body:not(.workflow-dark-mode) > header .workbench-switch-copy small {
  color: #718078 !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: .08em !important;
  line-height: 1.2 !important;
}
body:not(.workflow-dark-mode) > header .workbench-switch-copy b {
  overflow: visible !important;
  color: #173b31 !important;
  font-size: 16px !important;
  font-weight: 750 !important;
  letter-spacing: -.02em !important;
  line-height: 1.25 !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}
body:not(.workflow-dark-mode) > header .workbench-switch-mark {
  font-size: 13px !important;
  font-weight: 700 !important;
}
body.workflow-dark-mode > header .workbench-switch {
  grid-template-columns: 38px minmax(0, 1fr) 18px !important;
  min-height: 62px !important;
  gap: 9px !important;
  padding: 8px 10px !important;
}
body.workflow-dark-mode > header .workbench-switch-copy small {
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: .08em !important;
  line-height: 1.2 !important;
}
body.workflow-dark-mode > header .workbench-switch-copy b {
  overflow: visible !important;
  font-size: 16px !important;
  font-weight: 750 !important;
  letter-spacing: -.02em !important;
  line-height: 1.25 !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}

/* The popover is a concise workbench picker, not a second product description. */
body:not(.workflow-dark-mode) > header .workbench-menu {
  top: calc(100% + 8px) !important;
  padding: 6px !important;
  border-color: rgba(45, 89, 68, .16) !important;
  border-radius: 12px !important;
  background: #fffef9 !important;
  box-shadow: 0 12px 28px rgba(21, 45, 34, .14), 0 1px 3px rgba(21, 45, 34, .06) !important;
}
body:not(.workflow-dark-mode) > header .workbench-menu button {
  grid-template-columns: 30px minmax(0, 1fr) 18px !important;
  min-height: 46px !important;
  gap: 9px !important;
  margin: 0 !important;
  padding: 7px 8px !important;
  border-radius: 8px !important;
}
body:not(.workflow-dark-mode) > header .workbench-menu button + button {
  margin-top: 3px !important;
}
body:not(.workflow-dark-mode) > header .workbench-menu button:hover {
  background: #f1f6ef !important;
}
body:not(.workflow-dark-mode) > header .workbench-menu button.active {
  border-color: rgba(77, 132, 93, .3) !important;
  background: #e8f2e7 !important;
}
body:not(.workflow-dark-mode) > header .workbench-menu button > span:nth-child(2) {
  display: block !important;
  min-width: 0 !important;
}
body:not(.workflow-dark-mode) > header .workbench-menu b {
  overflow: visible !important;
  color: #234a38 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: -.01em !important;
  line-height: 1.2 !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}
body:not(.workflow-dark-mode) > header .workbench-menu strong {
  font-size: 15px !important;
  font-weight: 700 !important;
}
body:not(.workflow-dark-mode) > header .workbench-option-icon {
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
}
body.workflow-dark-mode > header .workbench-menu {
  top: calc(100% + 8px) !important;
  padding: 6px !important;
  border-radius: 12px !important;
}
body.workflow-dark-mode > header .workbench-menu button {
  grid-template-columns: 30px minmax(0, 1fr) 18px !important;
  min-height: 46px !important;
  gap: 9px !important;
  margin: 0 !important;
  padding: 7px 8px !important;
  border-radius: 8px !important;
}
body.workflow-dark-mode > header .workbench-menu button + button {
  margin-top: 3px !important;
}
body.workflow-dark-mode > header .workbench-menu b {
  overflow: visible !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: -.01em !important;
  line-height: 1.2 !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}

@media (prefers-reduced-motion: reduce) {
  .reference-image-node.will-expand .image-edit-hero,
  .reference-image-node.will-expand .image-edit-details { animation: none; }
  .workflow-link-bubble { display: none; }
}

/* An imported image expands as one node: the editor starts from the image's
   lower edge instead of becoming a second, offset work area.  These final
   rules intentionally override the earlier wide-console experiment. */
#workflow-nodes > .reference-image-node:not(.is-collapsed) {
  width: 320px !important;
  align-items: stretch !important;
}
/* Expanding an imported image must not create a second image card.  The
   existing bare source image stays exactly as the node visual; only its
   controls grow beneath its real lower edge. */
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-hero {
  width: min(280px, 34vw) !important;
  margin: 0 auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: visible !important;
  background: transparent !important;
  box-shadow: none !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-source {
  width: min(280px, 34vw) !important;
  height: auto !important;
  aspect-ratio: auto !important;
  object-fit: initial !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-details,
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-reference-deck,
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-prompt-console {
  width: 320px !important;
  box-sizing: border-box !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-reference-deck {
  margin: 0 !important;
  padding: 10px 12px 0;
  background: var(--workbench-surface);
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-reference-grid {
  justify-content: flex-start;
  gap: 6px;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-prompt-console {
  padding: 12px !important;
  border-radius: 0 0 12px 12px;
}

/* Expanded controls must not move the data ports.  They belong to the source
   image, so keep the full circular targets at that image's midpoint. */
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-port {
  top: var(--source-port-y, 120px) !important;
  z-index: 20 !important;
  width: 30px !important;
  height: 30px !important;
  opacity: 1 !important;
  transform: translateY(-50%) scale(1) !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-port-in { left: -38px !important; }
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-port-out { right: -38px !important; }

/* Links stay behind nodes.  Without explicit layers the SVG can paint above
   a transparent image node and hide its connection ports. */
#workflow-links { z-index: 0 !important; }
#workflow-nodes { z-index: 2 !important; }
#workflow-nodes > .reference-image-node { z-index: 3; }
#workflow-nodes > .reference-image-node.selected { z-index: 4; }
/* The shared performance rule uses contain: content on nodes.  This node has
   ports intentionally outside its image bounds, so it must opt out or the
   browser clips those ports even though their styles and events still exist. */
#workflow-nodes > .reference-image-node,
#workflow-nodes > .image-result-node,
#workflow-nodes > .eightway-node { contain: none !important; }

/* Ports are selection affordances, not permanent decoration. */
#workflow-nodes > .flow-node .node-port {
  opacity: 0 !important;
  pointer-events: none;
}
#workflow-nodes > .flow-node.selected .node-port,
.workflow-canvas.connecting #workflow-nodes > .flow-node .node-port-in,
.workflow-canvas.connecting #workflow-nodes > .flow-node.selected .node-port-out {
  opacity: 1 !important;
  pointer-events: auto;
}

/* Clicking an imported picture never replaces or resizes that picture.  The
   editor is a dock attached below the original node, outside its visual box. */
body #workflow-nodes > .reference-image-node:not(.is-collapsed) {
  display: block !important;
  width: min(280px, 34vw) !important;
  height: auto !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  animation: none !important;
}
body.workflow-dark-mode #workflow-nodes > .reference-image-node:not(.is-collapsed),
body.workflow-dark-mode #workflow-nodes > .reference-image-node:not(.is-collapsed).selected {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body #workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-hero,
body #workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-source {
  display: block !important;
  width: min(280px, 34vw) !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  animation: none !important;
  transition: none !important;
}
body #workflow-nodes > .reference-image-node:not(.is-collapsed).selected .image-edit-source {
  outline: 2px solid var(--workbench-amber);
  outline-offset: 7px;
}
body #workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-details {
  position: absolute !important;
  top: calc(100% + 18px) !important;
  left: 50% !important;
  z-index: 12 !important;
  display: flex !important;
  flex-direction: column !important;
  width: 720px !important;
  max-width: calc(100vw - 64px) !important;
  margin: 0 !important;
  overflow: visible !important;
  border: 1px solid var(--workbench-line) !important;
  border-radius: 14px !important;
  background: var(--workbench-surface) !important;
  box-shadow: var(--workbench-shadow) !important;
  transform: translateX(-50%) !important;
  transform-origin: top center;
  animation: imported-prompt-dock-open 220ms var(--workbench-ease) both !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-reference-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--workbench-line);
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-reference-deck {
  width: auto !important;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0;
  background: transparent !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-reference-panel,
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-reference-grid {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-reference-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 46px);
  justify-content: start;
  gap: 6px;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-reference-deck .reference-tile {
  width: 46px;
  height: 42px;
  flex: none;
  border-radius: 5px;
  box-shadow: none;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-prompt-console {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 156px !important;
  grid-template-areas:
    "prompt prompt"
    "options action" !important;
  gap: 10px 12px !important;
  width: auto !important;
  padding: 14px 16px 14px !important;
  border: 0 !important;
  border-radius: 0 0 14px 14px !important;
  background: transparent !important;
  box-shadow: none !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-prompt {
  display: block;
  gap: 0;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-prompt textarea {
  min-height: 224px;
  max-height: 440px;
  overflow-y: hidden;
  padding: 14px 15px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--workbench-muted) 48%, transparent) transparent;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-prompt textarea::-webkit-scrollbar {
  width: 8px;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .node-prompt textarea::-webkit-scrollbar-thumb {
  border: 2px solid var(--workbench-surface-muted);
  border-radius: 999px;
  background: color-mix(in srgb, var(--workbench-muted) 48%, transparent);
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-polish {
  position: static;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 5px 8px;
  border-color: var(--workbench-line);
  background: var(--workbench-surface-muted);
  color: var(--workbench-muted);
  box-shadow: none;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-options {
  grid-template-columns: 1.15fr 1fr .85fr !important;
  align-items: end;
  gap: 6px !important;
  margin: 0 !important;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-options > output,
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-options > select {
  display: block;
  width: 100%;
  box-sizing: border-box;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-options output,
#workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-options select {
  min-height: 30px;
  padding: 4px 7px;
}
#workflow-nodes > .reference-image-node:not(.is-collapsed) .generate-node {
  align-self: end;
  min-height: 30px !important;
  padding: 5px 10px !important;
}
#workflow-nodes .animation-frame-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}
@media (max-width: 820px) {
  #workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-details {
    width: min(94vw, 620px) !important;
  }
  #workflow-nodes > .reference-image-node:not(.is-collapsed) .node-reference-deck {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--workbench-line);
    border-radius: 14px 14px 0 0;
  }
  #workflow-nodes > .reference-image-node:not(.is-collapsed) .node-prompt-console {
    border-radius: 0 0 14px 14px !important;
  }
}

/* Animation production: one compact action produces four editable 256×64 direction strips. */
#workflow-nodes .animation-export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#workflow-nodes .animation-export-actions .animation-pixelize {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border-color: #4f8564;
  background: #e8f2e7;
  color: #24583f;
  font-weight: 750;
}

#workflow-nodes .animation-export-actions .animation-pixelize:hover:not(:disabled) {
  background: #dcebdc;
}

#workflow-nodes .animation-export-actions .animation-pixelize:disabled {
  cursor: wait;
  opacity: .78;
}

#workflow-nodes .mini-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: animation-pixel-spin .8s linear infinite;
}

@keyframes animation-pixel-spin {
  to { transform: rotate(360deg); }
}

#workflow-nodes > .animation-strip-node {
  width: 336px !important;
  height: auto !important;
  min-height: 104px !important;
  contain: layout style !important;
  overflow: visible !important;
}

#workflow-nodes .animation-strip-art {
  position: relative;
  display: grid;
  grid-template-rows: 80px auto;
  width: 320px;
  min-width: 320px;
  margin: 0 auto;
  overflow: visible;
}

#workflow-nodes .animation-strip-image {
  display: block;
  width: 320px !important;
  min-width: 320px !important;
  max-width: none !important;
  height: 80px !important;
  min-height: 80px !important;
  max-height: none !important;
  aspect-ratio: 4 / 1 !important;
  object-fit: fill !important;
  object-position: center !important;
  overflow: visible !important;
  background: repeating-conic-gradient(#e4ebe2 0 25%, #f9fbf8 0 50%) 50% / 10px 10px;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 10px rgba(34, 48, 41, .16));
  pointer-events: none;
}

#workflow-nodes .missing-asset-notice {
  display: none;
  box-sizing: border-box;
  width: 320px;
  height: 80px;
  padding: 15px 18px;
  border: 1px dashed #d29358;
  border-radius: 8px;
  background: #fff7ea;
  color: #9a5629;
  text-align: center;
  align-content: center;
}

#workflow-nodes .missing-asset-notice strong,
#workflow-nodes .missing-asset-notice span {
  display: block;
}

#workflow-nodes .missing-asset-notice strong {
  margin-bottom: 4px;
  font-size: 14px;
}

#workflow-nodes .missing-asset-notice span {
  font-size: 10px;
}

#workflow-nodes > .animation-strip-node.is-missing-asset .animation-strip-image {
  display: none;
}

#workflow-nodes > .animation-strip-node.is-missing-asset .missing-asset-notice {
  display: block;
}

#workflow-nodes > .animation-strip-node .image-node-drag-hit {
  inset: -8px !important;
  width: calc(100% + 16px) !important;
  height: calc(100% + 16px) !important;
}

#workflow-nodes .animation-strip-art figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 320px;
  margin-top: 6px;
  padding: 0 2px;
  color: #587064;
  font-size: 10px;
  line-height: 1.2;
}

#workflow-nodes .animation-strip-art figcaption b {
  color: #255840;
  font-size: 12px;
}

#workflow-nodes > .animation-strip-node.selected .animation-strip-image {
  outline: 3px solid rgba(208, 158, 54, .88);
  outline-offset: 4px;
}

#workflow-nodes > .animation-strip-node .node-port {
  top: 40px !important;
}

body.workflow-dark-mode #workflow-nodes .animation-export-actions .animation-pixelize {
  border-color: #6e9b80;
  background: #1d3a2e;
  color: #b8ddc3;
}

body.workflow-dark-mode #workflow-nodes .animation-export-actions .animation-pixelize:hover:not(:disabled) {
  background: #244838;
}

body.workflow-dark-mode #workflow-nodes .animation-strip-image {
  background: repeating-conic-gradient(#28342f 0 25%, #1d2823 0 50%) 50% / 10px 10px;
}

body.workflow-dark-mode #workflow-nodes .animation-strip-art figcaption {
  color: #9db0a6;
}

body.workflow-dark-mode #workflow-nodes .animation-strip-art figcaption b {
  color: #cae1d0;
}

@keyframes imported-prompt-dock-open {
  from { opacity: 0; transform: translate(-50%, -8px) scale(.985); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  body #workflow-nodes > .reference-image-node:not(.is-collapsed) .image-edit-details {
    animation: none !important;
  }
}

/* Right-click "new image" node: prompt chamber, four reference sockets, then
   a compact control base.  The silhouette follows the user's stacked device
   reference while keeping every form control readable and reachable. */
body #workflow-nodes > .normal-image-generation-node {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 500px !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body.workflow-dark-mode #workflow-nodes > .normal-image-generation-node,
body.workflow-dark-mode #workflow-nodes > .normal-image-generation-node.selected {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#workflow-nodes > .normal-image-generation-node .node-drag-strip {
  top: 12px;
  z-index: 8;
}
#workflow-nodes > .normal-image-generation-node .normal-generation-prompt {
  position: relative;
  z-index: 2;
  width: 372px;
  min-height: 190px;
  padding: 26px 20px 42px;
  box-sizing: border-box;
  border: 1px solid var(--workbench-line);
  border-radius: 28px 28px 12px 12px;
  background: var(--workbench-surface);
  box-shadow: var(--workbench-shadow);
}
#workflow-nodes > .normal-image-generation-node .normal-generation-prompt .node-prompt {
  display: block;
  margin: 0;
}
#workflow-nodes > .normal-image-generation-node .normal-generation-prompt textarea {
  min-height: 126px;
  resize: vertical;
}
#workflow-nodes > .normal-image-generation-node .normal-generation-reference {
  position: relative !important;
  z-index: 5 !important;
  width: 314px !important;
  margin: -30px 0 -30px !important;
  padding: 0 !important;
  background: transparent !important;
}
#workflow-nodes > .normal-image-generation-node .normal-generation-reference .node-reference-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
#workflow-nodes > .normal-image-generation-node .normal-generation-reference .reference-tile {
  width: auto;
  height: 66px;
  aspect-ratio: auto;
  border: 1px solid var(--workbench-line);
  border-radius: 8px;
  background: var(--workbench-surface-muted);
  box-shadow: 0 8px 16px rgba(31, 44, 39, .16);
}
#workflow-nodes > .normal-image-generation-node .normal-generation-controls {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 14px;
  align-items: end;
  width: 500px;
  min-height: 148px;
  padding: 54px 18px 18px;
  box-sizing: border-box;
  border: 1px solid var(--workbench-line);
  border-radius: 24px;
  background: var(--workbench-surface);
  box-shadow: var(--workbench-shadow);
}
#workflow-nodes > .normal-image-generation-node .normal-generation-controls .image-edit-options {
  display: grid !important;
  grid-template-columns: 1.1fr 1fr .8fr !important;
  grid-area: auto !important;
  gap: 8px;
  min-width: 0;
}
#workflow-nodes > .normal-image-generation-node .normal-generation-controls .generate-node {
  grid-area: auto !important;
  min-height: 38px;
  margin: 0;
  border-radius: 8px;
}
#workflow-nodes > .normal-image-generation-node .node-port {
  top: 50% !important;
}

.animation-config-node .animation-generation-error {
  margin: 10px 0;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--danger, #a34c42) 38%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--danger, #a34c42) 8%, transparent);
  font-size: 12px;
  line-height: 1.55;
}

.animation-config-node.error .generate-animation {
  width: 100%;
}

.animation-config-node .animation-review-ready {
  margin: 10px 0;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--workbench-amber) 46%, var(--workbench-line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--workbench-amber-soft) 42%, var(--workbench-surface));
  color: var(--workbench-spruce);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
}

body:has(#animation-frame-review-dialog[open]) > header {
  pointer-events: none;
}

#animation-frame-review-dialog {
  position: fixed;
  inset: 0;
  width: min(1180px, calc(100vw - 32px));
  max-width: none;
  height: min(820px, calc(100vh - 32px));
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--workbench-spruce) 20%, transparent);
  border-radius: 16px;
  background: var(--workbench-surface);
  color: var(--workbench-ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7), 0 28px 80px rgba(24, 46, 37, .28);
}

#animation-frame-review-dialog::backdrop {
  background: rgba(25, 43, 36, .66);
  backdrop-filter: blur(3px);
}

#animation-frame-review-dialog form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
}

#animation-frame-review-dialog .animation-review-header {
  position: static;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0;
  padding: 20px 24px 16px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--workbench-line) 70%, transparent);
  background: var(--workbench-surface);
}

.animation-review-header > div > span {
  display: block;
  margin-bottom: 4px;
  color: var(--workbench-moss);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .08em;
}

.animation-review-header h2 {
  margin: 0;
  color: var(--workbench-spruce);
  font-size: 22px;
  font-weight: 760;
  line-height: 1.2;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.animation-review-header p {
  margin: 7px 0 0;
  color: var(--workbench-muted);
  font-size: 13px;
  line-height: 1.5;
}

.animation-review-header > button {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--workbench-line) 70%, transparent);
  border-radius: 9px;
  background: var(--workbench-surface-muted);
  color: var(--workbench-spruce);
  font-size: 22px;
}

.animation-review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 0;
}

.animation-review-board-panel,
.animation-review-source-panel {
  min-width: 0;
  min-height: 0;
  padding: 18px 20px;
  overflow: auto;
}

.animation-review-source-panel {
  border-left: 1px solid color-mix(in srgb, var(--workbench-line) 72%, transparent);
  background: color-mix(in srgb, var(--workbench-surface-muted) 72%, var(--workbench-surface));
}

.animation-review-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.animation-review-section-heading b {
  display: block;
  color: var(--workbench-ink);
  font-size: 14px;
  font-weight: 750;
}

.animation-review-section-heading small {
  display: block;
  margin-top: 3px;
  color: var(--workbench-muted);
  font-size: 11px;
  line-height: 1.4;
}

#animation-review-count {
  flex: 0 0 auto;
  color: var(--workbench-danger);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.animation-review-board {
  display: grid;
  gap: 12px;
}

.animation-review-row {
  display: grid;
  grid-template-columns: 44px repeat(4, minmax(92px, 1fr));
  gap: 8px;
  align-items: center;
  min-width: 452px;
}

.animation-review-direction {
  color: var(--workbench-spruce);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.animation-review-frame,
.animation-review-source-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--workbench-line) 90%, transparent);
  border-radius: 8px;
  background: repeating-conic-gradient(#e5e8e6 0 25%, #f7f8f7 0 50%) 50% / 12px 12px;
  color: var(--workbench-ink);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
  transition: transform 140ms var(--workbench-ease), border-color 140ms ease, box-shadow 140ms ease;
}

.animation-review-frame {
  aspect-ratio: 1;
}

.animation-review-frame:hover,
.animation-review-source-frame:hover {
  border-color: var(--workbench-moss);
}

.animation-review-frame:focus-visible,
.animation-review-source-frame:focus-visible,
.animation-review-sheet-tabs button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--workbench-amber) 34%, transparent);
  outline-offset: 2px;
}

.animation-review-frame:active,
.animation-review-source-frame:active,
.animation-review-header > button:active,
.animation-review-actions button:active {
  transform: scale(.97);
}

.animation-review-frame.is-target {
  border-color: var(--workbench-amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--workbench-amber) 24%, transparent);
}

.animation-review-frame.is-issue {
  border-color: color-mix(in srgb, var(--workbench-danger) 65%, var(--workbench-line));
}

.animation-review-frame.is-manual {
  border-color: var(--workbench-spruce);
}

.animation-review-frame canvas,
.animation-review-source-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}

.animation-review-frame-label,
.animation-review-source-label {
  position: absolute;
  right: 5px;
  bottom: 5px;
  min-width: 18px;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(24, 44, 35, .76);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.animation-review-frame-status {
  position: absolute;
  top: 5px;
  left: 5px;
  padding: 3px 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--workbench-danger) 88%, transparent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.animation-review-frame.is-manual .animation-review-frame-status {
  background: color-mix(in srgb, var(--workbench-spruce) 88%, transparent);
}

.animation-review-raw-sheet {
  display: block;
  width: 100%;
  max-height: 238px;
  margin-bottom: 12px;
  object-fit: contain;
  background: repeating-conic-gradient(#e5e8e6 0 25%, #f7f8f7 0 50%) 50% / 12px 12px;
  image-rendering: pixelated;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.animation-review-sheet-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
}

.animation-review-sheet-tabs button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--workbench-line) 86%, transparent);
  border-radius: 7px;
  background: var(--workbench-surface);
  color: var(--workbench-muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.animation-review-sheet-tabs button.active {
  border-color: var(--workbench-spruce);
  color: var(--workbench-spruce);
  background: color-mix(in srgb, var(--workbench-moss) 10%, var(--workbench-surface));
}

.animation-review-source-pool {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.animation-review-source-frame {
  aspect-ratio: 1;
}

.animation-review-source-frame.is-issue {
  opacity: .58;
}

.animation-review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
  border-top: 1px solid color-mix(in srgb, var(--workbench-line) 72%, transparent);
  background: var(--workbench-surface);
}

.animation-review-actions p {
  max-width: 620px;
  margin: 0;
  color: var(--workbench-muted);
  font-size: 12px;
  line-height: 1.45;
}

.animation-review-actions > div {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.animation-review-actions button {
  min-height: 42px;
  margin: 0;
  padding: 9px 14px;
  border-radius: 8px;
}

.animation-review-actions button:disabled {
  cursor: wait;
  opacity: .58;
}

body.workflow-dark-mode #animation-frame-review-dialog,
body.workflow-dark-mode #animation-frame-review-dialog .animation-review-header,
body.workflow-dark-mode #animation-frame-review-dialog .animation-review-actions {
  background: #151c1a;
  color: #edf2ed;
  border-color: rgba(211, 232, 218, .14);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08);
}

body.workflow-dark-mode #animation-frame-review-dialog h2,
body.workflow-dark-mode #animation-frame-review-dialog b {
  color: #edf2ed;
}

body.workflow-dark-mode #animation-frame-review-dialog p,
body.workflow-dark-mode #animation-frame-review-dialog small {
  color: #a9b9b0;
}

body.workflow-dark-mode .animation-review-source-panel {
  background: #111815;
  border-color: rgba(211, 232, 218, .12);
}

body.workflow-dark-mode .animation-review-sheet-tabs button {
  background: #1b2521;
  color: #b5c3bb;
  border-color: rgba(211, 232, 218, .14);
}

@media (max-width: 820px) {
  #animation-frame-review-dialog {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
  }
  #animation-frame-review-dialog .animation-review-header {
    padding: 16px;
  }
  .animation-review-layout {
    display: block;
    overflow-y: auto;
  }
  .animation-review-board-panel,
  .animation-review-source-panel {
    overflow: visible;
    padding: 14px 16px;
  }
  .animation-review-board-panel {
    overflow-x: auto;
  }
  .animation-review-source-panel {
    border-top: 1px solid color-mix(in srgb, var(--workbench-line) 72%, transparent);
    border-left: 0;
  }
  .animation-review-raw-sheet {
    max-height: 190px;
  }
  .animation-review-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
  }
  .animation-review-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .animation-review-actions .primary {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .animation-review-frame,
  .animation-review-source-frame {
    transition: border-color 120ms ease, box-shadow 120ms ease;
  }
}

@media (max-width: 820px) {
  body #workflow-nodes > .normal-image-generation-node,
  #workflow-nodes > .normal-image-generation-node .normal-generation-controls {
    width: min(92vw, 500px) !important;
  }
  #workflow-nodes > .normal-image-generation-node .normal-generation-prompt {
    width: min(78vw, 372px);
  }
}
