.topic-toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 14px;
}
.topic-toolbar label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}
.topic-toolbar select {
  width: min(100%, 360px);
  min-width: 0;
}
.topic-toolbar button { padding: 9px 14px; }
.topic-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 20px 0 10px;
  color: var(--muted);
  font-size: 11px;
}
.topic-legend i {
  display: inline-block;
  width: 20px;
  margin-inline-end: 5px;
  vertical-align: middle;
  border-top: 2px solid #B9A4FF;
}
.topic-legend span:nth-child(2) i { border-top: 2px dashed #82DCCB; }
#topic-count { margin-inline-start: auto; }
.topic-viewport {
  overflow: auto;
  max-height: min(78vh, 820px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: radial-gradient(ellipse at 50% 35%, #10232d, #0c151f 76%);
  scrollbar-width: thin;
}
#topic-graph { width: 100%; min-width: var(--graph-min-width); height: auto; }
.topic-node { cursor: grab; touch-action: none; user-select: none; }
.topic-node.dragging { cursor: grabbing; opacity: 1; }
.topic-node-core { fill: #111d29; stroke: currentColor; stroke-width: 1.5; }
.topic-node.external .topic-node-core { stroke-opacity: .65; }
.topic-node-halo { fill: currentColor; opacity: .07; pointer-events: none; }
.topic-node-hit { fill: transparent; }
.topic-node-label, .topic-node-section { text-anchor: middle; }
.topic-node-label {
  fill: #e9eef8;
  font-size: 12px;
  font-weight: 550;
  paint-order: stroke;
  stroke: #0c151f;
  stroke-width: 3px;
  stroke-linejoin: round;
}
.topic-node-section { fill: currentColor; opacity: .72; font-size: 10px; }
.topic-node.muted { opacity: .38; }
.topic-node:hover, .topic-node:focus { opacity: 1; outline: none; }
.topic-node:hover .topic-node-core,
.topic-node:focus .topic-node-core,
.topic-node.selected .topic-node-core,
.topic-node.dragging .topic-node-core { stroke-width: 2.5; stroke-opacity: 1; fill: #223944; }
.topic-node.selected .topic-node-halo,
.topic-node.dragging .topic-node-halo { opacity: .23; }
.topic-node.selected .topic-node-label { fill: currentColor; }
.topic-edge { fill: none; stroke: #B9A4FF; stroke-width: 1.25; opacity: .45; pointer-events: none; }
.topic-edge.cross { stroke: #82DCCB; stroke-dasharray: 4 4; opacity: .32; }
.topic-edge.dim { opacity: .07; }
.topic-edge.active { opacity: .95; stroke-width: 2; }
#topic-motion[aria-pressed="true"] {
  color: #82DCCB;
  border-color: #82DCCB80;
}
.topic-edge-pulse {
  fill: none;
  stroke: #fff2c7;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 2 3 1 94;
  filter: drop-shadow(0 0 4px #82DCCB);
  opacity: 0;
  pointer-events: none;
  animation: topic-current 2.8s linear infinite paused;
}
.topic-motion-running .topic-edge-pulse {
  opacity: .95;
  animation-play-state: running;
}
@keyframes topic-current {
  from { stroke-dashoffset: 7; }
  to { stroke-dashoffset: -93; }
}
.topic-detail { margin-top: 16px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; }
.topic-detail p { color: var(--muted); font-size: 13px; }
.topic-detail h3 { margin: 5px 0 9px; }
.topic-detail .topic-source { font-size: 11px; color: var(--purple); }
.topic-detail-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.topic-detail h4 { margin-bottom: 6px; }
.topic-detail ul { margin: 0; padding-inline-start: 18px; font-size: 13px; }
.topic-detail li + li { margin-top: 8px; }
.topic-detail button {
  padding: 0;
  background: transparent;
  color: var(--purple);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (max-width: 720px) {
  .topic-toolbar label { width: 100%; }
  .topic-toolbar select { width: 100%; }
  .topic-detail-columns { grid-template-columns: 1fr; gap: 2px; }
  .topic-viewport { max-height: 440px; }
}
@media print {
  .topic-toolbar { display: none; }
  .topic-edge-pulse { display: none; }
  .topic-viewport { max-height: none; }
  #topic-graph { min-width: 0; }
}
