/* ===== Design tokens ===== */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --border: #dde1e6;
  --text: #1c2128;
  --text-muted: #6b7280;
  --accent: #4f6df5;
  --accent-contrast: #ffffff;
  --danger: #e0553f;
  --node-fill: #eef2ff;
  --node-stroke: #4f6df5;
  --bubble-fill: #e3e3e9;
  --bubble-stroke: #8b8b96;
  --edge-color: #5b6472;
  --grid-dot: #d8dce2;
  --shadow: 0 2px 10px rgba(20, 24, 33, 0.08);
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161c;
    --surface: #1b1e26;
    --surface-2: #21242e;
    --border: #2d313d;
    --text: #e7e9ee;
    --text-muted: #9099a8;
    --accent: #7c93ff;
    --accent-contrast: #10121a;
    --danger: #ff7a63;
    --node-fill: #232a44;
    --node-stroke: #7c93ff;
    --bubble-fill: #383a44;
    --bubble-stroke: #7c7c8a;
    --edge-color: #a7afc0;
    --grid-dot: #2a2e3a;
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #14161c;
  --surface: #1b1e26;
  --surface-2: #21242e;
  --border: #2d313d;
  --text: #e7e9ee;
  --text-muted: #9099a8;
  --accent: #7c93ff;
  --accent-contrast: #10121a;
  --danger: #ff7a63;
  --node-fill: #232a44;
  --node-stroke: #7c93ff;
  --bubble-fill: #383a44;
  --bubble-stroke: #7c7c8a;
  --edge-color: #a7afc0;
  --grid-dot: #2a2e3a;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Top bar ===== */
#topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  z-index: 20;
}
.brand {
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.title-input {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: var(--radius);
  min-width: 120px;
  max-width: 320px;
}
.title-input:hover { border-color: var(--border); }
.title-input:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
.spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ===== Tab bar — 한 창에서 여러 지도를 열어두고 전환 ===== */
#tabbar {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 8px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px 7px 12px;
  max-width: 200px;
  border-radius: 8px 8px 0 0;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}
.tab:hover { background: var(--surface); color: var(--text); }
.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}
.tab-rename-input {
  width: 120px;
  max-width: 40vw;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1px 4px;
  outline: none;
}
.tab-close, .tab-duplicate {
  border: none;
  background: none;
  color: inherit;
  opacity: 0.55;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  flex: 0 0 auto;
}
.tab-duplicate { font-size: 11px; }
.tab-close:hover { opacity: 1; background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.tab-duplicate:hover { opacity: 1; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.tab-add {
  flex: 0 0 auto;
  align-self: center;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  margin: 0 4px;
}
.tab-add:hover { background: var(--surface); color: var(--text); }

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 32px; height: 32px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 170px;
  overflow: hidden;
  z-index: 30;
}
.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.dropdown-menu button:hover { background: var(--surface-2); }

.archetype-menu {
  min-width: 300px;
  max-width: 360px;
  max-height: 70vh;
  overflow-y: auto;
}
.archetype-menu button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: normal;
}
.archetype-menu button:last-child { border-bottom: none; }
.archetype-name-row { display: flex; align-items: center; gap: 6px; }
.archetype-menu .archetype-name { font-weight: 600; font-size: 13px; }
.archetype-menu .archetype-subtitle { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }
.archetype-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}
.archetype-menu button.archetype-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.archetype-menu button.archetype-disabled:hover { background: none; }

/* ===== Body layout ===== */
#body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  /* 모바일 #propsPanel의 position:absolute가 뷰포트가 아니라 여기(상단바·탭바
     아래)를 기준으로 배치되도록 포지셔닝 컨텍스트를 만든다. */
  position: relative;
}

/* ===== Left toolbar ===== */
#toolbar {
  flex: 0 0 84px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  overflow-y: auto;
}
.tool-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.tool-group:last-child { border-bottom: none; }
.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 7px 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10.5px;
  width: 100%;
}
.tool-btn svg {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tool-btn[data-tool="rect"] svg, .tool-btn[data-tool="circle"] svg, .tool-btn[data-tool="diamond"] svg, .tool-btn[data-tool="bubble"] svg {
  fill: currentColor;
  stroke: none;
}
.tool-btn:hover { background: var(--surface-2); color: var(--text); }
.tool-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
}
.tool-btn.small {
  width: auto;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 600;
}
.zoom-group {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
}
#zoomLabel { font-size: 11px; color: var(--text-muted); width: 100%; text-align: center; order: 3; }

/* ===== Canvas ===== */
#canvasWrap {
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
#canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: default;
}
#canvas.panning { cursor: grabbing; }
#canvas.tool-connect { cursor: crosshair; }
#canvas.tool-add { cursor: copy; }

