:root {
  color-scheme: dark;
  --bg: oklch(0.105 0 0);
  --canvas: oklch(0.12 0.004 145);
  --panel: oklch(0.17 0.006 145);
  --panel-raised: oklch(0.225 0.009 145);
  --surface-hover: oklch(0.27 0.011 145);
  --surface-active: oklch(0.3 0.018 145);
  --ink: oklch(0.955 0.008 145);
  --ink-soft: oklch(0.84 0.012 145);
  --muted: oklch(0.72 0.012 145);
  --faint: oklch(0.57 0.012 145);
  --line: oklch(0.34 0.01 145);
  --line-strong: oklch(0.48 0.018 145);
  --primary: oklch(0.68 0.15 145);
  --primary-strong: oklch(0.61 0.16 145);
  --primary-soft: oklch(0.25 0.055 145);
  --blue: oklch(0.68 0.13 240);
  --blue-soft: oklch(0.24 0.05 240);
  --violet: oklch(0.7 0.14 305);
  --violet-soft: oklch(0.25 0.055 305);
  --coral: oklch(0.69 0.15 28);
  --coral-soft: oklch(0.245 0.055 28);
  --amber: oklch(0.76 0.14 85);
  --danger: oklch(0.65 0.18 25);
  --danger-soft: oklch(0.23 0.06 25);
  --white: oklch(1 0 0);
  --shadow-1: 0 3px 8px oklch(0 0 0 / 0.22);
  --shadow-2: 0 6px 14px oklch(0 0 0 / 0.3);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --node-width: 360px;
  --node-label-height: 28px;
  --node-card-border-size: 1px;
  --node-port-center-y: 130px;
  --node-port-size: 22px;
  --node-port-half-size: 11px;
  --node-port-gap: 8px;
  --topbar-height: 58px;
  --library-width: 264px;
  --inspector-width: 320px;
  --asset-width: 360px;
  --agent-width: 520px;
  --z-base: 1;
  --z-floating: 10;
  --z-dropdown: 20;
  --z-drawer: 30;
  --z-scrim: 25;
  --z-toast: 40;
  --z-home: 60;
  font-family: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:not(:disabled),
a,
select {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.svg-sprite {
  position: fixed;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.app-shell[hidden] {
  display: none;
}

.topbar {
  height: var(--topbar-height);
  flex: 0 0 var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: var(--z-floating);
}

.brand-cluster,
.topbar-actions,
.brand,
.workflow-name,
.save-state,
.button,
.icon-button,
.search-field,
.canvas-controls,
.run-log-actions {
  display: flex;
  align-items: center;
}

.brand-cluster {
  min-width: 0;
  gap: 10px;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  gap: 9px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius-sm);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.topbar-divider,
.control-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
  flex: 0 0 1px;
}

.workflow-name {
  min-width: 0;
  gap: 4px;
  border: 0;
  background: transparent;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}

.workflow-name:hover {
  background: var(--surface-hover);
}

.workflow-name span {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-name svg {
  width: 14px;
  transform: rotate(90deg);
  color: var(--muted);
}

.save-state {
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.save-state.dirty .save-dot {
  background: var(--amber);
}

.topbar-actions {
  gap: 8px;
  flex: 0 0 auto;
}

.credit-badge {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.credit-badge svg {
  width: 13px;
  height: 13px;
  color: var(--amber);
}

.button.agent-button {
  color: var(--ink);
  background: var(--surface-hover);
}

.button.agent-button:hover,
.button.agent-button[aria-expanded="true"] {
  color: var(--primary);
  background: var(--primary-soft);
}

.button,
.icon-button,
.text-button,
.zoom-value {
  border: 0;
  background: transparent;
}

.button {
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 650;
  transition: background-color 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}

.button:active,
.icon-button:active,
.library-item:active {
  transform: translateY(1px);
}

.button.primary {
  background: var(--primary-strong);
  color: var(--white);
}

.button.primary:hover {
  background: var(--primary);
}

.button.primary:disabled {
  background: var(--surface-active);
  color: var(--muted);
  cursor: wait;
}

.button.ghost {
  color: var(--ink-soft);
}

.button.ghost:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.button.compact {
  padding: 0 10px;
}

.icon-button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  transition: background-color 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.icon-button[aria-expanded="true"] {
  color: var(--primary);
  background: var(--primary-soft);
}

.workspace-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  position: relative;
}

.node-library,
.inspector,
.asset-panel,
.agent-panel {
  width: var(--library-width);
  min-height: 0;
  overflow: auto;
  background: var(--panel);
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  z-index: var(--z-drawer);
  box-shadow: var(--shadow-2);
  transition: transform 200ms cubic-bezier(.22, 1, .36, 1);
}

.node-library {
  left: 0;
  transform: translateX(-102%);
  border-right: 1px solid var(--line);
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
}

.inspector {
  width: var(--inspector-width);
  right: 0;
  transform: translateX(102%);
  border-left: 1px solid var(--line);
  padding: 18px;
}

.asset-panel {
  width: var(--asset-width);
  left: 0;
  transform: translateX(-102%);
  border-right: 1px solid var(--line);
  padding: 18px 14px 14px;
}

.agent-panel {
  width: var(--agent-width);
  right: 0;
  transform: translateX(102%);
  border-left: 1px solid var(--line);
  padding: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.node-library.open,
.inspector.open,
.asset-panel.open,
.agent-panel.open {
  transform: translateX(0);
}

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

.panel-heading h1,
.panel-heading h2,
.run-log h2 {
  margin: 3px 0 0;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.panel-kicker {
  color: var(--muted);
  font-size: 11px;
}

.search-field {
  height: 38px;
  gap: 8px;
  padding: 0 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
}

.search-field:focus-within {
  border-color: var(--primary);
}

.search-field svg {
  width: 16px;
  flex: 0 0 16px;
}

.search-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.search-field input::placeholder {
  color: var(--muted);
}

kbd {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--panel-raised);
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
}

.library-section {
  margin-top: 18px;
}

.section-label {
  margin: 0 8px 6px;
  color: var(--muted);
  font-size: 11px;
}

.library-item {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 8px;
  text-align: left;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  transition: background-color 150ms ease-out, transform 150ms ease-out;
}

.library-item:hover,
.library-item.search-match {
  background: var(--surface-hover);
}

.library-item > span:nth-child(2) {
  min-width: 0;
}

.library-item strong,
.library-item small {
  display: block;
}

.library-item strong {
  font-size: 12px;
  line-height: 1.45;
}

.catalog-inline-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--ink-soft);
  background: var(--surface-active);
  font-size: 7px;
  font-style: normal;
  vertical-align: 1px;
}

.catalog-inline-badge.new { color: oklch(0.86 0.1 220); background: oklch(0.25 0.06 220); }
.catalog-inline-badge.model { color: oklch(0.84 0.09 200); background: oklch(0.24 0.055 200); }

.library-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-indicator {
  width: 15px;
  color: var(--faint);
}

.library-item:hover .add-indicator {
  color: var(--primary);
}

.node-glyph {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  flex: 0 0 34px;
}

.node-glyph svg {
  width: 17px;
  height: 17px;
}

.node-glyph.text,
.node-glyph.script {
  color: var(--violet);
  background: var(--violet-soft);
}

.node-glyph.image,
.node-glyph.video {
  color: var(--blue);
  background: var(--blue-soft);
}

.node-glyph.smartEdit,
.node-glyph.storyboard {
  color: var(--coral);
  background: var(--coral-soft);
}

.node-glyph.audio,
.node-glyph.director,
.node-glyph.asset,
.node-glyph.upload,
.node-glyph.history {
  color: var(--primary);
  background: var(--primary-soft);
}

.library-footer {
  margin-top: auto;
  display: flex;
  gap: 9px;
  padding: 12px 10px 4px;
  color: var(--muted);
}

.library-footer > svg {
  flex: 0 0 17px;
  width: 17px;
  margin-top: 1px;
}

.library-footer p,
.library-footer strong,
.library-footer span {
  margin: 0;
  display: block;
}

.library-footer strong {
  color: var(--ink-soft);
  font-size: 11px;
}

.library-footer span {
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.5;
}

.canvas {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: clip;
  background-color: var(--canvas);
  background-image: radial-gradient(circle, oklch(0.39 0.012 145 / 0.46) 1px, transparent 1.15px);
  background-size: 20px 20px;
  cursor: grab;
  isolation: isolate;
  --canvas-composer-scale: 1;
  --canvas-node-type-scale: 1;
}

.canvas.is-panning,
.canvas.is-panning * {
  cursor: grabbing !important;
  user-select: none;
}

.canvas.is-connecting,
.canvas.is-connecting * {
  cursor: crosshair;
}

.canvas[data-tool="select"] {
  cursor: default;
}

.canvas[data-tool="select"].is-box-selecting,
.canvas[data-tool="select"].is-box-selecting * {
  cursor: crosshair !important;
  user-select: none;
}

.canvas[data-tool="hand"],
.canvas[data-tool="hand"] * {
  cursor: grab;
}

.canvas-stage {
  width: 1px;
  height: 1px;
  position: absolute;
  inset: 0 auto auto 0;
  transform-origin: 0 0;
}

.edge-layer {
  position: absolute;
  left: -5000px;
  top: -5000px;
  width: 10000px;
  height: 10000px;
  overflow: visible;
  pointer-events: none;
}

.edge {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.edge.active {
  stroke: var(--primary);
}

.edge-signal {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 4 96;
  opacity: 0.7;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
  animation: edge-signal-flow 3.6s linear infinite;
}

@keyframes edge-signal-flow { to { stroke-dashoffset: -100; } }

.multi-selection-frame {
  position: absolute;
  border: 1px solid oklch(0.72 0.012 230 / 0.65);
  border-radius: 10px;
  background: oklch(0.72 0.012 230 / 0.06);
  pointer-events: none;
}

.multi-selection-connect {
  position: absolute;
  right: -32px;
  top: calc(50% - 12px);
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink);
  background: var(--panel, #202428);
  font-size: 18px;
  line-height: 20px;
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
}

.multi-selection-toolbar {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: #202428;
  color: var(--ink);
  white-space: nowrap;
  pointer-events: auto;
  font-size: 12px;
}
.multi-selection-toolbar button,
.multi-selection-toolbar select {
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #202428;
  color: var(--ink);
  font: inherit;
}
.multi-selection-toolbar label { display: flex; align-items: center; gap: 6px; }
.multi-selection-frame.is-grouped .multi-selection-toolbar { bottom: calc(100% + 66px); }
.canvas-group-layer { position: absolute; inset: 0; pointer-events: none; }
.canvas-group-background {
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--group-color), white 25%);
  border-radius: 14px;
  background: color-mix(in srgb, var(--group-color) 24%, transparent);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}
.canvas-group-background header { display: flex; align-items: center; gap: 16px; padding: 12px 20px; }
.canvas-group-name {
  width: min(260px, 60%);
  padding: 4px 6px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 18px;
  font-weight: 600;
}
.canvas-group-name:hover, .canvas-group-name:focus { border-color: var(--line-strong); background: #202428; }
.canvas-group-color-label { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 12px; cursor: pointer; }
.canvas-group-color-label input { width: 30px; height: 28px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 5px; background: #202428; cursor: pointer; }
.multi-selection-drag { cursor: grab; touch-action: none; user-select: none; padding: 6px 0; }
.canvas.is-file-drop { box-shadow: inset 0 0 0 3px var(--primary); }

.multi-selection-connect:hover,
.multi-selection-connect:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .edge-signal { display: none; animation: none; }
}

.edge.reference-edge {
  stroke: oklch(0.72 0.12 215);
  stroke-width: 2.25;
}

.edge.selected {
  stroke: var(--primary);
  stroke-width: 3;
}

.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
  cursor: pointer;
  vector-effect: non-scaling-stroke;
}

.edge.running {
  stroke: var(--amber);
  stroke-dasharray: 7 7;
  animation: edge-flow 600ms linear infinite;
}

.edge.draft {
  stroke: var(--primary);
  stroke-dasharray: 5 5;
}

.edge.draft.pending {
  stroke-width: 2.5;
  stroke-dasharray: 7 5;
}

@keyframes edge-flow {
  to { stroke-dashoffset: -14; }
}

.workflow-node {
  width: var(--node-card-width, var(--node-width));
  min-height: 300px;
  position: absolute;
  cursor: default;
  user-select: none;
}

.workflow-node.node-type-image {
  min-height: calc(var(--node-card-height, 260px) + var(--node-label-height) + 12px);
}

.workflow-node.node-family-tool {
  min-height: calc(var(--node-card-height, 260px) + var(--node-label-height) + 12px);
}

.workflow-node.selected {
  min-height: 480px;
}

.workflow-node.selected.node-type-image { min-height: calc(var(--node-card-height, 260px) + 260px); }
.workflow-node.selected.node-type-image.has-image-reference { min-height: calc(var(--node-card-height, 260px) + 318px); }
.workflow-node.selected.node-type-video { min-height: calc(var(--node-card-height, 260px) + 322px); }
.workflow-node.selected.node-type-audio { min-height: 526px; }
.workflow-node.selected.node-family-tool { min-height: 516px; }

.workflow-node.node-type-upload:has(.media-node-canvas) {
  min-height: calc(var(--node-card-height, 260px) + var(--node-label-height) + 12px);
}

.node-label {
  height: var(--node-label-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
  color: var(--ink-soft);
  cursor: grab;
}

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

.node-label > span:first-child {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.node-label > span:first-child svg {
  width: 15px;
  height: 15px;
}

.node-label strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: calc(14px * var(--canvas-node-type-scale));
  font-weight: 700;
  letter-spacing: -0.01em;
}

.node-card {
  height: var(--node-card-height, 260px);
  position: relative;
  overflow: visible;
  border: var(--node-card-border-size) solid oklch(0.52 0.018 145);
  border-radius: var(--radius-md);
  background: oklch(0.225 0.009 145);
  box-shadow: 0 2px 6px oklch(0 0 0 / 0.28);
  transition: border-color 160ms ease-out, background-color 160ms ease-out, box-shadow 160ms ease-out;
}

.node-card.media-card {
  overflow: visible;
  background: oklch(0.15 0.006 145);
}

.workflow-node:hover .node-card {
  border-color: oklch(0.64 0.025 145);
}

.workflow-node.selected .node-card {
  border-color: oklch(0.73 0.11 205);
  background: oklch(0.245 0.012 160);
  box-shadow: 0 0 0 2px oklch(0.68 0.11 205 / 0.2), 0 3px 8px oklch(0 0 0 / 0.34);
}

.workflow-node.disabled {
  opacity: 0.48;
}

.workflow-node.disabled .node-card {
  border-style: dashed;
}

.workflow-node.multi-selected .node-card {
  border-color: var(--primary);
}

.workflow-node.running .node-card {
  border-color: var(--amber);
}

.workflow-node.success .node-card {
  border-color: var(--primary);
}

.workflow-node.error .node-card {
  border-color: var(--danger);
}

.canvas.is-picking-reference .workflow-node {
  transition: opacity 180ms ease-out, filter 180ms ease-out;
}

.canvas.is-picking-reference .workflow-node:not(.reference-candidate):not(.reference-target) {
  opacity: 0.34;
  filter: saturate(0.55);
}

.canvas.is-picking-reference .workflow-node.reference-target .node-card {
  border-color: oklch(0.52 0.025 200 / 0.85);
  box-shadow: 0 0 0 1px oklch(0.52 0.025 200 / 0.18);
}

.canvas.is-picking-reference .workflow-node.reference-candidate {
  cursor: pointer;
}

.canvas.is-picking-reference .workflow-node.reference-candidate .node-card {
  border-color: oklch(0.72 0.12 215);
  box-shadow: 0 0 0 3px oklch(0.72 0.12 215 / 0.14), var(--shadow-1);
}

.canvas.is-picking-reference .workflow-node.reference-candidate:hover .node-card,
.canvas.is-picking-reference .workflow-node.reference-candidate:focus-visible .node-card {
  border-color: oklch(0.82 0.13 215);
  box-shadow: 0 0 0 4px oklch(0.72 0.12 215 / 0.2), var(--shadow-2);
}

.reference-candidate-label {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  padding: 0 8px;
  border: 1px solid oklch(0.78 0.1 215 / 0.42);
  border-radius: 7px;
  color: oklch(0.9 0.055 215);
  background: oklch(0.16 0.02 210 / 0.9);
  box-shadow: var(--shadow-1);
  font-size: 9px;
  font-weight: 700;
  pointer-events: none;
}

.reference-candidate-label svg { width: 12px; height: 12px; }

.node-status {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
}

.node-status svg {
  width: 12px;
  height: 12px;
}

.workflow-node.running .node-status {
  color: var(--amber);
}

.workflow-node.running .node-status svg {
  animation: status-turn 900ms linear infinite;
}

.workflow-node.success .node-status {
  background: var(--primary-soft);
  color: var(--primary);
}

.workflow-node.error .node-status {
  background: var(--danger-soft);
  color: var(--danger);
}

@keyframes status-turn {
  to { transform: rotate(360deg); }
}

.node-empty-mark {
  height: 98px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--faint);
  opacity: 0.75;
}

.node-empty-mark > svg {
  width: 42px;
  height: 42px;
  margin-bottom: 2px;
  stroke-width: 1.35;
}

.node-empty-mark > span {
  width: 46px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
}

.node-empty-mark > span:nth-of-type(2) { width: 34px; }
.node-empty-mark > span:nth-of-type(3) { width: 22px; }

.node-result-preview {
  height: 98px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 24px 4px;
}

.node-result-preview > span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: calc(12px * var(--canvas-node-type-scale));
  font-weight: 650;
}

.node-result-preview > span svg { width: 14px; height: 14px; }

.node-result-preview p {
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: calc(11.5px * var(--canvas-node-type-scale));
  line-height: 1.5;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.text-node-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding: 18px;
}

.text-node-content p {
  width: 100%;
  min-height: 0;
  flex: 1;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--ink-soft);
  font-size: calc(14px * var(--canvas-node-type-scale));
  line-height: 1.65;
  user-select: text;
  white-space: pre-wrap;
}

