#funnelStudio {
  height: calc(100vh - 128px);
  min-height: 680px;
  display: flex;
  padding: 0;
}

.fn-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  color: #e4e4e7;
}

.fn-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}
.fn-brand { min-width: 168px; }
.fn-brand b { display: block; font-size: 13px; color: #fff; font-weight: 600; }
.fn-brand span { display: block; margin-top: 2px; font-size: 11px; color: #71717a; }
.fn-name { max-width: 320px; font-weight: 600; }
.fn-top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.fn-dirty { color: #fbbf24; font-size: 11px; }

.fn-body { display: flex; flex: 1; min-height: 0; }
.fn-lib, .fn-inspector {
  width: 268px;
  flex-shrink: 0;
  overflow: auto;
  background: rgba(0, 0, 0, 0.18);
}
.fn-lib { border-right: 1px solid rgba(255, 255, 255, 0.06); }
.fn-inspector { width: 300px; border-left: 1px solid rgba(255, 255, 255, 0.06); }
.fn-lib-pad, .fn-inspector { padding: 12px; }
.fn-lib-label {
  margin: 12px 0 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #71717a;
  font-weight: 600;
}
.fn-lib-label:first-child { margin-top: 0; }

.fn-item, .fn-tpl {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
}
.fn-item:hover, .fn-tpl:hover { border-color: rgba(96, 165, 250, 0.45); background: rgba(59, 130, 246, 0.08); }
.fn-item.is-on { border-color: rgba(96, 165, 250, 0.7); background: rgba(59, 130, 246, 0.14); }
.fn-item b, .fn-tpl b { display: block; font-size: 12px; font-weight: 600; color: #fff; }
.fn-item small, .fn-tpl small { display: block; margin-top: 3px; color: #a1a1aa; font-size: 11px; line-height: 1.35; }
.fn-item-row { display: flex; gap: 4px; align-items: stretch; }
.fn-item-row .fn-item { flex: 1; margin-bottom: 6px; }
.fn-mini {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #d4d4d8;
  border-radius: 8px;
  font-size: 11px;
  padding: 0 8px;
  cursor: pointer;
}
.fn-mini:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.fn-mini.danger:hover { color: #fecaca; }

.fn-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.fn-palette {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  overflow-x: auto;
}
.fn-chip {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e4e4e7;
  border-radius: 999px;
  font-size: 11.5px;
  padding: 4px 10px;
  cursor: grab;
  white-space: nowrap;
}
.fn-chip:hover { border-color: rgba(255, 255, 255, 0.2); }
.fn-chip i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 99px;
  margin-right: 6px;
}

.fn-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  cursor: grab;
  background-color: #09090b;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 22px 22px;
  outline: none;
}
.fn-viewport.is-panning { cursor: grabbing; }
.fn-viewport.is-space { cursor: grab; }

.fn-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fn-svg {
  position: absolute;
  left: -4000px;
  top: -4000px;
  width: 16000px;
  height: 12000px;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}
.fn-svg path.fn-hit { pointer-events: stroke; cursor: pointer; }
.fn-edge-label {
  font-size: 11px;
  fill: #e4e4e7;
  font-family: Inter, sans-serif;
  stroke: #0c0d12;
  stroke-width: 3px;
  paint-order: stroke;
  pointer-events: none;
}
.fn-guide { stroke: rgba(96, 165, 250, 0.85); stroke-width: 1; stroke-dasharray: 4 4; }

.fn-node {
  position: absolute;
  width: 244px;
  border-radius: 14px;
  background: #14151b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  cursor: grab;
  user-select: none;
  z-index: 2;
}
.fn-node:active { cursor: grabbing; }
.fn-node.is-selected {
  border-color: rgba(96, 165, 250, 0.9);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25), 0 12px 30px rgba(0, 0, 0, 0.4);
  z-index: 3;
}
.fn-node.is-sim { box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.45); }
.fn-node-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 13px 13px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.fn-node-head b { font-size: 12.5px; font-weight: 600; color: #fff; line-height: 1.3; }
.fn-node-head em { font-style: normal; font-size: 10px; color: #a1a1aa; }
.fn-dot { width: 8px; height: 8px; border-radius: 99px; flex-shrink: 0; }
.fn-body-text {
  padding: 8px 12px 10px;
  font-size: 11.5px;
  line-height: 1.4;
  color: #d4d4d8;
  white-space: pre-wrap;
  word-break: break-word;
}
.fn-outs { padding: 0 0 8px; }
.fn-out-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 22px;
  padding: 0 0 0 12px;
  position: relative;
  font-size: 11px;
  color: #a1a1aa;
}
.fn-port {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  border: 2px solid #18181b;
  background: #60a5fa;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
  cursor: crosshair;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.fn-port-in {
  position: absolute;
  left: -6px;
  top: 22px;
  background: #a1a1aa;
}
.fn-port-out { margin-right: -6px; }
.fn-node.type-start .fn-port-out,
.fn-node.type-start .fn-dot { background: #34d399; }
.fn-node.type-message .fn-port-out,
.fn-node.type-message .fn-dot { background: #60a5fa; }
.fn-node.type-delay .fn-port-out,
.fn-node.type-delay .fn-dot { background: #a1a1aa; }
.fn-node.type-wait .fn-port-out,
.fn-node.type-wait .fn-dot { background: #fbbf24; }
.fn-node.type-branch .fn-port-out,
.fn-node.type-branch .fn-dot { background: #c084fc; }
.fn-node.type-random .fn-port-out,
.fn-node.type-random .fn-dot { background: #f472b6; }
.fn-node.type-end .fn-dot { background: #fb7185; }
.fn-node.type-note { background: #1c1808; border-color: rgba(250, 204, 21, 0.28); }
.fn-node.type-note .fn-dot,
.fn-node.type-note .fn-port-out { background: #facc15; }
.fn-node.type-start .fn-node-head { background: rgba(16, 185, 129, 0.1); }
.fn-node.type-message .fn-node-head { background: rgba(59, 130, 246, 0.1); }
.fn-node.type-wait .fn-node-head { background: rgba(245, 158, 11, 0.1); }
.fn-node.type-branch .fn-node-head { background: rgba(168, 85, 247, 0.12); }
.fn-node.type-random .fn-node-head { background: rgba(236, 72, 153, 0.1); }
.fn-node.type-end .fn-node-head { background: rgba(244, 63, 94, 0.1); }

.fn-marquee {
  position: absolute;
  border: 1px solid rgba(96, 165, 250, 0.9);
  background: rgba(59, 130, 246, 0.12);
  pointer-events: none;
  display: none;
}

.fn-zoombar, .fn-minimap {
  position: absolute;
  z-index: 4;
}
.fn-zoombar {
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px;
  border-radius: 10px;
  background: rgba(12, 12, 16, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.fn-zoombar button, .fn-linkish {
  background: transparent;
  color: #e4e4e7;
  border: 0;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}
.fn-zoombar button:hover { background: rgba(255, 255, 255, 0.08); }
.fn-zoom-label { font-variant-numeric: tabular-nums; min-width: 40px; text-align: center; color: #a1a1aa; font-size: 11px; }
.fn-minimap {
  right: 10px;
  bottom: 10px;
  width: 168px;
  height: 108px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(9, 9, 12, 0.88);
  cursor: pointer;
}
.fn-status {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 4;
  font-size: 11px;
  color: #a1a1aa;
  background: rgba(9, 9, 12, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 4px 10px;
  pointer-events: none;
}
.fn-menu {
  position: fixed;
  z-index: 60;
  min-width: 180px;
  padding: 4px;
  border-radius: 10px;
  background: #16171d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.fn-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: #e4e4e7;
  border: 0;
  border-radius: 7px;
  padding: 7px 8px;
  font-size: 12px;
  cursor: pointer;
}
.fn-menu button:hover { background: rgba(255, 255, 255, 0.06); }

.fn-help { font-size: 11.5px; color: #a1a1aa; line-height: 1.45; }
.fn-help code { color: #e4e4e7; }
.fn-row { display: flex; gap: 6px; }
.fn-row .field { text-align: center; }
.fn-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.fn-ins-block {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.fn-ins-block .field { margin-top: 4px; }
.fn-kicker { font-size: 11px; color: #a1a1aa; margin-bottom: 4px; }
.fn-vars { display: grid; gap: 7px; margin-top: 8px; }
.fn-var { display: grid; grid-template-columns: 124px 1fr; gap: 8px; align-items: start; }
.fn-var span { font-size: 11.5px; color: #a1a1aa; line-height: 1.35; }
.fn-var .fn-mini { justify-self: start; }

.fn-sim {
  display: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.22);
  padding: 10px 12px;
  gap: 12px;
}
.fn-sim.open { display: grid; grid-template-columns: 280px 1fr 280px; }
.fn-phone {
  height: 180px;
  overflow: auto;
  border-radius: 16px;
  padding: 10px;
  background: #0c0d12;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.fn-bub {
  max-width: 90%;
  margin: 6px 0;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
}
.fn-bub.out { margin-left: auto; background: #2563eb; color: white; border-bottom-right-radius: 4px; }
.fn-bub.in { background: #27272a; color: #f4f4f5; border-bottom-left-radius: 4px; }
.fn-bub.sys { margin-left: auto; margin-right: auto; background: transparent; color: #71717a; font-size: 11px; text-align: center; }
.fn-path { font-size: 12px; color: #d4d4d8; line-height: 1.45; }

@media (max-width: 1100px) {
  .fn-lib { display: none; }
  .fn-sim.open { grid-template-columns: 1fr; }
}
