/* ============================================================
   B · 知识图谱探索
   ============================================================ */
body.graph-page {
  background: #07131f;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
body.graph-page > .site-header { flex: none; }

.graph-shell {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 22px 26px 22px;
  overflow: hidden;
  color: #e7eef7;
  background:
    radial-gradient(900px 520px at 78% -12%, rgba(45, 108, 223, .18), transparent 62%),
    radial-gradient(760px 460px at 6% 112%, rgba(245, 138, 0, .08), transparent 62%),
    #07131f;
}
.graph-topbar {
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 4px 16px;
}
.graph-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .18em;
  color: #6ea4f5;
}
.graph-eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: #f58a00;
}
.graph-topbar h1 {
  margin-top: 7px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: #fff;
}
.graph-sub {
  margin-top: 5px;
  font-size: 12.5px;
  color: #8399b0;
}
.graph-actions {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  padding-bottom: 2px;
}
.graph-stamp {
  font-size: 10.5px;
  color: #5f778f;
  font-variant-numeric: tabular-nums;
}
.version-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
}
.version-switch a {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #8fa5bc;
  transition: background .18s, color .18s;
}
.version-switch a:hover { color: #fff; }
.version-switch a.on {
  color: #0b1c2e;
  background: #e8eef6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .28);
}

.graph-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(126, 160, 200, .16);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(13, 30, 49, .72), rgba(7, 19, 31, .9));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.graph-toolbar {
  position: relative;
  z-index: 5;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(126, 160, 200, .12);
  background: rgba(8, 20, 33, .72);
  backdrop-filter: blur(10px);
}
.graph-search {
  flex: none;
  width: 268px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(126, 160, 200, .18);
  border-radius: 9px;
  background: rgba(255, 255, 255, .04);
  transition: border-color .18s, box-shadow .18s;
}
.graph-search:focus-within {
  border-color: #5b9cff;
  box-shadow: 0 0 0 3px rgba(91, 156, 255, .14);
}
.graph-search svg { flex: none; color: #6d859d; }
.graph-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: #e7eef7;
}
.graph-search input::placeholder { color: #617a92; }
.type-filters {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}
.type-filters::-webkit-scrollbar { display: none; }
.type-filter {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid rgba(126, 160, 200, .16);
  border-radius: 999px;
  background: transparent;
  color: #9db2c7;
  font: inherit;
  font-size: 11.5px;
  transition: opacity .18s, border-color .18s, background .18s, color .18s;
}
.type-filter .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c, #8fa5bc);
}
.type-filter b {
  font-size: 10px;
  font-weight: 600;
  color: #7e94a9;
  font-variant-numeric: tabular-nums;
}
.type-filter.on {
  color: #e7eef7;
  border-color: rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .07);
}
.type-filter.off { opacity: .4; }
.type-filter:hover { opacity: 1; border-color: rgba(255, 255, 255, .3); }
.graph-stats {
  margin-left: auto;
  font-size: 10.5px;
  color: #7b91a8;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.graph-reset {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(126, 160, 200, .2);
  border-radius: 8px;
  background: transparent;
  color: #a9bdd1;
  font: inherit;
  font-size: 11.5px;
  transition: color .18s, border-color .18s, background .18s;
}
.graph-reset:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .05);
}
.graph-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background-color: #081625;
  background-image:
    radial-gradient(circle at 24% 12%, rgba(45, 108, 223, .11), transparent 44%),
    radial-gradient(circle at 82% 88%, rgba(245, 138, 0, .06), transparent 42%),
    linear-gradient(rgba(126, 160, 200, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 160, 200, .045) 1px, transparent 1px);
  background-size: auto, auto, 46px 46px, 46px 46px;
}
#graph-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#graph-canvas.is-dragging { cursor: grabbing; }
#graph-canvas.is-pointer { cursor: pointer; }

