/* Graph canvas, nodes, ports and status. */
#graph-stage {
  height: 500px;
  position: relative;
  overflow: hidden;
  touch-action: none;
  cursor: default;
  background-color: #11171e;
  background-image: radial-gradient(#34414d 1px, transparent 1px);
  background-size: 22px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
#graph-content {
  position: absolute;
  left: 0;
  top: 0;
  width: 20000px;
  height: 20000px;
  transform-origin: 0 0;
  will-change: transform;
}
#wires {
  position: absolute;
  inset: 0;
  width: 20000px;
  height: 20000px;
  pointer-events: none;
}
#nodes-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#graph-stage.pan-ready {
  cursor: grab;
}
#graph-stage.panning {
  cursor: grabbing;
}
.graph-selection-frame {
  position: absolute;
  z-index: 100;
  pointer-events: none;
  border: 1px solid #8bd5ee;
  background: rgba(91, 178, 222, 0.15);
  border-radius: 3px;
  box-shadow: 0 0 0 1px #1b3749 inset;
}
.graph-node {
  position: absolute;
  width: 235px;
  min-height: 85px;
  background: #222d38;
  border: 1px solid #526273;
  border-radius: 9px;
  box-shadow: 0 9px 20px #0007;
  pointer-events: auto;
  overflow: hidden;
}
.graph-node.group-node {
  border-color: #ba96e7;
  background: #30273e;
}
.graph-node.selected {
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent),
    0 9px 20px #0007;
}
.node-preview {
  flex-direction: column;
  gap: 4px;
  margin: 7px 10px 10px;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #121921;
  border: 1px solid #41505b;
  border-radius: 6px;
  color: #a8b9c7;
  font-size: 11px;
  text-align: center;
  overflow: hidden;
  padding: 3px;
  overflow-wrap: anywhere;
}
.node-preview canvas {
  display: block;
  width: 96px;
  height: 96px;
  image-rendering: auto;
}
.vector-preview-mode {
  max-width: 100%;
  width: 100%;
  font-size: 10px;
  color: #d4e8f6;
  background: #263744;
  border: 1px solid #526b7b;
  border-radius: 4px;
  padding: 3px;
  cursor: pointer;
}
.node-preview.preview-error {
  color: #ffad9f;
  border-color: #87534c;
}
.preview-target-indicator {
  display: block;
  font-size: 10px;
  font-weight: normal;
  margin-top: 5px;
  color: #8bd5c6;
  letter-spacing: 0.02em;
}
.preview-toggle {
  display: block;
  font-size: 10px;
  font-weight: normal;
  margin-top: 5px;
  padding: 3px 6px;
}
.graph-node:not(.group-node):not(.boundary-node) > .node-head {
  border-top: 3px solid var(--node-category-accent, #526273);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--node-category-accent, #526273) 25%, #31404e),
    #31404e 78%
  );
}
.node-head {
  background: #31404e;
  padding: 10px 12px;
  font-weight: 650;
  cursor: grab;
  user-select: none;
}
.graph-node.dragging > .node-head {
  cursor: grabbing;
}
.port-row {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 8px 7px;
}
.port-cell {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 50%;
  font-size: 11px;
  color: #cbd6e0;
}
.port-cell.output {
  justify-content: flex-end;
  text-align: right;
}
.port {
  width: 14px;
  height: 14px;
  padding: 0;
  flex-shrink: 0;
  border-radius: 50%;
  background: #7cae98;
  border: 2px solid #c4ead3;
}
.port.vector-port {
  background: #d5a15b;
  border-color: #ffe1ad;
}
.port.material-port {
  background: #b18ce3;
  border-color: #e6d2ff;
}
.port.connecting {
  background: #86d9f4;
  border-color: #fff;
  cursor: grabbing;
}
.port.connect-target {
  background: #90edaa;
  border-color: white;
  box-shadow: 0 0 0 5px #90edaa44;
}
.port {
  cursor: crosshair;
}
.port.armed {
  background: #ffcb6b;
  border-color: white;
}
#graph-status {
  padding: 10px;
  color: var(--accent);
  font-size: 12px;
}
#graph-status.error {
  color: #ffad9f;
}

.preview-target-indicator[data-active="true"] {
  color: #a3e3ba;
  font-weight: 600;
}
