:root {
  --bg: #08100f;
  --panel: rgba(14, 27, 25, 0.86);
  --panel-strong: rgba(18, 34, 31, 0.96);
  --line: rgba(188, 230, 222, 0.14);
  --muted: rgba(226, 244, 240, 0.62);
  --text: #edf9f6;
  --accent: #55d6be;
  --accent-strong: #8bf4df;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 8%, rgba(85, 214, 190, 0.15), transparent 34%),
    radial-gradient(circle at 88% 0%, rgba(167, 139, 250, 0.11), transparent 30%),
    linear-gradient(180deg, #0b1513 0%, #07100f 58%, #050b0a 100%);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.semantic-map-shell {
  width: min(1580px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 42px;
}

.semantic-map-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 22px;
}

.semantic-map-back {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.semantic-map-back:hover {
  color: var(--accent-strong);
}

.semantic-map-kicker {
  margin: 28px 0 8px;
  color: var(--accent);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.semantic-map-header h1 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(31px, 4.2vw, 58px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.semantic-map-intro {
  max-width: 760px;
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.semantic-map-plain-intro {
  max-width: 760px;
  margin: 12px 0 0;
  padding: 11px 13px;
  border: 1px solid rgba(85, 214, 190, 0.24);
  border-radius: 8px;
  color: rgba(237, 249, 246, 0.9);
  background: rgba(85, 214, 190, 0.08);
  font-size: 14px;
  line-height: 1.7;
}

.semantic-map-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  min-width: 330px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 31, 28, 0.65);
  box-shadow: var(--shadow);
}

.semantic-map-stats span {
  padding: 15px 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
}

.semantic-map-stats span + span {
  border-left: 1px solid var(--line);
}

.semantic-map-stats strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 22px;
}

.semantic-map-toolbar {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) repeat(5, minmax(124px, 0.52fr)) minmax(210px, 0.72fr) repeat(2, minmax(110px, auto));
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.semantic-map-toolbar label,
.semantic-filter__button {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 42px;
  padding: 0 13px;
  border: 1px solid rgba(214, 246, 239, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.semantic-map-toolbar label span,
.semantic-filter__button span {
  flex: 0 0 auto;
  margin-right: 10px;
  color: rgba(226, 244, 240, 0.48);
  font-size: 11px;
}

.semantic-map-toolbar input,
.semantic-map-toolbar select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.semantic-map-toolbar input::placeholder {
  color: rgba(226, 244, 240, 0.35);
}

.semantic-map-toolbar select {
  cursor: pointer;
}

.semantic-map-toolbar option {
  color: #eaf7f4;
  background: #13211f;
}

.semantic-filter {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.semantic-filter.is-open {
  z-index: 40;
}

.semantic-filter__button {
  width: 100%;
  justify-content: space-between;
  padding: 0 12px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.semantic-filter__button:hover,
.semantic-filter.is-open .semantic-filter__button {
  border-color: rgba(85, 214, 190, 0.42);
  background: rgba(85, 214, 190, 0.08);
}

.semantic-filter__button strong {
  overflow: hidden;
  min-width: 0;
  color: rgba(237, 249, 246, 0.88);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.semantic-filter__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 45;
  width: max(100%, 238px);
  max-height: 330px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(214, 246, 239, 0.15);
  border-radius: 12px;
  background: rgba(11, 25, 23, 0.98);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.42);
}

.semantic-filter__option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 7px 8px;
  border-radius: 8px;
  color: rgba(237, 249, 246, 0.82);
  font-size: 12px;
  line-height: 1.35;
  cursor: pointer;
}

.semantic-filter__option:hover {
  background: rgba(255, 255, 255, 0.07);
}

.semantic-filter__option input {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.semantic-map-zoom-control {
  gap: 9px;
}

.semantic-map-zoom-control input[type="range"] {
  flex: 1 1 auto;
  min-width: 78px;
  accent-color: var(--accent);
  cursor: pointer;
}

.semantic-map-zoom-control strong {
  flex: 0 0 44px;
  color: rgba(237, 249, 246, 0.82);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

.semantic-map-button {
  min-width: 110px;
  height: 42px;
  padding: 0 15px;
  border: 1px solid rgba(214, 246, 239, 0.14);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  white-space: nowrap;
}

.semantic-map-button:hover {
  border-color: rgba(85, 214, 190, 0.45);
  background: rgba(85, 214, 190, 0.1);
}

.semantic-map-button--accent {
  border-color: rgba(85, 214, 190, 0.34);
  color: var(--accent-strong);
  background: rgba(85, 214, 190, 0.11);
}

.semantic-map-stage {
  position: relative;
  z-index: 1;
  min-height: 650px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(rgba(214, 246, 239, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 246, 239, 0.025) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(85, 214, 190, 0.05), transparent 58%),
    rgba(4, 12, 10, 0.8);
  background-size: 42px 42px, 42px 42px, auto, auto;
  box-shadow: var(--shadow);
}

#semantic-map {
  display: block;
  width: 100%;
  height: min(76vh, 880px);
  min-height: 650px;
  cursor: grab;
  touch-action: none;
}

#semantic-map:active {
  cursor: grabbing;
}

.semantic-link {
  stroke: rgba(172, 235, 223, 0.2);
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.semantic-focus-links {
  pointer-events: none;
}

.semantic-map-boundary {
  fill: rgba(7, 17, 15, 0.42);
  stroke: rgba(214, 246, 239, 0.18);
  stroke-dasharray: 2 2;
  vector-effect: non-scaling-stroke;
}

.semantic-node {
  cursor: pointer;
  outline: none;
}

.semantic-node circle {
  stroke: rgba(245, 255, 252, 0.74);
  stroke-width: 0.42;
  filter: drop-shadow(0 0 2px rgba(139, 244, 223, 0.22));
  transition: opacity 120ms ease;
  vector-effect: non-scaling-stroke;
}

.semantic-node:hover circle,
.semantic-node:focus circle {
  stroke: #fff;
  stroke-width: 1.2;
  filter: drop-shadow(0 0 6px rgba(139, 244, 223, 0.72));
}

.semantic-node text {
  fill: rgba(237, 249, 246, 0.84);
  font-size: 2.35px;
  paint-order: stroke;
  pointer-events: none;
  stroke: rgba(4, 12, 10, 0.96);
  stroke-width: 0.9px;
  stroke-linejoin: round;
}

.semantic-node.is-search-match circle {
  stroke: #fff8bd;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 8px rgba(255, 244, 163, 0.9));
}

.semantic-node,
.semantic-link {
  transition: opacity 180ms ease;
}

.semantic-node.is-focus-target circle {
  stroke: #7ff7f0;
  stroke-width: 2;
  filter: drop-shadow(0 0 9px rgba(127, 247, 240, 0.98));
  animation: semantic-focus-pulse 1.8s ease-in-out infinite;
}

.semantic-node.is-focus-neighbor circle {
  stroke: rgba(214, 255, 249, 0.94);
  stroke-width: 1.15;
  filter: drop-shadow(0 0 5px rgba(139, 244, 223, 0.62));
}

.semantic-link.is-focus-link {
  stroke: rgba(127, 247, 240, 0.88);
  stroke-width: 1.35;
  opacity: 0.92 !important;
}

.semantic-node.is-focus-dimmed {
  opacity: 0.18;
}

.semantic-link.is-focus-dimmed {
  opacity: 0.05 !important;
}

@keyframes semantic-focus-pulse {
  0%, 100% {
    stroke-width: 1.6;
    filter: drop-shadow(0 0 6px rgba(127, 247, 240, 0.78));
  }
  50% {
    stroke-width: 2.4;
    filter: drop-shadow(0 0 12px rgba(127, 247, 240, 1));
  }
}

@media (prefers-reduced-motion: reduce) {
  .semantic-node,
  .semantic-link,
  .semantic-node circle {
    transition: none;
  }

  .semantic-node.is-focus-target circle {
    animation: none;
  }
}

.semantic-map-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(5, 13, 11, 0.72);
  backdrop-filter: blur(8px);
}

.semantic-map-loading[hidden],
.semantic-tooltip[hidden] {
  display: none !important;
}

.semantic-map-loading.is-error {
  color: #ffb4b4;
}

.semantic-map-help {
  position: absolute;
  right: 16px;
  bottom: 14px;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.semantic-map-help span {
  padding: 6px 9px;
  border: 1px solid rgba(214, 246, 239, 0.1);
  border-radius: 999px;
  color: rgba(226, 244, 240, 0.48);
  background: rgba(5, 13, 11, 0.74);
  font-size: 10px;
}

.semantic-tooltip {
  position: fixed;
  z-index: 20;
  width: min(340px, calc(100vw - 28px));
  padding: 15px 16px;
  border: 1px solid rgba(214, 246, 239, 0.16);
  border-radius: 13px;
  color: var(--text);
  background: var(--panel-strong);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.44);
  pointer-events: none;
}

.semantic-tooltip__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.semantic-tooltip__meta span {
  padding: 3px 7px;
  border-radius: 999px;
  color: rgba(236, 250, 247, 0.72);
  background: rgba(255, 255, 255, 0.07);
  font-size: 10px;
}

.semantic-tooltip strong {
  display: block;
  font-size: 15px;
  line-height: 1.55;
}

.semantic-tooltip p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.semantic-map-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 4px 0;
}

.semantic-map-legend__items {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.semantic-legend-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.semantic-legend-button:hover,
.semantic-legend-button.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.semantic-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.semantic-map-method {
  flex: 0 0 auto;
  margin: 0;
  color: rgba(226, 244, 240, 0.42);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-align: right;
}

.semantic-map-status {
  min-height: 1.5em;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.semantic-map-accessible-list {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 980px) {
  .semantic-map-header {
    display: block;
  }

  .semantic-map-stats {
    width: 100%;
    min-width: 0;
    margin-top: 22px;
  }

  .semantic-map-toolbar {
    grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(130px, 0.45fr));
  }

  .semantic-map-zoom-control,
  .semantic-map-button {
    grid-column: span 1;
  }
}

@media (max-width: 700px) {
  .semantic-map-shell {
    width: min(100% - 20px, 1580px);
    padding-top: 18px;
  }

  .semantic-map-kicker {
    margin-top: 20px;
  }

  .semantic-map-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .semantic-map-search {
    grid-column: 1 / -1;
  }

  .semantic-filter__panel {
    position: fixed;
    top: auto;
    right: 10px;
    bottom: 72px;
    left: 10px;
    width: auto;
    max-height: 46vh;
  }

  .semantic-map-stage,
  #semantic-map {
    min-height: 590px;
    height: 70vh;
  }

  .semantic-map-help {
    left: 10px;
    right: auto;
    bottom: 10px;
    flex-wrap: wrap;
  }

  .semantic-map-help span:nth-child(2) {
    display: none;
  }

  .semantic-map-legend {
    display: block;
  }

  .semantic-map-method {
    margin-top: 12px;
    text-align: left;
  }
}

@media (max-width: 430px) {
  .semantic-map-toolbar {
    grid-template-columns: 1fr;
  }

  .semantic-map-search {
    grid-column: auto;
  }

  .semantic-map-stats span {
    padding: 12px 6px;
  }

  .semantic-map-stats strong {
    font-size: 19px;
  }
}
