:root {
  color-scheme: dark;
  --bg-solid: #262827;
  --scene-scale: 1;
  --node-w: 144px;
  --node-h: 94px;
  --thumb-h: 70px;
  --title-h: 19px;
  --cursor-size: 30px;
  --resolve-orange: #ff6a48;
  --connector-green: #8fe21c;
  --connector-blue: #28b7e9;
  --line: rgba(190, 190, 190, 0.48);
  --panel: rgba(22, 24, 26, 0.86);
  --text: #f7f7f7;
  --muted: #a9acb0;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: transparent;
}

button,
input,
select {
  font: inherit;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-width: 760px;
  min-height: 350px;
  overflow: hidden;
  color: var(--text);
  background-color: transparent;
}

.stage.has-demo-cursor {
  cursor: none;
}

.stage.has-demo-cursor * {
  cursor: none !important;
}

.stage.bg-grid {
  background:
    linear-gradient(rgba(0, 0, 0, 0.24) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.24) 2px, transparent 2px),
    var(--bg-solid);
  background-size: 126px 82px;
}

.stage.bg-green {
  background: #00b140;
}

.stage.bg-solid {
  background: var(--bg-solid);
}

.stage.bg-transparent {
  background: transparent;
}

.graph-shell {
  position: absolute;
  inset: 0;
  transform: scale(var(--scene-scale));
  transform-origin: center;
}

.connection-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.connection-path {
  fill: none;
  stroke: rgba(198, 198, 198, 0.56);
  stroke-width: 2;
  shape-rendering: crispEdges;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.7));
}

.connection-path.disabled-link {
  stroke: rgba(198, 198, 198, 0.56);
}

.rail {
  position: absolute;
  z-index: 3;
  width: 14px;
  height: 24px;
  border: 1px solid #030303;
  border-radius: 4px;
  background: linear-gradient(#414447, #111315);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13), 0 2px 5px rgba(0, 0, 0, 0.45);
  touch-action: none;
}

.rail::before {
  content: "";
  position: absolute;
  inset: -14px;
}

.rail-left {
  left: 10px;
}

.rail-right {
  right: 10px;
}

.rail span {
  position: absolute;
  left: 4px;
  top: 7px;
  width: 6px;
  height: 7px;
  border: 1px solid #0e2603;
  border-radius: 5px;
  background: var(--connector-green);
  box-shadow: 0 0 6px rgba(143, 226, 28, 0.55);
}

.node-track {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.node-wrap {
  position: absolute;
  width: var(--node-w);
  height: calc(var(--node-h) + 20px);
  user-select: none;
  touch-action: none;
}

.node-title {
  position: absolute;
  left: 3px;
  right: -50px;
  top: 0;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  min-height: 16px;
  color: white;
  font-size: 12px;
  line-height: 14px;
  white-space: nowrap;
  text-shadow: 0 1px 2px black;
  outline: 0;
  cursor: default;
  text-align: left;
  appearance: none;
}

.node-title:hover,
.node-title:focus {
  color: #ffe6cf;
}

.node-wrap.node-disabled .node-title {
  color: rgba(255, 255, 255, 0.42);
}

.node {
  position: absolute;
  left: 0;
  top: 19px;
  width: var(--node-w);
  height: var(--node-h);
  border: 1px solid #070707;
  border-radius: 3px;
  background: linear-gradient(#3b3d3e, #242628 44%, #141516);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.65),
    0 2px 7px rgba(0, 0, 0, 0.54);
  cursor: default;
  outline: 0;
  appearance: none;
  transition: filter 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.node:focus,
.node:focus-visible,
.node-title:focus,
.node-title:focus-visible {
  outline: 0;
}

.node.selected {
  border-color: var(--resolve-orange);
  box-shadow:
    0 0 0 1px var(--resolve-orange),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 2px 8px rgba(0, 0, 0, 0.54);
}

.node.disabled {
  opacity: 1;
  filter: saturate(0.55) brightness(0.43);
}

.node.disabled .thumbnail::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.36);
}

.node.drop-target {
  box-shadow:
    0 0 0 1px var(--resolve-orange),
    0 2px 8px rgba(0, 0, 0, 0.54);
}

.node.flash {
  animation: lut-flash 680ms ease;
}

.thumbnail {
  position: absolute;
  left: 5px;
  right: 5px;
  top: 5px;
  height: var(--thumb-h);
  overflow: hidden;
  border: 1px solid #161819;
  background: #080a0a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.thumbnail img,
.thumbnail canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.node-color-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 19px;
  height: 2px;
  background: var(--node-bar-color, #2c8ee8);
  box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.75);
}

.node-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(#3d3e3f, #262728);
}

.node-number {
  position: absolute;
  left: 9px;
  top: 2px;
  font-size: 12px;
  line-height: 14px;
  color: white;
}

.lut-icon {
  position: absolute;
  left: 31px;
  top: 3px;
  width: 11px;
  height: 11px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1px;
  opacity: 0;
  transition: opacity 120ms ease;
}

.node.has-lut .lut-icon {
  opacity: 1;
}

.node.lut-muted .lut-icon {
  opacity: 0.28;
}

.lut-icon i {
  background: #f2f2f2;
}

.connector {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid #080808;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.connector.in,
.connector.blue-in {
  top: 41px;
  background: var(--connector-green);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.connector.in {
  left: -9px;
}

.connector.out {
  right: -9px;
  top: 41px;
  background: var(--connector-green);
  clip-path: none;
}

.connector.blue-out {
  bottom: 22px;
  background: var(--connector-blue);
}

.connector.blue-in {
  left: -9px;
  bottom: 22px;
  top: auto;
  background: var(--connector-blue);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.connector.blue-out {
  right: -9px;
}

.demo-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  width: var(--cursor-size);
  height: var(--cursor-size);
  pointer-events: none;
  opacity: 0;
  --cursor-x: -999px;
  --cursor-y: -999px;
  transform: translate(var(--cursor-x), var(--cursor-y));
  transition: opacity 120ms ease;
}

.stage.has-demo-cursor .demo-cursor {
  opacity: 1;
}

.demo-cursor.cursor-arrow {
  width: calc(var(--cursor-size) * 0.72);
  height: var(--cursor-size);
  transform-origin: 0 0;
}

.demo-cursor.cursor-arrow::before {
  content: "";
  position: absolute;
  inset: 0;
  background: white;
  clip-path: polygon(0 0, 0 83%, 24% 62%, 38% 100%, 54% 94%, 40% 58%, 72% 58%);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.75));
}

.demo-cursor.cursor-ring {
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65), 0 2px 8px rgba(0, 0, 0, 0.4);
}

.demo-cursor.cursor-dot {
  width: calc(var(--cursor-size) * 0.52);
  height: calc(var(--cursor-size) * 0.52);
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65), 0 2px 8px rgba(0, 0, 0, 0.4);
}