.text-node-content button {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-hover);
  font-size: 11px;
}

.text-node-content button:hover { color: var(--ink); }
.text-node-content button svg { width: 13px; height: 13px; }

.text-content-actions {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.manual-text-editor {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.manual-text-editor textarea {
  width: 100%;
  min-height: 0;
  flex: 1;
  resize: none;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 13px;
  line-height: 1.65;
  user-select: text;
}

.manual-text-editor textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.manual-text-editor textarea::placeholder { color: var(--faint); }

.manual-text-footer,
.manual-text-footer > div,
.manual-text-footer > span {
  display: flex;
  align-items: center;
}

.manual-text-footer {
  justify-content: space-between;
  gap: 10px;
}

.manual-text-footer > span {
  min-width: 0;
  gap: 6px;
  color: var(--primary);
  font-size: 10px;
  white-space: nowrap;
}

.manual-text-footer > span svg {
  width: 13px;
  height: 13px;
}

.manual-text-footer > div { gap: 7px; }

.manual-text-footer button {
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 650;
}

.manual-text-cancel {
  color: var(--ink-soft);
  background: var(--surface-hover);
}

.manual-text-cancel:hover { color: var(--white); }

.manual-text-save {
  color: var(--white);
  background: var(--primary-strong);
}

.manual-text-save:hover { background: var(--primary); }

.media-node-canvas {
  height: 100%;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: calc(var(--radius-md) - var(--node-card-border-size));
  background: oklch(0.17 0.006 145);
}

.media-node-canvas > img,
.media-node-canvas > video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.image-node-canvas > img {
  object-fit: contain;
  background: oklch(0.17 0.006 145);
}

.workflow-node.selected.node-type-image .node-card {
  border-color: oklch(0.58 0.055 210 / 0.82);
  background: oklch(0.225 0.012 190);
}

.image-node-canvas {
  background: oklch(0.19 0.009 185);
}

.media-empty-state {
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: calc(12px * var(--canvas-node-type-scale));
  text-align: center;
}

.media-empty-state svg {
  width: 44px;
  height: 44px;
  stroke-width: 1.4;
}

.image-empty-state {
  width: min(250px, calc(100% - 38px));
  align-items: stretch;
  gap: 9px;
  color: var(--muted);
}

.image-empty-state > svg {
  align-self: center;
  color: oklch(0.57 0.025 190);
}

.image-empty-state > span {
  color: var(--ink-soft);
  text-align: center;
}

.image-empty-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 4px;
  text-align: left;
}

.image-empty-actions small {
  grid-column: 1 / -1;
  color: var(--faint);
  font-size: 10.5px;
}

.image-empty-actions button {
  min-width: 0;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  background: oklch(0.25 0.01 185 / 0.72);
  font-size: 10.5px;
}

.image-empty-actions button:hover,
.image-empty-actions button:focus-visible {
  outline: none;
  color: var(--ink);
  background: oklch(0.29 0.018 190);
}

.image-empty-actions button svg { width: 13px; height: 13px; color: oklch(0.68 0.08 205); }

.workflow-node.running .media-empty-state svg { animation: status-turn 900ms linear infinite; }

.image-node-canvas.is-loading > img { opacity: 0.42; }

.image-task-state {
  max-width: calc(100% - 24px);
  display: flex;
  align-items: center;
  gap: 10px;
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 2;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink-soft);
  background: oklch(0.16 0.009 145 / 0.96);
}

.image-task-state > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  border-radius: 7px;
  color: var(--primary);
  background: var(--primary-soft);
}

.image-task-state > span svg { width: 16px; height: 16px; }
.image-task-state:not(.error) > span svg { animation: status-turn 900ms linear infinite; }
.image-task-state > div { min-width: 0; flex: 1; }
.image-task-state strong,
.image-task-state small { display: block; }
.image-task-state strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.image-task-state small { margin-top: 5px; color: var(--ink-soft); font-size: 10px; }
.image-task-state i { height: 3px; display: block; margin-top: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-active); }
.image-task-state i b { width: 100%; height: 100%; display: block; border-radius: inherit; background: var(--primary); transform: scaleX(var(--image-task-progress, 0)); transform-origin: left; transition: transform 180ms cubic-bezier(.22, 1, .36, 1); }
.image-task-state.error > span { color: var(--danger); background: var(--danger-soft); }
.image-task-state.error small { color: var(--ink-soft); line-height: 1.4; }

.node-media-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--ink-soft);
  background: oklch(0.13 0.004 145 / 0.82);
  font-size: 10.5px;
  font-weight: 650;
}

.media-canvas-action {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  position: absolute;
  right: 10px;
  bottom: 10px;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  background: oklch(0.13 0.004 145 / 0.82);
}

.media-canvas-action:hover { color: var(--white); background: var(--primary-strong); }
.media-canvas-action svg { width: 14px; height: 14px; }

.media-download-action {
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  background: oklch(0.13 0.004 145 / 0.88);
  font-size: 10px;
  font-weight: 650;
  transition: color 160ms ease-out, background-color 160ms ease-out;
}

.media-download-action:hover,
.media-download-action:focus-visible {
  outline: none;
  color: var(--white);
  background: var(--primary-strong);
}

.media-download-action:focus-visible { box-shadow: 0 0 0 2px oklch(0.78 0.1 210 / 0.55); }
.media-download-action:disabled { cursor: wait; opacity: 0.64; }
.media-download-action svg { width: 14px; height: 14px; }

.media-preview-action { left: auto; right: 10px; }
.canvas-controls .batch-image-connect {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: auto;
  min-height: 36px;
  padding: 0 12px;
  color: var(--primary);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: nowrap;
}
.canvas-controls .batch-image-connect[hidden] { display: none; }

.video-node-canvas::after {
  content: "";
  position: absolute;
  inset: 58% 0 0;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, oklch(0.08 0 0 / 0.8));
}

.video-node-canvas {
  background: oklch(0.185 0.007 250);
}

.video-node-canvas > img,
.video-node-canvas > video {
  object-fit: contain;
  background: oklch(0.145 0.006 250);
}

.video-empty-state {
  max-width: 250px;
  gap: 7px;
}

.video-empty-state > svg { margin-bottom: 4px; color: oklch(0.48 0.02 245); }
.video-empty-state > strong { color: var(--ink); font-size: calc(13px * var(--canvas-node-type-scale)); font-weight: 700; }
.video-empty-state > span { max-width: 220px; color: var(--ink-soft); font-size: calc(11px * var(--canvas-node-type-scale)); line-height: 1.5; }
.video-node-canvas:not(:has(> video)) .video-play-button,
.video-node-canvas:not(:has(> video)) .video-timeline { display: none; }
.video-upload-action { top: 10px; bottom: auto; z-index: 2; }

.video-play-button {
  width: 78px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: absolute;
  z-index: 1;
  border: 0;
  border-radius: 8px;
  color: var(--white);
  background: oklch(0.12 0.004 145 / 0.76);
  transition: opacity 160ms ease-out, background-color 160ms ease-out;
}

.video-play-button:hover { background: var(--primary-strong); }
.video-play-button svg { width: 18px; height: 18px; }
.video-node-canvas.is-playing .video-play-button { opacity: 0; pointer-events: none; }

.audio-node-canvas {
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  border-radius: calc(var(--radius-md) - var(--node-card-border-size));
  color: var(--faint);
  background: oklch(0.17 0.006 145);
}

.audio-preview-button {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 50%;
  color: var(--faint);
  background: transparent;
}

.audio-preview-button:hover,
.audio-preview-button.playing {
  color: var(--white);
  background: var(--primary-strong);
}

.audio-preview-button svg { width: 42px; height: 42px; stroke-width: 1.5; }
.audio-node-canvas > span { position: relative; z-index: 1; color: var(--ink-soft); font-size: calc(12px * var(--canvas-node-type-scale)); }

.audio-waveform {
  height: 48px;
  position: absolute;
  right: 20px;
  bottom: 30px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0.42;
  transition: opacity 160ms ease-out;
}

.audio-waveform i {
  min-width: 2px;
  height: var(--wave);
  flex: 1;
  border-radius: 2px;
  background: var(--primary);
}

.audio-timeline {
  height: 22px;
  position: absolute;
  right: 12px;
  bottom: 5px;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 9px;
}

.audio-timeline svg { width: 13px; height: 13px; }
.audio-node-canvas:not(.has-audio) .audio-waveform,
.audio-node-canvas:not(.has-audio) .audio-timeline { opacity: 0; }

.capability-node-canvas,
.resource-node-canvas {
  height: 100%;
  padding: 18px;
}

.capability-node-canvas {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.capability-node-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.capability-node-heading > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 10px;
  color: var(--coral);
  background: var(--coral-soft);
}

.node-type-director .capability-node-heading > span,
.node-type-storyboard .capability-node-heading > span { color: var(--primary); background: var(--primary-soft); }
.node-type-script .capability-node-heading > span { color: var(--violet); background: var(--violet-soft); }
.capability-node-heading > span svg { width: 20px; height: 20px; }
.capability-node-heading div { min-width: 0; }
.capability-node-heading strong,
.capability-node-heading small { display: block; }
.capability-node-heading strong { font-size: calc(14px * var(--canvas-node-type-scale)); }
.capability-node-heading small { margin-top: 4px; overflow: hidden; color: var(--ink-soft); font-size: calc(11px * var(--canvas-node-type-scale)); white-space: nowrap; text-overflow: ellipsis; }
.capability-node-canvas.has-result .capability-node-heading > span { color: var(--primary); background: var(--primary-soft); }

.capability-runtime {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: -4px;
  padding: 4px 7px;
  overflow: hidden;
  border-radius: 6px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.capability-runtime.agent { color: var(--amber); background: oklch(0.24 0.055 75); }
.capability-runtime svg { width: 11px; height: 11px; flex: 0 0 11px; }

.capability-list {
  display: grid;
  gap: 7px;
}

.capability-list button {
  height: 43px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 13px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: calc(12px * var(--canvas-node-type-scale));
  font-weight: 620;
  text-align: left;
}

.capability-list button:hover { border-color: var(--primary); color: var(--white); }
.capability-list b { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; color: var(--primary); background: var(--primary-soft); font-size: 9px; }
.capability-list svg { width: 12px; height: 12px; transform: rotate(90deg); color: var(--faint); }

.director-node-canvas {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 36%, oklch(0.3 0.04 235 / 0.3), transparent 38%),
    linear-gradient(180deg, oklch(0.18 0.008 145), oklch(0.14 0.006 145));
}

.director-node-glyph {
  position: relative;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  color: var(--blue);
}

.director-node-glyph i {
  position: absolute;
  left: 23px;
  top: 23px;
  width: 22px;
  height: 1px;
  background: currentColor;
  transform-origin: left center;
}

.director-node-glyph i:nth-child(1) { transform: rotate(-30deg); }
.director-node-glyph i:nth-child(2) { transform: rotate(90deg); }
.director-node-glyph i:nth-child(3) { transform: rotate(210deg); }
.director-node-glyph b { position: absolute; inset: 15px; border: 1px solid currentColor; transform: rotate(30deg) skew(-8deg); opacity: 0.8; }
.director-node-glyph::after { content: ""; position: absolute; left: 20px; top: 20px; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 12px oklch(0.68 0.13 240 / 0.72); }
.director-node-canvas > strong { font-size: calc(15px * var(--canvas-node-type-scale)); letter-spacing: -0.01em; }
.director-node-canvas > p { max-width: 250px; margin: 7px 0 13px; color: var(--ink-soft); font-size: calc(11px * var(--canvas-node-type-scale)); line-height: 1.6; }
.director-node-canvas > button { height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink); background: var(--panel-raised); font-size: 11px; font-weight: 700; }
.director-node-canvas > button:hover { border-color: var(--blue); background: var(--surface-hover); }
.director-node-canvas > button svg { width: 13px; height: 13px; color: var(--blue); }
.director-node-canvas > small { margin-top: 9px; color: var(--muted); font-size: 10px; }

.resource-node-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.resource-node-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 13px;
  color: var(--primary);
  background: var(--primary-soft);
}

