/* 实时知识地图 — phone-first live argument map.
   Extends the site's 刻本 tokens (css/index.css): paper ground, ink text.
   Designed for a three-to-five-second glance: core question, where the
   speaker is now, and the main line; everything else is folded. */

.rtms-map.container {
  max-width: 720px;
  padding-bottom: 4.5rem; /* room for 回到当前 */
}

.map-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.map-head h1 {
  font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.map-status {
  font-size: 0.85rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
}
.map-status[data-state="interrupted"],
.map-status[data-state="limit"] { color: #92400e; border-color: #f59e0b; }
.map-status[data-state="ended"],
.map-status[data-state="frozen"],
.map-status[data-state="paused"] { color: var(--muted, #6b7280); }

.map-session-label {
  font-size: 0.85rem;
  margin-left: auto;
}
.map-session-label select { max-width: 16rem; }
.final-map-entry { border: 1px solid #2c5842; border-radius: 8px; color: #2c5842; padding: 7px 12px; text-decoration: none; white-space: nowrap; }
.final-map-entry:hover { background: #eef3ed; }

.map-error {
  color: #b91c1c;
  margin-bottom: 0.75rem;
}

.map-root section {
  margin-bottom: 1.1rem;
}
.map-root h2 {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--muted, #6b7280);
  margin: 0 0 0.35rem;
}

.map-question p {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}
.map-question.is-pending p {
  font-weight: 400;
  color: var(--muted, #6b7280);
}

.map-current {
  border-left: 3px solid var(--cinnabar, #b91c1c);
  padding: 0.5rem 0.75rem;
  background: var(--card);
  scroll-margin-top: 4rem;
}
.map-current-text {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}
.map-activity {
  font-size: 0.85rem;
  color: #92400e;
  margin: 0 0 0.25rem;
}

.map-how {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
}
.map-how li {
  margin: 0.3rem 0;
  font-size: 0.92rem;
}
.map-rel {
  display: inline-block;
  min-width: 4.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 0.35rem;
}

.map-mainline ol {
  padding-left: 1.4rem;
  margin: 0;
}
.map-step {
  margin: 0.45rem 0;
}
.map-step.is-current > .map-node > .map-node-text {
  font-weight: 700;
}

.map-node {
  margin: 0.2rem 0;
}
.map-node.is-current {
  outline: 2px solid var(--cinnabar, #b91c1c);
  outline-offset: 2px;
  border-radius: 4px;
}
.map-node-text {
  margin: 0;
}

.map-badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  margin: 0.15rem 0.25rem 0 0;
}
.map-badge.is-supplement { color: #1d4ed8; }
.map-badge.is-revised { color: #92400e; }

.map-fold,
.map-more-fold,
.map-evidence {
  margin: 0.25rem 0 0.25rem 0.25rem;
  font-size: 0.9rem;
}
.map-fold > summary,
.map-more-fold > summary,
.map-evidence > summary {
  cursor: pointer;
  color: var(--muted, #6b7280);
  min-height: 1.75rem; /* comfortable tap target on phones */
}
.map-detail {
  margin: 0.25rem 0 0.25rem 0.75rem;
}
.map-detail-kind {
  font-size: 0.8rem;
  color: var(--muted, #6b7280);
}
.map-evidence-line {
  margin: 0.2rem 0 0.2rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.5;
}
.map-muted {
  color: var(--muted, #6b7280);
  font-size: 0.85rem;
}

.map-back {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--card);
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* One compact line per proposition in the overview; its examples, logical
   connections and evidence sit behind a single fold. */
.map-more-fold > summary {
  font-size: 0.78rem;
}
.map-relations,
.map-earlier {
  margin: 0.2rem 0 0.2rem 0.5rem;
  padding-left: 1rem;
}
.map-relations li {
  margin: 0.25rem 0;
  font-size: 0.88rem;
}

/* 逻辑关系 — the 2D relation view. Wider page, graph with a side panel on
   desktop; the panel drops below the graph on phones. */
.rtms-map.container[data-view="graph"] {
  max-width: 1280px;
}
.map-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.map-tabs[hidden] { display: none; }
.map-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  padding: 0.45rem 0.9rem;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--muted, #6b7280);
}
.map-tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--cinnabar, #b91c1c);
  font-weight: 600;
}
.map-root[hidden],
.map-graph[hidden],
.map-graph [hidden] { display: none !important; }

.map-graph .map-question { margin-bottom: 0.9rem; }
.map-graph .map-question p.is-pending {
  font-weight: 400;
  color: var(--muted, #6b7280);
}
.map-graph-message {
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted, #6b7280);
}
.map-graph-retry { margin-left: 0.5rem; }

.map-graph-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1rem;
  align-items: start;
}
.graph-workspace,
.graph-side {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.graph-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
}
.graph-search {
  flex: 1 1 10rem;
  min-width: 0;
  padding: 0.4rem 0.6rem;
}
.graph-results {
  max-height: 12rem;
  overflow: auto;
  padding: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.graph-results ul,
.graph-list ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.graph-results button,
.graph-list button,
.graph-panel button[data-node] {
  display: block;
  width: 100%;
  text-align: left;
  line-height: 1.6;
  padding: 0.4rem 0.5rem;
  margin: 0.2rem 0;
  font-size: 0.88rem;
  cursor: pointer;
}
.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  padding: 0.5rem 0.8rem;
  font-size: 0.75rem;
  color: var(--muted, #6b7280);
}
.graph-legend .is-support { color: #35765b; }
.graph-legend .is-inference { color: #386cac; }
.graph-legend .is-contrast { color: #af672d; }
.graph-branch-tag {
  display: inline-block;
  padding: 0 0.35rem;
  border-radius: 5px;
  color: #69507e;
  background: #eee8f4;
  font-size: 0.72rem;
}
.graph-canvas-wrap {
  position: relative;
  height: max(420px, calc(100vh - 360px));
  background: #f8f9f3;
}
.graph-canvas {
  position: absolute;
  inset: 0;
}
.graph-more {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 0.8rem;
  border-top: 1px solid var(--line);
}
.graph-more button {
  font-size: 0.78rem;
  max-width: 100%;
  cursor: pointer;
}
.graph-more-branch {
  display: inline-block;
  max-width: 12em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.graph-state {
  padding: 0.5rem 0.8rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--muted, #6b7280);
}
.graph-side {
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}
.graph-all {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.graph-all > summary { cursor: pointer; }
.graph-list {
  max-height: 16rem;
  overflow: auto;
}
.graph-panel { padding: 0.9rem; }
.graph-node-meta {
  font-size: 0.78rem;
  color: var(--muted, #6b7280);
  margin: 0;
}
.graph-panel h2.graph-node-text {
  font-size: 1.05rem;
  line-height: 1.6;
  letter-spacing: 0;
  color: var(--ink);
  margin: 0.3rem 0 0.4rem;
  font-weight: 600;
}
.graph-panel h3 {
  font-size: 0.8rem;
  color: var(--muted, #6b7280);
  margin: 1rem 0 0.4rem;
}
.graph-node-marks { margin: 0; }
.graph-relation {
  margin: 0.4rem 0;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-left: 3px solid #35765b;
  border-radius: 6px;
}
.graph-relation.is-inference { border-left-color: #386cac; }
.graph-relation.is-contrast { border-left-color: #af672d; }
.graph-relation-type {
  font-size: 0.78rem;
  font-weight: 600;
}
.graph-relation button[data-node] {
  border: 0;
  background: none;
  padding: 0.2rem 0;
}
.graph-edge-detail {
  padding: 0.7rem;
  margin-bottom: 0.8rem;
  background: #f3f6ef;
  border-radius: 6px;
}
.graph-edge-detail h3 { margin-top: 0; }
.graph-edge-label.is-support { color: #35765b; }
.graph-edge-label.is-inference { color: #386cac; }
.graph-edge-label.is-contrast { color: #af672d; }

@media (max-width: 850px) {
  .map-graph-body { grid-template-columns: 1fr; }
  .graph-canvas-wrap { height: 53vh; min-height: 330px; }
  .graph-side { max-height: none; }
}