.graph-legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 3;
  min-width: 158px;
  padding: 12px 14px;
  border: 1px solid rgba(126, 160, 200, .16);
  border-radius: 12px;
  background: rgba(8, 20, 33, .8);
  backdrop-filter: blur(10px);
  font-size: 11px;
  color: #8fa5bc;
  pointer-events: none;
}
.graph-legend h4 {
  margin-bottom: 8px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .14em;
  color: #637b93;
  text-transform: uppercase;
}
.graph-legend .row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.graph-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.graph-legend .row b {
  margin-left: auto;
  color: #c9d7e5;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.graph-legend .note {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(126, 160, 200, .12);
  color: #637b93;
  line-height: 1.5;
}
.graph-hint {
  position: absolute;
  left: 50%;
  bottom: 17px;
  z-index: 2;
  transform: translateX(-50%);
  font-size: 10.5px;
  color: #5c748c;
  white-space: nowrap;
  pointer-events: none;
}
.graph-tooltip {
  position: absolute;
  z-index: 8;
  max-width: 280px;
  padding: 8px 10px;
  border: 1px solid rgba(126, 160, 200, .22);
  border-radius: 8px;
  background: rgba(8, 20, 33, .94);
  color: #e7eef7;
  font-size: 11.5px;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -132%);
  transition: opacity .12s;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .3);
}
.graph-tooltip.on { opacity: 1; }
.graph-tooltip b { display: block; font-weight: 600; }
.graph-tooltip span { color: #8fa5bc; font-size: 10.5px; }

.graph-loading {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 19, 31, .9);
  backdrop-filter: blur(4px);
  color: #9db2c7;
  font-size: 12.5px;
  text-align: center;
}
.graph-loading[hidden] { display: none; }
.graph-loading .spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto 12px;
  border: 2px solid rgba(126, 160, 200, .2);
  border-top-color: #5b9cff;
  border-radius: 50%;
  animation: graph-spin .8s linear infinite;
}
@keyframes graph-spin { to { transform: rotate(360deg); } }
.graph-loading .retry {
  margin-top: 14px;
  padding: 7px 14px;
  border: 1px solid rgba(126, 160, 200, .3);
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  color: #e7eef7;
  font: inherit;
  font-size: 12px;
}
.graph-loading.error { color: #f0a8a8; }

.graph-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 6;
  width: 342px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(126, 160, 200, .2);
  border-radius: 14px;
  background: rgba(9, 23, 38, .93);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .42);
  transform: translateX(calc(100% + 30px));
  transition: transform .28s cubic-bezier(.22, .8, .3, 1);
}
.graph-panel.open { transform: translateX(0); }
.gp-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(126, 160, 200, .12);
}
.gp-type {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--c);
  background: var(--bg);
}
.gp-close {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: auto;
  border: 1px solid rgba(126, 160, 200, .18);
  border-radius: 7px;
  background: transparent;
  color: #8fa5bc;
  font-size: 16px;
  line-height: 1;
}
.gp-close:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }
.gp-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}
.gp-body h2 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -.01em;
  color: #fff;
}
.gp-sub {
  margin-top: 5px;
  font-size: 11.5px;
  color: #8fa5bc;
}
.gp-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.gp-meta .cell {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid rgba(126, 160, 200, .13);
  border-radius: 9px;
  background: rgba(255, 255, 255, .025);
}
.gp-meta .cell dt {
  font-size: 9.5px;
  letter-spacing: .04em;
  color: #6e869e;
}
.gp-meta .cell dd {
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 600;
  color: #dbe7f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gp-neighbors {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(126, 160, 200, .12);
}
.gp-neighbors h4 {
  margin-bottom: 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  color: #6e869e;
}
.gp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid rgba(126, 160, 200, .16);
  border-radius: 7px;
  background: rgba(255, 255, 255, .03);
  color: #a8bdd2;
  font: inherit;
  font-size: 10.5px;
  text-align: left;
}
.gp-chip:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .07);
}
.gp-chip .dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.gp-chip span {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gp-more {
  margin-top: 8px;
  font-size: 10px;
  color: #5f778f;
}
.gp-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 10px 13px;
  border-radius: 9px;
  background: #e8eef6;
  color: #0b1c2e;
  font-size: 12px;
  font-weight: 600;
  transition: background .18s;
}
.gp-link:hover { background: #fff; }
.gp-link span { font-size: 16px; line-height: 1; }

@media (max-width: 1180px) {
  .graph-stats { display: none; }
  .graph-search { width: 220px; }
  .graph-shell { padding: 18px 18px 18px; }
}
@media (max-width: 900px) {
  .graph-topbar h1 { font-size: 22px; }
  .graph-actions { gap: 7px; }
  .graph-panel { width: 318px; }
  .graph-toolbar { flex-wrap: wrap; }
  .graph-search { flex: 1 1 220px; width: auto; }
  .graph-stats { display: block; margin-left: 0; order: 5; }
}
@media (max-width: 720px) {
  .graph-shell {
    min-height: 0;
    padding: 14px 12px 12px;
  }
  .graph-topbar {
    align-items: flex-start;
    padding-bottom: 12px;
  }
  .graph-topbar h1 { font-size: 20px; }
  .graph-sub { font-size: 11px; }
  .graph-stamp { display: none; }
  .version-switch a { padding: 5px 10px; font-size: 11px; }
  .graph-toolbar {
    gap: 8px;
    padding: 10px;
  }
  .graph-search { flex: 1 1 100%; width: 100%; }
  .graph-reset { margin-left: auto; }
  .graph-stats {
    flex: 1 1 100%;
    order: 6;
    white-space: normal;
    line-height: 1.4;
  }
  .graph-legend, .graph-hint { display: none; }
  .graph-panel {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: 62%;
    transform: translateY(calc(100% + 24px));
  }
  .graph-panel.open { transform: translateY(0); }
}
@media (max-width: 460px) {
  .graph-eyebrow { font-size: 9.5px; }
  .graph-topbar h1 { font-size: 18px; }
  .graph-sub { display: none; }
  .graph-actions { padding-top: 2px; }
  .graph-shell { min-height: 460px; }
}