.resource-node-icon svg { width: 25px; height: 25px; }
.resource-node-canvas > strong { font-size: calc(14px * var(--canvas-node-type-scale)); }
.resource-node-canvas > p { max-width: 270px; margin: 7px 0 12px; color: var(--ink-soft); font-size: calc(11px * var(--canvas-node-type-scale)); line-height: 1.55; }
.resource-node-canvas > div:not(.resource-node-image) { display: flex; gap: 5px; margin-bottom: 14px; }
.resource-node-canvas > div:not(.resource-node-image) span { padding: 4px 6px; border-radius: 5px; color: var(--ink-soft); background: var(--surface-hover); font-size: 9.5px; }
.resource-node-image { position: relative; width: 220px; height: 104px; margin-bottom: 10px; overflow: hidden; border-radius: 9px; background: var(--canvas); }
.resource-node-image img,
.resource-node-image video { width: 100%; height: 100%; display: block; object-fit: cover; }
.resource-node-image span { position: absolute; top: 7px; right: 7px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 5px; color: var(--white); background: oklch(0.08 0.01 150 / 0.82); font-size: 8px; }
.resource-node-image span svg { width: 11px; height: 11px; color: var(--primary); }
.resource-node-canvas > button { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-radius: 7px; color: var(--white); background: var(--primary-strong); font-size: 11px; font-weight: 650; }
.resource-node-canvas > button:hover { background: var(--primary); }
.resource-node-canvas > button svg { width: 14px; height: 14px; }

.node-suggestions {
  padding: 2px 26px 18px;
}

.node-suggestions > span {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: calc(13px * var(--canvas-node-type-scale));
}

.node-suggestions ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.node-suggestions li {
  height: 29px;
}

.node-suggestions li button {
  width: 100%;
  height: 29px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 5px;
  border: 0;
  border-radius: 5px;
  color: var(--ink-soft);
  background: transparent;
  font-size: calc(12.5px * var(--canvas-node-type-scale));
  font-weight: 620;
  text-align: left;
}

.node-suggestions li button:hover {
  color: var(--white);
  background: var(--surface-hover);
}

.node-suggestions li svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.port {
  width: var(--node-port-size);
  height: var(--node-port-size);
  display: grid;
  place-items: center;
  position: absolute;
  top: calc(var(--node-port-center-y) - var(--node-port-half-size) - var(--node-card-border-size));
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: var(--canvas);
  color: var(--ink-soft);
  z-index: 2;
  transition: border-color 140ms ease-out, background-color 140ms ease-out, transform 140ms ease-out;
}

.port:hover,
.canvas.is-connecting .port.input {
  border-color: var(--primary);
  background: var(--primary-strong);
  color: var(--white);
  transform: scale(1.1);
}

.port.connection-source {
  border-color: var(--primary);
  background: var(--primary-strong);
  color: var(--white);
  transform: scale(1.1);
}

.port.input {
  left: calc((var(--node-port-size) + var(--node-port-gap) + var(--node-card-border-size)) * -1);
}

.port.output {
  right: calc((var(--node-port-size) + var(--node-port-gap) + var(--node-card-border-size)) * -1);
}

.port svg {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}

.node-composer {
  width: 660px;
  height: 150px;
  position: absolute;
  top: calc(var(--node-card-height, 260px) + 46px);
  left: 50%;
  z-index: 3;
  transform: translateX(-50%) scale(var(--canvas-composer-scale));
  transform-origin: top center;
  overflow: hidden;
  border: 1px solid oklch(0.56 0.02 155);
  border-radius: var(--radius-md);
  background: oklch(0.235 0.01 150);
  box-shadow: 0 4px 8px oklch(0 0 0 / 0.38);
  animation: composer-in 180ms cubic-bezier(.22, 1, .36, 1) both;
}

.node-composer.expanded {
  height: 260px;
}

.node-composer.media-composer {
  height: 200px;
}

.node-composer.image-composer.has-results { height: 248px; }
.node-composer.image-composer.has-reference { height: 258px; }
.node-composer.image-composer.has-reference.has-results { height: 306px; }

.node-composer.image-composer {
  border-color: oklch(0.42 0.018 185 / 0.82);
  background: oklch(0.235 0.009 185);
  box-shadow: 0 3px 8px oklch(0 0 0 / 0.28);
}

.node-composer.image-composer.expanded { height: 300px; }
.node-composer.image-composer.expanded.has-results { height: 348px; }
.node-composer.image-composer.expanded.has-reference { height: 358px; }
.node-composer.image-composer.expanded.has-reference.has-results { height: 406px; }
.node-composer.image-composer.expanded .image-prompt-field { height: 188px; }

.node-composer.video-composer {
  height: auto;
  min-height: 284px;
  border-color: oklch(0.4 0.018 240 / 0.82);
  background: oklch(0.225 0.009 240);
  box-shadow: 0 3px 8px oklch(0 0 0 / 0.3);
}

.node-composer.video-composer.expanded { height: auto; min-height: 386px; }
.composer-video-preview { display: none; }
.video-composer.expanded:has(.composer-video-preview) { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.video-composer.expanded .composer-video-preview { display: block; grid-column: 1; grid-row: 1 / 3; padding: 12px; min-height: 260px; }
.composer-video-preview video { width: 100%; height: 260px; object-fit: contain; background: #000; }
.video-composer.expanded:has(.composer-video-preview) > .prompt-mention-field { grid-column: 2; }
.video-composer.expanded:has(.composer-video-preview) > .video-reference-strip { grid-column: 2; }
.video-composer.expanded:has(.composer-video-preview) > .video-sound-row,
.video-composer.expanded:has(.composer-video-preview) > .composer-footer { grid-column: 1 / -1; }

.node-composer.audio-composer {
  height: 210px;
}

.node-composer.tool-composer {
  height: 200px;
}

@keyframes composer-in {
  from { opacity: 0; transform: translate(-50%, 8px) scale(var(--canvas-composer-scale)); }
}

.node-composer textarea {
  width: 100%;
  height: 98px;
  display: block;
  padding: 18px 52px 12px 18px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 450;
  line-height: 1.7;
  user-select: text;
}

.node-composer textarea:focus-visible {
  box-shadow: inset 0 0 0 1px oklch(0.7 0.1 205 / 0.72);
}

.node-composer.expanded textarea {
  height: 208px;
}

.media-composer > textarea {
  height: 82px;
  padding-top: 12px;
}

.media-composer-tools {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px 4px;
}

.image-composer-tools {
  height: 48px;
  gap: 6px;
  padding: 9px 50px 4px 12px;
}

.image-composer-tools > button,
.image-composer-tools .reference-slot {
  height: 32px;
  min-width: 0;
  padding-inline: 9px;
  border-color: transparent;
  border-radius: 8px;
  color: var(--ink-soft);
  background: oklch(0.285 0.009 185 / 0.7);
  font-size: 10px;
}

.image-composer-tools > button:hover,
.image-composer-tools > button.active,
.image-composer-tools .reference-slot:hover,
.image-composer-tools .reference-slot.has-asset {
  border-color: oklch(0.49 0.035 200 / 0.7);
  color: var(--ink);
  background: oklch(0.31 0.025 195 / 0.82);
}

.image-prompt-field {
  height: 88px;
  position: relative;
}

.image-prompt-field .prompt-mention-editor {
  padding: 11px 18px 8px;
  color: var(--ink);
  line-height: 1.6;
}

.text-prompt-field {
  height: 98px;
  position: relative;
}

.node-composer.expanded .text-prompt-field { height: 208px; }

.text-prompt-field .prompt-mention-editor {
  padding: 18px 52px 12px 18px;
  font-size: 14px;
  font-weight: 450;
  line-height: 1.7;
}

.image-reference-strip {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 6px;
  border-top: 1px solid oklch(0.42 0.018 185 / 0.42);
  border-bottom: 1px solid oklch(0.42 0.018 185 / 0.42);
  background: oklch(0.205 0.008 185 / 0.56);
}

.image-reference-thumbnail {
  width: 42px;
  height: 42px;
  position: relative;
  flex: 0 0 42px;
  padding: 0;
  overflow: hidden;
  border: 1px solid oklch(0.65 0.09 210 / 0.62);
  border-radius: 8px;
  background: var(--canvas);
}

.image-reference-thumbnail:hover { border-color: oklch(0.78 0.13 210); }
.image-reference-thumbnail > img,
.image-reference-thumbnail > video { width: 100%; height: 100%; display: block; object-fit: cover; }
.image-reference-thumbnail > span { width: 15px; height: 15px; display: grid; place-items: center; position: absolute; right: 3px; bottom: 3px; border-radius: 50%; color: oklch(0.2 0.02 190); background: oklch(0.84 0.13 195); }
.image-reference-thumbnail > span svg { width: 9px; height: 9px; stroke-width: 3; }

.image-reference-copy { min-width: 0; display: grid; gap: 2px; flex: 1; }
.image-reference-copy strong,
.image-reference-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-reference-copy strong { color: var(--ink-soft); font-size: 10px; }
.image-reference-copy small { color: var(--muted); font-size: 8px; }

.image-reference-remove {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}

.image-reference-remove:hover { color: var(--ink); background: var(--surface-hover); }
.image-reference-remove svg { width: 13px; height: 13px; }

.image-result-strip {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 6px;
  overflow-x: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.image-result-strip button {
  width: 42px;
  height: 34px;
  flex: 0 0 42px;
  padding: 0;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--bg);
}

.image-result-strip button:hover,
.image-result-strip button.active { border-color: var(--primary); }
.image-result-strip button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.image-result-strip img { width: 100%; height: 100%; display: block; object-fit: cover; }

.media-composer-tools > button,
.reference-slot {
  height: 40px;
  min-width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--bg);
  font-size: 9px;
}

.media-composer-tools > button:hover,
.media-composer-tools > button.active,
.reference-slot:hover,
.reference-slot.has-asset {
  border-color: var(--primary);
  color: var(--ink);
  background: var(--primary-soft);
}

.media-composer-tools svg,
.reference-slot svg { width: 14px; height: 14px; }

.reference-slot img {
  width: 30px;
  height: 30px;
  margin-left: -6px;
  border-radius: 5px;
  object-fit: cover;
}

.reference-slot video {
  width: 30px;
  height: 30px;
  margin-left: -6px;
  border-radius: 5px;
  object-fit: cover;
}

.reference-slot span {
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-reference-strip {
  height: 80px;
  min-height: 80px;
  flex: 0 0 80px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 48px 7px 12px;
  overflow-x: auto;
  overscroll-behavior: contain;
  border-bottom: 1px solid oklch(0.38 0.015 240 / 0.48);
  scrollbar-width: thin;
}

.video-reference-add {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink-soft);
  background: oklch(0.275 0.01 240);
}

.video-reference-add:hover,
.video-reference-add:focus-visible {
  outline: none;
  border-color: oklch(0.65 0.09 215);
  color: var(--ink);
  background: oklch(0.31 0.025 225);
}

.video-reference-add svg { width: 18px; height: 18px; }

.video-reference-item {
  width: 48px;
  height: 48px;
  position: relative;
  flex: 0 0 48px;
  overflow: visible;
  border-radius: 8px;
  background: var(--canvas);
}

.video-reference-item > img,
.video-reference-item > video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border: 1px solid oklch(0.52 0.035 220);
  border-radius: inherit;
}

.video-reference-item.is-video > svg {
  width: 18px;
  height: 18px;
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 4px;
  border-radius: 50%;
  color: var(--white);
  background: oklch(0.08 0.01 240 / 0.78);
  transform: translate(-50%, -50%);
}

.video-reference-item > span {
  max-width: 44px;
  position: absolute;
  right: 2px;
  bottom: 2px;
  left: 2px;
  overflow: hidden;
  padding: 2px 4px;
  border-radius: 4px;
  color: var(--ink);
  background: oklch(0.12 0.008 235 / 0.84);
  font-size: 8px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-reference-item > button {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  position: absolute;
  top: -5px;
  right: -5px;
  padding: 0;
  border: 1px solid oklch(0.42 0.012 240);
  border-radius: 50%;
  color: var(--muted);
  background: oklch(0.2 0.01 240);
}

.video-reference-item > button:hover { color: var(--white); background: oklch(0.42 0.12 25); }
.video-reference-item > button svg { width: 9px; height: 9px; }

.video-reference-empty {
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.video-reference-empty kbd {
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font: inherit;
}

.video-prompt-field {
  height: 124px;
  position: relative;
}

.prompt-mention-editor {
  width: 100%;
  height: 100%;
  padding: 14px 50px 26px 16px;
  overflow-y: auto;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  cursor: text;
  font-size: 13.5px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  user-select: text;
  overscroll-behavior: contain;
}

.prompt-mention-editor:empty::before {
  content: attr(data-placeholder);
  color: oklch(0.72 0.018 240);
  pointer-events: none;
}

.prompt-mention-editor:focus-visible { box-shadow: inset 0 0 0 1px oklch(0.62 0.08 215 / 0.74); }

.prompt-inline-reference {
  height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 2px;
  padding: 2px 7px 2px 3px;
  vertical-align: -8px;
  overflow: hidden;
  border: 1px solid oklch(0.48 0.026 225);
  border-radius: 6px;
  color: oklch(0.91 0.012 230);
  background: oklch(0.29 0.017 235);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  user-select: all;
}

.prompt-inline-reference img {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  border-radius: 4px;
  object-fit: cover;
}

.prompt-inline-reference span { max-width: 58px; overflow: hidden; text-overflow: ellipsis; }
.prompt-inline-reference:hover { border-color: oklch(0.66 0.075 215); background: oklch(0.32 0.025 230); }
.video-prompt-field > small { position: absolute; right: 14px; bottom: 8px; color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.video-composer.expanded .video-prompt-field { height: 226px; }

.video-sound-row { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 14px 5px; }
.video-sound-row small { color: var(--ink-soft); font-size: 11px; }
.video-sound-toggle { flex-shrink: 0; }
.video-sound-toggle span { font-weight: 700; }
.video-sound-toggle:disabled { cursor: not-allowed; color: var(--ink-soft); }
.video-sound-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.video-composer-footer {
  height: 62px !important;
  gap: 5px;
  padding: 5px 9px 8px 12px !important;
  border-top: 1px solid oklch(0.38 0.015 240 / 0.48);
}

.video-composer-footer .model-selector { max-width: 126px; }
.video-composer-footer .model-selector > svg { color: var(--ink-soft); }
.video-composer-footer .media-footer-options { flex: 1; gap: 4px; overflow-x: auto; overscroll-behavior: contain; scrollbar-width: none; }
.video-composer-footer .media-footer-options::-webkit-scrollbar { display: none; }
.video-composer-footer .composer-icon-action { color: var(--ink-soft); }
.video-composer-footer .composer-cost { flex: 0 0 auto; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }

.video-setting-select {
  height: 30px;
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink-soft);
  background: oklch(0.205 0.008 215 / 0.58);
  font-weight: 600;
  transition: color 160ms ease-out, border-color 160ms ease-out, background-color 160ms ease-out;
}

.video-setting-select:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface-hover);
}

.video-setting-select:focus-within {
  color: var(--ink);
  border-color: oklch(0.65 0.08 210);
  background: var(--surface-hover);
  box-shadow: 0 0 0 2px oklch(0.65 0.08 210 / 0.16);
}

.video-setting-select select {
  height: 100%;
  min-width: 0;
  appearance: none;
  padding: 0 23px 0 7px;
  border: 0;
  outline: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}

