:root {
  --bg: #0b1020;
  --panel: rgba(15, 23, 42, 0.92);
  --panel-2: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --danger: #ef4444;
  --grid-small: rgba(148, 163, 184, 0.12);
  --grid-big: rgba(148, 163, 184, 0.22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, .file-btn {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
}
button:hover, .file-btn:hover { background: rgba(139, 92, 246, 0.20); border-color: rgba(139, 92, 246, 0.55); }
.file-btn input { display: none; }
#topbar {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(16px);
  z-index: 20;
  overflow: visible;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 250px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(135deg, var(--accent), #06b6d4); font-weight: 900; font-size: 24px; }
.brand span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.toolbar[hidden] { display: none !important; }
#topbar .toolbar {
  padding: 3px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.58);
  align-content: center;
  overflow: visible;
  cursor: grab;
}
#topbar .toolbar.is-floating {
  position: fixed;
  z-index: 80;
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}
#topbar .toolbar button,
#topbar .toolbar .file-btn {
  padding: 0;
  line-height: 1;
}
#topbar .toolbar .toolbar-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: 0 0 auto;
}
#topbar .toolbar .toolbar-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.panel-collapse-toggle {
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.panel-collapse-toggle svg {
  transition: transform 0.2s ease;
}
.toolbar-separator {
  width: 1px;
  height: 20px;
  margin: 0 2px;
  background: rgba(148, 163, 184, 0.22);
}
.toolbar.dragging {
  cursor: grabbing;
  user-select: none;
}
.toolbar.collapsed {
  width: 38px !important;
  min-width: 38px;
  height: 38px;
  gap: 0;
  overflow: hidden !important;
  flex-wrap: nowrap;
}
.toolbar.collapsed > :not(.canvas-kit-toolbar-collapse) {
  display: none !important;
}
.toolbar.collapsed .canvas-kit-toolbar-collapse svg {
  transform: rotate(180deg);
}
.floating-tooltip {
  position: fixed;
  padding: 5px 7px;
  border-radius: 7px;
  background: rgba(2, 6, 23, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #e5e7eb;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  z-index: 300;
}
.floating-tooltip.hidden { display: none; }
.floating-tooltip::before {
  content: "";
  position: absolute;
  left: var(--tip-arrow-left, 50%);
  top: -5px;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: rgba(2, 6, 23, 0.96);
  border-left: 1px solid rgba(148, 163, 184, 0.18);
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}
.floating-tooltip.above::before {
  top: auto;
  bottom: -5px;
  border-left: 0;
  border-top: 0;
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}
.canvas-kit-host {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  isolation: isolate;
}
#stage-shell.canvas-kit-host { height: calc(100% - 62px); }
.canvas-kit-toolbar {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 10px;
  z-index: 16;
  width: max-content;
  max-width: calc(100% - 24px);
  margin: 0 auto;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(12px);
  overflow: visible;
  cursor: grab;
}
.canvas-kit-toolbar.is-floating {
  right: auto;
  margin: 0;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}
.canvas-kit-toolbar button,
.canvas-kit-toolbar .file-btn {
  padding: 0;
  line-height: 1;
}
.canvas-kit-toolbar .toolbar-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: 0 0 auto;
}
.canvas-kit-toolbar .toolbar-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.canvas-kit-toolbar .toolbar-icon:disabled,
#topbar .toolbar .toolbar-icon:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(148, 163, 184, 0.14);
}
.canvas-kit-toolbar .toolbar-icon:disabled:hover,
#topbar .toolbar .toolbar-icon:disabled:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(148, 163, 184, 0.14);
}
.canvas-kit-toolbar .toolbar-icon.has-format {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.62);
  background: rgba(74, 222, 128, 0.14);
}
.canvas-kit-toolbar .toolbar-icon.active:not(.has-format) {
  color: var(--muted);
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.1);
}
.canvas-kit-toolbar .toolbar-icon.has-format {
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.18), 0 0 18px rgba(74, 222, 128, 0.14);
}
.canvas-kit-host.format-painter-active #canvas-container,
.canvas-kit-host.format-painter-active .canvas-item,
.canvas-kit-host.format-painter-active .connection-hit {
  cursor: crosshair;
}
.canvas-kit-host.format-painter-loaded #canvas-container,
.canvas-kit-host.format-painter-loaded .canvas-item,
.canvas-kit-host.format-painter-loaded .connection-hit {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg fill='none' stroke='%234ade80' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 23h8'/%3E%3Cpath d='M17 4l7 7'/%3E%3Cpath d='M16 5l7 7-10 10H6v-7z'/%3E%3Cpath d='M13 16l-3-3'/%3E%3C/g%3E%3C/svg%3E") 5 23, copy;
}
#canvas-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: default;
  touch-action: none;
  background-color: #090e1b;
  background-image:
    radial-gradient(circle, rgba(148, 163, 184, 0.32) 1px, transparent 1.4px),
    radial-gradient(circle, rgba(148, 163, 184, 0.14) 1px, transparent 1.4px);
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px, 120px 120px;
}
#canvas-container.panning { cursor: grabbing; }
#world { position: absolute; left: 0; top: 0; width: 10000px; height: 10000px; transform-origin: 0 0; }
#connection-layer, #element-layer, #guide-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#connection-layer { pointer-events: auto; z-index: 1; }
#element-layer { z-index: 2; pointer-events: none; }
#guide-layer { z-index: 9; pointer-events: none; }
.canvas-item {
  position: absolute;
  pointer-events: auto;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.92);
  border-style: solid;
  border-color: #8b5cf6;
  border-width: 2px;
  box-shadow: 0 16px 36px rgba(0,0,0,0.28);
  user-select: none;
  color: var(--text);
  overflow: visible;
}
.canvas-item.node { min-width: 110px; min-height: 70px; }
.canvas-item.node:has(.sentence-node-preview) {
  min-height: 0;
}
.canvas-item.group { background: rgba(30, 41, 59, 0.36); border-color: #22d3ee; border-radius: 20px; }
.canvas-item.selected {
  box-shadow: 0 18px 38px rgba(0,0,0,0.35);
}
.canvas-item.selected::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: calc(var(--item-radius, 16px) + 8px);
  pointer-events: none;
  background: transparent;
  box-shadow:
    0 0 0 1px color-mix(in srgb, currentColor 22%, transparent),
    0 0 18px color-mix(in srgb, currentColor 46%, transparent),
    0 0 34px color-mix(in srgb, currentColor 24%, transparent);
}
.canvas-item.highlight { filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.8)); }
.canvas-item.border-dashed,
.canvas-item.border-wave { border-style: solid; }
.item-border-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.item-border-path {
  fill: none;
  vector-effect: non-scaling-stroke;
}
.canvas-item.border-dashed::after {
  content: none;
}
.canvas-item.border-wave::after {
  content: none;
}
.item-label {
  position: absolute;
  left: 10px;
  top: -33px;
  max-width: calc(100% - 20px);
  min-height: 26px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--item-accent, #c0c1ff) 15%, transparent), transparent 62%),
    rgba(17, 18, 23, 0.92);
  border: 1px solid color-mix(in srgb, var(--item-accent, #c0c1ff) 34%, rgba(255, 255, 255, 0.08));
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  font-size: 12px;
  font-weight: 550;
  line-height: 16px;
  letter-spacing: 0.01em;
  color: #f0eef2;
  pointer-events: auto;
  cursor: text;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.item-label::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 7px 1px 1px;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--item-accent, #c0c1ff);
  box-shadow: 0 0 8px color-mix(in srgb, var(--item-accent, #c0c1ff) 72%, transparent);
}
.item-label:hover,
.canvas-item.selected .item-label {
  border-color: color-mix(in srgb, var(--item-accent, #c0c1ff) 62%, rgba(255, 255, 255, 0.14));
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.34),
    0 0 14px color-mix(in srgb, var(--item-accent, #c0c1ff) 12%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.075);
  transform: translateY(-1px);
}
.item-body { height: 100%; display: grid; place-items: center; padding: 16px; text-align: center; line-height: 1.35; color: #cbd5e1; overflow: hidden; }
.canvas-item.node .item-body,
.canvas-item.node .parser-result-node-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(203, 213, 225, 0.18) rgba(15, 23, 42, 0.18);
}
.canvas-item.node .item-body::-webkit-scrollbar,
.canvas-item.node .parser-result-node-content::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.canvas-item.node .item-body::-webkit-scrollbar-track,
.canvas-item.node .parser-result-node-content::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.16);
  border-radius: 999px;
}
.canvas-item.node .item-body::-webkit-scrollbar-thumb,
.canvas-item.node .parser-result-node-content::-webkit-scrollbar-thumb {
  background: rgba(203, 213, 225, 0.16);
  border: 1px solid rgba(15, 23, 42, 0.82);
  border-radius: 999px;
}
.canvas-item.node .item-body::-webkit-scrollbar-thumb:hover,
.canvas-item.node .parser-result-node-content::-webkit-scrollbar-thumb:hover {
  background: rgba(203, 213, 225, 0.28);
}
.item-body b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sentence-node-preview,
.parser-view-preview {
  width: 100%;
  height: 100%;
  display: grid;
  align-content: center;
  gap: 8px;
  text-align: left;
}
.sentence-node-preview {
  align-content: center;
  color: rgba(229, 226, 227, 0.88);
  font-size: 15px;
  line-height: 1.32;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.canvas-item:has(.sentence-node-preview) .item-body {
  padding: 4px 10px;
  place-items: center start;
}
.sentence-node-preview strong,
.parser-view-preview strong {
  color: #f8fafc;
  font-size: 13px;
  line-height: 1.2;
}
.sentence-node-preview p,
.parser-view-preview p {
  margin: 0;
  color: rgba(203, 213, 225, 0.78);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.parser-view-preview {
  align-content: start;
}
.canvas-item:has(.parser-view-loading) {
  background:
    linear-gradient(120deg, rgba(192, 193, 255, 0.08), rgba(78, 222, 163, 0.055), rgba(192, 193, 255, 0.08)),
    rgba(15, 23, 42, 0.92);
  background-size: 220% 100%;
  animation: parser-loading-bg 3.8s ease-in-out infinite;
}
.parser-view-preview .view-strip {
  display: grid;
  gap: 5px;
}
.parser-view-preview .view-row {
  height: 9px;
  border-radius: 999px;
  background: rgba(192, 193, 255, 0.22);
}
.parser-view-preview .view-row:nth-child(2) { width: 78%; background: rgba(78, 222, 163, 0.2); }
.parser-view-preview .view-row:nth-child(3) { width: 56%; }
.parser-view-loading .view-row {
  position: relative;
  overflow: hidden;
  background: rgba(82, 81, 96, 0.34);
  animation: parser-loading-bar-pulse 1.8s ease-in-out infinite;
}
.parser-view-loading .view-row:nth-child(2) {
  animation-delay: 0.14s;
}
.parser-view-loading .view-row:nth-child(3) {
  animation-delay: 0.28s;
}
.parser-view-loading .view-row::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(229, 226, 227, 0.18), transparent);
  animation: parser-view-shimmer 1.25s infinite;
}
.parser-view-loading p {
  color: rgba(199, 196, 215, 0.72);
}
.parser-view-error p {
  color: #fca5a5;
}
.canvas-item.canvas-node-attention {
  animation: canvas-node-attention 0.85s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes canvas-node-attention {
  0%, 100% {
    box-shadow: var(--canvas-item-shadow, 0 12px 28px rgba(0, 0, 0, 0.28));
  }
  42% {
    box-shadow:
      0 0 0 4px rgba(192, 193, 255, 0.18),
      0 0 28px rgba(192, 193, 255, 0.24),
      var(--canvas-item-shadow, 0 12px 28px rgba(0, 0, 0, 0.28));
  }
}
.canvas-item:has(.parser-auth-state) {
  border-color: rgba(192, 193, 255, 0.34);
  background:
    radial-gradient(circle at 50% 0%, rgba(192, 193, 255, 0.11), transparent 52%),
    rgba(18, 18, 21, 0.96);
}
.parser-auth-state {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 18px 16px;
  text-align: center;
}
.parser-auth-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 7px;
  border: 1px solid rgba(192, 193, 255, 0.22);
  border-radius: 10px;
  background: rgba(192, 193, 255, 0.09);
  color: #c0c1ff;
}
.parser-auth-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.parser-auth-eyebrow {
  margin-bottom: 3px;
  color: rgba(192, 193, 255, 0.72);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.parser-auth-state > strong {
  color: rgba(246, 245, 252, 0.96);
  font-size: 13px;
  line-height: 1.3;
}
.parser-auth-state > p {
  max-width: 235px;
  margin: 5px 0 11px;
  color: rgba(199, 196, 215, 0.62);
  font-size: 10px;
  line-height: 1.45;
}
.parser-auth-login {
  min-width: 104px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 13px;
  border: 1px solid rgba(192, 193, 255, 0.34);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(192, 193, 255, 0.2), rgba(142, 144, 255, 0.13));
  color: rgba(244, 243, 252, 0.94);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.2);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}
.parser-auth-login svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.parser-auth-login:hover {
  border-color: rgba(192, 193, 255, 0.58);
  background: linear-gradient(135deg, rgba(192, 193, 255, 0.28), rgba(142, 144, 255, 0.18));
  transform: translateY(-1px);
}
.parser-auth-login:focus-visible {
  outline: 2px solid rgba(192, 193, 255, 0.58);
  outline-offset: 2px;
}
@keyframes parser-view-shimmer {
  100% {
    transform: translateX(100%);
  }
}
@keyframes parser-loading-bg {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}
@keyframes parser-loading-bar-pulse {
  0%, 100% {
    opacity: 0.62;
  }
  50% {
    opacity: 1;
  }
}
.group .item-body { align-items: start; justify-items: start; color: rgba(203,213,225,0.82); font-size: 13px; }
.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid #0f172a;
  background: white;
  border-radius: 50%;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s, transform .12s;
}
.canvas-item.resize-enabled .resize-handle {
  opacity: 1;
  pointer-events: auto;
}
.resize-handle.nw { left: -5px; top: -5px; cursor: nwse-resize; }
.resize-handle.ne { right: -5px; top: -5px; cursor: nesw-resize; }
.resize-handle.sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.resize-handle.se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.resize-handle.n { left: 50%; top: -5px; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.s { left: 50%; bottom: -5px; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.e { right: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.resize-handle.w { left: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.parser-output-resize-grip {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 22px;
  height: 22px;
  z-index: 7;
  display: none;
  cursor: nwse-resize;
  opacity: 0.34;
  transition: opacity .14s ease, transform .14s ease;
}
.parser-output-resize-grip::before,
.parser-output-resize-grip::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 6px;
  width: 11px;
  height: 1px;
  border-radius: 999px;
  background: rgba(192, 193, 255, 0.76);
  transform: rotate(-45deg);
  transform-origin: right center;
}
.parser-output-resize-grip::after {
  right: 5px;
  bottom: 10px;
  width: 7px;
}
.canvas-item.parser-result-node.resize-enabled .parser-output-resize-grip {
  display: block;
  pointer-events: auto;
}
.canvas-item.parser-result-node.resize-enabled:hover .parser-output-resize-grip,
.canvas-item.parser-result-node.resize-enabled:focus-within .parser-output-resize-grip {
  opacity: 0.88;
}
.canvas-item.parser-result-node.resize-enabled .parser-output-resize-grip:hover {
  transform: translate(-1px, -1px);
}
.port {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #f8fafc;
  border: 2px solid #0f172a;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.85);
  transition: opacity .12s, transform .12s;
  z-index: 6;
  cursor: crosshair;
  pointer-events: none;
}
.canvas-item.resize-enabled .port,
.canvas-kit-host.resize-mode-active .canvas-item.connection-target .port {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}
.canvas-item.connection-target .port { background: #67e8f9; box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.16); }
.port[data-port="top"] { left: 50%; top: 0; }
.port[data-port="right"] { left: 100%; top: 50%; }
.port[data-port="bottom"] { left: 50%; top: 100%; }
.port[data-port="left"] { left: 0; top: 50%; }
.connection-hit { pointer-events: stroke; cursor: pointer; stroke: transparent; stroke-width: 16; fill: none; }
.connection-path { fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.connection-label {
  font-size: 12px;
  fill: #e5e7eb;
  paint-order: stroke;
  stroke: rgba(2,6,23,0.95);
  stroke-width: 5px;
  stroke-linejoin: round;
  pointer-events: auto;
  cursor: text;
}
.connection-selected .connection-path { filter: drop-shadow(0 0 5px rgba(255,255,255,0.9)); }
.guide-line { position: absolute; background: #fb7185; box-shadow: 0 0 0 1px rgba(251, 113, 133, 0.4); }
.guide-line.v { width: 1px; height: 10000px; top: 0; }
.guide-line.h { height: 1px; width: 10000px; left: 0; }
.selection-box {
  position: absolute;
  border: 1px solid rgba(125, 211, 252, 0.85);
  background: rgba(14, 165, 233, 0.13);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.14);
  pointer-events: none;
}
#property-panel {
  position: absolute;
  right: 18px;
  top: 18px;
  width: min(320px, calc(100vw - 36px));
  max-height: calc(100% - 36px);
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.34);
  backdrop-filter: blur(18px);
  padding: 14px;
  overflow: auto;
  z-index: 14;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
#property-panel.dragging {
  user-select: none;
}
#property-panel.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#property-panel:not(.active) .text-analysis-controls {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: none;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px -4px 12px;
  padding: 7px 8px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.32);
  border: 1px solid rgba(148, 163, 184, 0.12);
  cursor: grab;
}
.panel-header:active { cursor: grabbing; }
.panel-header h3 { margin: 0; font-size: 15px; }
.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.panel-title-icon {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: #c4b5fd;
}
.panel-title-icon::before,
.panel-title-icon::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
}
.panel-title-icon.selection::before {
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 5px;
}
.panel-title-icon.node::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 5px;
}
.panel-title-icon.group::before {
  inset: 5px 2px 2px 5px;
  border: 2px solid currentColor;
  border-radius: 4px;
}
.panel-title-icon.group::after {
  inset: 2px 5px 5px 2px;
  border: 1px solid currentColor;
  border-radius: 4px;
  opacity: 0.72;
}
.panel-title-icon.connection::before {
  left: 3px;
  right: 3px;
  top: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}
.panel-title-icon.connection::after {
  left: 2px;
  right: 2px;
  top: 6px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
}
.panel-close-btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(203, 213, 225, 0.62);
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.panel-close-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.panel-close-btn:focus-visible {
  outline: none;
  color: rgba(245, 243, 255, 0.9);
  background: rgba(196, 181, 253, 0.1);
  box-shadow: 0 0 0 2px rgba(196, 181, 253, 0.18);
}
.panel-close-btn:hover {
  color: rgba(245, 243, 255, 0.92);
  background: rgba(226, 232, 240, 0.08);
  box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.06);
  transform: translateY(-1px);
}
.panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: -4px 0 12px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.22);
  border: 1px solid rgba(148, 163, 184, 0.1);
}
.panel-actions [hidden] {
  display: none !important;
}
.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: rgba(226, 232, 240, 0.82);
  flex: 1 1 0;
  min-width: 28px;
  max-width: 38px;
}
.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn:hover {
  background: rgba(139, 92, 246, 0.22);
  color: #f8fafc;
}
.icon-btn.danger { color: #fecaca; }
.action-separator {
  width: 1px;
  height: 18px;
  margin: 0 2px;
  background: rgba(148, 163, 184, 0.22);
  flex: 0 0 1px;
}
#selection-summary {
  margin-top: 18px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.4;
}
.summary-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px;
  align-items: baseline;
  margin: 5px 0;
}
.summary-row span {
  color: var(--muted);
}
.summary-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #e5e7eb;
  font-weight: 600;
}
.field-row { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; margin: 10px 0; font-size: 13px; }
.field-row input, .field-row select { width: 100%; background: #0f172a; color: var(--text); border: 1px solid rgba(148, 163, 184, 0.25); border-radius: 8px; padding: 7px 8px; }
#property-panel input:focus,
#property-panel input:active,
#property-panel select:focus,
#property-panel select:active {
  outline: none;
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: none;
}
.color-control {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  align-items: center;
  width: auto;
  min-width: 0;
  max-width: 100%;
  padding: 4px;
}
.color-swatches {
  display: contents;
}
.color-swatch {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 9px;
  background: var(--swatch-color);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.color-swatch:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 0 2px rgba(196, 181, 253, 0.3), 0 4px 9px rgba(0, 0, 0, 0.25);
}
.color-swatch.active {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 0 2px #17161a, 0 0 0 4px rgba(192, 193, 255, 0.72);
}
.color-swatch.active::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: translateY(-1px) rotate(45deg);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
}
.custom-color-picker {
  --custom-color: #c0c1ff;
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 9px;
  color: white;
  background:
    linear-gradient(var(--custom-color), var(--custom-color)) padding-box,
    conic-gradient(#f43f5e, #f59e0b, #10b981, #22d3ee, #8b5cf6, #f43f5e) border-box;
  box-shadow: inset 0 0 0 3px #17161a, 0 1px 3px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.custom-color-picker:hover,
.custom-color-picker:focus-within {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 3px #17161a, 0 0 0 2px rgba(196, 181, 253, 0.38), 0 4px 9px rgba(0, 0, 0, 0.25);
}
.custom-color-picker span {
  position: relative;
  z-index: 1;
  font: 500 17px/1 var(--font-ui);
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}
.custom-color-picker input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

body.canvas-presentation-mode .canvas-item .resize-handle,
body.canvas-presentation-mode .canvas-item .port,
body.canvas-presentation-mode .parser-output-resize-grip {
  display: none !important;
}

.canvas-item[data-validation-status="pending"]::after,
.canvas-item[data-validation-status="warning"]::after,
.canvas-item[data-validation-status="invalid"]::after {
  position: absolute;
  right: 8px;
  bottom: -9px;
  z-index: 6;
  min-height: 18px;
  display: grid;
  place-items: center;
  padding: 1px 7px;
  border: 1px solid rgba(192, 193, 255, 0.25);
  border-radius: 999px;
  background: rgba(18, 18, 20, 0.94);
  color: rgba(208, 207, 232, 0.82);
  font-size: 8px;
  font-weight: 650;
  line-height: 1;
  pointer-events: none;
}

.canvas-item[data-validation-status="pending"]::after {
  content: "Validating\2026";
  animation: canvasValidationPulse 0.9s ease-in-out infinite;
}

.canvas-item[data-validation-status="warning"]::after {
  content: "Review text";
  border-color: rgba(251, 191, 36, 0.3);
  color: rgba(252, 211, 77, 0.9);
}

.canvas-item[data-validation-status="invalid"]::after {
  content: "Invalid text";
  border-color: rgba(251, 113, 133, 0.3);
  color: rgba(253, 164, 175, 0.92);
}

@keyframes canvasValidationPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 9px;
  background: rgba(2, 6, 23, 0.38);
}
.segmented-control.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.segmented-control.border-style-control {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border-radius: 11px;
  background: rgba(12, 12, 15, 0.68);
}
.segmented-control button {
  display: grid;
  place-items: center;
  height: 28px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
}
.segmented-control button:hover,
.segmented-control button.active {
  background: rgba(139, 92, 246, 0.24);
}
.segmented-control button.active {
  box-shadow: inset 0 0 0 1px rgba(196, 181, 253, 0.42);
}
.segmented-control.border-style-control button {
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}
.segmented-control.border-style-control button:hover {
  border-color: rgba(192, 193, 255, 0.22);
  background: rgba(192, 193, 255, 0.08);
}
.segmented-control.border-style-control button.active {
  border-color: rgba(192, 193, 255, 0.62);
  background: linear-gradient(180deg, rgba(192, 193, 255, 0.18), rgba(192, 193, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 0 1px rgba(192, 193, 255, 0.08);
}
.border-preview {
  position: relative;
  display: block;
  width: min(30px, calc(100% - 8px));
  height: 14px;
  border: 0;
}
.border-preview::before {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 6px;
  height: 2px;
  border-radius: 999px;
  background: #c4b5fd;
}
.border-preview.none::before {
  background: rgba(196, 181, 253, 0.25);
}
.border-preview.none::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 6px;
  height: 2px;
  border-radius: 999px;
  background: #c4b5fd;
  transform: rotate(-28deg);
}
.border-preview.dashed::before {
  height: 0;
  background: none;
  border-top: 2px dashed #c4b5fd;
}
.border-preview.wave::before {
  inset: 1px 0 0;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 12'%3E%3Cpath d='M1 6 Q5 1 9 6 T17 6 T25 6 T33 6' fill='none' stroke='%23c4b5fd' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 12px no-repeat;
}
.line-preview,
.line-style-preview {
  position: relative;
  display: block;
  width: 38px;
  height: 18px;
}
.line-preview svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.line-preview svg path {
  fill: none;
  stroke: #c4b5fd;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.line-preview::before,
.line-style-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #c4b5fd;
  height: 2px;
  top: 8px;
  border-radius: 999px;
}
.line-preview.straight::before,
.line-style-preview::before {
  left: 3px;
  right: 3px;
}
.line-preview.angled::before,
.line-preview.angled::after {
  content: "";
  position: absolute;
  background: #c4b5fd;
  border-radius: 999px;
}
.line-preview.angled::before {
  left: 5px;
  top: 5px;
  width: 16px;
  height: 2px;
}
.line-preview.angled::after {
  right: 5px;
  bottom: 5px;
  width: 17px;
  height: 2px;
}
.line-preview.angled {
  background:
    linear-gradient(#c4b5fd, #c4b5fd) 20px 5px / 2px 8px no-repeat;
}
.line-preview.bezier::before,
.line-preview.bezier::after {
  content: none;
}
.line-style-preview.dashed::before {
  background: repeating-linear-gradient(90deg, #c4b5fd 0 7px, transparent 7px 11px);
}
.context-menu {
  position: fixed;
  min-width: 188px;
  max-width: 236px;
  background: rgba(24, 23, 25, 0.96);
  border: 1px solid rgba(82, 81, 96, 0.58);
  box-shadow: 0 22px 54px rgba(0,0,0,0.44);
  border-radius: 12px;
  padding: 5px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 100;
}
.context-menu.hidden { display: none; }
.context-menu button {
  width: 100%;
  min-height: 26px;
  text-align: left;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(229, 226, 227, 0.82);
  padding: 4px 9px;
  font: 500 12px/1.2 var(--font-ui);
  letter-spacing: 0;
  white-space: normal;
  cursor: pointer;
}
.context-menu button.danger { color: #fecaca; }
.context-menu button:hover {
  color: #f6f3f4;
  background: rgba(192, 193, 255, 0.12);
}
.context-menu button.danger:hover {
  color: #ffe4e6;
  background: rgba(239, 68, 68, 0.12);
}
.context-submenu-wrap { position: relative; }
.context-menu .context-submenu-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.context-menu .context-submenu-arrow {
  color: rgba(199, 196, 215, 0.5);
  font-size: 18px;
  line-height: 1;
}
.context-submenu {
  position: absolute;
  top: -7px;
  left: calc(100% + 5px);
  min-width: 190px;
  display: none;
}
.context-submenu-wrap:hover > .context-submenu,
.context-submenu-wrap:focus-within > .context-submenu { display: block; }
.menu-separator { height: 1px; background: rgba(82, 81, 96, 0.5); margin: 5px 6px; }

.text-analysis-controls {
  display: none;
  margin: 12px 0 2px;
  padding: 12px;
  border: 1px solid rgba(192, 193, 255, 0.14);
  border-radius: 10px;
  background: rgba(192, 193, 255, 0.045);
}
.property-section {
  margin: 12px 0 2px;
  padding: 12px;
  border: 1px solid rgba(199, 196, 215, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
}
.property-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.property-section-header h4 {
  margin: 0;
  color: rgba(244, 243, 252, 0.9);
  font-size: 12px;
  font-weight: 500;
}
.property-section-collapse {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: rgba(199, 196, 215, 0.62);
  cursor: pointer;
}
.property-section-collapse:hover,
.property-section-collapse:focus-visible {
  border-color: rgba(192, 193, 255, 0.2);
  background: rgba(192, 193, 255, 0.08);
  color: rgba(244, 243, 252, 0.92);
  outline: none;
}
.property-section-collapse svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}
.property-section.is-collapsed .property-section-collapse svg {
  transform: rotate(-90deg);
}
.property-section-body {
  max-height: 360px;
  margin-top: 10px;
  overflow: visible;
  opacity: 1;
  transition: max-height 0.22s ease, margin 0.2s ease, opacity 0.15s ease;
}
.property-section.is-collapsed .property-section-body {
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
}
.property-section-body > .field-row:first-child {
  margin-top: 0;
}
.text-analysis-controls.active { display: block; }
.text-analysis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.text-analysis-heading {
  margin: 0;
  color: rgba(244, 243, 252, 0.94);
  font-size: 12px;
  font-weight: 500;
}
.text-analysis-collapse {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: rgba(199, 196, 215, 0.62);
  cursor: pointer;
}
.text-analysis-collapse:hover,
.text-analysis-collapse:focus-visible {
  border-color: rgba(192, 193, 255, 0.2);
  background: rgba(192, 193, 255, 0.08);
  color: rgba(244, 243, 252, 0.92);
  outline: none;
}
.text-analysis-collapse svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}
.text-analysis-controls.is-collapsed .text-analysis-collapse svg {
  transform: rotate(-90deg);
}
.text-analysis-body {
  max-height: 260px;
  margin-top: 10px;
  overflow: visible;
  opacity: 1;
  transition: max-height 0.22s ease, margin 0.2s ease, opacity 0.15s ease;
}
.text-analysis-controls.is-collapsed .text-analysis-body {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  overflow: hidden;
}
.text-analysis-language-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.text-analysis-field {
  display: grid;
  gap: 5px;
  color: rgba(199, 196, 215, 0.58);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.analysis-language-picker {
  position: relative;
  display: block;
  min-width: 0;
}
.analysis-language-trigger {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  border: 1px solid rgba(82, 81, 96, 0.5);
  border-radius: 7px;
  background: rgba(18, 18, 20, 0.84);
  color: rgba(229, 226, 237, 0.88);
  padding: 0 7px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  text-align: left;
  text-transform: none;
  cursor: pointer;
}
.analysis-language-trigger svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: rgba(199, 196, 215, 0.62);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s ease;
}
.analysis-language-picker.open .analysis-language-trigger {
  border-color: rgba(192, 193, 255, 0.42);
  background: rgba(28, 27, 31, 0.96);
}
.analysis-language-picker.open .analysis-language-trigger svg {
  transform: rotate(180deg);
}
.analysis-language-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 40;
  width: max-content;
  min-width: 100%;
  max-height: 190px;
  display: none;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid rgba(82, 81, 96, 0.62);
  border-radius: 8px;
  background: rgba(20, 19, 22, 0.98);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  scrollbar-width: thin;
  scrollbar-color: rgba(192, 193, 255, 0.34) transparent;
}
.analysis-language-menu::-webkit-scrollbar {
  width: 5px;
}
.analysis-language-menu::-webkit-scrollbar-track {
  background: transparent;
}
.analysis-language-menu::-webkit-scrollbar-thumb {
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(192, 193, 255, 0.34);
  background-clip: padding-box;
}
.analysis-language-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(192, 193, 255, 0.5);
  background-clip: padding-box;
}
.analysis-language-picker.open .analysis-language-menu {
  display: grid;
  animation: analysisLanguageMenuIn 0.14s ease-out;
}
.analysis-language-menu button {
  min-width: 96px;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(215, 212, 226, 0.76);
  padding: 0 8px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}
.analysis-language-menu button:hover,
.analysis-language-menu button[aria-selected="true"] {
  background: rgba(192, 193, 255, 0.11);
  color: rgba(246, 244, 252, 0.96);
}
@keyframes analysisLanguageMenuIn {
  from { opacity: 0; transform: translateY(-3px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.text-analysis-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
.text-analysis-actions button {
  position: relative;
  min-height: 40px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(82, 81, 96, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--analysis-accent) 7%, transparent), transparent 58%),
    rgba(24, 23, 27, 0.72);
  color: rgba(224, 222, 234, 0.84);
  padding: 5px 8px 5px 6px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.018);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.text-analysis-action-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--analysis-accent) 28%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--analysis-accent) 10%, transparent);
  color: var(--analysis-accent);
}
.text-analysis-action-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.text-analysis-action-arrow {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: rgba(199, 196, 215, 0.36);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s ease, stroke 0.16s ease;
}
.text-analysis-action-status {
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
}
.text-analysis-action-status > svg {
  grid-area: 1 / 1;
}
.text-analysis-action-existing {
  width: 15px;
  height: 15px;
  display: none;
  fill: none;
  stroke: var(--analysis-accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.text-analysis-actions button.has-existing-output {
  border-color: color-mix(in srgb, var(--analysis-accent) 62%, rgba(82, 81, 96, 0.42));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--analysis-accent) 18%, transparent), transparent 72%),
    rgba(31, 30, 35, 0.9);
  color: rgba(247, 246, 253, 0.96);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--analysis-accent) 72%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.text-analysis-actions button.has-existing-output .text-analysis-action-icon {
  border-color: color-mix(in srgb, var(--analysis-accent) 58%, transparent);
  background: color-mix(in srgb, var(--analysis-accent) 17%, transparent);
}
.text-analysis-actions button.has-existing-output .text-analysis-action-arrow {
  display: none;
}
.text-analysis-actions button.has-existing-output .text-analysis-action-existing {
  display: block;
}
.text-analysis-actions button:hover {
  border-color: color-mix(in srgb, var(--analysis-accent) 38%, rgba(82, 81, 96, 0.42));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--analysis-accent) 13%, transparent), transparent 68%),
    rgba(31, 30, 34, 0.86);
  color: #f1f0fa;
  transform: translateX(2px);
}
.text-analysis-actions button:hover .text-analysis-action-arrow {
  stroke: var(--analysis-accent);
  transform: translateX(2px);
}
.text-analysis-actions button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--analysis-accent) 52%, transparent);
  outline-offset: 1px;
}
#minimap {
  position: absolute;
  left: 16px;
  bottom: 18px;
  width: 320px;
  height: 150px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(12px);
  overflow: hidden;
  z-index: 12;
  cursor: crosshair;
}
#minimap-controls {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(226, 232, 240, 0.12);
  border-radius: 9px;
  background: rgba(2, 6, 23, 0.48);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.minimap-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(226, 232, 240, 0.62);
  cursor: pointer;
}
.minimap-zoom-reset {
  width: 38px;
  color: rgba(226, 232, 240, 0.68);
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1;
}
.minimap-btn:hover {
  background: rgba(196, 181, 253, 0.12);
  color: rgba(196, 181, 253, 0.95);
}
.minimap-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
#minimap-content {
  position: absolute;
  inset: 0;
  isolation: isolate;
  background:
    radial-gradient(circle at 18% 12%, rgba(196, 181, 253, 0.13), transparent 38%),
    radial-gradient(circle at 88% 74%, rgba(34, 211, 238, 0.06), transparent 32%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.18), rgba(2, 6, 23, 0.08));
}
#minimap-content::before,
#minimap-content::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
#minimap-content::before {
  background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.04) 38%, transparent 58%);
  opacity: 0.45;
  transform: translateX(-42%);
  animation: minimapContentSheen 18s ease-in-out infinite;
}
#minimap-content::after {
  background-image: radial-gradient(circle, rgba(226, 232, 240, 0.08) 1px, transparent 1.2px);
  background-size: 18px 18px;
  opacity: 0.18;
}
@keyframes minimapContentSheen {
  0%, 42% { transform: translateX(-48%); opacity: 0.28; }
  58% { transform: translateX(34%); opacity: 0.48; }
  100% { transform: translateX(48%); opacity: 0.28; }
}
@media (prefers-reduced-motion: reduce) {
  #minimap-content::before {
    animation: none;
    transform: none;
  }
}
.mini-connections { position: absolute; inset: 0; overflow: visible; z-index: 1; }
.mini-item { position: absolute; z-index: 2; border-radius: 3px; background: rgba(139, 92, 246, 0.72); border: 1px solid rgba(255,255,255,0.4); }
.mini-item.group { background: rgba(34, 211, 238, 0.24); }
#minimap-viewport { position: absolute; border: 1px solid rgba(226, 232, 240, 0.62); box-shadow: 0 0 0 999px rgba(0,0,0,0.16); border-radius: 4px; cursor: grab; }
#minimap-viewport:active { cursor: grabbing; }
.canvas-kit-prompt-modal {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.canvas-kit-prompt-modal.hidden {
  display: none;
}
.canvas-kit-prompt-card {
  width: min(360px, 100%);
  border: 1px solid rgba(82, 81, 96, 0.58);
  border-radius: 14px;
  background: rgba(24, 23, 25, 0.98);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.46);
  padding: 16px;
}
.canvas-kit-prompt-card h3 {
  margin: 0;
  color: #f6f3f4;
  font: 700 15px/1.25 var(--font-ui);
  letter-spacing: 0;
}
.canvas-kit-prompt-card p {
  margin: 6px 0 12px;
  color: rgba(229, 226, 227, 0.62);
  font: 400 12px/1.4 var(--font-ui);
  letter-spacing: 0;
}
.canvas-kit-prompt-card input {
  width: 100%;
  height: 38px;
  border: 1px solid rgba(192, 193, 255, 0.18);
  border-radius: 10px;
  background: rgba(12, 12, 14, 0.78);
  color: #e5e2e3;
  padding: 0 10px;
  outline: none;
}
.canvas-kit-prompt-card input:focus {
  border-color: rgba(192, 193, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(192, 193, 255, 0.14);
}
.canvas-kit-prompt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.canvas-kit-prompt-actions button {
  min-width: 76px;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
}
.canvas-kit-prompt-submit {
  border-color: rgba(192, 193, 255, 0.48);
  background: rgba(192, 193, 255, 0.16);
}
.canvas-kit-confirm-card {
  border-color: rgba(248, 113, 113, 0.28);
}
.canvas-kit-confirm-submit {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(239, 68, 68, 0.16);
}
.canvas-kit-confirm-submit:hover,
.canvas-kit-confirm-submit:focus-visible {
  color: #fff1f2;
  border-color: rgba(248, 113, 113, 0.72);
  background: rgba(239, 68, 68, 0.26);
}
#toast { position: fixed; left: 50%; top: 24px; bottom: auto; transform: translateX(-50%); background: rgba(15, 23, 42, 0.985); color: #f8fafc; padding: 9px 14px; border-radius: 999px; border: 1px solid rgba(148,163,184,.34); opacity: 0; transition: opacity .2s, translate .2s; z-index: 200; pointer-events: none; box-shadow: 0 14px 36px rgba(0,0,0,0.42); }
#toast.show { opacity: 1; translate: 0 -4px; }
.canvas-kit-modal {
  position: fixed;
  display: grid;
  grid-template-rows: 42px 1fr;
  min-width: 420px;
  min-height: 320px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: hidden;
  resize: both;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.96);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}
.canvas-kit-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.94);
  cursor: grab;
  user-select: none;
}
.canvas-kit-modal-header:active { cursor: grabbing; }
.canvas-kit-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.canvas-kit-modal-title svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: rgba(196, 181, 253, 0.9);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.canvas-kit-modal-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}
.canvas-kit-modal-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
}
.canvas-kit-modal-close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.canvas-kit-modal-body {
  min-height: 0;
  position: relative;
}
@media (max-width: 950px) {
  #property-panel {
    left: 12px;
    right: 12px;
    top: 12px;
    width: auto;
    max-height: min(460px, calc(100% - 24px));
  }
  .toolbar { gap: 5px; }
  button, .file-btn { padding: 7px 8px; font-size: 12px; }
}
