.knowledge-map-page {
  --map-bg: #050911;
  --map-bg-2: #09121b;
  --map-panel: rgba(7, 14, 22, 0.78);
  --map-panel-strong: rgba(9, 18, 28, 0.9);
  --map-glass: rgba(8, 17, 26, 0.68);
  --map-line: rgba(190, 220, 224, 0.13);
  --map-line-strong: rgba(184, 228, 225, 0.24);
  --map-text: #edf6f4;
  --map-text-soft: rgba(237, 246, 244, 0.74);
  --map-muted: rgba(179, 205, 206, 0.48);
  --accent: #72f2c8;
  --accent-soft: rgba(114, 242, 200, 0.1);
  --accent-line: rgba(114, 242, 200, 0.34);
  min-height: 100svh;
  overflow: hidden;
  color: var(--map-text);
  background:
    radial-gradient(circle at 22% 16%, rgba(91, 217, 255, 0.12), transparent 28%),
    radial-gradient(circle at 88% 20%, rgba(184, 121, 255, 0.1), transparent 30%),
    radial-gradient(circle at 55% 88%, rgba(255, 202, 101, 0.07), transparent 36%),
    linear-gradient(135deg, #03060b 0%, #071019 48%, #04070d 100%);
}

.knowledge-map-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.36;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 76%);
}

.knowledge-map-shell {
  min-height: 100svh;
  color: var(--map-text);
}

.map-topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(18px, 2.8vw, 44px);
  border-bottom: 1px solid var(--map-line);
  background: rgba(4, 9, 15, 0.74);
  backdrop-filter: blur(22px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
}

.map-brand strong,
.map-brand small {
  display: block;
}

.map-brand strong {
  color: var(--map-text);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-shadow: 0 0 18px rgba(114, 242, 200, 0.18);
}

.map-brand small {
  margin-top: 6px;
  color: rgba(237, 246, 244, 0.5);
  font: 600 9px/1 var(--font-mono);
  letter-spacing: 0.18em;
}

.map-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(12px, 1.9vw, 30px);
  min-width: 0;
}

.map-nav a {
  position: relative;
  padding: 10px 0;
  color: rgba(237, 246, 244, 0.72);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.map-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 3px;
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), #8fb2ff);
  transform-origin: right;
  transition: width 180ms ease;
}

.map-nav a:hover,
.map-nav a:focus-visible {
  outline: none;
  color: var(--map-text);
}

.map-nav a:hover::after,
.map-nav a:focus-visible::after {
  width: 100%;
}

.map-workspace {
  position: relative;
  height: calc(100svh - 72px);
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(420px, 1fr) minmax(320px, 390px);
  gap: 1px;
  background: var(--map-line);
}

.map-command-panel,
.map-canvas-panel,
.map-detail-panel {
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(12, 23, 34, 0.9), rgba(5, 10, 16, 0.94)),
    var(--map-bg);
}

.map-command-panel,
.map-detail-panel {
  overflow: auto;
  padding: clamp(18px, 2.2vw, 30px);
  scrollbar-color: rgba(114, 242, 200, 0.48) rgba(7, 16, 20, 0.4);
}

.map-title-block span,
.map-search label,
.map-panel-heading small,
.map-stats span,
.detail-kicker,
.detail-meta,
.resource-kind,
.relation-tag,
.node-tag,
.detail-section > span {
  font-family: var(--font-mono);
}