.video-setting-select option {
  color: var(--ink);
  background: oklch(0.22 0.008 215);
}

.video-setting-select > svg {
  width: 10px;
  height: 10px;
  position: absolute;
  right: 7px;
  pointer-events: none;
  color: var(--ink-soft);
  opacity: 0.9;
  transform: rotate(90deg);
}

.video-setting-prefix {
  width: 13px;
  height: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 7px;
  pointer-events: none;
}

.video-setting-prefix svg { width: 13px; height: 13px; }
.video-setting-prefix + select { padding-left: 4px; }
.video-mode-select select { width: 72px; }
.video-ratio-select select { width: 54px; }
.video-quality-select select { width: 54px; }
.video-batch-select select { width: 45px; }

.video-duration-control {
  height: 30px;
  min-width: 88px;
  display: inline-flex;
  flex: 0 0 88px;
  align-items: center;
  gap: 7px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink-soft);
  background: oklch(0.205 0.008 215 / 0.58);
  transition: color 160ms ease-out, border-color 160ms ease-out, background-color 160ms ease-out;
}

.video-duration-control:hover,
.video-duration-control:focus-within {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface-hover);
}

.video-duration-control:focus-within {
  border-color: oklch(0.65 0.08 210);
  box-shadow: 0 0 0 2px oklch(0.65 0.08 210 / 0.16);
}

.video-duration-control input[type="range"] {
  width: 51px;
  height: 16px;
  flex: 0 0 51px;
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: ew-resize;
}

.video-duration-control input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--primary) 0 var(--video-range-progress), var(--line-strong) var(--video-range-progress) 100%);
}

.video-duration-control input[type="range"]::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  appearance: none;
  margin-top: -4.5px;
  border: 2px solid oklch(0.22 0.008 215);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 1px oklch(0.78 0.08 205 / 0.45);
}

.video-duration-control input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line-strong); }
.video-duration-control input[type="range"]::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--primary); }
.video-duration-control input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border: 2px solid oklch(0.22 0.008 215); border-radius: 50%; background: var(--primary); }
.video-duration-control input[type="range"]:disabled { cursor: default; opacity: 0.5; }