.grid-dot { fill: var(--grid-dot); }
.arrow-fill { fill: var(--edge-color); }

#emptyHint {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-muted);
  pointer-events: none;
  max-width: 420px;
  font-size: 13px;
  line-height: 1.6;
}
#emptyHint p:first-child { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
#emptyHint.hidden { display: none; }

/* SVG element styling */
.node-shape {
  stroke-width: 2;
  cursor: move;
}
.node.selected .node-shape {
  stroke: var(--accent);
  stroke-width: 2.5;
}
.node-label {
  font-size: 13px;
  fill: var(--text);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  user-select: none;
  font-family: inherit;
}
.node.connect-pending .node-shape {
  stroke: var(--danger);
  stroke-dasharray: 5 3;
}
.resize-handle {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 1.5;
  cursor: nwse-resize;
}
/* 텍스트·루프 노드의 폭 전용 손잡이(오른쪽 가장자리 세로 막대) — 높이는
   줄바꿈에 맞춰 자동으로 정해지므로 폭만 조절한다는 뜻에서 좌우 커서로 구분 */
.resize-handle-h {
  cursor: ew-resize;
}
/* 텍스트·루프 노드의 투명 히트 영역 (클릭·드래그·연결을 받기 위함) */
.node-hit { cursor: move; }
/* 텍스트·루프 노드: 배경 도형이 없어 selection 표시를 위한 점선 박스 */
.text-select-box {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  pointer-events: none;
}
.node-label.loop-label {
  font-size: 15px;
  font-weight: 700;
}

/* ---- PT 모드: 발표 중 클릭한 노드를 강조하고 그 노드에서 나가는 연결선을 깜박여
   보여준다. 더블클릭하면 이어진 이웃 노드도 (더 옅은 강조로) 함께 표시된다. ---- */
#btnPtMode[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}
/* 발표 중엔 도구 모음이 필요 없어 숨기고, 그만큼 캔버스가 넓어짐(#toolbar가
   flex 아이템이라 display:none이면 #canvasWrap의 flex:1이 자동으로 채움).
   속성 패널은 JS의 updatePanel()이 ptMode일 때 아예 열지 않도록 막아 여기서는
   따로 숨길 필요가 없다. */
.pt-mode #toolbar { display: none; }
.node.pt-highlight .node-shape {
  stroke: var(--accent);
  stroke-width: 4;
  filter: drop-shadow(0 0 6px var(--accent));
}
.node.pt-highlight .node-label {
  filter: drop-shadow(0 0 4px var(--accent));
}
.node.pt-highlight-neighbor .node-shape {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-dasharray: 6 3;
}
.node.pt-highlight-neighbor .node-label {
  font-weight: 700;
}
.edge.pt-blink {
  animation: pt-blink 0.9s ease-in-out infinite;
}
@keyframes pt-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

.edge-line {
  stroke: var(--edge-color);
  stroke-width: 2;
  fill: none;
}
.edge-hit {
  stroke: #000;
  opacity: 0;
  stroke-width: 14;
  fill: none;
  cursor: pointer;
  pointer-events: stroke;
}
.edge.selected .edge-line {
  stroke: var(--accent);
  stroke-width: 2.5;
}
.edge-label-bg {
  fill: var(--bg);
  opacity: 0.92;
}
.edge-label {
  font-size: 11.5px;
  fill: var(--text);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  user-select: none;
}
/* 인과 지도 표기: 지연 표시(=)와 극성 표시(+/-) */
.edge-delay-mark {
  stroke: var(--edge-color);
  stroke-width: 2;
}
.edge-polarity {
  font-size: 13px;
  font-weight: 700;
  fill: var(--edge-color);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  user-select: none;
}
.bend-handle {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 1.5;
  cursor: grab;
}
.bend-handle:active { cursor: grabbing; }
/* Shift+드래그 다중 선택 영역 */
.marquee-rect {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

.group-outline {
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  pointer-events: none;
}
/* 말풍선 꼬리: 화살표 대신 점점 커지는 점들로 잇는 연결선 */
.edge-bubble-dot {
  fill: var(--text-muted);
}
.pending-line {
  stroke: var(--danger);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  fill: none;
  pointer-events: none;
}

/* Inline edit overlay */
.edit-input {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  text-align: center;
  padding: 2px 4px;
  z-index: 40;
  font-family: inherit;
}

/* ===== Properties panel ===== */
#propsPanel {
  flex: 0 0 260px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.panel-header h3 { margin: 0; font-size: 13px; }
.panel-body { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.field input[type="text"], .field input[type="number"], .field select, .field textarea {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
}
.field input[type="color"] {
  width: 100%;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  padding: 2px;
  cursor: pointer;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.danger-btn {
  border: 1px solid var(--danger);
  color: var(--danger);
  background: none;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.danger-btn:hover { background: var(--danger); color: white; }

.panel-section-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0;
}
.align-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.align-grid-2 { grid-template-columns: 1fr 1fr; }
.align-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 4px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.align-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* ===== 문장으로 다이어그램 만들기 (모달) ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 18, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
/* display:flex 위 규칙이 같은 우선순위인 브라우저 기본 [hidden]{display:none}보다
   나중에 와서 이겨버리므로, hidden 속성이 있을 때는 명시적으로 다시 숨긴다. */
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(560px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 14px; }
.modal-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
.modal-hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin: 0; }
.modal-hint b { color: var(--text); }
.modal-error { color: var(--danger); }
#textDiagramInput {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
}
#textDiagramInput:focus { outline: none; border-color: var(--accent); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* ===== Status bar ===== */
#statusbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 6px 14px;
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

/* Scrollbars (webkit) */
#toolbar::-webkit-scrollbar, #propsPanel::-webkit-scrollbar { width: 8px; }
#toolbar::-webkit-scrollbar-thumb, #propsPanel::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 4px;
}

