:root {
  color-scheme: dark;
  --bg: #101925;
  --panel: #182738;
  --line: #354b60;
  --muted: #a0b7ca;
  --text: #e1edf6;
  --accent: #9ad3ff;
  --image: #85caff;
  --string: #efc18a;
  --integer: #9aabff;
  --float: #c7a1ee;
  --typedArray: #ed9eba;
  --titlebar: linear-gradient(180deg, #baddf6, #8fbee0);
  --titlebar-border: #9bc9ea;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button, input, select, textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button, input, select, textarea {
  color: inherit;
}
button {
  background: none;
  border: 1px solid transparent;
  border-radius: 7px;
}
button:hover {
  background: #283f54;
}
button:disabled {
  opacity: .4;
  cursor: not-allowed;
}
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
input, select, textarea {
  background: #13202e;
  border: 1px solid #45637d;
  border-radius: 6px;
  min-width: 0;
  padding: 8px 10px;
}
input[type=number] {
  appearance: textfield;
}
input::-webkit-inner-spin-button {
  appearance: none;
}
input[type=checkbox] {
  accent-color: var(--accent);
}
a {
  color: var(--accent);
}
.topbar {
  height: 76px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 25px;
  gap: 34px;
  background: #13202e;
}
.project {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 1px solid var(--line);
  padding-left: 25px;
  flex: 1;
}
.project-icon {
  font-size: 20px;
  color: #a5bbcf;
}
.project input {
  border: 0;
  background: transparent;
  width: 165px;
  padding: 7px 0;
  font-weight: 500;
}
.save-state {
  color: #a5bbcf;
  font-size: 10px;
  white-space: nowrap;
}
.save-state:before {
  content: '✓';
  margin-right: 5px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.quiet {
  padding: 8px 12px;
  color: #d5e5f2;
}
.primary {
  background: var(--accent);
  color: #a5bbcf;
  font-weight: 700;
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  box-shadow: 0 1px 0 #bde2ff28 inset;
}
.primary:hover {
  background: #283f54;
}
.icon-button {
  width: 30px;
  height: 30px;
  color: #d5e5f2;
  font-size: 18px;
  display: inline-grid;
  place-items: center;
}
.top-actions>.icon-button {
  border: 1px solid #45637d;
  border-radius: 50%;
  font-size: 13px;
  width: 21px;
  height: 21px;
  margin-right: 6px;
}
.workspace {
  height: calc(100dvh - 109px);
  min-height: 640px;
  display: grid;
  grid-template-columns: 221px minmax(400px,1fr) 307px;
}
.library {
  border-right: 1px solid var(--line);
  background: #13202e;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  padding: 25px 20px 0;
  font-weight: 650;
  font-size: 14px;
}
.muted {
  color: var(--muted);
}
.search {
  display: flex;
  align-items: center;
  margin: 0 15px 15px;
  border: 1px solid #45637d;
  background: #13202e;
  border-radius: 7px;
  padding: 0 10px;
  gap: 7px;
}
.search>span {
  font-size: 23px;
  color: #a5bbcf;
}
.search input {
  border: 0;
  background: none;
  padding: 9px 0;
  width: 100%;
  font-size: 11px;
  outline: none;
}
.search kbd {
  border: 1px solid #45637d;
  padding: 0 4px;
  border-radius: 3px;
  color: #a5bbcf;
  font-size: 10px;
}
.library-list {
  overflow: auto;
  flex: 1;
  padding: 0 10px 14px;
  scrollbar-width: thin;
  scrollbar-color: #45637d transparent;
}
.category {
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #a5bbcf;
  margin: 20px 10px 9px;
  display: flex;
  justify-content: space-between;
}
.category:first-child {
  margin-top: 5px;
}
.category span {
  font-size: 10px;
  color: #a5bbcf;
}
.library-node {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  text-align: left;
  font-size: 11px;
  color: #d5e5f2;
  border: 1px solid transparent;
}
.library-node:hover {
  background: #1c2c3d;
  border-color: #45637d;
  color: #d5e5f2;
}
.lib-icon {
  width: 27px;
  height: 27px;
  border: 1px solid #45637d;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #d5e5f2;
  font-size: 16px;
  background: #13202e;
}
.library-node[data-kind=custom] .lib-icon {
  color: #d5e5f2;
}
.lib-plus {
  margin-left: auto;
  opacity: 0;
  color: var(--accent);
  font-size: 17px;
}
.library-node:hover .lib-plus {
  opacity: 1;
}
.center {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.canvas-toolbar {
  height: 53px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  background: #13202e;
}
.canvas-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 12px;
  height: 100%;
  border-bottom: 2px solid var(--accent);
  padding: 0 5px;
}
.status-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.count {
  background: #1c2c3d;
  color: #d5e5f2;
  border: 1px solid #45637d;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 9px;
  font-weight: 400;
  margin-left: 5px;
}
.canvas-options {
  display: flex;
  align-items: center;
  gap: 13px;
}
.auto-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: #d5e5f2;
  cursor: pointer;
}
.auto-label input {
  position: absolute;
  opacity: 0;
  width: 25px;
}
.toggle-track {
  width: 25px;
  height: 14px;
  border-radius: 8px;
  background: #1c2c3d;
  position: relative;
}
.toggle-track:after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #283f54;
  top: 2px;
  left: 2px;
  transition: transform .15s;
}
.auto-label input:checked+.toggle-track {
  background: #283f54;
}
.auto-label input:checked+.toggle-track:after {
  background: #1c2c3d;
  transform: translateX(11px);
}
.auto-label input:focus-visible+.toggle-track {
  outline: 2px solid var(--accent);
}
.divider {
  height: 17px;
  width: 1px;
  background: #1c2c3d;
  display: inline-block;
}
.run-button {
  color: var(--accent);
  font-size: 15px;
  padding: 6px 0 6px 5px;
  display: flex;
  gap: 7px;
  align-items: center;
}
.run-button span {
  font-size: 11px;
}
.graph-viewport {
  flex: 1;
  min-height: 340px;
  overflow: hidden;
  position: relative;
  background-color: #13202e;
  background-image: radial-gradient(#1c2c3d 1px,transparent 1px);
  background-size: 22px 22px;
  outline: none;
  touch-action: none;
}
.graph-viewport.panning {
  cursor: grabbing;
}
.world {
  position: absolute;
  transform-origin: 0 0;
  left: 0;
  top: 0;
}
.wires {
  position: absolute;
  overflow: visible;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.wire {
  fill: none;
  stroke-width: 2;
  opacity: .65;
  pointer-events: stroke;
  cursor: pointer;
}
.wire:hover, .wire.selected {
  stroke-width: 3;
  opacity: 1;
}
.wire-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
  cursor: pointer;
}
.wire-draft {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  pointer-events: none;
}
.node {
  position: absolute;
  width: 224px;
  background: #13202e;
  border: 1px solid #45637d;
  border-radius: 10px;
  box-shadow: 0 8px 24px #00000038;
  user-select: none;
}
.node.selected {
  border-color: #45637d;
  box-shadow: 0 0 0 1px #00000038,0 8px 25px #00000038;
}
.node-header {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border-bottom: 1px solid #45637d;
  cursor: grab;
  border-radius: 9px 9px 0 0;
  background: linear-gradient(120deg,#1c2c3d,#1c2c3d);
}
.node-header:active {
  cursor: grabbing;
}
.node-icon {
  font-size: 19px;
  min-width: 22px;
  color: #d5e5f2;
}
.node-title {
  font-weight: 600;
  font-size: 12px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.node-number {
  font: 9px monospace;
  color: #a5bbcf;
}
.node-menu {
  color: #a5bbcf;
  letter-spacing: 1px;
  font-size: 14px;
  padding: 2px;
}
.node-body {
  padding: 9px 0;
}
.node-description {
  font-size: 9px;
  color: #a5bbcf;
  padding: 0 13px;
  margin: 3px 0 11px;
}
.port-row {
  position: relative;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 13px;
  color: #d5e5f2;
  font-size: 10px;
}
.port-row.output {
  justify-content: flex-end;
  color: #d5e5f2;
}
.port-row .type-label {
  color: #a5bbcf;
  font: 8px monospace;
}
.port {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #45637d;
  background: var(--port-color,var(--accent));
  box-shadow: 0 0 0 1px var(--port-color,var(--accent));
  cursor: crosshair;
  padding: 0;
  z-index: 2;
}
.port.in {
  left: -6px;
}
.port.out {
  right: -6px;
}
.port:hover, .port.compatible {
  box-shadow: 0 0 0 4px #00000038;
  width: 13px;
  height: 13px;
}
.port.incompatible {
  opacity: .15;
}
.port.unwired {
  background: #13202e;
}
.port-row input {
  width: 77px;
  margin-left: auto;
  padding: 5px 7px;
  border-radius: 4px;
  background: #13202e;
  color: #d5e5f2;
  font: 10px monospace;
  border: 1px solid #45637d;
}
.mode-button {
  padding: 3px 4px;
  font-size: 12px;
  color: #a5bbcf;
  border-radius: 3px;
  margin-left: auto;
  line-height: 1;
}
.mode-button.local {
  color: #a5bbcf;
}
.port-row input+.mode-button {
  margin-left: 0;
}
.node-thumbnail {
  height: 116px;
  margin: 0 12px 7px;
  border-radius: 5px;
  overflow: hidden;
  background: #13202e;
  position: relative;
}
.node-thumbnail canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.node-thumbnail span {
  position: absolute;
  bottom: 6px;
  left: 7px;
  font-size: 8px;
  padding: 3px 5px;
  background: #13202e;
  border-radius: 3px;
  color: #d5e5f2;
}
.node-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  border-top: 1px solid #45637d;
  font-size: 7px;
  color: #a5bbcf;
  line-height: 9px;
  min-height: 10px;
  margin: 0;
}
.node-footer .status-dot {
  width: 4px;
  height: 4px;
  margin-right: 4px;
}
.node-value {
  margin: 0 12px 9px;
  width: calc(100% - 24px);
  font: 11px monospace;
  padding: 9px;
  resize: vertical;
}
.node .function-edit {
  font-size: 10px;
  margin: 0 12px 7px;
  width: calc(100% - 24px);
  border: 1px dashed #45637d;
  padding: 8px;
  color: #d5e5f2;
}
.node-data-preview {
  margin: 0 12px 8px;
  max-height: 120px;
  overflow: auto;
  color: #d5e5f2;
  font: 10px monospace;
  white-space: pre-wrap;
}
.canvas-bottom {
  position: absolute;
  bottom: 17px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.type-legend {
  display: flex;
  gap: 12px;
  font-size: 8px;
  color: #a5bbcf;
  pointer-events: auto;
  padding: 7px 9px;
  border-radius: 5px;
  background: #13202e;
}
.type-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.type-legend i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.type-legend i[data-type=image] {
  background: var(--image);
}
.type-legend i[data-type=string] {
  background: var(--string);
}
.type-legend i[data-type=integer] {
  background: var(--integer);
}
.type-legend i[data-type=float] {
  background: var(--float);
}
.type-legend i[data-type=typedArray] {
  background: var(--typedArray);
}
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #13202e;
  border: 1px solid #45637d;
  border-radius: 6px;
  padding: 4px;
  pointer-events: auto;
}
.zoom-controls button {
  width: 25px;
  height: 24px;
  font-size: 16px;
  color: #d5e5f2;
}
.zoom-controls span:not(.divider) {
  font: 9px monospace;
  padding: 0 5px;
  min-width: 40px;
  text-align: center;
}
.batch-panel {
  height: 196px;
  flex-shrink: 0;
  background: #13202e;
  border-top: 1px solid var(--line);
  padding: 0 20px;
}
.batch-header {
  height: 49px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.batch-header strong {
  font-size: 11px;
  font-weight: 550;
}
.batch-header .quiet {
  font-size: 10px;
  padding-right: 0;
}
.batch-hint {
  color: #a5bbcf;
  font-size: 9px;
  margin-left: 14px;
}
.batch-items {
  display: flex;
  gap: 10px;
  overflow: auto;
  padding-bottom: 5px;
  height: 108px;
  scrollbar-width: thin;
}
.batch-card {
  width: 130px;
  flex-shrink: 0;
  position: relative;
  border: 1px solid #45637d;
  border-radius: 6px;
  padding: 4px;
  background: #13202e;
  text-align: left;
}
.batch-card.active {
  border-color: var(--accent);
  background: #1c2c3d;
}
.batch-card canvas {
  width: 100%;
  height: 64px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
}
.batch-card .file-name {
  font-size: 9px;
  display: block;
  margin: 6px 3px 3px;
  max-width: 100px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  color: #d5e5f2;
}
.batch-card .selected-check {
  position: absolute;
  top: 8px;
  right: 8px;
  border-radius: 50%;
  width: 15px;
  height: 15px;
  background: var(--accent);
  color: #a5bbcf;
  display: grid;
  place-items: center;
  font-size: 9px;
}
.batch-card .remove-file {
  position: absolute;
  right: 5px;
  bottom: 6px;
  padding: 0 3px;
  color: #a5bbcf;
  font-size: 11px;
}
.batch-add {
  min-width: 125px;
  flex: 1;
  border: 1px dashed #45637d;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #a5bbcf;
  font-size: 9px;
  gap: 5px;
  min-height: 95px;
}
.batch-add>span {
  font-size: 20px;
  color: #d5e5f2;
}
.batch-add small {
  font-size: 8px;
  color: #a5bbcf;
}
.batch-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  font-size: 8px;
  color: #a5bbcf;
}
.batch-footer .status-dot {
  width: 4px;
  height: 4px;
  margin-right: 6px;
}
.text-button {
  color: #d5e5f2;
  font-size: 9px;
  padding: 5px 0;
}
.inspector {
  background: #13202e;
  border-left: 1px solid var(--line);
  padding: 0 19px;
  display: flex;
  flex-direction: column;
  overflow: auto;
  scrollbar-width: thin;
}
.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 550;
  height: 59px;
  flex-shrink: 0;
}
.live-badge {
  border: 1px solid #45637d;
  color: #d5e5f2;
  background: #1c2c3d;
  padding: 3px 5px;
  border-radius: 4px;
  font: 8px monospace;
  letter-spacing: 1px;
}
.live-badge.error {
  color: #d5e5f2;
  border-color: #45637d;
  background: #1c2c3d;
}
.output-select-wrap {
  margin-bottom: 11px;
}
.output-select-wrap select {
  width: 100%;
  font-size: 10px;
  background: #13202e;
  color: #d5e5f2;
  padding: 7px;
}
.preview-stage {
  position: relative;
  min-height: 180px;
  aspect-ratio: 4/3;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: repeating-conic-gradient(#1c2c3d 0% 25%,#13202e 0% 50%) 50% / 16px 16px;
  display: grid;
  place-items: center;
  border: 1px solid #45637d;
}
.preview-stage canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
}
.image-format {
  position: absolute;
  left: 9px;
  bottom: 9px;
  font: 8px monospace;
  letter-spacing: 1px;
  background: #13202e;
  padding: 4px 6px;
  color: #d5e5f2;
  border: 1px solid #45637d;
  border-radius: 3px;
}
.preview-stage pre {
  max-width: 100%;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
  font: 11px monospace;
  position: absolute;
  background: #13202e;
  color: #d5e5f2;
}
.preview-stage #preview-empty {
  text-align: center;
  color: #a5bbcf;
  font-size: 11px;
  line-height: 1.8;
}
.preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
}
.preview-meta strong {
  font-weight: 500;
  font-size: 11px;
  display: block;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-meta small {
  font: 9px monospace;
  color: #a5bbcf;
  display: block;
  margin-top: 6px;
}
.preview-switch {
  background: #13202e;
  display: flex;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid #45637d;
}
.preview-switch button {
  width: 50%;
  padding: 6px;
  font-size: 10px;
  color: #a5bbcf;
}
.preview-switch button.active {
  background: #1c2c3d;
  color: #d5e5f2;
  border-color: #45637d;
  box-shadow: 0 1px 3px #00000038;
}
.inspector-rule {
  height: 1px;
  min-height: 1px;
  background: var(--line);
  margin: 23px 0 20px;
}
.selection-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
  color: #d5e5f2;
  font-size: 11px;
  font-weight: 550;
}
.selection-subtitle {
  font-size: 9px;
  line-height: 1.6;
  color: #a5bbcf;
  margin-bottom: 17px;
}
.inspector-field {
  display: block;
  margin-bottom: 13px;
}
.inspector-field>span {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #a5bbcf;
  margin-bottom: 6px;
}
.inspector-field input, .inspector-field select, .inspector-field textarea {
  width: 100%;
  background: #13202e;
  border-color: #45637d;
  color: #d5e5f2;
  font-size: 11px;
}
.inspector-field textarea {
  resize: vertical;
  min-height: 75px;
  font: 10px monospace;
}
.selection-badge {
  font: 8px monospace;
  color: #a5bbcf;
  background: #1c2c3d;
  border: 1px solid #45637d;
  padding: 4px 5px;
  border-radius: 4px;
}
.connection-list {
  font-size: 10px;
  color: #a5bbcf;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px;
  border: 1px solid #45637d;
  border-radius: 5px;
  background: #13202e;
  margin-bottom: 12px;
}
.connection-list>div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.connection-list b {
  font-weight: 400;
  color: #d5e5f2;
}
.inspector-actions {
  display: flex;
  gap: 7px;
  margin-top: 14px;
}
.inspector-actions button {
  border: 1px solid #45637d;
  flex: 1;
  font-size: 10px;
  padding: 7px;
  color: #d5e5f2;
}
.inspector-actions .danger {
  color: #d5e5f2;
}
.run-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 9px;
  line-height: 1.5;
  color: #a5bbcf;
  margin: 22px 0 17px;
}
.run-info .status-dot {
  margin-top: 4px;
}
.run-info.error {
  color: #d5e5f2;
}
.run-info.error .status-dot {
  background: #283f54;
}
.statusbar {
  height: 33px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 19px;
  border-top: 1px solid var(--line);
  background: #13202e;
  font-size: 8px;
  color: #a5bbcf;
}
.statusbar>span:first-child {
  display: flex;
  align-items: center;
  gap: 7px;
}
.statusbar b {
  font-weight: 400;
  margin: 0 8px;
  color: #a5bbcf;
}
.statusbar>span:last-child {
  font: 7px monospace;
  letter-spacing: 1px;
}
.statusbar>span:last-child b {
  margin: 0 0 0 5px;
  letter-spacing: 0;
}
.statusbar kbd {
  font: 8px monospace;
  background: #1c2c3d;
  border: 1px solid #45637d;
  border-radius: 3px;
  padding: 1px 3px;
}
dialog {
  width: min(720px,90vw);
  max-height: 88vh;
  color: var(--text);
  background: #13202e;
  border: 1px solid #45637d;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 20px 100px #00000038;
}
dialog::backdrop {
  background: #13202e;
  backdrop-filter: blur(5px);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-header h2 {
  font: 600 20px system-ui,sans-serif;
  margin: 0;
  letter-spacing: -.5px;
}
.modal-intro {
  color: #a5bbcf;
  font-size: 12px;
  line-height: 1.8;
  margin: 0 0 20px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.code-block {
  background: #13202e;
  border: 1px solid #45637d;
  padding: 15px;
  color: #d5e5f2;
  font: 11px/1.7 monospace;
  border-radius: 6px;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 230px;
}
.code-editor {
  width: 100%;
  height: 190px;
  font: 12px/1.7 monospace;
  tab-size: 2;
  background: #13202e;
  color: #d5e5f2;
}
.schema-editors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.schema-editors textarea {
  height: 125px;
  font: 10px/1.5 monospace;
  width: 100%;
  resize: vertical;
}
.modal-field {
  font-size: 11px;
  color: #d5e5f2;
  display: block;
  margin-bottom: 13px;
}
.modal-field>span {
  display: block;
  margin-bottom: 7px;
}
.modal-note {
  font-size: 10px;
  line-height: 1.7;
  color: #a5bbcf;
}
.modal-error {
  color: #d5e5f2;
  font-size: 11px;
  white-space: pre-wrap;
}
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.help-grid h3 {
  color: #d5e5f2;
  font-size: 12px;
  font-weight: 550;
}
.help-grid p {
  font-size: 11px;
  line-height: 1.8;
  color: #a5bbcf;
}
.shortcut-list {
  font-size: 11px;
  line-height: 2;
  color: #a5bbcf;
}
.port-chip {
  font: 10px monospace;
  padding: 2px 5px;
  border: 1px solid #45637d;
  border-radius: 3px;
  color: var(--accent);
}
#toast {
  position: fixed;
  bottom: 51px;
  left: 50%;
  transform: translate(-50%,15px);
  background: #283f54;
  color: #a5bbcf;
  box-shadow: 0 8px 30px #00000038;
  padding: 11px 19px;
  font-size: 12px;
  border-radius: 7px;
  opacity: 0;
  transition: opacity .2s,transform .2s;
  pointer-events: none;
  max-width: 80vw;
  z-index: 10;
}
#toast.visible {
  opacity: 1;
  transform: translate(-50%,0);
}
[hidden] {
  display: none!important;
}
.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -5px;
}
.no-nodes {
  font-size: 11px;
  color: #a5bbcf;
  padding: 15px 10px;
}
.mini-tag {
  border: 1px solid #45637d;
  color: #a5bbcf;
  font: 8px monospace;
  padding: 3px 4px;
  border-radius: 3px;
}
.batch-progress {
  color: var(--accent);
}