.map-title-block span {
  display: block;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.map-title-block h1 {
  margin: 14px 0 0;
  color: var(--map-text);
  font-size: clamp(30px, 2.8vw, 46px);
  font-weight: 610;
  line-height: 1.12;
  letter-spacing: 0;
  text-shadow: 0 0 30px rgba(114, 242, 200, 0.08);
}

.map-title-block p {
  margin: 18px 0 0;
  color: var(--map-text-soft);
  font-size: 13px;
  line-height: 1.9;
}

.map-search {
  display: grid;
  gap: 10px;
  margin-top: 32px;
}

.map-search label {
  color: var(--map-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.map-search > div {
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border: 1px solid rgba(184, 228, 225, 0.18);
  background:
    linear-gradient(135deg, rgba(114, 242, 200, 0.06), transparent 46%),
    rgba(5, 11, 18, 0.72);
  box-shadow: inset 0 0 22px rgba(114, 242, 200, 0.035);
}

.map-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0 13px;
  color: var(--map-text);
  background: transparent;
  font-size: 13px;
}

.map-search input::placeholder {
  color: rgba(179, 205, 206, 0.42);
}

.map-search button,
.map-canvas-toolbar button,
.map-focus-exit {
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  color: var(--accent);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.12), transparent 32%),
    rgba(114, 242, 200, 0.1);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.map-search button {
  min-width: 58px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 760;
}

.map-search button:hover,
.map-search button:focus-visible,
.map-canvas-toolbar button:hover,
.map-canvas-toolbar button:focus-visible,
.map-focus-exit:hover,
.map-focus-exit:focus-visible {
  outline: none;
  border-color: var(--accent-line);
  background: rgba(114, 242, 200, 0.16);
  box-shadow: 0 0 22px rgba(114, 242, 200, 0.18);
  transform: translateY(-1px);
}

.map-filter-block {
  margin-top: 28px;
}

.map-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.map-panel-heading strong {
  color: var(--map-text-soft);
  font-size: 13px;
  font-weight: 700;
}

.map-panel-heading small {
  color: var(--map-muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.domain-filter-grid {
  display: grid;
  gap: 7px;
}

.domain-filter {
  min-height: 42px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 1px solid rgba(190, 220, 224, 0.12);
  color: rgba(237, 246, 244, 0.7);
  background: rgba(7, 14, 22, 0.46);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.domain-filter:hover,
.domain-filter:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--domain-color, var(--accent)) 48%, transparent);
  transform: translateX(2px);
}

.domain-filter i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--domain-color, var(--accent));
  box-shadow: 0 0 16px color-mix(in srgb, var(--domain-color, var(--accent)) 68%, transparent);
}

.domain-filter span {
  overflow: hidden;
  font-size: 13px;
  font-weight: 670;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.domain-filter b {
  color: var(--map-muted);
  font: 550 10px/1 var(--font-mono);
}

.domain-filter.is-active {
  border-color: color-mix(in srgb, var(--domain-color, var(--accent)) 62%, transparent);
  color: var(--map-text);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--domain-color, var(--accent)) 16%, transparent), transparent),
    rgba(7, 14, 22, 0.72);
  box-shadow: inset 0 0 24px color-mix(in srgb, var(--domain-color, var(--accent)) 12%, transparent);
}

.map-toggle-row {
  margin-top: 24px;
  padding: 15px 0;
  border-top: 1px solid var(--map-line);
  border-bottom: 1px solid var(--map-line);
}

.map-toggle-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--map-text-soft);
  font-size: 13px;
  font-weight: 670;
  cursor: pointer;
}

.map-toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.map-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 24px;
  border: 1px solid rgba(190, 220, 224, 0.12);
  background: rgba(114, 242, 200, 0.08);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
}

.map-stats div {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 12px;
  background: rgba(7, 14, 22, 0.76);
}

.map-stats span {
  color: var(--map-muted);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.map-stats strong {
  color: var(--accent);
  font: 560 24px/1 var(--font-mono);
  text-shadow: 0 0 16px rgba(114, 242, 200, 0.24);
}

.map-canvas-panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 45%, rgba(42, 72, 92, 0.22), transparent 45%),
    linear-gradient(145deg, #02060b 0%, #07101a 42%, #03070d 100%);
}

.map-canvas-panel::before,
.map-canvas-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.map-canvas-panel::before {
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(139, 197, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(114, 242, 200, 0.045) 1px, transparent 1px);
  background-size: 78px 78px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 82%);
}

.map-canvas-panel::after {
  opacity: 0.7;
  background:
    radial-gradient(circle at 18% 25%, rgba(103, 217, 255, 0.11), transparent 26%),
    radial-gradient(circle at 82% 24%, rgba(188, 118, 255, 0.09), transparent 28%),
    radial-gradient(circle at 42% 82%, rgba(255, 197, 91, 0.065), transparent 32%),
    radial-gradient(circle at 76% 78%, rgba(255, 116, 150, 0.055), transparent 30%);
  mix-blend-mode: screen;
}

.map-nebula-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-canvas-toolbar {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 7;
  display: flex;
  gap: 8px;
}