@media (max-width: 720px) {
  /* 좁은 화면에서는 상단바를 두 줄로 접는다: 1줄 = 아이콘+제목, 2줄 = 동작 버튼들
     (.spacer를 강제로 줄바꿈시켜 그 뒤의 topbar-actions가 다음 줄로 밀려나게 함). */
  #topbar { flex-wrap: wrap; row-gap: 6px; padding: 6px 10px; gap: 8px; }
  .brand span { display: none; }
  .title-input { flex: 1 1 auto; min-width: 60px; max-width: none; }
  .spacer { flex-basis: 100%; height: 0; }
  .topbar-actions { flex-wrap: wrap; gap: 6px; }
  .btn { padding: 6px 9px; font-size: 12.5px; }

  /* 탭이 여러 개면 가로로 넘치므로 옆으로 스크롤 — 각 탭은 손가락으로 짚기
     편한 최소 너비를 유지하고, 줄바꿈 없이 한 줄로만 흐르게 한다. */
  #tabbar { padding: 0 4px; }
  .tab { max-width: 130px; padding: 8px 6px 8px 10px; }
  .tab-label { font-size: 12px; }
  .tab-rename-input { font-size: 12px; width: 90px; }

  #toolbar { flex-basis: 64px; }
  .tool-btn span { display: none; }
  .tool-btn { padding: 10px 4px; } /* 터치하기 편하도록 세로 여백을 넉넉히 */

  #propsPanel {
    position: absolute; right: 0; top: 0; bottom: 0;
    width: min(85vw, 300px);
    box-shadow: var(--shadow);
    z-index: 25;
  }

  /* 하단 힌트 문구가 길어 여러 줄로 접히며 캔버스 영역을 잡아먹지 않도록
     한 줄로 자르고 넘치는 부분은 말줄임표로 표시한다. */
  #statusbar { gap: 10px; }
  #hint {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #counts { flex: 0 0 auto; white-space: nowrap; }

  .modal-overlay { padding: 10px; }
  .modal-box { max-height: 90vh; }
}

/* ---- 노드 태그 ----------------------------------------------------------------------------
   속성 패널에서 추가·삭제하는 UI(.tag-editor 이하)와, 노드를 선택했을 때만 캔버스에 뜨는
   칩(.tag-chip, SVG)은 서로 다른 마크업(HTML span vs SVG g)이라 클래스 이름을 겹치지 않게
   나눴다. */
.tag-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 4px 2px 10px;
  font-size: 12px;
  color: var(--text);
}
.tag-pill-remove {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 50%;
  cursor: pointer;
}
.tag-pill-remove:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.tag-add-input {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
}

/* 캔버스: 노드를 선택했을 때만 위에 뜨는 태그 칩(SVG). 칩을 누르면 같은 태그를 가진
   다른 노드들이 tag-highlight로 강조된다. */
.tag-chip { cursor: pointer; }
.tag-chip-bg {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1.5;
}
.tag-chip-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.tag-chip:hover .tag-chip-bg { stroke: var(--accent); }
.tag-chip.active .tag-chip-bg { fill: var(--accent); stroke: var(--accent); }
.tag-chip.active .tag-chip-label { fill: var(--accent-contrast); }

/* 태그로 강조된 노드 — PT 모드(파란 글로우)·선택(파란 테두리)과 헷갈리지 않도록
   따로 호박색 계열을 씀 */
.node.tag-highlight .node-shape {
  stroke: #d98c00;
  stroke-width: 3;
  filter: drop-shadow(0 0 5px #d98c00);
}
.node.tag-highlight .node-label {
  filter: drop-shadow(0 0 3px #d98c00);
}