.video-duration-control output {
  min-width: 21px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.audio-input-row {
  height: 146px;
  position: relative;
  padding: 10px 12px 0;
}

.audio-input-row textarea {
  width: 100%;
  height: 100%;
  padding: 16px 42px 12px 14px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  line-height: 1.65;
  user-select: text;
}

.audio-input-row.has-input textarea { padding-top: 62px; }

.audio-input-chip {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 1;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: 11px;
}

.audio-input-chip b {
  min-width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  margin-left: -8px;
  margin-top: -28px;
  border-radius: 50%;
  color: var(--white);
  background: var(--panel);
  font-size: 9px;
}

.audio-input-chip svg { width: 14px; height: 14px; }

.audio-composer-footer {
  height: 64px;
  padding-bottom: 9px;
  border-top: 1px solid oklch(0.3 0.008 145 / 0.5);
}

.audio-model-symbol { font-family: Georgia, serif; font-size: 15px; }
.audio-mode-option { color: var(--ink-soft); font-size: 11px; }
.audio-mode-option > svg:last-child { width: 10px; transform: rotate(90deg); }
.composer-spacer { min-width: 8px; flex: 1; }

.audio-character-count {
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tool-mode-tabs {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px 4px;
  overflow-x: auto;
}

.tool-mode-tabs button {
  min-height: 29px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: var(--faint);
  background: transparent;
  font-size: 9px;
  white-space: nowrap;
}

.tool-mode-tabs button:hover { color: var(--ink-soft); background: var(--surface-hover); }
.tool-mode-tabs button.active { color: var(--ink); background: var(--surface-active); }
.tool-composer > textarea { height: 90px; padding-top: 10px; }
.tool-composer .composer-footer { height: 64px; padding-bottom: 9px; }

.resource-composer {
  height: 150px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 18px;
}

.resource-composer-copy { min-width: 0; display: flex; align-items: center; gap: 12px; }
.resource-composer-copy > span { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 42px; border-radius: 10px; color: var(--primary); background: var(--primary-soft); }
.resource-composer-copy > span svg { width: 20px; height: 20px; }
.resource-composer-copy strong { display: block; font-size: 13px; }
.resource-composer-copy p { margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.resource-composer-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.resource-composer-actions > div { display: flex; gap: 5px; }
.resource-composer-actions span { padding: 4px 6px; border-radius: 5px; color: var(--muted); background: var(--surface-hover); font-size: 8px; }
.resource-composer-actions button { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-radius: 7px; color: var(--white); background: var(--primary-strong); font-size: 10px; font-weight: 650; }
.resource-composer-actions button:hover { background: var(--primary); }
.resource-composer-actions button svg { width: 14px; height: 14px; }

.node-composer textarea::placeholder {
  color: oklch(0.74 0.014 155);
}

.composer-expand {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.composer-expand:hover { background: var(--surface-hover); color: var(--ink); }
.composer-expand svg { width: 15px; height: 15px; }

.composer-footer {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 10px 16px;
  border-top: 1px solid oklch(0.4 0.012 150 / 0.72);
}

.media-composer .composer-footer {
  height: 64px;
  padding-bottom: 8px;
}

.image-composer .composer-footer {
  height: 64px;
  gap: 5px;
  padding: 8px 10px 9px 12px;
}

.video-composer .composer-footer {
  height: 58px;
}

.model-selector {
  min-width: 0;
  max-width: 260px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.model-selector:hover,
.model-selector[aria-expanded="true"] { background: var(--surface-hover); }
.model-selector:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.model-selector > svg { width: 12px; height: 12px; flex: 0 0 12px; transform: rotate(90deg); color: var(--muted); transition: transform 160ms ease-out; }
.model-selector[aria-expanded="true"] > svg { transform: rotate(-90deg); }
.model-selector-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.image-composer .model-selector {
  max-width: 190px;
  padding-inline: 6px;
  color: var(--ink-soft);
  font-weight: 600;
}

.model-symbol {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
}

.model-symbol svg { width: 12px; height: 12px; }

.canvas-model-menu {
  position: fixed;
  inset: auto;
  top: var(--canvas-model-menu-top, auto);
  left: var(--canvas-model-menu-left, 12px);
  bottom: var(--canvas-model-menu-bottom, 84px);
  width: var(--canvas-model-menu-width, 370px);
  max-height: min(430px, calc(100dvh - 24px));
  margin: 0;
  padding: 6px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  background: var(--panel-raised);
  box-shadow: 0 4px 8px oklch(0 0 0 / 0.42);
  font: inherit;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 160ms ease-out, transform 160ms cubic-bezier(.22, 1, .36, 1);
}

.canvas-model-menu:popover-open { opacity: 1; transform: translateY(0); }
@starting-style { .canvas-model-menu:popover-open { opacity: 0; transform: translateY(5px); } }

.canvas-model-menu > header {
  display: grid;
  gap: 3px;
  padding: 9px 10px 10px;
  border-bottom: 1px solid var(--line);
}

.canvas-model-menu > header strong { font-size: 13px; }
.canvas-model-menu > header small { color: var(--muted); font-size: 10px; }
.canvas-model-options { display: grid; gap: 2px; padding-top: 5px; }

.canvas-model-options [role="option"] {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.canvas-model-options [role="option"]:hover:not(:disabled),
.canvas-model-options [role="option"]:focus-visible { outline: none; background: var(--surface-hover); }
.canvas-model-options [role="option"][aria-selected="true"] { background: var(--primary-soft); }
.canvas-model-options [role="option"]:disabled { cursor: not-allowed; opacity: 0.58; }
.canvas-model-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: var(--surface-active); }
.canvas-model-mark svg { width: 16px; height: 16px; }
.canvas-model-copy { min-width: 0; display: grid; gap: 3px; }
.canvas-model-copy strong,
.canvas-model-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas-model-copy strong { font-size: 12px; }
.canvas-model-copy small { color: var(--muted); font-size: 9px; }
.canvas-model-options em { padding: 3px 6px; border-radius: 999px; font-size: 9px; font-style: normal; font-weight: 700; white-space: nowrap; }
.canvas-model-options em.demo { color: var(--ink-soft); background: var(--surface-active); }
.canvas-model-options em.ready { color: var(--primary); background: var(--primary-soft); }
.canvas-model-options em.unavailable { color: var(--amber); background: oklch(0.24 0.055 75 / 0.7); }
.canvas-model-options [role="option"] > svg { width: 15px; height: 15px; color: var(--primary); }
.canvas-model-options > p { margin: 0; padding: 20px 12px; color: var(--muted); font-size: 11px; text-align: center; }

.image-settings-trigger {
  min-width: 0;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 10px;
  white-space: nowrap;
}

.image-settings-trigger:hover,
.image-settings-trigger[aria-expanded="true"] { color: var(--ink); background: var(--surface-hover); }
.image-settings-trigger:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.image-settings-trigger > svg:first-child { width: 14px; height: 14px; }
.image-settings-trigger > svg:last-child { width: 11px; height: 11px; transform: rotate(90deg); color: var(--faint); }

.image-settings-popover {
  position: fixed;
  inset: auto;
  top: var(--image-settings-top, auto);
  left: var(--image-settings-left, 12px);
  bottom: var(--image-settings-bottom, 84px);
  width: var(--image-settings-width, 330px);
  max-height: min(440px, calc(100dvh - 24px));
  margin: 0;
  padding: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink-soft);
  background: oklch(0.245 0.008 185);
  box-shadow: 0 4px 8px oklch(0 0 0 / 0.38);
  font: inherit;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 160ms ease-out, transform 160ms cubic-bezier(.22, 1, .36, 1);
}

.image-settings-popover:popover-open { opacity: 1; transform: translateY(0); }
@starting-style { .image-settings-popover:popover-open { opacity: 0; transform: translateY(5px); } }
.image-settings-popover section + section { margin-top: 13px; }
.image-settings-popover section > strong { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 600; }
.image-setting-options { display: grid; gap: 6px; }
.quality-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ratio-options { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.batch-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.image-setting-options button {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: oklch(0.225 0.007 185);
  font-size: 10px;
}

.ratio-options button { height: 54px; }
.image-setting-options button:hover { color: var(--ink); border-color: oklch(0.52 0.035 200); }
.image-setting-options button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.image-setting-options button.active { color: var(--ink); border-color: oklch(0.66 0.07 205); background: oklch(0.31 0.025 195); }

.media-footer-options {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
}

.node-option,
.composer-icon-action {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 10.5px;
  white-space: nowrap;
}

.node-option:hover,
.node-option.active,
.composer-icon-action:hover,
.composer-icon-action.active {
  color: var(--ink);
  background: var(--surface-hover);
}

.node-option svg,
.composer-icon-action svg { width: 13px; height: 13px; }

.composer-icon-action {
  width: 30px;
  flex: 0 0 30px;
  justify-content: center;
  padding: 0;
}

.composer-cost {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--faint);
  font-size: 10px;
}

.composer-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.composer-tools svg { width: 15px; height: 15px; }
.credit-mark { color: var(--amber); }

.composer-run {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink-soft);
  color: var(--panel);
}

.composer-run:hover { background: var(--ink); }
.composer-run svg { width: 17px; height: 17px; }

.canvas[data-zoom-tier="overview"] .capability-node-heading small,
.canvas[data-zoom-tier="overview"] .director-node-canvas > p,
.canvas[data-zoom-tier="overview"] .director-node-canvas > small,
.canvas[data-zoom-tier="overview"] .resource-node-canvas > p,
.canvas[data-zoom-tier="overview"] .resource-node-canvas > div:not(.resource-node-image),
.canvas[data-zoom-tier="overview"] .video-empty-state > span,
.canvas[data-zoom-tier="overview"] .image-empty-actions small {
  display: none;
}

.canvas[data-zoom-tier="overview"] .capability-node-canvas {
  justify-content: center;
}

.canvas[data-zoom-tier="overview"] .resource-node-icon {
  margin-bottom: 14px;
}

.workflow-node.running .composer-run {
  background: var(--amber);
}

.workflow-node.success .composer-run {
  background: var(--primary);
  color: var(--white);
}

.canvas-hint {
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: var(--z-floating);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  box-shadow: var(--shadow-1);
  color: var(--ink-soft);
  font-size: 11px;
}

.canvas.is-picking-reference .canvas-hint,
.canvas.is-picking-reference .image-context-toolbar { display: none; }

.canvas-reference-picker {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: absolute;
  top: 16px;
  left: 50%;
  z-index: var(--z-dropdown);
  max-width: calc(100% - 32px);
  padding: 6px 7px 6px 8px;
  border: 1px solid oklch(0.58 0.07 210 / 0.72);
  border-radius: 12px;
  color: var(--ink-soft);
  background: oklch(0.19 0.014 205 / 0.96);
  box-shadow: var(--shadow-2);
  transform: translateX(-50%);
  animation: reference-picker-in 180ms cubic-bezier(.22, 1, .36, 1) both;
}

.canvas-reference-picker[hidden] { display: none; }
.canvas-reference-picker[aria-busy="true"] { opacity: 0.76; }

.prompt-mention-menu {
  max-height: min(294px, calc(100dvh - 20px));
  position: fixed;
  z-index: var(--z-dropdown);
  overflow: hidden;
  border: 1px solid oklch(0.42 0.018 230);
  border-radius: 12px;
  color: var(--ink-soft);
  background: oklch(0.205 0.012 235 / 0.98);
  box-shadow: 0 4px 8px oklch(0 0 0 / 0.4);
  animation: prompt-mention-in 160ms cubic-bezier(.22, 1, .36, 1) both;
}

.prompt-mention-menu[hidden] { display: none; }
.prompt-mention-menu > header { height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 10px 0 12px; border-bottom: 1px solid var(--line); }
.prompt-mention-menu > header strong { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 11px; }
.prompt-mention-menu > header strong svg { width: 14px; height: 14px; color: var(--primary); }
.prompt-mention-menu > header small { color: var(--faint); font-size: 9px; }
.prompt-mention-options { max-height: 248px; padding: 5px; overflow-y: auto; overscroll-behavior: contain; }

.prompt-mention-options > button {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border: 0;
  border-radius: 8px;
  color: var(--ink-soft);
  background: transparent;
  text-align: left;
}

.prompt-mention-options > button:hover,
.prompt-mention-options > button.active,
.prompt-mention-options > button:focus-visible { outline: none; color: var(--ink); background: oklch(0.285 0.022 225); }
.prompt-mention-options > button > img { width: 38px; height: 38px; display: block; object-fit: cover; border-radius: 7px; background: var(--canvas); }
.prompt-mention-options > button > span { min-width: 0; display: grid; gap: 2px; }
.prompt-mention-options > button strong,
.prompt-mention-options > button small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prompt-mention-options > button strong { font-size: 10px; }
.prompt-mention-options > button small { color: var(--muted); font-size: 8px; }
.prompt-mention-options > button > svg { width: 14px; height: 14px; color: var(--primary); }
.prompt-mention-options > p { display: flex; align-items: center; gap: 7px; margin: 0; padding: 13px 9px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.prompt-mention-options > p svg { width: 16px; height: 16px; flex: 0 0 16px; }

@keyframes prompt-mention-in {
  from { opacity: 0; transform: translateY(5px); }
}

@keyframes reference-picker-in {
  from { opacity: 0; transform: translate(-50%, -6px); }
}

.canvas-reference-picker-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  border-radius: 9px;
  color: oklch(0.84 0.12 210);
  background: oklch(0.72 0.12 215 / 0.13);
}

.canvas-reference-picker-icon svg { width: 17px; height: 17px; }
.canvas-reference-picker-copy { min-width: 190px; display: grid; gap: 2px; }
.canvas-reference-picker-copy strong { color: var(--ink); font-size: 11px; }
.canvas-reference-picker-copy small { max-width: 330px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.canvas-reference-local {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid oklch(0.62 0.07 210 / 0.54);
  border-radius: 8px;
  color: var(--ink-soft);
  background: oklch(0.25 0.02 205);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.canvas-reference-local:hover { color: var(--ink); background: oklch(0.3 0.03 205); }
.canvas-reference-local svg { width: 14px; height: 14px; }
.canvas-reference-local:disabled { opacity: 0.5; cursor: wait; }

.canvas-reference-cancel {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.canvas-reference-cancel:hover { color: var(--ink); background: var(--surface-hover); }
.canvas-reference-cancel svg { width: 14px; height: 14px; }

.image-context-toolbar {
  max-width: calc(100% - 28px);
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 2px;
  position: absolute;
  top: var(--image-toolbar-top, 14px);
  left: var(--image-toolbar-left, 50%);
  z-index: var(--z-dropdown);
  padding: 4px 6px;
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink-soft);
  background: oklch(0.19 0.007 145 / 0.98);
  box-shadow: var(--shadow-1);
  transform: translateX(-50%);
  animation: image-toolbar-in 180ms cubic-bezier(.22, 1, .36, 1) both;
}

.image-context-toolbar[hidden] { display: none; }
.image-context-toolbar.is-offscreen { visibility: hidden; pointer-events: none; }
.image-context-toolbar[aria-busy="true"] > button { pointer-events: none; opacity: 0.55; }

@keyframes image-toolbar-in {
  from { opacity: 0; transform: translate(-50%, -6px); }
}

.image-context-toolbar > button {
  min-width: max-content;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 11px;
  white-space: nowrap;
}

.image-context-toolbar > button:hover,
.image-context-toolbar > button.active,
.image-context-toolbar > button[aria-expanded="true"] { color: var(--ink); background: var(--surface-hover); }
.image-context-toolbar > button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.image-context-toolbar > button > svg { width: 16px; height: 16px; flex: 0 0 16px; }
.image-context-toolbar > button > .toolbar-chevron { width: 11px; height: 11px; transform: rotate(90deg); color: var(--faint); transition: transform 170ms ease-out; }
.image-context-toolbar > button[aria-expanded="true"] > .toolbar-chevron { transform: rotate(-90deg); }
.image-context-toolbar > button > em { padding: 2px 5px; border-radius: 999px; color: oklch(0.16 0.02 220); background: var(--blue); font-size: 8px; font-style: normal; font-weight: 800; }
.image-context-toolbar > button.image-toolbar-icon { width: 40px; min-width: 40px; padding: 0; }

.image-tool-dropdown {
  width: var(--image-tool-menu-width, 184px);
  max-height: var(--image-tool-menu-max-height, 360px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: fixed;
  top: var(--image-tool-menu-top, 70px);
  left: var(--image-tool-menu-left, 12px);
  z-index: calc(var(--z-dropdown) + 1);
  padding: 6px;
  overflow: auto;
  border: 1px solid oklch(0.43 0.012 180);
  border-radius: 10px;
  color: var(--ink-soft);
  background: oklch(0.225 0.009 175 / 0.99);
  box-shadow: 0 4px 8px oklch(0 0 0 / 0.38);
  animation: image-tool-menu-in 170ms cubic-bezier(.22, 1, .36, 1) both;
}

.image-tool-dropdown[hidden] { display: none; }

@keyframes image-tool-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
}

.image-tool-dropdown > button {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

.image-tool-dropdown > button:hover,
.image-tool-dropdown > button:focus-visible,
.image-tool-dropdown > button.active {
  outline: none;
  color: var(--ink);
  background: oklch(0.31 0.014 175);
}

.image-tool-dropdown > button > svg:first-child {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: var(--muted);
}

.image-tool-dropdown > button:hover > svg:first-child,
.image-tool-dropdown > button:focus-visible > svg:first-child,
.image-tool-dropdown > button.active > svg:first-child { color: var(--ink-soft); }
.image-tool-dropdown > button > span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.image-tool-dropdown > button > svg:last-child:not(:first-child) { width: 13px; height: 13px; flex: 0 0 13px; color: var(--primary); stroke-width: 2.5; }

.image-toolbar-divider {
  width: 1px;
  height: 24px;
  flex: 0 0 1px;
  margin: 0 3px;
  background: var(--line);
}

.image-preview-dialog {
  width: min(94vw, 1500px);
  height: min(92vh, 1000px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  background: var(--canvas);
  box-shadow: 0 6px 14px oklch(0 0 0 / 0.5);
}

.image-preview-dialog::backdrop { background: oklch(0 0 0 / 0.78); }
.image-preview-dialog-stage { width: 100%; height: 100%; position: relative; display: grid; place-items: center; padding: 54px 24px 68px; }
.image-preview-dialog-media { width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; display: grid; place-items: center; }
.image-preview-dialog-media > img { width: 100%; height: 100%; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; display: block; object-fit: contain; }
.image-preview-dialog-stage { min-width: 0; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.prompt-video-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px; }
.prompt-inline-reference > svg { width: 21px; height: 21px; }
.media-node-canvas > img, .image-result-strip img { object-fit: contain; }
.workflow-node video[controls] { touch-action: none; }
.workflow-node [data-node-video-player] { cursor: grab; touch-action: none; }
.canvas-history-trigger { position: absolute; top: 16px; right: 20px; padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); }
.canvas-video-preview, .canvas-creation-history { margin: auto; padding: 20px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--canvas); color: var(--ink); }
.canvas-video-preview { width: min(92vw, 1200px); height: min(90vh, 900px); overflow: hidden; }
.canvas-video-preview header, .canvas-creation-history header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.canvas-video-preview video { width: 100%; height: calc(100% - 54px); object-fit: contain; background: #000; }
.canvas-video-preview::backdrop, .canvas-creation-history::backdrop { background: #000a; }
.canvas-creation-history { width: min(90vw, 680px); max-height: 85vh; overflow: auto; }
.canvas-history-list article { padding: 16px 0; border-top: 1px solid var(--line-strong); }
.canvas-history-list small { display: block; color: var(--muted); margin-top: 6px; }
.canvas-history-list p { white-space: pre-wrap; overflow-wrap: anywhere; }
.canvas-video-preview button, .canvas-creation-history button { color: var(--ink); background: var(--panel); padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 6px; margin-right: 6px; }
.image-preview-dialog-stage > button { width: 40px; height: 40px; display: grid; place-items: center; position: absolute; top: 12px; right: 12px; border: 0; border-radius: 8px; color: var(--ink-soft); background: var(--panel-raised); }
.image-preview-dialog-stage > button:hover { color: var(--ink); background: var(--surface-hover); }
.image-preview-dialog-stage > button svg { width: 18px; height: 18px; }
.image-preview-dialog-meta { position: absolute; right: 24px; bottom: 18px; left: 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; }
.image-preview-dialog-meta strong { overflow: hidden; color: var(--ink-soft); text-overflow: ellipsis; white-space: nowrap; }

.image-tool-dialog {
  width: min(94vw, 1120px);
  height: min(90vh, 760px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--ink);
  background: oklch(0.17 0.007 175);
}

.image-tool-dialog::backdrop { background: oklch(0.06 0.01 190 / 0.82); }
.image-tool-dialog-shell { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }

.image-tool-dialog-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: oklch(0.19 0.008 175);
}

.image-tool-dialog-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
}

.image-tool-dialog-mark svg { width: 19px; height: 19px; }
.image-tool-dialog-header > div { min-width: 0; flex: 1; }
.image-tool-dialog-header h2 { margin: 0; color: var(--ink); font-size: 15px; font-weight: 700; letter-spacing: -0.015em; }
.image-tool-dialog-header p { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.image-tool-dialog-header > button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.image-tool-dialog-header > button:hover { color: var(--ink); background: var(--surface-hover); }
.image-tool-dialog-header > button svg { width: 17px; height: 17px; }

.image-tool-dialog-workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 286px; }
.image-tool-editor-stage { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; gap: 10px; padding: 22px; overflow: hidden; background: oklch(0.115 0.006 175); }

.image-tool-surface {
  max-width: 100%;
  max-height: 100%;
  position: relative;
  overflow: visible;
  line-height: 0;
  background: var(--bg);
  touch-action: none;
  user-select: none;
}

.image-tool-surface > img { max-width: 100%; max-height: calc(90vh - 210px); display: block; object-fit: contain; pointer-events: none; }
.image-tool-mask-canvas { display: none; }
.image-tool-surface > canvas { width: 100%; height: 100%; display: none; position: absolute; inset: 0; cursor: crosshair; opacity: 0.42; mix-blend-mode: screen; touch-action: none; }
.image-tool-dialog[data-tool="erase"] .image-tool-surface > canvas { display: block; }

.image-tool-crop-frame {
  display: none;
  position: absolute;
  border: 1px solid var(--white);
  outline: 1px solid oklch(0.12 0.02 180 / 0.7);
  box-shadow: 0 0 0 120vmax oklch(0.02 0.004 180 / 0.64);
  cursor: move;
  touch-action: none;
}

.image-tool-dialog[data-tool="crop"] .image-tool-crop-frame { display: block; }
.image-tool-crop-frame::before,
.image-tool-crop-frame::after { content: ""; position: absolute; pointer-events: none; opacity: 0.55; }
.image-tool-crop-frame::before { top: 33.333%; right: 0; bottom: 33.333%; left: 0; border-top: 1px solid var(--white); border-bottom: 1px solid var(--white); }
.image-tool-crop-frame::after { top: 0; right: 33.333%; bottom: 0; left: 33.333%; border-right: 1px solid var(--white); border-left: 1px solid var(--white); }
.image-tool-crop-frame > i { width: 14px; height: 14px; position: absolute; border: 2px solid var(--white); background: oklch(0.12 0.01 180); }
.image-tool-crop-frame > i[data-crop-handle="nw"] { top: -7px; left: -7px; cursor: nwse-resize; }
.image-tool-crop-frame > i[data-crop-handle="ne"] { top: -7px; right: -7px; cursor: nesw-resize; }
.image-tool-crop-frame > i[data-crop-handle="sw"] { bottom: -7px; left: -7px; cursor: nesw-resize; }
.image-tool-crop-frame > i[data-crop-handle="se"] { right: -7px; bottom: -7px; cursor: nwse-resize; }

.image-tool-dialog[data-tool="outpaint"] .image-tool-surface::before,
.image-tool-dialog[data-tool="panorama"] .image-tool-surface::before {
  content: "";
  position: absolute;
  inset: -28px -52px;
  z-index: -1;
  border: 1px dashed oklch(0.68 0.15 145 / 0.75);
  background: oklch(0.18 0.02 150);
}

.image-tool-stage-hint { max-width: 68ch; min-height: 16px; color: var(--muted); font-size: 10px; line-height: 1.5; text-align: center; }
.image-tool-controls { min-height: 0; padding: 16px; overflow: auto; border-left: 1px solid var(--line); background: oklch(0.19 0.007 175); }
.image-tool-controls > section + section { margin-top: 18px; }
.image-tool-controls h3 { margin: 0 0 5px; color: var(--ink-soft); font-size: 12px; }
.image-tool-controls p { margin: 0 0 10px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.image-tool-controls label { display: grid; gap: 7px; color: var(--ink-soft); font-size: 10px; font-weight: 600; }
.image-tool-controls label + label { margin-top: 13px; }
.image-tool-controls textarea { width: 100%; min-height: 88px; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: var(--canvas); font-size: 10px; line-height: 1.55; }
.image-tool-controls textarea:focus { border-color: var(--primary); }
.image-tool-controls textarea::placeholder { color: var(--muted); }
.image-tool-controls input[type="range"] { width: 100%; accent-color: var(--primary); }
.image-tool-range-row { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 9px; font-weight: 500; }
.image-tool-range-row output { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.image-tool-option-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.image-tool-option-grid button { min-width: 52px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--canvas); font-size: 10px; }
.image-tool-option-grid button:hover { color: var(--ink); border-color: var(--line-strong); }
.image-tool-option-grid button.active { color: oklch(0.92 0.05 145); border-color: var(--primary); background: var(--primary-soft); }
.image-tool-option-grid button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.image-tool-note { display: flex; gap: 8px; padding: 10px; border-radius: 9px; color: var(--muted); background: var(--canvas); font-size: 9px; line-height: 1.5; }
.image-tool-note svg { width: 15px; height: 15px; flex: 0 0 15px; color: var(--primary); }

.image-tool-dialog-footer { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 14px; border-top: 1px solid var(--line); background: oklch(0.19 0.008 175); }
.image-tool-dialog-footer > span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.image-tool-dialog-footer > span svg { width: 14px; height: 14px; color: var(--amber); }
.image-tool-dialog-footer > div { display: flex; gap: 8px; }
.image-tool-dialog-footer button { height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; border-radius: 8px; font-size: 10px; font-weight: 700; }
.image-tool-cancel { border: 1px solid var(--line); color: var(--ink-soft); background: transparent; }
.image-tool-cancel:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.image-tool-apply { min-width: 112px; border: 0; color: oklch(0.12 0.025 145); background: var(--primary); }
.image-tool-apply:hover { background: oklch(0.73 0.16 145); }
.image-tool-apply:disabled { cursor: wait; opacity: 0.55; }
.image-tool-apply svg { width: 15px; height: 15px; }

.image-operation-composer { min-height: 138px; padding: 14px; }
.image-operation-summary { display: grid; gap: 10px; }
.image-operation-heading { display: flex; align-items: center; gap: 9px; }
.image-operation-heading > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--primary); background: var(--primary-soft); }
.image-operation-heading > span svg { width: 16px; height: 16px; }
.image-operation-heading div { min-width: 0; display: grid; gap: 2px; }
.image-operation-heading strong { color: var(--ink); font-size: 11px; }
.image-operation-heading small { color: var(--muted); font-size: 9px; }
.image-operation-params { display: flex; flex-wrap: wrap; gap: 6px; }
.image-operation-params span { padding: 5px 8px; border-radius: 6px; color: var(--ink-soft); background: var(--canvas); font-size: 9px; }
.image-operation-composer .composer-footer { margin-top: auto; padding: 10px 0 0; border-top: 1px solid var(--line); }

.style-plaza-dialog {
  width: min(95vw, 1480px);
  height: min(91vh, 860px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--ink);
  background: oklch(0.205 0.007 185);
  box-shadow: 0 6px 12px oklch(0 0 0 / 0.48);
}

.style-plaza-dialog::backdrop { background: oklch(0.08 0.01 200 / 0.76); }
.style-plaza-shell { height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }

.style-plaza-header {
  min-height: 68px;
  display: grid;
  grid-template-columns: auto minmax(240px, 390px) minmax(160px, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.style-plaza-views {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: oklch(0.26 0.006 185);
}

.style-plaza-views button,
.style-plaza-categories button {
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.style-plaza-views button { height: 34px; padding: 0 15px; border-radius: 8px; }
.style-plaza-views button:hover,
.style-plaza-views button.active { color: var(--ink); background: oklch(0.32 0.008 185); }
.style-plaza-views button:focus-visible,
.style-plaza-categories button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.style-plaza-search {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: oklch(0.255 0.007 185);
}

.style-plaza-search:focus-within { border-color: oklch(0.58 0.07 205); }
.style-plaza-search svg { width: 15px; height: 15px; flex: 0 0 15px; }
.style-plaza-search input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font: inherit; font-size: 11px; }
.style-plaza-search input::placeholder { color: oklch(0.62 0.016 190); }

.style-plaza-heading { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.style-plaza-heading h2 { margin: 0; overflow: hidden; color: var(--ink-soft); font-size: 12px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.style-plaza-heading button { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; color: var(--muted); background: transparent; }
.style-plaza-heading button:hover { color: var(--ink); background: var(--surface-hover); }
.style-plaza-heading button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.style-plaza-heading svg { width: 18px; height: 18px; }

.style-plaza-categories {
  min-height: 47px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.style-plaza-categories button { height: 30px; flex: 0 0 auto; padding: 0 11px; border-radius: 7px; }
.style-plaza-categories button:hover,
.style-plaza-categories button.active { color: var(--ink); background: oklch(0.29 0.008 185); }

.style-plaza-results {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  align-content: start;
  gap: 14px;
  padding: 16px;
  overflow: auto;
}

.style-plaza-card {
  min-width: 0;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 11px;
  background: oklch(0.235 0.006 185);
}

.style-plaza-card:hover { border-color: oklch(0.43 0.018 195); }
.style-plaza-card.selected { border-color: oklch(0.63 0.07 205); }
.style-card-select { width: 100%; display: block; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; }
.style-card-select:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.style-card-visual { aspect-ratio: 4 / 3; display: block; overflow: hidden; background: var(--bg); }
.style-card-visual img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform 180ms cubic-bezier(.22, 1, .36, 1); }
.style-plaza-card:hover .style-card-visual img { transform: scale(1.025); }
.style-plaza-card[data-style-tone="warm"] img { filter: sepia(.2) saturate(.9) hue-rotate(338deg); }
.style-plaza-card[data-style-tone="soft"] img { filter: saturate(.65) brightness(1.08); }
.style-plaza-card[data-style-tone="ink"] img { filter: grayscale(.78) contrast(1.08) brightness(.92); }
.style-plaza-card[data-style-tone="graphic"] img { filter: saturate(1.35) contrast(1.16); }
.style-plaza-card[data-style-tone="architectural"] img { filter: grayscale(.4) contrast(.94); }
.style-plaza-card[data-style-tone="story"] img { filter: sepia(.12) saturate(.82) contrast(.96); }
.style-plaza-card[data-style-tone="clean"] img { filter: saturate(.55) brightness(1.16) contrast(.9); }

.style-card-copy { display: grid; gap: 4px; padding: 10px 11px 11px; }
.style-card-copy strong,
.style-card-copy small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.style-card-copy strong { color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.style-card-copy small { color: var(--muted); font-size: 9px; }

.style-card-favorite {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  border-radius: 8px;
  color: oklch(0.86 0.01 190);
  background: oklch(0.13 0.008 190 / 0.74);
}

.style-card-favorite:hover,
.style-card-favorite.active { color: oklch(0.78 0.12 18); background: oklch(0.18 0.018 18 / 0.88); }
.style-card-favorite:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.style-card-favorite svg { width: 15px; height: 15px; }
.style-card-favorite.active svg { fill: currentColor; }
.style-card-selected { display: flex; align-items: center; gap: 4px; position: absolute; left: 8px; top: 8px; padding: 4px 7px; border-radius: 7px; color: var(--ink); background: oklch(0.2 0.025 200 / 0.88); font-size: 9px; }
.style-card-selected svg { width: 12px; height: 12px; color: var(--primary); }

.style-plaza-empty { min-height: 260px; grid-column: 1 / -1; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); text-align: center; }
.style-plaza-empty svg { width: 28px; height: 28px; color: var(--faint); }
.style-plaza-empty strong { color: var(--ink-soft); font-size: 13px; }
.style-plaza-empty span { font-size: 10px; }

.sr-only {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.canvas-hint > svg {
  color: var(--primary);
  flex: 0 0 15px;
  width: 15px;
}

.canvas-hint button {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.canvas-hint button:hover { background: var(--surface-hover); }
.canvas-hint button svg { width: 13px; }

.canvas-controls {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: var(--z-floating);
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-1);
}

.canvas-controls .icon-button {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.canvas-controls .control-divider {
  height: 18px;
  margin: 0 3px;
}

.selection-box {
  position: absolute;
  z-index: calc(var(--z-floating) - 1);
  border: 1px solid var(--primary);
  background: oklch(0.68 0.15 145 / 0.12);
  pointer-events: none;
}

.selection-box[hidden] { display: none; }

.creation-toolbar {
  min-height: 44px;
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: var(--z-floating);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--panel-raised);
  box-shadow: var(--shadow-1);
  transform: translateX(-50%);
}

.creation-toolbar .control-divider {
  height: 20px;
  margin: 0 2px;
}

.tool-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: transparent;
}

.tool-button:hover,
.tool-button.active {
  color: var(--ink);
  background: var(--surface-hover);
}

.tool-button.primary-tool {
  color: var(--white);
  background: var(--primary-strong);
}

.tool-button.primary-tool:hover { background: var(--primary); }
.tool-button svg { width: 16px; height: 16px; }

.canvas-empty {
  width: min(520px, calc(100% - 40px));
  position: absolute;
  left: 50%;
  top: 44%;
  z-index: var(--z-base);
  text-align: center;
  transform: translate(-50%, -50%);
}

.canvas-empty[hidden] { display: none; }

.canvas-empty-mark {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--primary);
  background: var(--primary-soft);
}

.canvas-empty h2 {
  margin: 14px 0 6px;
  font-size: 17px;
  text-wrap: balance;
}

.canvas-empty p {
  margin: 0 auto;
  max-width: 55ch;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.empty-template-list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.empty-template-list button,
.agent-presets button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  background: var(--panel);
  font-size: 10px;
}

.empty-template-list button:hover,
.agent-presets button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--surface-hover);
}

.zoom-value {
  min-width: 48px;
  height: 32px;
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 11px;
}

.zoom-value:hover { background: var(--surface-hover); }

.minimap {
  width: 148px;
  height: 92px;
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: var(--z-floating);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow-1);
}

.minimap-label {
  position: absolute;
  top: 6px;
  left: 8px;
  color: var(--faint);
  font-size: 9px;
}

.minimap-node {
  position: absolute;
  width: 18px;
  height: 8px;
  border-radius: 2px;
  background: var(--muted);
}

.minimapViewport {
  position: absolute;
  border: 1px solid var(--primary);
  border-radius: 3px;
  background: oklch(0.68 0.15 145 / 0.08);
}

.add-menu {
  width: 220px;
  max-height: calc(100vh - 20px);
  position: fixed;
  z-index: var(--z-dropdown);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-raised);
  box-shadow: var(--shadow-2);
  animation: add-menu-in 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.add-menu[hidden] { display: none; }

.add-menu-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 8px 9px;
  color: var(--muted);
  font-size: 10px;
}

.add-menu-title-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.add-menu-title-copy strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.add-menu-title-copy small {
  color: var(--primary);
  font-size: 9px;
}

@keyframes add-menu-in {
  from { opacity: 0; transform: translateY(4px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.add-menu button[data-quick-add] {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 11px;
  text-align: left;
}

.add-menu button[data-quick-add] > svg:first-child {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--ink-soft);
}

.add-menu button[data-quick-add] > span {
  min-width: 0;
  flex: 1;
}

.add-menu .menu-chevron {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  color: var(--muted);
}

.menu-badge {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 5px;
  color: var(--ink-soft);
  background: var(--surface-active);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
}

.menu-badge.new {
  color: oklch(0.86 0.1 220);
  background: oklch(0.25 0.06 220);
}

.menu-badge.model {
  color: oklch(0.84 0.09 200);
  background: oklch(0.24 0.055 200);
}

.add-menu-section {
  margin: 6px 8px 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10px;
}

.add-menu button[data-quick-add]:hover,
.add-menu button[data-quick-add]:focus-visible {
  background: var(--surface-hover);
}

.context-menu,
.workflow-menu {
  width: 210px;
  position: fixed;
  z-index: var(--z-dropdown);
  padding: 6px;
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  box-shadow: var(--shadow-2);
  animation: add-menu-in 140ms cubic-bezier(0.22, 1, 0.36, 1);
}

.context-menu[hidden],
.workflow-menu[hidden] { display: none; }

.context-menu button,
.workflow-menu button {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 11px;
  text-align: left;
}

.context-menu button:hover,
.context-menu button:focus-visible,
.workflow-menu button:hover,
.workflow-menu button:focus-visible {
  color: var(--ink);
  background: var(--surface-hover);
}

.context-menu button.danger { color: oklch(0.78 0.12 25); }
.context-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}
.context-menu button svg,
.workflow-menu button svg { width: 15px; height: 15px; }

.context-menu-separator {
  height: 1px;
  margin: 5px 6px;
  background: var(--line);
}

.context-menu-shortcut {
  margin-left: auto;
  color: var(--faint);
  font-size: 9px;
}

.workflow-menu {
  top: 50px;
  left: 176px;
}

.template-palette {
  width: min(680px, calc(100% - 32px));
  position: fixed;
  left: 50%;
  top: 74px;
  z-index: var(--z-dropdown);
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--panel-raised);
  box-shadow: var(--shadow-2);
  transform: translateX(-50%);
  animation: template-in 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.template-palette[hidden] { display: none; }

.template-palette header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.template-palette h2 {
  margin: 3px 0 0;
  font-size: 15px;
}

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

.template-card {
  min-height: 104px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 3px 10px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--panel);
  text-align: left;
}

.template-card:hover { background: var(--surface-hover); }

.template-icon {
  width: 38px;
  height: 38px;
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--primary);
  background: var(--primary-soft);
}

.template-icon.character { color: var(--blue); background: var(--blue-soft); }
.template-icon.manga { color: var(--amber); background: oklch(0.24 0.055 75); }
.template-icon.commerce { color: var(--coral); background: var(--coral-soft); }
.template-icon.music { color: var(--violet); background: var(--violet-soft); }
.template-icon svg { width: 18px; height: 18px; }
.template-card strong { align-self: end; font-size: 12px; }
.template-card small { align-self: start; color: var(--muted); font-size: 10px; }
.template-card em { grid-column: 3; grid-row: 1 / 3; color: var(--faint); font-size: 9px; font-style: normal; }

@keyframes template-in {
  from { opacity: 0; transform: translate(-50%, -5px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.inspector-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.inspector-content {
  padding-bottom: 40px;
}

.asset-heading,
.agent-heading {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.asset-heading h2,
.agent-heading h2 {
  margin: 3px 0 0;
  font-size: 15px;
}

.panel-tabs {
  display: flex;
  gap: 3px;
  margin-bottom: 14px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.panel-tabs button {
  min-height: 32px;
  flex: 1;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
}

.panel-tabs button.active {
  color: var(--ink);
  background: var(--surface-hover);
}

.asset-content {
  padding-bottom: 32px;
}

.asset-selection-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  background: var(--primary-soft);
  font-size: 10px;
}

.asset-selection-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: var(--primary);
}

.asset-dropzone {
  min-height: 112px;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: var(--bg);
  text-align: center;
}

.asset-dropzone.dragging,
.asset-content.dragging .asset-dropzone {
  border-color: var(--primary);
  color: var(--ink);
  background: var(--primary-soft);
}

.asset-dropzone svg {
  width: 22px;
  height: 22px;
  margin-bottom: 7px;
  color: var(--primary);
}

.asset-dropzone strong,
.asset-dropzone span { display: block; }
.asset-dropzone strong { color: var(--ink-soft); font-size: 11px; }
.asset-dropzone span { margin-top: 4px; font-size: 9px; }

.asset-dropzone button {
  min-height: 30px;
  margin-top: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--white);
  background: var(--primary-strong);
  font-size: 10px;
}

.asset-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 2px 8px;
  color: var(--muted);
  font-size: 10px;
}

.asset-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.asset-item {
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.asset-preview {
  height: 88px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  background: var(--surface-hover);
}

.asset-preview img,
.asset-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-preview svg { width: 25px; height: 25px; }

.asset-meta {
  padding: 8px;
}

.asset-meta strong,
.asset-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-meta strong { font-size: 10px; }
.asset-meta small { margin-top: 3px; color: var(--faint); font-size: 8px; }

.asset-meta button {
  width: 100%;
  min-height: 28px;
  margin-top: 7px;
  border: 0;
  border-radius: 6px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: 9px;
}

.asset-meta button:hover { color: var(--primary); }

.panel-empty {
  padding: 32px 14px;
  color: var(--muted);
  text-align: center;
  font-size: 10px;
  line-height: 1.6;
}

.panel-empty svg {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  color: var(--faint);
}

.agent-thread {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 10px 2px 16px;
}

.agent-panel [hidden] { display: none !important; }

.agent-heading { margin-bottom: 8px; }

.agent-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
}

.agent-online i,
.agent-capability-strip i {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background: var(--primary);
}

.agent-heading-actions { display: flex; gap: 6px; }

.agent-capability-strip {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-hover);
  font-size: 9px;
}

.agent-capability-strip span { display: inline-flex; align-items: center; gap: 5px; color: var(--primary); }
.agent-capability-strip b { color: var(--ink-soft); font-weight: 650; }
.agent-model-picker { min-width: 0; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.agent-model-picker > span { color: var(--muted); }
.agent-model-picker select { min-width: 128px; max-width: 170px; height: 26px; border: 1px solid var(--line); border-radius: 6px; outline: none; background: var(--bg); color: var(--ink-soft); font: inherit; font-size: 9px; }
.agent-capability-strip em { margin-left: auto; color: var(--faint); font-style: normal; }
.agent-capability-strip.is-connected { border-color: oklch(0.48 0.11 145); background: oklch(0.18 0.035 145); }
.agent-capability-strip.is-connected em { color: var(--primary); }
.agent-capability-strip.is-error span,
.agent-capability-strip.is-error em { color: var(--amber); }
.agent-capability-strip.is-error i { background: var(--amber); }

.agent-question-card {
  flex: 0 0 auto;
  margin: 4px 0 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: oklch(0.205 0.008 145);
}

.agent-question-card header,
.agent-question-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-question-card header strong { color: var(--ink); font-size: 12px; }
.agent-question-card header > span { color: var(--muted); font-size: 10px; }
.agent-question-card header > span b { color: var(--primary); }

.agent-question-progress {
  height: 2px;
  margin: 11px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.agent-question-progress i {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--primary);
  transform: scaleX(var(--agent-question-progress, 0));
  transform-origin: left;
  transition: transform 180ms cubic-bezier(.22, 1, .36, 1);
}

.agent-question-card > p { margin: 0 0 10px; color: var(--muted); font-size: 10px; }

.agent-question-options { display: grid; gap: 7px; }

.agent-question-options button {
  min-height: 42px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  background: var(--bg);
  font-size: 10px;
  line-height: 1.45;
  text-align: left;
}

.agent-question-options button:hover { border-color: var(--muted); color: var(--white); }
.agent-question-options button.selected { border-color: var(--primary); color: var(--white); background: var(--primary-soft); }

.agent-question-options b {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-active);
  font-size: 9px;
}

.agent-question-options button.selected b { color: var(--canvas); background: var(--primary); }

.agent-custom-answer {
  width: 100%;
  height: 38px;
  margin-top: 8px;
  padding: 0 10px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 10px;
}

.agent-question-card footer { margin-top: 12px; }
.agent-question-card footer button { min-height: 32px; border-radius: 7px; font-size: 10px; }
.agent-question-skip { padding: 0 8px; border: 0; color: var(--muted); background: transparent; }
.agent-question-skip:hover { color: var(--ink); }
.agent-question-next { display: inline-flex; align-items: center; gap: 5px; padding: 0 12px; border: 0; color: var(--canvas); background: var(--primary); font-weight: 750; }
.agent-question-next svg { width: 11px; height: 11px; }
.agent-question-next:disabled { color: var(--faint); background: var(--surface-active); cursor: not-allowed; }

.agent-artifact-group,
.agent-generation-block {
  margin: 0 0 14px 37px;
}

.agent-artifact-label,
.agent-generation-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
}

.agent-artifact-label svg,
.agent-generation-heading svg { width: 13px; height: 13px; }

.agent-artifact-card {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  background: oklch(0.22 0.01 210);
  text-align: left;
}

.agent-artifact-card:hover { border-color: var(--primary); }
.agent-artifact-card > svg { width: 20px; height: 20px; color: oklch(0.74 0.12 210); }
.agent-artifact-card span { min-width: 0; flex: 1; }
.agent-artifact-card strong,
.agent-artifact-card small { display: block; }
.agent-artifact-card strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.agent-artifact-card small { margin-top: 3px; color: var(--muted); font-size: 8px; }

.agent-anchor-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }

