/* 知识图谱浏览：左目录、中局部图、右详情。窄屏改为上下堆叠。 */

body.page-explore {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.page-explore .site-header,
body.page-explore .site-footer { flex: none; }
.explore {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr) minmax(270px, 380px);
  grid-template-rows: minmax(0, 1fr);
}
.explore-mobile-bar { display: none; }

.side, .detail, .graph-pane { min-width: 0; min-height: 0; }
.side {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
}
.side-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.side-tools input, .side-tools select { width: 100%; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.count { color: var(--muted); font-size: 0.92rem; }
.list { overflow: auto; flex: 1; padding-bottom: 12px; }

.vol > summary, .chap > summary {
  cursor: pointer;
  padding: 10px 12px;
  min-height: 44px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.vol > summary { position: sticky; top: 0; background: var(--bg-elev); z-index: 1; border-bottom: 1px solid var(--line); }
.chap > summary { font-weight: 700; font-size: 0.95rem; }
.count-pill { color: var(--muted); font-weight: 700; font-size: 0.85rem; }
.topic-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: calc(100% - 16px);
  margin: 2px 8px;
  text-align: left;
  gap: 1px;
  border: none;
  background: transparent;
  color: inherit;
  border-radius: 10px;
}
.topic-item .nm { font-weight: 700; overflow-wrap: anywhere; }
.topic-item .meta { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.topic-item:hover { background: var(--bg-muted); }
.topic-item.sel { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }

.graph-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.graph-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.depth, .zoom-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.depth-label { color: var(--muted); font-weight: 800; font-size: 0.92rem; }
.depth button.on { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.graph-fold {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 8px 12px;
  background: var(--warn-bg);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}
.graph-fold button { white-space: normal; max-width: 100%; }
.graph-stage { position: relative; flex: 1; min-width: 0; min-height: 280px; display: flex; flex-direction: column; }
#cy { flex: 1; min-height: 280px; width: 100%; }
.graph-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 24px 20px;
}
.graph-empty p { margin: 0; max-width: 36em; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin: 0;
  padding: 8px 12px 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; border: 2px solid transparent; display: inline-block; }
.sw-p { background: var(--node-primary-bg); border-color: var(--node-primary); }
.sw-j { background: var(--node-junior-bg); border-color: var(--node-junior); }
.sw-h { background: var(--node-senior-bg); border-color: var(--node-senior); }
.sw-c { background: var(--node-current-bg); border-color: var(--node-current-border); }
.line-hard, .line-soft { width: 22px; height: 0; border-radius: 0; border: none; border-top: 2px solid var(--edge); background: none; }
.line-soft { border-top-style: dashed; border-top-color: var(--edge-soft); }
.graph-meta { margin: 0; padding: 4px 12px 10px; color: var(--muted); font-size: 0.9rem; }

.detail {
  overflow: auto;
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  padding: 16px 16px 24px;
}
.detail h1 { margin: 0 0 6px; font-size: 1.55rem; line-height: 1.3; overflow-wrap: anywhere; }
.detail h2 { margin: 18px 0 8px; font-size: 1.08rem; }
.detail p { margin: 0.35em 0; overflow-wrap: anywhere; }
.detail-empty h1 { font-size: 1.4rem; }
.alias-note {
  background: var(--warn-bg);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
}
.pill-p { background: var(--node-primary-bg); color: var(--node-text); }
.pill-j { background: var(--node-junior-bg); color: var(--node-text); }
.pill-h { background: var(--node-senior-bg); color: var(--node-text); }
.id-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--muted);
}
.diag-btn { margin: 4px 0 8px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.meta-grid div { background: var(--bg-muted); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.meta-grid .span-2 { grid-column: 1 / -1; }
.meta-grid dt { color: var(--muted); font-size: 0.82rem; }
.meta-grid dd { margin: 0; font-weight: 800; overflow-wrap: anywhere; }
.detail ul.plain { margin: 4px 0 0; padding-left: 1.2em; }
.std { background: var(--bg-muted); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.std p { margin: 0.25em 0; }
.sample-q {
  background: var(--bg-muted);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 10px 12px;
}
.detail details.ans > summary, .rel-row { cursor: pointer; }
.rel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  margin: 0 0 8px;
  background: var(--bg);
}
.rel-name { font-weight: 800; color: var(--brand-strong); }
.rel-where, .why { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.why { flex: 1 1 100%; font-weight: 500; }
.muted { color: var(--muted); }
.root-reason { color: var(--muted); }

@media (max-width: 900px) {
  body.page-explore { height: auto; min-height: 100dvh; overflow: auto; }
  .explore { display: flex; flex-direction: column; height: auto; }
  .explore-mobile-bar { display: block; padding: 10px 12px 0; }
  .list-toggle { width: 100%; }
  .side { display: none; border-right: none; }
  .side.open { display: flex; max-height: 62vh; border-bottom: 1px solid var(--line); }
  .graph-stage { flex: none; min-height: 0; }
  #cy { height: 420px; flex: none; }
  .detail { border-left: none; border-top: 1px solid var(--line); }
}