@media(min-width:1600px){.workspace {
  grid-template-columns: 240px minmax(400px,1fr) 340px;
}
.library-node {
  font-size: 12px;
  padding: 9px;
}
.preview-stage {
  margin-top: 5px;
}
.topbar {
  padding: 0 30px;
}
}
@media(max-width:1180px){.workspace {
  grid-template-columns: 190px minmax(350px,1fr) 260px;
}
.topbar {
  gap: 18px;
  padding: 0 18px;
}
.save-state, .batch-hint {
  display: none;
}
.project {
  padding-left: 17px;
}
.inspector {
  padding: 0 14px;
}
.type-legend {
  gap: 8px;
  font-size: 7px;
}
.canvas-bottom {
  left: 12px;
  right: 12px;
}
.canvas-toolbar {
  padding: 0 13px;
}
.canvas-options {
  gap: 8px;
}
.batch-panel {
  padding: 0 14px;
}
.library-node {
  font-size: 10px;
}
}
@media(max-width:900px){.workspace {
  grid-template-columns: 165px minmax(330px,1fr);
}
.inspector {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 10px 22px;
  overflow: visible;
  border-top: 1px solid var(--line);
  padding: 20px;
  height: auto;
}
.workspace {
  height: auto;
  min-height: calc(100dvh - 109px);
}
.center, .library {
  height: calc(100dvh - 109px);
  min-height: 660px;
}
.inspector .preview-heading {
  height: 24px;
}
.inspector .output-select-wrap {
  grid-column: 1;
  grid-row: 2;
}
.inspector .preview-stage {
  grid-column: 1;
  grid-row: 3 / span 3;
  min-height: 160px;
}
.inspector .preview-meta {
  grid-column: 1;
  grid-row: 6;
}
.inspector #selection-panel {
  grid-column: 2;
  grid-row: 1 / span 6;
}
.inspector .preview-switch {
  grid-column: 1;
}
.inspector .inspector-rule {
  display: none;
}
.inspector .run-info {
  grid-column: 2;
}
.topbar {
  gap: 15px;
  height: 70px;
}
.project {
  padding-left: 12px;
}
.project input {
  width: 140px;
  font-size: 11px;
}
.project-icon, .top-actions>.icon-button {
  display: none;
}
.top-actions {
  gap: 1px;
}
.primary {
  font-size: 11px;
  padding: 9px 11px;
}
.top-actions .quiet {
  font-size: 11px;
  padding: 7px;
}
.statusbar {
  position: sticky;
  bottom: 0;
}
.canvas-help {
  display: none;
}
.type-legend span:not(:first-child) {
  display: none;
}
.panel-heading {
  font-size: 12px;
  padding-left: 15px;
}
.lib-icon {
  width: 23px;
  height: 23px;
}
.library-node {
  gap: 7px;
  padding: 7px 4px;
}
.batch-panel {
  height: 185px;
}
.batch-header {
  height: 43px;
}
.batch-footer {
  font-size: 7px;
}
.batch-footer .text-button {
  font-size: 8px;
}
}
@media(max-width:600px){.workspace {
  grid-template-columns: 125px minmax(245px,1fr);
}
.project {
  display: none;
}
.topbar {
  justify-content: space-between;
  padding: 0 12px;
}
.top-actions .quiet {
  font-size: 10px;
}
.top-actions .primary {
  font-size: 10px;
  padding: 8px;
}
.top-actions .primary span {
  display: none;
}
.search kbd {
  display: none;
}
.panel-heading {
  padding: 18px 10px;
}
.search {
  margin: 0 8px 12px;
  padding: 0 6px;
}
.search input {
  font-size: 9px;
}
.search>span {
  display: none;
}
.library-list {
  padding: 0 6px;
}
.library-node {
  font-size: 9px;
  gap: 5px;
}
.lib-icon {
  width: 20px;
  height: 23px;
  min-width: 20px;
  font-size: 13px;
}
.lib-plus {
  display: none;
}
.category {
  font-size: 8px;
  margin: 17px 4px 8px;
  letter-spacing: .6px;
}
.canvas-toolbar {
  padding: 0 10px;
}
.canvas-options {
  gap: 5px;
}
.auto-label {
  font-size: 0;
}
.auto-label .toggle-track {
  display: none;
}
.canvas-options .divider {
  display: none;
}
.run-button span {
  font-size: 9px;
}
.canvas-tab {
  font-size: 10px;
  gap: 5px;
}
.batch-header .quiet {
  font-size: 9px;
}
.batch-header strong {
  font-size: 10px;
}
.batch-header .count {
  font-size: 7px;
}
.batch-footer>span {
  display: none;
}
.batch-footer {
  justify-content: flex-end;
}
.batch-panel {
  padding: 0 10px;
}
.inspector {
  grid-template-columns: 140px 1fr;
  padding: 15px;
  gap: 10px 15px;
}
.preview-stage {
  min-height: 110px!important;
}
.preview-meta strong {
  font-size: 10px;
  max-width: 110px;
}
.preview-meta small {
  font-size: 8px;
}
.selection-subtitle {
  font-size: 8px;
}
.help-grid, .schema-editors {
  grid-template-columns: 1fr;
}
.canvas-bottom {
  left: 8px;
  right: 8px;
}
.type-legend {
  padding: 5px;
}
.zoom-controls button {
  width: 20px;
}
.statusbar {
  padding: 0 10px;
}
.statusbar>span:last-child {
  display: none;
}
}