.agent-anchor-card {
  aspect-ratio: 0.78;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--faint);
  background: var(--surface-hover);
  font-size: 8px;
}

.agent-anchor-card svg { width: 20px; height: 20px; }
.agent-generation-note { margin: 8px 0 0; color: var(--faint); font-size: 8px; }

.agent-stage-action {
  margin: 0 0 16px 37px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-hover);
}

.agent-stage-action > span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
}

.agent-stage-action > span svg { width: 13px; height: 13px; color: var(--primary); }

.agent-stage-action button {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  color: var(--canvas);
  background: var(--primary);
  font-size: 10px;
  font-weight: 750;
}

.agent-stage-action button:hover { background: var(--primary-strong); }
.agent-stage-action button svg { width: 12px; height: 12px; }
.agent-stage-action button.completed,
.agent-stage-action button:disabled { color: var(--muted); background: var(--surface-active); cursor: default; }

.manga-agent-brief {
  flex: 0 0 auto;
  margin: 12px 0 14px;
  padding: 13px;
  border: 1px solid oklch(0.43 0.08 145 / 0.65);
  border-radius: var(--radius-md);
  background: oklch(0.16 0.025 145);
}

.manga-agent-status,
.manga-agent-title,
.manga-agent-metrics,
.manga-agent-create,
.manga-skill-list summary {
  display: flex;
  align-items: center;
}

