/* Edges */
.edge { fill: none; stroke: var(--edge-color); stroke-width: 2; stroke-linecap: round; }
.edge-dnd { fill: none; stroke: var(--green); stroke-width: 2; stroke-dasharray: 5,3; }

/* Nodes */
.node-group { cursor: pointer; }
.node-rect {
  transition: filter 0.1s;
}
.node-group.root .node-rect { fill: var(--node-root-fill); stroke: var(--accent); stroke-width: 2; }
.node-group.l1 .node-rect   { fill: var(--node-l1-fill);   stroke: var(--node-l1-stroke); stroke-width: 1.5; }
.node-group.leaf .node-rect { fill: var(--node-leaf-fill);  stroke: var(--node-leaf-stroke); stroke-width: 1; }

.node-group.selected .node-rect { stroke: var(--node-sel-stroke) !important; stroke-width: 2.5 !important; }
.node-group.dragging { opacity: 0.85; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5)); }

/* リサイズハンドル（右下角・選択中のみ表示） */
.node-resize-handle {
  fill: var(--node-sel-stroke);
  stroke: var(--bg2);
  stroke-width: 1.5;
  opacity: 0;
  pointer-events: none;
  cursor: nwse-resize;
  transition: opacity 0.1s;
}
.node-group.selected .node-resize-handle {
  opacity: 0.9;
  pointer-events: auto;
}
.node-group.selected .node-resize-handle:hover { opacity: 1; }

/* フラットテーマ：ノード角丸を縮小し、ドラッグ影を除去 */
[data-theme="flat"] .node-rect { rx: 3px; }
[data-theme="flat"] .boundary-rect { rx: 4px; }
[data-theme="flat"] .node-group.dragging { filter: none; }
.node-group.ghost .node-rect { fill: none; stroke: var(--border); stroke-dasharray: 4,3; }

.node-text {
  fill: var(--text); font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  pointer-events: none; user-select: none;
}
.node-group.root .node-text { fill: #fff; font-weight: 600; font-size: 13px; }
.node-group.l1   .node-text { fill: var(--text); }

/* Drop indicators */
.drop-target-rect { fill: none; stroke: var(--green); stroke-width: 2.5; }
.drop-line { stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; }
.drop-dot  { fill: var(--green); }
/* 境界線内ドロップ時のハイライト */
.drop-boundary-highlight {
  fill: color-mix(in srgb, var(--green) 12%, transparent);
  stroke: var(--green); stroke-width: 2.5; stroke-dasharray: none;
}
/* サマリー内ドロップ時のブラケットハイライト */
.drop-summary-highlight {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* 境界線内ドロップ時のドロップライン（緑・実線） */
.drop-line-boundary {
  stroke: var(--green); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 6, 3;
}

/* Canvas panning cursor */
#mindmap-svg.panning { cursor: grabbing; }

/* ── 関連線 ── */
.relation-hit {
  fill: none; stroke: transparent; stroke-width: 14;
  cursor: pointer;
}
.relation-path {
  fill: none;
  /* accent と text-sub を混ぜた落ち着いたトーン。ノード枠線より目立たない */
  stroke: color-mix(in srgb, var(--accent) 55%, var(--text-sub) 45%);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 6 4;
  pointer-events: none;
}
.relation-path.selected {
  stroke-width: 2;
  stroke: color-mix(in srgb, var(--accent) 75%, var(--text-sub) 25%);
  stroke-dasharray: 6 4;
}
.relation-handle-line {
  stroke: color-mix(in srgb, var(--accent) 55%, var(--text-sub) 45%);
  stroke-width: 1; stroke-dasharray: 4, 3; opacity: 0.55;
  pointer-events: none;
}
.relation-handle {
  fill: var(--bg2);
  stroke: color-mix(in srgb, var(--accent) 55%, var(--text-sub) 45%);
  stroke-width: 1.5; cursor: grab;
}
.relation-handle:hover {
  fill: color-mix(in srgb, var(--accent) 55%, var(--text-sub) 45%);
}
.relation-handle:active { cursor: grabbing; }
.relation-label {
  fill: var(--text); font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  pointer-events: none; user-select: none;
}
/* 関連線モード時：接続先候補ノードのハイライト */
#mindmap-svg.relation-selecting .node-group:hover .node-rect {
  stroke: var(--green) !important; stroke-width: 2.5 !important;
}

/* ラッソ選択 */
.lasso-rect {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
  stroke: var(--accent); stroke-width: 1.5;
  stroke-dasharray: 5, 3;
  pointer-events: none;
}

/* 折りたたみトグルボタン */
.node-toggle { cursor: pointer; }
.toggle-circle {
  fill: var(--bg2); stroke: var(--accent); stroke-width: 1.5;
  transition: fill 0.15s;
}
.node-toggle:hover .toggle-circle { fill: var(--accent); }
.toggle-label {
  fill: var(--accent); font-size: 9px; font-weight: bold;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
  pointer-events: none; user-select: none;
}
.node-toggle:hover .toggle-label { fill: #fff; }

/* アイコン */
.node-icon {
  font-size: 14px;
  pointer-events: none; user-select: none;
}

/* リンクバッジ */
.node-link-badge { cursor: pointer; }
.link-badge-rect { fill: var(--accent); opacity: 0.85; }
.node-link-badge:hover .link-badge-rect { opacity: 1; }
.link-badge-text {
  fill: #fff; font-size: 9px; font-weight: bold;
  pointer-events: none; user-select: none;
}

/* ── サマリー括弧 ── */
.summary-bracket {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── 境界線 ── */
.boundary-rect {
  fill: color-mix(in srgb, var(--accent) 7%, transparent);
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 7, 4;
  cursor: pointer;
}
.boundary-rect:hover {
  fill: color-mix(in srgb, var(--accent) 13%, transparent);
  stroke-width: 2;
}
.boundary-label {
  fill: var(--accent);
  font-size: 11px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  pointer-events: none;
  user-select: none;
}