.demo-cursor.click-shrink {
  transform: translate(var(--cursor-x), var(--cursor-y)) scale(0.72);
}

.demo-cursor.cursor-arrow.click-shrink {
  transform-origin: 0 0;
}

.demo-cursor.click-pulse::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  animation: cursor-pulse 360ms ease-out;
}

.demo-cursor.cursor-arrow.click-pulse::after {
  left: 0;
  top: 0;
  width: var(--cursor-size);
  height: var(--cursor-size);
  inset: auto;
  transform: translate(-50%, -50%);
  transform-origin: center;
  animation: cursor-arrow-tip-pulse 360ms ease-out;
}

.panel {
  position: absolute;
  top: 16px;
  right: 16px;
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.stage[data-controls="hidden"] .panel {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
}

.panel-head,
.panel-actions,
.control-row,
.node-control-grid {
  display: grid;
  gap: 8px;
}

.panel-head {
  position: sticky;
  top: -14px;
  z-index: 5;
  grid-template-columns: 1fr 28px;
  align-items: center;
  margin: -14px -14px 12px;
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(22, 24, 26, 0.96);
  backdrop-filter: blur(18px);
}

.panel-head strong {
  font-size: 13px;
}

.icon-button,
.floating-toggle {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.icon-button {
  width: 28px;
  height: 28px;
  font-size: 18px;
}

.floating-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.stage[data-controls="hidden"] .floating-toggle {
  opacity: 1;
  visibility: visible;
}

.control-row {
  grid-template-columns: 104px 1fr;
  align-items: center;
  margin: 9px 0;
}

.control-row label,
.node-card label {
  color: var(--muted);
  font-size: 12px;
}

select,
input[type="text"],
input[type="color"] {
  width: 100%;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: white;
  background: rgba(0, 0, 0, 0.22);
}

input[type="text"] {
  padding: 0 8px;
}

input[type="range"] {
  width: 100%;
}

.source-card,
.node-controls {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.source-card,
.node-card {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
}

.node-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: white;
  font-size: 12px;
}

.source-card input[type="file"],
.node-card input[type="file"] {
  width: 100%;
  color: var(--muted);
  font-size: 11px;
}

.source-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.source-card .inline-check {
  display: flex;
  align-items: center;
  gap: 7px;
  color: white;
}

.lut-name {
  min-height: 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.toggle-row label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: white;
}

.panel-actions {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.panel-actions button {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.panel-actions button:hover,
.icon-button:hover,
.floating-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
}

@keyframes lut-flash {
  0% {
    box-shadow: 0 0 0 1px var(--resolve-orange), 0 0 0 rgba(255, 106, 72, 0);
  }

  42% {
    box-shadow: 0 0 0 2px #ffb13b, 0 0 28px rgba(255, 177, 59, 0.74);
  }

  100% {
    box-shadow: 0 0 0 1px var(--resolve-orange), 0 0 0 rgba(255, 106, 72, 0);
  }
}

@keyframes cursor-pulse {
  from {
    opacity: 0.9;
    transform: scale(0.4);
  }

  to {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes cursor-arrow-tip-pulse {
  from {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(0.35);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.35);
  }
}

@media (max-width: 860px) {
  .stage {
    min-width: 0;
  }

  :root {
    --scene-scale: 0.86;
  }

  .panel {
    left: 12px;
    right: 12px;
    top: 12px;
    width: auto;
  }
}