.manga-agent-status {
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
}

.manga-agent-status span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary);
  font-weight: 700;
}

.manga-agent-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 7px oklch(0.7 0.16 145 / 0.68);
}

.manga-agent-status em {
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--faint);
  background: var(--surface-hover);
  font-style: normal;
}

.manga-agent-title {
  gap: 10px;
  margin-top: 12px;
}

.manga-agent-title > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  border-radius: 9px;
  color: oklch(0.9 0.05 145);
  background: var(--primary-strong);
}

.manga-agent-title svg { width: 19px; height: 19px; }
.manga-agent-title div { min-width: 0; }
.manga-agent-title strong,
.manga-agent-title small { display: block; }
.manga-agent-title strong { color: var(--white); font-size: 13px; }
.manga-agent-title small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.45; }

.manga-agent-metrics {
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line);
}

.manga-agent-metrics span {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 1px;
  padding: 7px 5px;
  background: oklch(0.135 0.016 145);
  text-align: center;
}

.manga-agent-metrics b { color: var(--ink); font-size: 13px; }
.manga-agent-metrics small { color: var(--faint); font-size: 8px; white-space: nowrap; }

.manga-agent-create {
  width: 100%;
  min-height: 38px;
  justify-content: flex-start;
  gap: 7px;
  margin-top: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: var(--white);
  background: var(--primary-strong);
  font-size: 10px;
  font-weight: 750;
}

.manga-agent-create:hover { background: var(--primary); }
.manga-agent-create span { flex: 1; text-align: left; }
.manga-agent-create svg { width: 14px; height: 14px; }
.manga-agent-create svg:last-child { width: 12px; }

.manga-skill-list {
  margin-top: 9px;
  color: var(--muted);
  font-size: 9px;
}

.manga-skill-list summary {
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.manga-skill-list summary small { color: var(--faint); font-size: 8px; }
.manga-skill-list > div { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.manga-skill-list > div span { padding: 4px 6px; border-radius: 5px; color: var(--ink-soft); background: var(--surface-hover); }

.agent-message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 12px;
}

.agent-message > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  border-radius: 7px;
  color: var(--primary);
  background: var(--primary-soft);
}

.agent-message > span svg { width: 15px; height: 15px; }

.agent-message p {
  margin: 0;
  padding: 9px 10px;
  border-radius: 4px 10px 10px 10px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: 11px;
  line-height: 1.6;
}

.agent-message.user {
  justify-content: flex-end;
}

.agent-message.user p {
  max-width: 86%;
  border-radius: 10px 4px 10px 10px;
  color: var(--white);
  background: var(--primary-strong);
}

.agent-message.thinking p {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.agent-message.thinking p i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
  animation: agent-thinking 900ms ease-in-out infinite alternate;
}

.agent-message.thinking p i:nth-child(2) { animation-delay: 140ms; }
.agent-message.thinking p i:nth-child(3) { animation-delay: 280ms; }

@keyframes agent-thinking {
  to { opacity: 0.32; transform: translateY(-2px); }
}

.agent-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.agent-presets button { min-height: 30px; padding-inline: 9px; }

.agent-composer {
  min-height: 104px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: end;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
}

.agent-composer textarea {
  min-height: 74px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
  line-height: 1.55;
}

.agent-composer textarea::placeholder { color: var(--muted); }

.agent-composer button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--white);
  background: var(--primary-strong);
}

.agent-composer button:hover { background: var(--primary); }
.agent-composer button svg { width: 16px; height: 16px; }

.empty-inspector {
  padding: 18px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.empty-inspector-visual {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
}

.empty-inspector-visual svg { width: 22px; height: 22px; }
.empty-inspector p { margin: 0 0 10px; }
.empty-inspector ul { margin: 0; padding-left: 18px; }

.inspector-node-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.inspector-node-identity strong,
.inspector-node-identity span {
  display: block;
}

.inspector-node-identity strong { font-size: 13px; }
.inspector-node-identity span { margin-top: 2px; color: var(--muted); font-size: 10px; }

.form-section {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.form-section legend {
  width: 100%;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.inspector-capability-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 4px 0 12px;
}

.inspector-capability-list span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--ink-soft);
  background: var(--surface-hover);
  font-size: 9px;
}

.inspector-capability-list svg { width: 12px; height: 12px; color: var(--primary); }

.field {
  display: block;
  margin-bottom: 12px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-size: 11px;
  line-height: 1.5;
  outline: 0;
  transition: border-color 150ms ease-out, background-color 150ms ease-out;
}

.field input,
.field select { height: 38px; padding: 0 10px; }
.field textarea { min-height: 76px; padding: 9px 10px; resize: vertical; }
.field textarea.code-field,
.field input.code-field { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--line-strong); }

.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--primary); }

.field-hint {
  margin: 5px 0 0;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.5;
}

.security-note,
.result-card {
  display: flex;
  gap: 9px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: oklch(0.22 0.035 85);
  color: oklch(0.84 0.1 85);
  font-size: 10px;
  line-height: 1.5;
}

.security-note svg,
.result-card svg { flex: 0 0 16px; width: 16px; margin-top: 1px; }

.result-card {
  margin-top: 12px;
  background: var(--primary-soft);
  color: oklch(0.82 0.1 145);
}