/* Compact controls share the brighter node header treatment. */
.topbar { height: 54px; padding: 0 16px; gap: 16px; background: #13202e; }
.project { border: 0; padding: 0; gap: 8px; }
.project input { width: 190px; }
.workspace { height: calc(100dvh - 83px); grid-template-columns: 194px minmax(400px, 1fr) 284px; }
.statusbar { height: 29px; background: #1c2c3d; }
.statusbar > span:last-child { font: inherit; letter-spacing: normal; }
.primary { background: #283f54; color: #d5e5f2; border-color: #45637d; padding: 8px 12px; }
.primary:hover { background: #1c2c3d; }
button:hover { background-color: #1c2c3d; }
input, select, textarea { background: #13202e; border-color: #45637d; }
input::placeholder { color: #a5bbcf; }
.library, .inspector { background: #13202e; }
.panel-heading { padding: 14px 12px 12px; font-size: 12px; }
.search { margin: 0 10px 8px; background: #13202e; }
.search input { padding: 7px 0; }
.library-list { padding: 0 9px 12px; }
.category { margin: 12px 3px 6px; letter-spacing: .7px; font-size: 9px; }
.category:first-child { margin-top: 5px; }
.node-header, .library-node {
  background: var(--titlebar);
  border-color: var(--titlebar-border);
  color: #d5e5f2;
  box-shadow: inset 0 1px 0 #bde2ff28;
}
.library-node {
  height: 29px;
  min-height: 29px;
  margin-bottom: 4px;
  padding: 3px 7px;
  gap: 7px;
  border: 1px solid var(--titlebar-border);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
}
.library-node:hover { background: #13202e; border-color: #45637d; color: #d5e5f2; }
.lib-icon { width: 19px; min-width: 19px; height: 20px; border: 0; background: none; font-size: 15px; color: #a5bbcf; }
.library-node[data-kind=custom] .lib-icon { color: #a5bbcf; }
.lib-plus { opacity: .7; font-size: 13px; }
.node { background: #13202e; border-color: #45637d; box-shadow: 0 4px 13px #00000038; }
.node.selected { border-color: #45637d; box-shadow: 0 0 0 1px #00000038, 0 5px 15px #00000038; }
.node-header { height: 41px; border-bottom: 1px solid var(--titlebar-border); }
.node-icon { color: #a5bbcf; }
.node-number, .node-menu { color: #a5bbcf; }
.node-description { color: #a5bbcf; }
.port-row { color: #d5e5f2; }
.port-row.output { color: #d5e5f2; }
.port-row .type-label { color: #a5bbcf; }
.port-row input { background: #13202e; border-color: #45637d; color: #d5e5f2; }
.port { border-color: #45637d; background: var(--port-color, var(--accent)); }
.port.unwired { background: #13202e; }
.port:hover, .port.compatible { box-shadow: 0 0 0 4px #00000038; }
.mode-button { color: #a5bbcf; }
.mode-button.local { color: #a5bbcf; }
.node-footer { border-color: #45637d; color: #a5bbcf; }
.node-thumbnail span, .image-format { background: #13202e; color: #d5e5f2; border-color: #45637d; }
.node-data-preview { color: #d5e5f2; }
.canvas-toolbar { height: 44px; background: #1c2c3d; padding: 0 15px; }
.graph-viewport { background-color: #13202e; background-image: radial-gradient(#283f54 1px, transparent 1px); }
.type-legend { background: #13202e; color: #a5bbcf; }
.zoom-controls { background: #1c2c3d; border-color: #45637d; }
.toggle-track { background: #283f54; }
.toggle-track:after { background: #13202e; }
.auto-label input:checked + .toggle-track { background: #456986; }
.auto-label input:checked + .toggle-track:after { background: #13202e; }
.count, .selection-badge, .mini-tag, .live-badge { background: #1c2c3d; border-color: #45637d; color: #d5e5f2; }
.batch-panel { background: #13202e; }
.batch-card { background: #13202e; border-color: #45637d; }
.batch-card.active { background: #1c2c3d; border-color: #45637d; }
.batch-card .selected-check { background: #456986; color: #a5bbcf; }
.batch-add { border-color: #45637d; }
.preview-stage { background: repeating-conic-gradient(#1c2c3d 0% 25%, #13202e 0% 50%) 50% / 16px 16px; border-color: #45637d; }
.preview-stage pre { background: #13202e; color: #d5e5f2; }
.inspector { padding: 0 14px; }
.preview-heading { height: 43px; }
.preview-meta { padding: 9px 0; }
.preview-switch { background: #1c2c3d; border-color: #45637d; }
.preview-switch button.active { background: var(--titlebar); border-color: #45637d; color: #d5e5f2; }
.inspector-rule { margin: 15px 0 13px; }
.inspector-field { margin-bottom: 10px; }
.inspector-field input, .inspector-field select, .inspector-field textarea { background: #13202e; color: #d5e5f2; border-color: #45637d; padding: 6px 8px; }
.selection-subtitle { margin-bottom: 12px; }
.connection-list { gap: 8px; padding: 10px; background: #1c2c3d; border-color: #45637d; }
.inspector-actions button { padding: 6px; background: var(--titlebar); border-color: var(--titlebar-border); color: #d5e5f2; }
.inspector-actions .danger { color: #a5bbcf; }
.live-badge.error { background: #1c2c3d; color: #a5bbcf; border-color: #45637d; }
.run-info.error, .modal-error { color: #a5bbcf; }
.run-info.error .status-dot { background: #456986; }
.run-info { margin: 15px 0; }
dialog { background: #13202e; border-color: #45637d; }
dialog::backdrop { background: #456986; }
.code-block, .code-editor { background: #13202e; color: #d5e5f2; border-color: #45637d; }
#toast { background: #1c2c3d; color: #d5e5f2; border: 1px solid #45637d; }
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 180px minmax(350px, 1fr) 260px; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 165px minmax(330px, 1fr); height: auto; }
  .center, .library { height: calc(100dvh - 83px); }
  .inspector { padding: 16px; }
  .library-node { padding: 3px 5px; font-size: 10px; gap: 5px; }
  .statusbar > .canvas-help { display: none; }
}
@media (max-width: 600px) {
  .topbar { padding: 0 9px; gap: 6px; }
  .project { display: flex; min-width: 0; }
  .project input { width: 100%; font-size: 10px; }
  .workspace { grid-template-columns: 125px minmax(245px, 1fr); }
  .library-list { padding: 0 5px 10px; }
  .library-node { height: 28px; min-height: 28px; font-size: 9px; gap: 3px; }
  .lib-icon { width: 16px; min-width: 16px; font-size: 13px; }
  .lib-plus { display: none; }
  .top-actions { flex-shrink: 0; }
  .panel-heading { padding: 12px 9px; }
  .inspector { padding: 15px; }
}

/* Dark surfaces keep the pale blue headers and connection types prominent. */
.topbar, .statusbar, .canvas-toolbar { background: #192a3b; }
.library, .inspector, .batch-panel { background: #172638; }
.graph-viewport { background-color: #101a27; background-image: radial-gradient(#30475c 1px, transparent 1px); }
.node { background: #213448; border-color: #6085a4; box-shadow: 0 5px 18px #0005; }
.node.selected { border-color: #a6d9ff; box-shadow: 0 0 0 1px #92cefa88, 0 5px 18px #0006; }
.node-header, .library-node, .primary, .preview-switch button.active, .inspector-actions button {
  background: var(--titlebar);
  border-color: var(--titlebar-border);
  color: #173e5a;
  box-shadow: inset 0 1px 0 #eff8ff88;
}
.node-header { height: 38px; }
.node-icon, .node-header .node-menu, .lib-icon { color: #235578; }
.node-number { color: #446b88; }
.library-node[data-kind=custom] .lib-icon { color: #65418a; }
.library-node .lib-plus { color: #235578; }
.library-node:hover, .primary:hover, .inspector-actions button:hover { background: #cce9fd; color: #173e5a; }
.node-menu { min-width: 22px; min-height: 22px; line-height: 16px; letter-spacing: 0; }
.node-menu:hover, .node-menu[aria-expanded="true"] { background: #e2f2ff99; }
.node-body { padding-bottom: 2px; }
.node-description, .selection-subtitle { color: #a9bfd1; }
.port-row, .port-row.output { color: #d8e8f5; }
.port-row .type-label { color: #9db5cb; }
.port-row input, .node-value, input, select, textarea, .inspector-field input, .inspector-field select, .inspector-field textarea, .output-select-wrap select {
  background: #102030;
  border-color: #56748e;
  color: #e4f1fb;
}
.port { border-color: #203346; }
.port.unwired { background: #203346; }
.port:hover, .port.compatible { box-shadow: 0 0 0 4px #95d1ff44; }
.wire { opacity: .85; }
.mode-button { color: #b9e2ff; }
.mode-button.local { color: #92abc0; }
.node-footer { border-color: #344c62; color: #8da4b8; }
.node-footer .status-dot { width: 3px; height: 3px; background: #8da4b8; }
.node-thumbnail span, .image-format { background: #142639d9; border-color: #587996; color: #e0edf8; }
.search { background: #102030; border-color: #466580; }
.search input { background: transparent; border: 0; }
.project input { background: transparent; border: 0; }
.type-legend { background: #101a27e8; color: #b8cddd; }
.zoom-controls { background: #22394eed; border-color: #5d7f9c; }
.zoom-controls button, .quiet, .icon-button, .batch-add, .batch-add > span { color: #c5e0f5; }
.auto-label input:checked + .toggle-track { background: #6db5ea; }
.auto-label input:checked + .toggle-track:after { background: #ebf7ff; }
.count, .selection-badge, .mini-tag, .live-badge { background: #294a64; border-color: #5a86a7; color: #bfdef5; }
.batch-card { background: #22374a; border-color: #4c6e89; }
.batch-card.active { background: #304f6a; border-color: #9ed5ff; }
.batch-card .selected-check { background: #b6defb; color: #204b69; }
.batch-card .file-name, .connection-list b { color: #d7eaf9; }
.batch-card .remove-file { color: #b4ccde; }
.batch-add { border-color: #6388a6; }
.batch-add small, .batch-hint, .batch-footer, .preview-meta small, .run-info { color: #a4bed2; }
.preview-stage { background: repeating-conic-gradient(#263a4e 0% 25%, #192a3b 0% 50%) 50% / 16px 16px; border-color: #557791; }
.preview-stage pre { background: #122234; color: #d5eafb; }
.preview-switch { background: #102030; border-color: #456681; }
.preview-switch button { color: #b9d3e7; }
.connection-list { background: #20394f; border-color: #466984; color: #b5cee0; }
.inspector-actions .danger { color: #793b35; }
.live-badge.error { background: #55382f; color: #ffc9b6; border-color: #9a6c5c; }
.run-info.error, .modal-error { color: #ffc0a5; }
.run-info.error .status-dot { background: #f6ad90; }
dialog { background: #192d40; border-color: #779dbb; }
dialog::backdrop { background: #030b14ad; }
.code-block, .code-editor { background: #102030; color: #d1eaff; border-color: #4d728e; }
.modal-intro, .modal-note, .modal-field, .help-grid p, .shortcut-list { color: #b2cadd; }
.help-grid h3 { color: #d3eafb; }
#toast { background: #b5dcf8; color: #163e5b; border-color: #e0f2ff; }
.node.compact { border-radius: 7px; }
.node.compact .node-header {
  position: relative;
  height: var(--compact-height);
  border-radius: 6px;
  border-bottom: 0;
}
.compact-port { transform: translateY(-50%); }
.node-actions-menu {
  position: fixed;
  z-index: 20;
  width: 160px;
  padding: 4px;
  background: #243d53;
  border: 1px solid #80afd2;
  border-radius: 6px;
  box-shadow: 0 8px 24px #0008;
}
.node-actions-menu button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  text-align: left;
  color: #e1f0fb;
  font-size: 12px;
  border-radius: 3px;
}
.node-actions-menu button:hover, .node-actions-menu button:focus-visible { background: #426c8b; }
.node-actions-menu .danger { color: #ffc3b5; border-top: 1px solid #46637b; margin-top: 3px; }

/* Panel-local tools leave the full window height available to the graph. */
.workspace { height: calc(100dvh - 29px); min-height: 420px; }
.panel-heading { height: 44px; flex-shrink: 0; align-items: center; padding: 0 12px; }
.panel-heading .icon-button { width: 21px; height: 21px; font-size: 12px; border: 1px solid #456681; border-radius: 50%; }
.canvas-toolbar { height: 44px; padding: 0 10px; gap: 12px; }
.workflow-heading { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 100%; }
.workflow-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
#project-name { width: 176px; min-width: 40px; padding: 3px 2px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: #e1edf6; font-size: 12px; font-weight: 600; text-overflow: ellipsis; }
#project-name:hover { border-color: #456681; }
#project-name:focus { background: #102030; border-color: #7eaaca; }
.workflow-title .save-state { display: block; flex-shrink: 0; font-size: 8px; color: #9bb6ca; }
.workflow-heading .count { margin-left: 0; flex-shrink: 0; }
.canvas-options { flex-shrink: 0; }
.preview-toolbar { display: flex; align-items: center; justify-content: flex-end; flex-shrink: 0; height: 44px; gap: 4px; margin: 0 -14px; padding: 0 10px; border-bottom: 1px solid var(--line); background: #192a3b; }
.preview-toolbar .quiet { padding: 6px 9px; font-size: 11px; }
.preview-toolbar .primary { padding: 7px 10px; font-size: 11px; white-space: nowrap; }
.graph-viewport { min-height: 220px; }
.canvas-bottom { inset: 0; display: block; pointer-events: none; }
.type-legend { position: absolute; bottom: 2px; left: 8px; padding: 0; gap: 10px; font-size: 8px; line-height: 12px; max-width: calc(100% - 16px); }
.type-legend span, .type-legend span:not(:first-child) { display: flex; }
.zoom-controls { position: absolute; right: 8px; bottom: 8px; }
.batch-panel { position: relative; display: flex; flex-direction: column; height: 116px; padding: 0 8px 6px; }
.batch-header { display: flex; align-items: center; flex-shrink: 0; height: 30px; padding-right: 30px; gap: 8px; }
.batch-label, .batch-actions { display: flex; align-items: center; gap: 6px; min-width: 0; }
.batch-label { flex-shrink: 0; }
.batch-header strong { font-size: 10px; }
.batch-actions { margin-left: auto; }
.batch-header .quiet, .batch-header .text-button { padding: 4px 7px; font-size: 10px; white-space: nowrap; }
.batch-toggle { position: absolute; top: 3px; right: 8px; width: 24px; height: 24px; padding: 0; font-size: 18px; line-height: 20px; border: 1px solid #557b98; color: #cce9fd; background: #243e54; z-index: 1; }
.batch-items { height: auto; flex: 1; min-height: 0; gap: 6px; padding: 0 0 2px; overflow-x: auto; overflow-y: hidden; }
.batch-card { width: 96px; padding: 3px; border-radius: 4px; }
.batch-select { display: block; padding: 0; width: 100%; text-align: left; border: 0; border-radius: 2px; }
.batch-card canvas { height: 52px; }
.batch-card .file-name { margin: 4px 12px 0 1px; max-width: none; font-size: 8px; line-height: 12px; }
.batch-card .remove-file { right: 3px; bottom: 3px; }
.batch-card .selected-check { width: 12px; height: 12px; top: 6px; right: 6px; font-size: 8px; }
.batch-add { flex: 0 0 80px; min-width: 80px; min-height: 0; gap: 2px; font-size: 8px; }
.batch-add > span { font-size: 16px; line-height: 16px; }
.batch-add small { font-size: 7px; }
.batch-panel.collapsed { height: 48px; padding: 4px 38px 4px 8px; }
.batch-panel.collapsed .batch-header,
.batch-panel.collapsed .file-name,
.batch-panel.collapsed .remove-file,
.batch-panel.collapsed .selected-check,
.batch-panel.collapsed .batch-add { display: none; }
.batch-panel.collapsed .batch-toggle { top: 11px; }
.batch-panel.collapsed .batch-items { gap: 5px; padding-bottom: 0; }
.batch-panel.collapsed .batch-card { width: 50px; padding: 1px; }
.batch-panel.collapsed .batch-select { height: 100%; }
.batch-panel.collapsed .batch-card canvas { width: 100%; height: 100%; border-radius: 2px; }
.batch-panel.collapsed .batch-add:only-child { display: flex; flex: 0 0 40px; min-width: 40px; font-size: 0; gap: 0; }
.batch-panel.collapsed .batch-add small { display: none; }
@media (max-width: 1180px) {
  #project-name { width: 132px; }
  .workflow-title { gap: 7px; }
}
@media (max-width: 900px) {
  .workspace { height: auto; min-height: calc(100dvh - 29px); }
  .center, .library { height: calc(100dvh - 29px); min-height: 480px; }
  .inspector .preview-toolbar { grid-column: 1 / -1; grid-row: 1; margin: -16px -16px 0; }
  .inspector .preview-heading { grid-column: 1; grid-row: 2; }
  .inspector .output-select-wrap { grid-column: 1; grid-row: 3; }
  .inspector .preview-stage { grid-column: 1; grid-row: 4 / span 3; }
  .inspector .preview-meta { grid-column: 1; grid-row: 7; }
  .inspector .preview-switch { grid-column: 1; grid-row: 8; }
  .inspector #selection-panel { grid-column: 2; grid-row: 2 / span 6; }
  .inspector .run-info { grid-column: 2; grid-row: 8; }
  .workflow-title { flex-direction: column; align-items: flex-start; gap: 0; flex: 1; }
  .workflow-heading { gap: 5px; }
  #project-name { width: 100%; font-size: 11px; padding: 1px 2px; }
  .workflow-title .save-state { font-size: 7px; margin-left: 3px; }
  .zoom-controls { bottom: 24px; }
}
@media (max-width: 600px) {
  .inspector .preview-toolbar { margin: -15px -15px 0; }
  .canvas-toolbar { gap: 6px; padding: 0 8px; }
  .type-legend { gap: 7px; font-size: 7px; }
  .type-legend span { gap: 3px; }
  .batch-header { gap: 3px; }
  .batch-label { gap: 2px; }
  .batch-header strong { font-size: 9px; }
  .batch-label .count { margin-left: 0; font-size: 7px; padding: 2px 3px; }
  .batch-actions { gap: 0; }
  .batch-header .quiet, .batch-header .text-button { font-size: 8px; padding: 4px 3px; }
}
/* Function port editor */
.port-editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 11px; color: #d5e5f2; }
.port-editor-head .preview-switch button { padding: 3px 12px; }
.port-form { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
.port-section h3 { margin: 0 0 7px; font-size: 11px; font-weight: 600; color: #d3eafb; }
.port-section h3 .muted { font-weight: 400; margin-left: 4px; }
.fn-port { display: grid; grid-template-columns: 8px minmax(90px, 1.2fr) minmax(110px, 1fr) minmax(80px, 1fr) 52px 48px 24px; align-items: center; gap: 6px; margin-bottom: 5px; }
.fn-port[data-side="outputs"] { grid-template-columns: 8px minmax(90px, 1.2fr) minmax(110px, 1fr) 48px 24px; }
.port-section h3:has(+ .port-labels) { margin-bottom: 0; }
.port-labels { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; color: #a4bed2; margin: 4px 0; }
.port-swatch { width: 8px; height: 8px; border-radius: 50%; }
.fn-port input:not([type="checkbox"]), .fn-port select { min-width: 0; width: 100%; padding: 5px 7px; font: 11px monospace; background: #102030; color: #d1eaff; border: 1px solid #4d728e; border-radius: 5px; }
.fn-port input:disabled { opacity: .55; font-style: italic; }
.port-wire { display: flex; align-items: center; gap: 4px; font-size: 10px; color: #b2cadd; }
.port-order { display: flex; }
.fn-port button { padding: 2px 6px; font-size: 12px; color: #b2cadd; }
.fn-port button:disabled { opacity: .3; }
.port-remove:hover { color: #ffc0a5; }
.port-add { margin-top: -1px; font-size: 11px; padding: 4px 10px; border: 1px solid rgba(213, 229, 242, .2); border-radius: 6px; }
@media (max-width: 600px) {
  .fn-port[data-side="inputs"] { grid-template-columns: 8px 1fr 1fr 48px; grid-template-areas: "sw name type remove" ". value wire order"; row-gap: 4px; margin-bottom: 10px; }
  .fn-port[data-side="inputs"] > .port-swatch { grid-area: sw; }
  .fn-port[data-side="inputs"] > [data-field="name"] { grid-area: name; }
  .fn-port[data-side="inputs"] > [data-field="type"] { grid-area: type; }
  .fn-port[data-side="inputs"] > [data-field="value"] { grid-area: value; }
  .fn-port[data-side="inputs"] > .port-wire { grid-area: wire; }
  .fn-port[data-side="inputs"] > .port-order { grid-area: order; }
  .fn-port[data-side="inputs"] > .port-remove { grid-area: remove; justify-self: end; }
  .fn-port[data-side="outputs"] { grid-template-columns: 8px 1fr 1fr 48px 24px; }
  .port-labels { display: none; }
}
/* Node parameter fields hold numbers or expressions; let them use the free row width. */
.port-row input[data-param] { flex: 1 1 77px; min-width: 77px; text-overflow: ellipsis; }
.port-row input[data-param].expression { color: #efc18a; font-style: italic; }
.port-row input[data-param].expression:focus { font-style: normal; }
.port-row select[data-param] { flex: 1 1 77px; min-width: 77px; margin-left: auto; padding: 4px 5px; border-radius: 4px; background: #13202e; color: #d5e5f2; font: 10px monospace; border: 1px solid #45637d; }
/* Color values */
:root { --color: #8fdcb4; }
.type-legend i[data-type=color] { background: var(--color); }
#color-swatch { position: absolute; inset: 0; }
.image-format { max-width: calc(100% - 18px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Color swatches and the sampling color dialog */
.color-chip, .color-compare span {
  --checker: repeating-conic-gradient(#c9d6e0 0 25%, #fff 0 50%) 0 0 / 6px 6px;
  background: linear-gradient(var(--chip), var(--chip)), var(--checker);
}
.color-chip { flex: 0 0 18px; width: 18px; height: 18px; padding: 0; margin-left: auto; border: 1px solid #779dbb; border-radius: 4px; }
.color-chip:hover { border-color: #d5eafb; }
.color-chip.unknown { background: repeating-linear-gradient(135deg, #45637d 0 3px, #13202e 3px 6px); }
.port-row .color-chip + input[data-param] { margin-left: 0; }
#color-shield { position: fixed; inset: 0; z-index: 1000; background: #030b1426; }
#color-shield.sampling { cursor: crosshair; }
.color-dialog {
  position: fixed; z-index: 1001; top: 72px; left: 50%; transform: translateX(-50%);
  width: min(340px, calc(100vw - 32px)); padding: 16px 18px; color: var(--text);
  background: #192d40; border: 1px solid #779dbb; border-radius: 12px; box-shadow: 0 20px 80px #00000060;
}
.color-dialog.moved { transform: none; }
.color-dialog-header { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 12px; cursor: move; user-select: none; touch-action: none; }
.color-dialog-header h2 { font: 600 14px system-ui, sans-serif; margin: 0; }
.color-compare { display: grid; grid-template-columns: 2fr 1fr; height: 44px; border: 1px solid #4d728e; border-radius: 7px; overflow: hidden; margin-bottom: 12px; }
.color-compare span { --chip: transparent; }
.color-dialog .modal-field select, .color-dialog .modal-field input, .color-channel input[type=text] { width: 100%; padding: 5px 7px; font: 11px monospace; background: #102030; color: #d1eaff; border: 1px solid #4d728e; border-radius: 5px; }
.color-dialog .modal-field input.invalid { border-color: #f6ad90; }
.color-channels { display: grid; gap: 6px; margin-bottom: 12px; }
.color-channel { display: grid; grid-template-columns: 14px 1fr 64px; align-items: center; gap: 8px; font: 600 11px monospace; color: #b2cadd; }
.color-channel input[type=range] { width: 100%; accent-color: #9ad3ff; }
.color-dialog .modal-actions { margin-top: 12px; }
.color-dialog .modal-note { margin: 0; min-height: 17px; }
/* Shown when fingerprinting protection blocks canvas reads */
.canvas-banner {
  position: fixed; z-index: 900; top: 56px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; width: min(640px, calc(100vw - 32px)); padding: 14px 16px;
  background: #55382f; color: #ffe3d8; border: 1px solid #9a6c5c; border-radius: 10px; box-shadow: 0 12px 40px #00000050;
}
.canvas-banner strong { font-size: 13px; }
.canvas-banner p { margin: 4px 0 0; font-size: 11px; line-height: 1.6; }
.canvas-banner .primary { flex: none; }
.canvas-banner.flash { animation: banner-flash .6s; }
@keyframes banner-flash { 30% { border-color: #ffc9b6; box-shadow: 0 0 0 4px #ffc9b640, 0 12px 40px #00000050; } }
@media (max-width: 600px) { .canvas-banner { flex-direction: column; align-items: stretch; } }
/* Kernel filter presets in node settings */
.kernel-presets { margin: 4px 0 12px; }
.kernel-presets .selection-subtitle { margin-bottom: 6px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 5px; }
.preset-grid button { padding: 5px 6px; font-size: 10px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #d5e5f2; background: #1c2c3d; border: 1px solid rgba(213, 229, 242, .2); border-radius: 6px; }
.preset-grid button:hover { border-color: #9ad3ff; }
.preset-grid button.active { background: #294a64; border-color: #9ad3ff; color: #e6f4ff; }
/* Workflow switcher */
.workflow-menu-button { flex: none; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; font-size: 12px; line-height: 1; color: #d5e5f2; background: #1c2c3d; border: 1px solid rgba(213, 229, 242, .2); border-radius: 5px; }
.workflow-menu-button:hover, .workflow-menu-button[aria-expanded="true"] { background: #294a64; border-color: #9ad3ff; }
.workflow-menu { position: fixed; z-index: 30; width: min(300px, calc(100vw - 16px)); max-height: min(420px, calc(100dvh - 80px)); overflow-y: auto; padding: 4px; background: #243d53; border: 1px solid #80afd2; border-radius: 7px; box-shadow: 0 10px 30px #0009; }
.workflow-menu button { color: #e1f0fb; text-align: left; border-radius: 4px; }
.workflow-menu button:hover, .workflow-menu button:focus-visible { background: #426c8b; }
.workflow-new { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; font-size: 12px; font-weight: 600; }
.workflow-menu-rule { height: 1px; margin: 4px 2px; background: #46637b; }
.workflow-entry { display: flex; align-items: center; gap: 2px; }
.workflow-entry > [data-workflow-open] { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 6px 10px; }
.workflow-entry-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workflow-entry-meta { font-size: 9px; color: #a9c3d7; }
.workflow-entry.current > [data-workflow-open] { background: #2f526e; }
.workflow-entry-check { flex: none; width: 26px; text-align: center; color: #9ad3ff; }
.workflow-entry-delete { flex: none; width: 26px; height: 26px; padding: 0; text-align: center !important; color: #b8cfe0 !important; }
.workflow-entry-delete:hover { color: #ffc3b5 !important; }
/* Narrow screens: shorten "Add images" so "Download processed batch" fits beside it. */
@media (max-width: 600px) { #process-batch { white-space: normal; line-height: 1.15; text-align: right; } }
@media (max-width: 480px) { .wide-only { display: none; } }

/* Add-node menu: opens at a long press on empty canvas, or where a wire is dropped on empty canvas. */
.add-node-menu { --row: 36px; position: fixed; z-index: 30; width: min(260px, calc(100vw - 16px)); padding: 5px; background: #243d53; border: 1px solid #80afd2; border-radius: 7px; box-shadow: 0 10px 30px #0009; }
.add-node-menu .search { margin: 0 0 5px; padding: 0 8px; background: #13202e; }
.add-node-menu .search>span { display: block; font-size: 17px; }
.add-node-menu .search input { padding: 7px 0; font-size: 12px; }
.add-node-context { display: flex; align-items: center; gap: 6px; padding: 2px 4px 6px; font-size: 10px; color: #a9c3d7; }
.add-node-context i { width: 8px; height: 8px; border-radius: 50%; background: var(--port-color); flex: none; }
.add-node-list { max-height: calc(var(--rows, 4) * var(--row)); overflow-y: auto; overscroll-behavior: contain; touch-action: none; user-select: none; scrollbar-width: thin; }
.add-node-list.dragging { cursor: grabbing; }
.add-node-item { display: flex; align-items: center; gap: 8px; width: 100%; height: var(--row); padding: 0 6px; text-align: left; color: #e1f0fb; border-radius: 4px; }
.add-node-item.active { background: #426c8b; }
.add-node-item .lib-icon { width: 24px; min-width: 24px; height: 24px; flex: none; font-size: 14px; color: #cfe3f3; }
.add-node-item-text { display: grid; min-width: 0; }
.add-node-item-title { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-node-item-meta { font-size: 9px; color: #a9c3d7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-node-empty { height: var(--row); display: grid; place-items: center; font-size: 11px; color: #a9c3d7; }

/* Connection feedback. `scale` (not width) keeps a port centred, and composes with compact ports' transform. */
.port { transition: scale .12s ease, box-shadow .12s ease, opacity .12s ease; }
.port:hover { scale: 1.35; box-shadow: 0 0 0 3px color-mix(in srgb, var(--port-color, var(--accent)) 45%, transparent); }
.port.compatible { scale: 1.2; box-shadow: 0 0 0 3px color-mix(in srgb, var(--port-color, var(--accent)) 30%, transparent); }
.port.drag-source { scale: 1.35; box-shadow: 0 0 0 3px #fff6; }
.port.drop-target { scale: 1.7; box-shadow: 0 0 0 2px #fff, 0 0 10px 3px var(--port-color, var(--accent)); opacity: 1; }
.port.drop-invalid { scale: 1.35; box-shadow: 0 0 0 2px #ff8a73; opacity: 1; }
.graph-viewport.wiring, .graph-viewport.wiring * { cursor: crosshair !important; }
.graph-viewport.wiring.no-drop, .graph-viewport.wiring.no-drop * { cursor: not-allowed !important; }
.wire-draft.valid { stroke-width: 3; stroke-dasharray: none; filter: drop-shadow(0 0 4px var(--wire-color)); }
.wire-draft.invalid { stroke: #ff8a73; stroke-dasharray: 3 4; opacity: .9; }
.wire-snap { fill: none; stroke-width: 2; pointer-events: none; animation: wire-snap .9s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes wire-snap { from { opacity: .9; transform: scale(.6); } to { opacity: 0; transform: scale(1.6); } }
.wire.replaced { opacity: .25; stroke-dasharray: 4 4; }
.wire-hint { position: absolute; z-index: 5; padding: 3px 7px; max-width: 260px; font-size: 11px; font-weight: 600; color: #d5e5f2; background: #13202ee6; border: 1px solid #45637d; border-radius: 5px; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wire-hint.valid { color: var(--wire-color); border-color: var(--wire-color); }
.wire-hint.invalid { color: #ffb3a3; border-color: #ff8a73; }
@media (prefers-reduced-motion: reduce) { .port { transition: none; } .wire-snap { animation: none; } }

/* Run errors: the nodes, ports and wires the engine names, until the next change. */
.node.error, .node.error.selected { z-index: 3; border-color: #ff7a66; box-shadow: 0 0 0 1px #ff7a66, 0 0 18px #ff5a4633, 0 5px 18px #0006; }
.node.error .node-header { box-shadow: inset 0 -2px 0 #ff7a66; }
.node-error { position: absolute; left: -1px; bottom: calc(100% + 6px); max-width: 300px; width: max-content; padding: 4px 8px 4px 5px; font: 600 10px/1.35 system-ui, sans-serif; color: #fff1ee; background: #8f2f24; border: 1px solid #ff7a66; border-radius: 5px; box-shadow: 0 4px 12px #0007; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.node-error span { display: inline-grid; place-items: center; width: 13px; height: 13px; margin-right: 5px; border-radius: 50%; background: #ff7a66; color: #3a0d07; font-size: 9px; font-weight: 800; vertical-align: -2px; }
.port.error { box-shadow: 0 0 0 2px #13202e, 0 0 0 4px #ff7a66; }
.port-row.error > span:not(.type-label) { color: #ffb3a3; }
.port-row.error input[data-param], .port-row.error select[data-param] { border-color: #ff7a66; box-shadow: 0 0 0 1px #ff7a6666; }
.wire.error { stroke: #ff7a66; stroke-width: 3; opacity: 1; stroke-dasharray: 7 5; animation: wire-error 1s linear infinite; }
@keyframes wire-error { to { stroke-dashoffset: -12; } }
@media (prefers-reduced-motion: reduce) { .wire.error { animation: none; } }