.map-canvas-toolbar button,
.map-focus-exit {
  width: 40px;
  height: 40px;
  border-color: rgba(190, 220, 224, 0.1);
  color: var(--accent);
  font: 680 18px/1 var(--font-mono);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.map-focus-exit {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 8;
  display: none;
  color: #ffd1da;
  background: rgba(255, 95, 130, 0.1);
}

.knowledge-graph {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

.knowledge-graph.is-panning,
.knowledge-graph.is-dragging {
  cursor: grabbing;
}

.domain-aura {
  fill: currentColor;
  opacity: 0.045;
  filter: url("#domainBlur");
}

.domain-ring {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-dasharray: 2 18;
  opacity: 0.2;
  vector-effect: non-scaling-stroke;
  animation: domainDrift 18s linear infinite;
}

.domain-halo {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1;
  stroke-dasharray: 9 16;
  opacity: 0.22;
  vector-effect: non-scaling-stroke;
}

.domain-label {
  fill: currentColor;
  font: 700 13px/1 var(--font-mono);
  letter-spacing: 0.08em;
  opacity: 0.78;
  text-shadow: 0 0 12px currentColor;
}

.graph-edge {
  pointer-events: none;
  transition: opacity 220ms ease;
}

.graph-edge path {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.edge-base {
  stroke: rgba(205, 230, 232, 0.13);
  stroke-width: 1.05;
  transition:
    stroke 180ms ease,
    stroke-width 180ms ease,
    opacity 180ms ease;
}

.edge-glow {
  stroke: var(--relation-color, var(--accent));
  stroke-width: 6;
  opacity: 0;
  filter: url("#edgeGlow");
  transition: opacity 180ms ease;
}

.edge-flow {
  stroke: var(--relation-color, var(--accent));
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 18 150;
  opacity: 0;
  filter: url("#edgeGlow");
  animation: edgeFlow 2.7s linear infinite;
}

.graph-edge.is-muted {
  opacity: 0.13;
}

.graph-edge.is-active .edge-base {
  stroke: color-mix(in srgb, var(--relation-color, var(--accent)) 74%, white);
  stroke-width: 1.6;
  opacity: 0.74;
}

.graph-edge.is-active .edge-glow {
  opacity: 0.34;
}

.graph-edge.is-active .edge-flow {
  opacity: 0.96;
}

.graph-edge.is-secondary .edge-base {
  stroke: var(--relation-color, rgba(237, 246, 244, 0.58));
  stroke-width: 1.2;
  opacity: 0.42;
}

.graph-edge.is-secondary .edge-flow {
  stroke-width: 1.4;
  opacity: 0.34;
}

.graph-node {
  cursor: pointer;
  transition:
    opacity 220ms ease,
    filter 220ms ease;
}

.graph-node.is-muted {
  opacity: 0.16;
  filter: saturate(0.42);
}

.graph-node.is-hidden,
.graph-edge.is-hidden,
.domain-group.is-hidden {
  display: none;
}

.node-aura {
  fill: var(--node-color, var(--accent));
  opacity: 0.08;
  filter: url("#nodeGlow");
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 180ms ease, transform 220ms ease;
}

.node-orbit,
.node-shape {
  transform-box: fill-box;
  transform-origin: center;
  transition:
    fill 180ms ease,
    stroke 180ms ease,
    stroke-width 180ms ease,
    opacity 180ms ease,
    transform 220ms ease,
    filter 220ms ease;
}

.node-orbit {
  fill: transparent;
  stroke: var(--node-color, var(--accent));
  stroke-width: 1.15;
  stroke-dasharray: 5 8;
  opacity: 0.42;
  vector-effect: non-scaling-stroke;
  animation: nodeOrbit 8s linear infinite;
}

.node-shape {
  fill: color-mix(in srgb, var(--node-color, var(--accent)) 7%, rgba(4, 10, 16, 0.92));
  stroke: color-mix(in srgb, var(--node-color, var(--accent)) 80%, white);
  stroke-width: 1.55;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.28));
  vector-effect: non-scaling-stroke;
}

.node-core {
  fill: color-mix(in srgb, var(--node-color, var(--accent)) 74%, white);
  opacity: 0.6;
  filter: url("#nodeGlow");
  transition: opacity 180ms ease, r 180ms ease;
}

.graph-node.is-selected .node-aura,
.graph-node.is-search-match .node-aura {
  opacity: 0.34;
  transform: scale(1.2);
  animation: selectedPulse 2.6s ease-in-out infinite;
}

.graph-node.is-selected .node-orbit,
.graph-node.is-search-match .node-orbit {
  stroke-width: 1.7;
  opacity: 0.9;
  stroke-dasharray: 10 6;
  filter: url("#nodeGlow");
}

.graph-node.is-selected .node-shape,
.graph-node.is-search-match .node-shape {
  fill: color-mix(in srgb, var(--node-color, var(--accent)) 18%, rgba(6, 14, 23, 0.94));
  stroke-width: 2.4;
  filter: url("#nodeGlow");
  transform: scale(1.08);
}

.graph-node.is-selected .node-core,
.graph-node.is-search-match .node-core {
  opacity: 1;
}

.graph-node.is-neighbor .node-aura {
  opacity: 0.18;
}

.graph-node.is-neighbor .node-shape {
  fill: color-mix(in srgb, var(--node-color, var(--accent)) 13%, rgba(6, 14, 23, 0.92));
  stroke-width: 1.9;
}

.node-title {
  fill: var(--map-text);
  font-size: 12px;
  font-weight: 720;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.node-type-mark {
  fill: rgba(237, 246, 244, 0.64);
  font: 700 8px/1 var(--font-mono);
  text-anchor: middle;
  pointer-events: none;
}

.node-hit {
  fill: transparent;
}

.graph-node[data-node-type="experiment"] .node-shape,
.graph-node[data-node-type="experiment"] .node-orbit {
  stroke-dasharray: 5 4;
}

.graph-node[data-node-type="pitfall"] .node-shape,
.graph-node[data-node-type="pitfall"] .node-orbit,
.graph-node[data-node-type="pitfall"] .node-core {
  stroke: #ff8fa5;
  fill: color-mix(in srgb, #ff8fa5 16%, rgba(6, 14, 23, 0.92));
}

.map-empty-state {
  position: absolute;
  inset: auto 24px 84px 24px;
  z-index: 8;
  display: grid;
  gap: 8px;
  max-width: 420px;
  padding: 16px;
  border: 1px solid rgba(255, 200, 87, 0.28);
  color: #f8df99;
  background: rgba(7, 16, 20, 0.88);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.32);
}

.map-empty-state[hidden] {
  display: none;
}

.map-empty-state strong,
.map-empty-state span {
  display: block;
}

.map-empty-state span {
  color: rgba(248, 223, 153, 0.72);
  font-size: 12px;
}

.map-legend {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 7;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  max-width: min(560px, calc(100% - 36px));
  padding: 10px 12px;
  border: 1px solid rgba(190, 220, 224, 0.12);
  background: rgba(4, 9, 15, 0.66);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(237, 246, 244, 0.66);
  font-size: 11px;
  font-weight: 670;
}

.legend-shape {
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--accent);
  background: rgba(114, 242, 200, 0.08);
  box-shadow: 0 0 12px rgba(114, 242, 200, 0.18);
}

.legend-shape.is-method {
  border-radius: 50%;
}

.legend-shape.is-model {
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}

.legend-shape.is-question {
  transform: rotate(45deg) scale(0.82);
}

.legend-shape.is-experiment {
  border-style: dashed;
}

.legend-shape.is-pitfall {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  border: 0;
  background: #ff8fa5;
}

.detail-empty {
  display: grid;
  align-content: center;
  min-height: 360px;
}

.detail-empty span {
  color: var(--accent);
  font: 700 10px/1 var(--font-mono);
  letter-spacing: 0.16em;
}

.detail-empty h2 {
  margin: 14px 0 0;
  color: var(--map-text);
  font-size: 34px;
  font-weight: 610;
  line-height: 1.12;
}

.detail-empty p {
  margin: 14px 0 0;
  color: var(--map-text-soft);
  font-size: 13px;
}

.detail-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.detail-kicker b {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  background: var(--node-color, var(--accent));
  box-shadow: 0 0 16px var(--node-color, var(--accent));
}

.map-detail-panel h2 {
  margin: 16px 0 0;
  color: var(--map-text);
  font-size: clamp(30px, 2.4vw, 42px);
  font-weight: 610;
  line-height: 1.12;
  letter-spacing: 0;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.detail-meta span {
  padding: 6px 8px;
  border: 1px solid rgba(190, 220, 224, 0.12);
  color: rgba(237, 246, 244, 0.62);
  background: rgba(7, 14, 22, 0.48);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.detail-summary {
  margin: 18px 0 0;
  color: rgba(237, 246, 244, 0.74);
  font-size: 14px;
  line-height: 1.9;
}

.detail-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--map-line);
}

.detail-section > span {
  display: block;
  margin-bottom: 12px;
  color: var(--map-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.node-tags,
.detail-list,
.resource-list,
.relation-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.node-tags {
  display: flex;
  flex-wrap: wrap;
}

.node-tag {
  padding: 6px 8px;
  color: var(--accent);
  background: rgba(114, 242, 200, 0.08);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.detail-list li {
  position: relative;
  padding-left: 16px;
  color: rgba(237, 246, 244, 0.74);
  font-size: 13px;
  line-height: 1.7;
}

.detail-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 5px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(114, 242, 200, 0.38);
}

.relation-list button {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(190, 220, 224, 0.12);
  color: var(--map-text-soft);
  background: rgba(7, 14, 22, 0.48);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.relation-list button:hover,
.relation-list button:focus-visible {
  outline: none;
  border-color: var(--accent-line);
  color: var(--map-text);
  background: rgba(114, 242, 200, 0.08);
  transform: translateX(2px);
}

.relation-tag {
  min-width: 54px;
  padding: 5px 6px;
  color: var(--relation-color, var(--accent));
  background: color-mix(in srgb, var(--relation-color, var(--accent)) 12%, transparent);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-align: center;
}

.relation-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 670;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.resource-list a {
  min-height: 60px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(190, 220, 224, 0.12);
  color: var(--map-text);
  background: rgba(7, 14, 22, 0.48);
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.resource-list a:hover,
.resource-list a:focus-visible {
  outline: none;
  border-color: var(--accent-line);
  background: rgba(114, 242, 200, 0.08);
  transform: translateX(2px);
}

.resource-kind {
  min-width: 58px;
  padding: 7px 8px;
  color: var(--accent);
  background: rgba(114, 242, 200, 0.08);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-align: center;
}

.resource-copy {
  min-width: 0;
}

.resource-copy strong,
.resource-copy small {
  display: block;
}

.resource-copy strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.resource-copy small {
  margin-top: 5px;
  color: var(--map-muted);
  font-size: 11px;
  line-height: 1.5;
}

.knowledge-map-shell.is-focus-mode .map-workspace {
  display: block;
  background: #02060b;
}

.knowledge-map-shell.is-focus-mode .map-canvas-panel {
  position: absolute;
  inset: 0;
}

.knowledge-map-shell.is-focus-mode .map-canvas-panel::before {
  opacity: 0.36;
  background-size: 96px 96px;
}

.knowledge-map-shell.is-focus-mode .map-canvas-toolbar {
  right: 68px;
  z-index: 11;
}

.knowledge-map-shell.is-focus-mode .map-focus-exit {
  display: inline-grid;
  z-index: 12;
}

.knowledge-map-shell.is-focus-mode .map-command-panel,
.knowledge-map-shell.is-focus-mode .map-detail-panel {
  position: absolute;
  z-index: 9;
  border: 1px solid rgba(190, 220, 224, 0.16);
  background:
    linear-gradient(180deg, rgba(12, 25, 36, 0.74), rgba(4, 10, 17, 0.78)),
    var(--map-glass);
  backdrop-filter: blur(22px);
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.42),
    inset 0 0 28px rgba(114, 242, 200, 0.035);
  transition:
    opacity 220ms ease,
    transform 260ms ease,
    border-color 220ms ease;
}

.knowledge-map-shell.is-focus-mode .map-command-panel {
  top: 18px;
  left: 18px;
  width: min(300px, calc(100% - 36px));
  max-height: calc(100% - 36px);
  transform: translateX(calc(-100% + 52px));
  opacity: 0.48;
}

.knowledge-map-shell.is-focus-mode .map-command-panel:hover,
.knowledge-map-shell.is-focus-mode .map-command-panel:focus-within {
  transform: translateX(0);
  opacity: 1;
  border-color: rgba(114, 242, 200, 0.32);
}

.knowledge-map-shell.is-focus-mode .map-detail-panel {
  top: 78px;
  right: 18px;
  bottom: 18px;
  width: min(390px, calc(100% - 36px));
  opacity: 0.92;
}

.knowledge-map-shell.is-focus-mode .map-detail-panel:hover,
.knowledge-map-shell.is-focus-mode .map-detail-panel:focus-within {
  opacity: 1;
  border-color: rgba(114, 242, 200, 0.28);
}

.knowledge-map-shell.is-focus-mode .map-legend {
  background: rgba(4, 9, 15, 0.46);
}

.knowledge-map-shell.is-focus-mode .graph-node.is-selected .node-aura {
  opacity: 0.48;
}

.knowledge-map-shell.is-focus-mode .graph-node.is-selected .node-title {
  font-size: 13px;
}

@keyframes edgeFlow {
  from {
    stroke-dashoffset: 168;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes nodeOrbit {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -78;
  }
}

@keyframes selectedPulse {
  0%,
  100% {
    transform: scale(1.08);
    opacity: 0.26;
  }
  50% {
    transform: scale(1.26);
    opacity: 0.44;
  }
}

@keyframes domainDrift {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -220;
  }
}

@media (max-width: 1180px) {
  .map-workspace {
    grid-template-columns: minmax(230px, 270px) minmax(360px, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .map-detail-panel {
    grid-column: 1 / -1;
    max-height: 34svh;
    border-top: 1px solid var(--map-line);
  }

  .map-detail-panel h2 {
    font-size: 30px;
  }

  .knowledge-map-shell.is-focus-mode .map-detail-panel {
    top: 72px;
  }
}

@media (max-width: 860px) {
  .knowledge-map-page {
    overflow: auto;
  }

  .map-topbar {
    height: auto;
    min-height: 72px;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 18px;
  }

  .map-nav {
    width: 100%;
    justify-content: flex-start;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .map-nav a {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .map-search input {
    min-height: 36px;
  }

  .map-toggle-row input {
    width: 22px;
    height: 22px;
  }

  .map-workspace {
    height: auto;
    min-height: calc(100svh - 72px);
    grid-template-columns: 1fr;
    grid-template-rows: auto 68svh auto;
  }

  .map-command-panel,
  .map-detail-panel {
    max-height: none;
    overflow: visible;
  }

  .map-canvas-toolbar {
    top: 12px;
    right: 12px;
  }

  .map-canvas-toolbar button,
  .map-focus-exit {
    width: 36px;
    height: 36px;
  }

  .map-focus-exit {
    top: 12px;
    right: 12px;
  }

  .map-legend {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }

  .map-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .knowledge-map-shell.is-focus-mode .map-workspace {
    height: calc(100svh - 114px);
    min-height: 620px;
  }

  .knowledge-map-shell.is-focus-mode .map-canvas-toolbar {
    right: 56px;
  }

  .knowledge-map-shell.is-focus-mode .map-command-panel {
    display: none;
  }

  .knowledge-map-shell.is-focus-mode .map-detail-panel {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    width: auto;
    max-height: 34svh;
    overflow: auto;
  }
}

@media (max-width: 520px) {
  .map-title-block h1 {
    font-size: 30px;
  }

  .map-search > div {
    grid-template-columns: 1fr;
  }

  .map-search button {
    min-height: 38px;
    border-top-color: var(--map-line);
  }

  .map-stats div {
    padding: 10px 8px;
  }

  .resource-list a,
  .relation-list button {
    grid-template-columns: 1fr;
  }

  .resource-kind,
  .relation-tag {
    width: max-content;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-nav a::after,
  .map-search button,
  .map-canvas-toolbar button,
  .map-focus-exit,
  .domain-filter,
  .relation-list button,
  .resource-list a,
  .graph-edge,
  .graph-edge path,
  .graph-node,
  .node-aura,
  .node-orbit,
  .node-shape {
    transition: none;
  }

  .domain-ring,
  .edge-flow,
  .node-orbit,
  .graph-node.is-selected .node-aura,
  .graph-node.is-search-match .node-aura {
    animation: none;
  }
}