.result-card pre {
  max-height: 180px;
  margin: 6px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.danger-zone {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.button.danger {
  width: 100%;
  color: oklch(0.82 0.11 25);
  background: var(--danger-soft);
}

.button.danger:hover { background: oklch(0.28 0.08 25); }

.run-log {
  width: min(560px, calc(100% - 32px));
  max-height: min(520px, calc(100% - 32px));
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: var(--z-dropdown);
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-raised);
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

.run-log.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.run-log header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.text-button {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
}

.text-button:hover { color: var(--ink); background: var(--surface-hover); }

.log-summary {
  margin: 12px 0;
  padding: 9px 10px;
  border-radius: 7px;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 10px;
}

.log-list {
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.log-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

.log-item:last-child { border-bottom: 0; }
.log-item svg { width: 15px; height: 15px; }
.log-item.success > svg { color: var(--primary); }
.log-item.error > svg { color: var(--danger); }
.log-item.running > svg { color: var(--amber); animation: status-turn 900ms linear infinite; }

.log-item strong,
.log-item span { display: block; }
.log-item strong { color: var(--ink-soft); font-weight: 600; }
.log-item span { margin-top: 3px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.log-item time { color: var(--faint); font-variant-numeric: tabular-nums; }

.toast-region {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  box-shadow: var(--shadow-1);
  color: var(--ink-soft);
  font-size: 11px;
  animation: toast-in 180ms ease-out both;
}

.toast.success svg { color: var(--primary); }
.toast.error svg { color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
}

.scrim {
  position: fixed;
  inset: var(--topbar-height) 0 0;
  z-index: var(--z-scrim);
  background: oklch(0 0 0 / 0.55);
}

.scrim[hidden] { display: none; }

@media (max-width: 1180px) {
  :root { --library-width: 232px; --inspector-width: 292px; --asset-width: 330px; --agent-width: 440px; }
  .node-library { padding-inline: 10px; }
  .inspector { padding-inline: 14px; }
  .minimap { display: none; }
  /* 积分是账户核心状态，窄屏也必须保留；只缩短文字避免挤压操作区。 */
  .credit-badge { display: inline-flex; }
  .credit-badge > span { display: none; }
}

@media (max-width: 900px) {
  .node-library,
  .inspector,
  .asset-panel,
  .agent-panel {
    width: min(330px, calc(100vw - 40px));
  }
  .run-log { right: 16px; }
  .template-grid { grid-template-columns: 1fr; }
  .template-palette { max-height: calc(100vh - 92px); overflow: auto; }
  .style-plaza-header { grid-template-columns: auto minmax(220px, 1fr) auto; }
  .style-plaza-heading h2 { display: none; }
  .style-plaza-results { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 12px; }
  .image-tool-dialog-workspace { grid-template-columns: minmax(0, 1fr) 250px; }
  .image-tool-editor-stage { padding: 16px; }
}

@media (max-width: 640px) {
  .topbar { padding-inline: 8px; gap: 8px; }
  .brand > span:last-child,
  .topbar-divider,
  .save-state,
  .desktop-label { display: none; }
  .workflow-name span { max-width: 118px; }
  .button.primary { padding-inline: 11px; }
  .button.primary span { display: none; }
  #templateToggle,
  #shareButton { display: none; }
  .canvas-hint { top: 10px; }
  .canvas.has-image-context-toolbar .canvas-hint { display: none; }
  .image-context-toolbar { max-width: calc(100% - 20px); }
  .canvas-hint span { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .canvas-reference-picker { top: 10px; width: calc(100% - 20px); }
  .canvas-reference-picker-copy { min-width: 0; flex: 1; }
  .canvas-reference-picker-copy small { max-width: 180px; }
  .canvas-reference-local { padding-inline: 8px; }
  .canvas-reference-local svg { display: none; }
  .canvas-controls { left: 10px; bottom: 10px; }
  .canvas-controls > :first-child,
  .canvas-controls > :nth-child(2),
  .canvas-controls > :nth-child(3) { display: none; }
  .creation-toolbar { bottom: 10px; }
  .run-log { width: calc(100% - 20px); right: 10px; bottom: 10px; max-height: 66%; }
  .workflow-menu { left: 10px; }
  .asset-list { grid-template-columns: 1fr; }
  .style-plaza-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; }
  .style-plaza-header { grid-template-columns: 1fr auto; gap: 8px; padding: 10px; }
  .style-plaza-views { grid-column: 1 / -1; order: 2; overflow-x: auto; }
  .style-plaza-search { min-width: 0; }
  .style-plaza-heading { grid-column: 2; grid-row: 1; }
  .style-plaza-categories { padding-inline: 10px; }
  .style-plaza-results { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
  .style-card-copy { padding: 8px; }
  .image-tool-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; }
  .image-tool-dialog-header { min-height: 64px; padding: 10px; }
  .image-tool-dialog-header p { white-space: normal; }
  .image-tool-dialog-workspace { grid-template-columns: 1fr; grid-template-rows: minmax(260px, 1fr) auto; overflow: auto; }
  .image-tool-editor-stage { min-height: 300px; }
  .image-tool-surface > img { max-height: 45vh; }
  .image-tool-controls { overflow: visible; border-top: 1px solid var(--line); border-left: 0; }
  .image-tool-dialog-footer { position: sticky; bottom: 0; }
  .image-tool-dialog-footer > span { display: none; }
  .image-tool-dialog-footer > div { width: 100%; }
  .image-tool-dialog-footer button { flex: 1; }
}

@media (pointer: coarse) {
  .library-item { min-height: 58px; }
  .port {
    --node-port-size: 26px;
    --node-port-half-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* 3D director studio */
.director-studio-dialog {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--ink);
  background: #070a0f;
}

.director-studio-dialog::backdrop { background: #05070b; }
.director-studio-shell { width: 100%; height: 100%; display: grid; grid-template-rows: 48px minmax(0, 1fr); background: #070a0f; }
.director-studio-header { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; min-width: 0; padding: 0 12px; border-bottom: 1px solid #262b32; background: #111418; }
.director-studio-titlebar { min-width: 0; display: flex; align-items: center; gap: 10px; }
.director-studio-titlebar > button,
.director-mobile-panels button { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px; color: #b9c1ca; background: transparent; }
.director-studio-titlebar > button:hover,
.director-mobile-panels button:hover { color: #fff; background: #292e35; }
.director-studio-titlebar button svg,
.director-mobile-panels svg { width: 16px; height: 16px; }
.director-studio-mark { width: 1px; height: 22px; overflow: hidden; color: transparent; background: #30353d; }
.director-studio-titlebar h2 { margin: 0; font-size: 13px; font-weight: 720; letter-spacing: -0.01em; }
.director-studio-titlebar > div { display: flex; align-items: baseline; gap: 10px; }
#directorSaveState { display: inline-flex; align-items: center; gap: 5px; color: #7f8994; font-size: 9px; white-space: nowrap; }
#directorSaveState i { width: 5px; height: 5px; border-radius: 50%; background: #52db87; box-shadow: 0 0 8px rgb(82 219 135 / 0.5); }
#directorSaveState.dirty i { background: #edb753; box-shadow: none; }
.director-view-switch { position: absolute; left: 50%; top: 7px; display: flex; padding: 2px; border: 1px solid #353a42; border-radius: 7px; background: #20242a; transform: translateX(-50%); }
.director-view-switch button { height: 29px; padding: 0 13px; border: 0; border-radius: 5px; color: #929ba5; background: transparent; font-size: 10px; font-weight: 650; }
.director-view-switch button:hover { color: #e9edf2; }
.director-view-switch button.active { color: #fff; background: #40454d; box-shadow: 0 1px 2px rgb(0 0 0 / 0.35); }
.director-mobile-panels { display: none; gap: 4px; }

.director-studio-workspace { min-height: 0; display: grid; grid-template-columns: 272px minmax(0, 1fr) 288px; }
.director-scene-panel { position: relative; z-index: 4; min-width: 0; display: grid; grid-template-columns: 40px minmax(0, 1fr); border-right: 1px solid #282d34; background: #171a1f; }
.director-object-rail { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 9px 4px; border-right: 1px solid #282d34; background: #121519; }
.director-object-rail button { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; color: #8e98a3; background: transparent; }
.director-object-rail button:hover { color: #fff; background: #292e35; }
.director-object-rail button.active { color: #e9f4ff; background: #343941; }
.director-object-rail button svg { width: 16px; height: 16px; }
.director-scene-browser { min-width: 0; padding: 12px 9px; }
.director-scene-browser > header { height: 28px; display: flex; align-items: center; justify-content: space-between; color: #eef3f8; font-size: 11px; font-weight: 700; }
.director-scene-browser > header button { width: 25px; height: 25px; display: grid; place-items: center; padding: 0; border: 0; color: #8e98a3; background: transparent; }
.director-scene-browser > header button:hover { color: #fff; }
.director-scene-browser > header svg { width: 13px; height: 13px; }
.director-scene-search { height: 34px; display: flex; align-items: center; gap: 7px; margin: 6px 0 10px; padding: 0 9px; border: 1px solid transparent; border-radius: 6px; background: #292d33; }
.director-scene-search:focus-within { border-color: #4b8fb8; }
.director-scene-search svg { width: 13px; height: 13px; color: #a4adb6; }
.director-scene-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: #e8edf2; background: transparent; font-size: 10px; }
.director-scene-search input::placeholder { color: #7e8790; }
.director-scene-tree { display: grid; gap: 3px; }
.director-scene-tree > button { min-width: 0; min-height: 42px; display: grid; grid-template-columns: 27px minmax(0, 1fr) 14px; align-items: center; gap: 7px; padding: 5px 7px; border: 1px solid transparent; border-radius: 5px; color: #c9d0d8; background: transparent; text-align: left; }
.director-scene-tree > button:hover { background: #24282e; }
.director-scene-tree > button.active { border-color: #3f444c; color: #fff; background: #30343a; }
.director-scene-tree > button > span:first-child { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 5px; color: #8ca9c0; background: #20252b; }
.director-scene-tree > button > span:first-child svg { width: 13px; height: 13px; }
.director-scene-tree > button > span:nth-child(2) { min-width: 0; }
.director-scene-tree strong,
.director-scene-tree small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.director-scene-tree strong { font-size: 10px; }
.director-scene-tree small { margin-top: 2px; color: #78828c; font-size: 8px; }
.director-scene-tree > button > svg { width: 12px; height: 12px; color: #58b9eb; }
.director-scene-empty { min-height: 120px; display: grid; place-items: center; align-content: center; gap: 8px; color: #727c86; font-size: 10px; text-align: center; }
.director-scene-empty svg { width: 20px; height: 20px; }

.director-viewport { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #070a0f; }
.director-viewport canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.director-viewport canvas.dragging { cursor: grabbing; }
.director-viewport canvas.transforming { cursor: default; }
.director-viewport-hint { position: absolute; top: 54px; left: 50%; display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid rgb(83 105 119 / 0.42); border-radius: 5px; color: #aeb8c2; background: rgb(12 18 25 / 0.76); font-size: 9px; pointer-events: none; transform: translateX(-50%); transition: opacity 180ms ease; }
.director-viewport-hint.dismissed { opacity: 0; }
.director-viewport-hint svg { width: 12px; height: 12px; color: #61b9e6; }
.director-axis { position: absolute; top: 16px; right: 16px; width: 58px; height: 58px; border: 1px solid #252c35; border-radius: 50%; background: rgb(19 24 32 / 0.76); pointer-events: none; }
.director-axis i { position: absolute; left: 28px; top: 28px; width: 22px; height: 2px; transform-origin: left center; }
.director-axis .axis-x { background: #f45a64; transform: rotate(0); }
.director-axis .axis-y { background: #55d983; transform: rotate(-90deg); }
.director-axis .axis-z { background: #5378ff; transform: rotate(145deg); }
.director-axis b { position: absolute; left: 24px; top: 24px; width: 8px; height: 8px; border-radius: 50%; background: #6d7aff; box-shadow: 0 0 7px rgb(88 111 255 / 0.7); }
.director-reset-view { position: absolute; top: 81px; right: 13px; height: 27px; display: flex; align-items: center; gap: 5px; padding: 0 8px; border: 1px solid #2e343c; border-radius: 5px; color: #929ca6; background: rgb(20 24 29 / 0.82); font-size: 9px; }
.director-reset-view:hover { color: #fff; border-color: #46515d; }
.director-reset-view svg { width: 12px; height: 12px; }
.director-bottom-tools { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); width: min(720px, calc(100% - 32px)); display: flex; align-items: center; gap: 9px; transform: translateX(-50%); }
.director-quick-tools { height: 42px; display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid #333943; border-radius: 8px; background: rgb(24 28 34 / 0.92); box-shadow: 0 5px 18px rgb(0 0 0 / 0.3); }
.director-quick-tools button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px; color: #98a3ad; background: transparent; }
.director-quick-tools button:hover,
.director-quick-tools button.active { color: #fff; background: #353b43; }
.director-quick-tools svg { width: 15px; height: 15px; }
.director-scene-prompt { min-width: 0; flex: 1; height: 42px; display: flex; align-items: center; padding: 3px; border: 1px solid #363d46; border-radius: 8px; background: rgb(23 27 33 / 0.94); box-shadow: 0 5px 18px rgb(0 0 0 / 0.3); }
.director-scene-prompt:focus-within { border-color: #4b8fb8; }
.director-scene-prompt label { min-width: 0; flex: 1; display: flex; align-items: center; gap: 7px; padding: 0 8px; }
.director-scene-prompt label svg { width: 13px; height: 13px; color: #6f7a84; }
.director-scene-prompt input { width: 100%; min-width: 0; border: 0; outline: 0; color: #e8edf2; background: transparent; font-size: 10px; }
.director-scene-prompt input::placeholder { color: #747e88; }
.director-scene-prompt > button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; color: #081018; background: #74c9f2; }
.director-scene-prompt > button:hover { background: #91d7f8; }
.director-scene-prompt > button svg { width: 15px; height: 15px; }

.director-inspector { position: relative; z-index: 4; min-width: 0; overflow: auto; border-left: 1px solid #282d34; background: #202327; scrollbar-width: thin; scrollbar-color: #4b5158 transparent; }
.director-inspector > header { min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid #34383e; }
.director-inspector > header span,
.director-inspector > header strong { display: block; }
.director-inspector > header span { color: #8b949d; font-size: 8px; }
.director-inspector > header strong { margin-top: 3px; font-size: 12px; }
.director-inspector > header button { width: 29px; height: 29px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px; color: #8d969f; background: transparent; }
.director-inspector > header button:hover:not(:disabled) { color: #ff7c82; background: rgb(124 37 42 / 0.24); }
.director-inspector > header button:disabled { opacity: 0.3; cursor: not-allowed; }
.director-inspector > header svg { width: 14px; height: 14px; }
.director-inspector-tabs { height: 44px; display: flex; align-items: end; gap: 4px; padding: 0 12px; border-bottom: 1px solid #34383e; }
.director-inspector-tabs button { height: 34px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; color: #919aa4; background: transparent; font-size: 10px; font-weight: 650; }
.director-inspector-tabs button:hover { color: #e8edf2; }
.director-inspector-tabs button.active { color: #fff; border-bottom-color: #5ab5e5; }
.director-inspector-content { padding: 14px 12px 24px; }
.director-property-form { display: grid; gap: 15px; }
.director-name-field,
.director-scale-field,
.director-color-field { display: grid; gap: 7px; }
.director-property-form label > span,
.director-vector-field legend,
.director-pose-panel > span { color: #8f99a3; font-size: 9px; }
.director-name-field input { height: 34px; padding: 0 9px; border: 1px solid transparent; border-radius: 5px; outline: 0; color: #eef2f6; background: #35383d; font-size: 10px; font-weight: 650; }
.director-name-field input:focus { border-color: #4b8fb8; }
.director-vector-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.director-vector-field legend { margin-bottom: 7px; }
.director-vector-field > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.director-vector-field label { min-width: 0; height: 31px; display: flex; align-items: center; gap: 4px; padding: 0 6px; border: 1px solid transparent; border-radius: 5px; color: #7f8993; background: #35383d; }
.director-vector-field label:focus-within { border-color: #4b8fb8; }
.director-vector-field label span { flex: 0 0 auto; color: #7f8993; font-size: 8px; }
.director-vector-field input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; color: #edf2f7; background: transparent; font-size: 10px; font-variant-numeric: tabular-nums; }
.director-scale-field > div { display: grid; grid-template-columns: minmax(0, 1fr) 46px; align-items: center; gap: 8px; }
.director-scale-field input[type="range"] { width: 100%; accent-color: #5cb7e5; }
.director-scale-field output { height: 29px; display: grid; place-items: center; border-radius: 5px; color: #edf2f7; background: #35383d; font-size: 9px; font-variant-numeric: tabular-nums; }
.director-color-field > div { display: grid; grid-template-columns: 31px minmax(0, 1fr); gap: 7px; }
.director-color-field input { width: 31px; height: 31px; padding: 2px; border: 1px solid #464b52; border-radius: 5px; background: #35383d; }
.director-color-field code { height: 31px; display: flex; align-items: center; padding: 0 9px; border-radius: 5px; color: #dce3ea; background: #35383d; font: 10px ui-monospace, monospace; }
.director-pose-panel { display: grid; gap: 10px; }
.director-pose-panel > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.director-pose-panel button { min-height: 64px; display: grid; place-items: center; align-content: center; gap: 5px; padding: 8px; border: 1px solid #3a3f46; border-radius: 6px; color: #b1bac3; background: #2b2e33; font-size: 9px; }
.director-pose-panel button:hover { border-color: #53606d; color: #fff; }
.director-pose-panel button.active { border-color: #579fc4; color: #fff; background: rgb(52 106 135 / 0.24); }
.director-pose-panel button svg { width: 16px; height: 16px; color: #65b9e4; }
.director-pose-panel p { margin: 2px 0 0; color: #737d87; font-size: 9px; line-height: 1.55; }

@media (max-width: 1180px) {
  .director-studio-workspace { grid-template-columns: 230px minmax(0, 1fr) 254px; }
  .director-studio-titlebar #directorSaveState { display: none; }
}

@media (max-width: 860px) {
  .director-studio-workspace { position: relative; display: block; }
  .director-mobile-panels { display: flex; }
  .director-scene-panel,
  .director-inspector { position: absolute; top: 0; bottom: 0; width: min(290px, calc(100vw - 46px)); transform: translateX(-105%); transition: transform 180ms ease; }
  .director-scene-panel { left: 0; }
  .director-inspector { right: 0; transform: translateX(105%); }
  .director-scene-panel.mobile-open,
  .director-inspector.mobile-open { transform: translateX(0); }
  .director-viewport { width: 100%; height: 100%; }
  .director-view-switch { position: static; transform: none; }
}

@media (max-width: 560px) {
  .director-studio-header { padding-inline: 6px; }
  .director-studio-mark,
  #directorStudioTitle { display: none; }
  .director-view-switch button { padding-inline: 9px; }
  .director-axis { top: 10px; right: 10px; transform: scale(0.84); transform-origin: top right; }
  .director-reset-view { top: 66px; right: 8px; }
  .director-bottom-tools { bottom: max(8px, env(safe-area-inset-bottom)); width: calc(100% - 16px); align-items: stretch; }
  .director-quick-tools { flex: 0 0 auto; }
  .director-scene-prompt { min-width: 0; }
  .director-scene-prompt label svg { display: none; }
}

/* Card gestures keep native controls usable and distinguish movement from wiring. */
.workflow-node .node-label,
.workflow-node .node-card { cursor: grab; }
.workflow-node .node-card :is(button, a, summary, label) { cursor: pointer; }
.workflow-node :is(textarea, input, [contenteditable], .text-node-content p, .node-result-preview p) { cursor: text; }
.workflow-node :is(select, video[controls], audio[controls]) { cursor: auto; }
.workflow-node :is(.node-label, .node-empty-mark, .media-empty-state, .image-node-canvas > img, .audio-waveform, .node-media-badge) { touch-action: none; }
.canvas.is-dragging-node,
.canvas.is-dragging-node .node-card,
.canvas.is-dragging-node .node-label { cursor: grabbing; }
.canvas.is-connecting .workflow-node .node-card { cursor: crosshair; }
.workflow-node.connection-drop-valid .node-card { outline: 3px solid #7bd5a6; outline-offset: 5px; box-shadow: 0 0 0 10px #7bd5a618; }
.workflow-node.connection-drop-valid .port.input { background: #7bd5a6; color: #102019; transform: scale(1.16); }
.workflow-node.connection-drop-invalid .node-card { outline: 2px solid #ed9b8b; outline-offset: 5px; cursor: not-allowed; }
.canvas-connection-hint { position: absolute; z-index: 90; top: 18px; left: 50%; transform: translateX(-50%); max-width: min(560px, calc(100% - 32px)); padding: 10px 16px; border: 1px solid #7bd5a660; border-radius: 12px; background: #14251ff5; color: #d5f8e5; box-shadow: 0 6px 24px #0005; pointer-events: none; font-size: 13px; line-height: 1.6; text-align: center; }
.canvas-connection-hint.invalid { color: #ffe0da; border-color: #ed9b8b80; background: #32201cf5; }
.canvas-connection-hint[hidden] { display: none; }

.node-drag-host { position: relative; isolation: isolate; }
.node-drag-surface { display: block; position: absolute; inset: 0; z-index: -1; touch-action: none; border-radius: inherit; }
[data-node-drag-touch], .workflow-node .port { touch-action: none; }
