/* /graph/ — tier-banded ladder over the content graph. Spare by intent:
   layout + colour carry meaning; text is demoted to hover/detail. */

.cover-slim { padding-top: 2.4rem; padding-bottom: 2.4rem; }

/* two-column layout is dense — let it breathe wider than the shared 860px default */
.wrap { max-width: 1200px; }

/* near-wordless visual key */
.legend2 {
  display: flex; align-items: center; gap: .4rem;
  font-size: .8rem; color: var(--muted); margin: 0 0 1.4rem;
}
.legend2 .lg-wire { width: 22px; height: 0; border-top-width: 2.5px; border-top-style: solid; }
.legend2 .lg-wire.down { border-color: var(--red); }
.legend2 .lg-wire.up { border-color: var(--navy); }
.legend2 .lg-wire:not(:first-child) { margin-left: 1rem; }
.legend2 .lg-chip {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  font-family: "LXGW WenKai", serif; font-size: .9rem; margin-left: 1rem;
}
.legend2 .lg-chip.frontier {
  border: 1.5px dashed var(--border); color: var(--muted); opacity: .6; border-radius: 5px;
}

/* wires (shared by the ego stage) */
.wire { fill: none; stroke-width: 2; stroke-linecap: round; opacity: .8; transition: opacity .12s, stroke-width .12s; }
.wire.down { stroke: var(--red); }
/* appears-in rings: solid (ring0) → light (ring1) → light+dashed (ring2) halo */
.wire.down.r1 { opacity: .42; }
.wire.down.r2 { opacity: .26; stroke-width: 1.5; stroke-dasharray: 3 4; }
/* hover-promote a child's spoke to a hard red line, whatever its ring */
.wire.hot { stroke: var(--red); opacity: 1; stroke-width: 2.5; stroke-dasharray: none; }

/* ── two columns: tier index (left ~60%) + ego graph (right ~40%) ── */
.graph-cols { display: flex; align-items: flex-start; gap: 1.6rem; }
.graph-cols > #ladder { flex: 3 1 0; min-width: 0; }
.graph-cols > .graph-right {
  flex: 2 1 0; min-width: 0; position: sticky; top: 1rem;
  display: flex; flex-direction: column; gap: 1rem;
}

/* ── ego stage: current-glyph-centred local graph ── */
#ego { position: relative; height: 32rem; margin: 0; }

/* referent (义) — the glyph's meaning, given its own bay (future: sense image) */
#referent {
  border: 1.5px dashed var(--gold); border-radius: 12px; background: var(--cream);
  min-height: 7.5rem; padding: 1rem 1.3rem; display: flex; align-items: center; gap: 1.1rem;
}
.ref-mark { font-family: "LXGW WenKai", serif; font-size: 3rem; line-height: 1; color: var(--gold); }
.ref-body { display: flex; flex-direction: column; gap: .3rem; }
.ref-label { font-size: 1.1rem; color: var(--ink); }
.ref-cap { font-size: .68rem; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
#egowires { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: visible; }
.egonode { position: absolute; transform: translate(-50%, -50%); z-index: 1; }

.egonode.center {
  left: 50%; top: 50%; display: flex; flex-direction: column; align-items: center; gap: .25rem;
  background: var(--white); border: 2px solid var(--navy); border-radius: 14px;
  padding: .55rem .9rem; box-shadow: 0 3px 14px rgba(30, 42, 74, .16);
}
.egonode.center.frontier { border-style: dashed; border-color: var(--border); }
.ec-glyph { font-family: "LXGW WenKai", serif; font-size: 2.6rem; line-height: 1; color: var(--ink); }
.ec-facts { font-size: .78rem; color: var(--muted); }
.ec-wk { font-size: .68rem; padding: .04rem .4rem; border-radius: 999px; }
.ec-wk.mean { color: var(--green); border: 1px solid var(--green); }
.ec-wk.mnem { color: var(--red); border: 1px dashed var(--red); }

/* parts ("built from") as clickable chips inside the card — navy = ingredient */
.ec-parts {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem;
  margin-top: .4rem; padding-top: .4rem; max-width: 9.5rem;
  border-top: 1px solid var(--border);
}
.ec-part {
  font-family: "LXGW WenKai", serif; font-size: 1rem; line-height: 1;
  width: 1.55rem; height: 1.55rem; display: grid; place-items: center; padding: 0;
  background: var(--white); color: var(--ink); border: 1px solid var(--navy);
  border-radius: 5px; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.ec-part:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(30, 42, 74, .18); }
/* a part chip stacks its twin form(s) as a small muted row directly beneath it,
   so 西 [覀 襾] reads as one grouped slot instead of crowding the chip row */
.ec-parts { align-items: flex-start; }
.ec-part-wrap { display: inline-flex; flex-direction: column; align-items: center; gap: .16rem; }
.ec-vars { display: flex; gap: .16rem; }
.ec-var {
  font-family: "LXGW WenKai", serif; font-size: .66rem; line-height: 1;
  min-width: .95rem; height: .95rem; padding: 0 .12rem;
  display: grid; place-items: center; color: var(--muted, #7c86a2);
  background: var(--white); border: 1px dashed var(--border); border-radius: 4px;
  cursor: pointer; transition: transform .12s, color .12s, border-color .12s;
}
.ec-var.ghost { cursor: default; opacity: .7; }
.ec-var:not(.ghost):hover { transform: translateY(-1px); color: var(--ink); border-color: var(--navy); }

.egonode.nb {
  width: 2rem; height: 2rem; display: grid; place-items: center; padding: 0;
  font-family: "LXGW WenKai", serif; font-size: 1.05rem; line-height: 1;
  background: var(--cream); color: var(--ink); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.egonode.nb:hover { transform: translate(-50%, -50%) translateY(-2px); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.egonode.nb.whole { border-color: var(--red); }
.egonode.nb.frontier { opacity: .5; border-style: dashed; color: var(--muted); }

/* spiral tiers: ring0 solid & wired, ring1–2 fade to an ambient halo. size stays
   uniform (even seed density), grade by opacity only. */
.egonode.nb.ring1 { opacity: .72; }
.egonode.nb.ring2 { opacity: .5; background: transparent; }
.egonode.nb.ring1:hover, .egonode.nb.ring2:hover { opacity: 1; }

.egonode.more { font-size: .78rem; color: var(--muted); }
.egonode.more.overflow {
  width: 1.85rem; height: 1.85rem; display: grid; place-items: center; padding: 0;
  font-size: .72rem; color: var(--red); background: var(--white); cursor: pointer;
  border: 1px dashed var(--red); border-radius: 8px; opacity: .7;
  transition: opacity .12s, transform .12s;
}
.egonode.more.overflow:hover { opacity: 1; transform: translate(-50%, -50%) translateY(-2px); }

/* overflow → sorted list overlay (fills the ego stage) */
.ego-list {
  position: absolute; inset: 0; z-index: 2; background: var(--white);
  border-radius: 12px; display: flex; flex-direction: column; padding: .6rem .35rem;
}
.el-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .82rem; color: var(--muted); padding: 0 .55rem .55rem;
}
.el-back { font-size: .78rem; color: var(--navy); background: none; border: none; cursor: pointer; padding: 0; }
.el-grid {
  display: flex; flex-wrap: wrap; gap: .4rem; overflow-y: auto;
  padding: 0 .55rem; align-content: flex-start;
}
.el-grid .chip { width: 2.4rem; height: 2.4rem; font-size: 1.35rem; }

.band {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: .9rem 0; border-top: 1px solid var(--border);
  position: relative; z-index: 1;
}
.band:last-child { border-bottom: 1px solid var(--border); }
.band-label {
  flex: 0 0 4.5rem; display: flex; flex-direction: column; line-height: 1.25;
  padding-top: .35rem;
}
.band-label .bl-zh { font-weight: 700; color: var(--navy); }
.band-label .bl-en { font-size: .7rem; color: var(--muted); }
.band-label .bl-n { font-size: .72rem; color: var(--muted); margin-top: .15rem; }

.band-chips { display: flex; flex-wrap: wrap; gap: .5rem; flex: 1; }
.band-empty { color: var(--muted); }

.chip {
  font-family: "LXGW WenKai", serif; font-size: 1.7rem; line-height: 1;
  width: 3rem; height: 3rem; display: grid; place-items: center;
  background: var(--cream); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; padding: 0; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.chip:hover { border-color: var(--navy); transform: translateY(-1px); }
.chip.frontier { opacity: .42; border-style: dashed; color: var(--muted); }
.chip.sel {
  border-color: var(--navy); border-width: 2px; background: var(--white);
  box-shadow: 0 2px 10px rgba(30, 42, 74, .18); opacity: 1;
}
.chip.adj { box-shadow: 0 0 0 2px var(--red); }

/* detail */
#detail { margin-top: 1.6rem; min-height: 4rem; }
.detail-empty { color: var(--muted); text-align: center; padding: 1.4rem 0; }

.frontier-card {
  display: flex; align-items: center; gap: 1.2rem;
  border: 1.5px dashed var(--border); border-radius: 12px;
  padding: 1.1rem 1.4rem; background: var(--cream);
}
.frontier-card .fc-glyph {
  font-family: "LXGW WenKai", serif; font-size: 3.4rem; color: var(--muted); line-height: 1;
}
.frontier-card .fc-tag { font-size: .82rem; color: var(--muted); }
.frontier-card .fc-built { margin-top: .3rem; font-size: 1.1rem; }
.frontier-card .fc-built b { font-family: "LXGW WenKai", serif; font-weight: 400; }

/* ══ author/debug console ═══════════════════════════════════════════════════
   English chrome by intent: this is tooling, not a study surface. The only CJK
   is the glyph data. Cream section sets it apart from the white ego view. */
.bg-cream { background: var(--cream); }
.con-panel { margin-top: 1rem; }

/* ── coverage: stat tiles + ratio bars ── */
.cov-tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: .8rem; margin-bottom: 1.6rem;
}
.cov-tile {
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  border-left-width: 4px; padding: .9rem 1.1rem;
}
.cov-tile.ink   { border-left-color: var(--ink); }
.cov-tile.navy  { border-left-color: var(--navy); }
.cov-tile.red   { border-left-color: var(--red); }
.cov-tile.gold  { border-left-color: var(--gold); }
.cov-tile.muted { border-left-color: var(--border); }
.ct-n { font-size: 2rem; font-weight: 700; color: var(--ink); line-height: 1; }
.ct-label { font-size: .82rem; font-weight: 600; color: var(--navy); margin-top: .35rem; letter-spacing: .02em; }
.ct-sub { font-size: .68rem; color: var(--muted); margin-top: .25rem; }

.cov-bars { display: flex; flex-direction: column; gap: .7rem; max-width: 34rem; }
.cb-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .78rem; margin-bottom: .3rem; }
.cb-label { color: var(--ink); }
.cb-frac { color: var(--muted); font-variant-numeric: tabular-nums; }
.cb-track { height: 7px; background: var(--border); border-radius: 999px; overflow: hidden; }
.cb-fill { height: 100%; background: var(--green); border-radius: 999px; }

/* ── integrity: one row per invariant; green when clear, coloured when firing ── */
.int-summary { font-size: .9rem; padding: .55rem .9rem; border-radius: 8px; margin-bottom: 1rem; display: inline-block; }
.int-summary.ok  { color: var(--green); background: rgba(44,107,62,.08); }
.int-summary.bad { color: var(--red);   background: rgba(196,30,58,.08); }

.int-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: .6rem .7rem; padding: .55rem 0; border-top: 1px solid var(--border);
}
.int-row:last-child { border-bottom: 1px solid var(--border); }
.ir-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.int-row.hit.err  .ir-dot { background: var(--red); }
.int-row.hit.warn .ir-dot { background: var(--gold); }
.int-row.hit.info .ir-dot { background: var(--navy); }
.ir-name { font-size: .9rem; color: var(--ink); }
.int-row.clear .ir-name { color: var(--muted); }
.ir-count { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .95rem; color: var(--muted); }
.int-row.hit.err  .ir-count { color: var(--red); }
.int-row.hit.warn .ir-count { color: var(--gold); }
.int-row.hit.info .ir-count { color: var(--navy); }
.ir-hits { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .1rem; }
.ir-note { grid-column: 2 / 4; font-size: .74rem; color: var(--muted); font-style: italic; }
.ic-chip {
  display: inline-flex; align-items: center; gap: .3rem; cursor: pointer;
  font-size: .78rem; color: var(--ink); background: var(--cream);
  border: 1px solid var(--border); border-radius: 999px; padding: .12rem .55rem;
  transition: border-color .12s, transform .12s;
}
.ic-chip:hover { border-color: var(--navy); transform: translateY(-1px); }
.icc-g { font-family: "LXGW WenKai", serif; font-size: 1.05rem; line-height: 1; }

/* ── worklist: frontier stubs ranked by ready context ── */
.wl-note { font-size: .82rem; color: var(--muted); margin-bottom: 1rem; max-width: 40rem; }
.wl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .7rem; }
.wl-item {
  position: relative; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  column-gap: .7rem; align-items: center;
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  padding: .7rem .9rem; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.wl-item:hover { border-color: var(--navy); transform: translateY(-1px); box-shadow: 0 2px 10px rgba(30,42,74,.1); }
.wl-item.cold { opacity: .55; }
.wl-glyph { grid-row: 1 / 3; font-family: "LXGW WenKai", serif; font-size: 2.4rem; line-height: 1; color: var(--ink); }
.wl-score {
  justify-self: start; font-variant-numeric: tabular-nums; font-weight: 700; font-size: .78rem;
  color: var(--navy); background: var(--cream); border-radius: 999px; padding: .05rem .5rem;
}
.wl-item.cold .wl-score { color: var(--muted); }
.wl-nb { font-size: .74rem; color: var(--muted); display: flex; flex-direction: column; gap: .15rem; margin-top: .2rem; }
.wl-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem; }
.wl-k { color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; }
.wl-nb b { font-family: "LXGW WenKai", serif; font-weight: 400; font-size: 1rem; color: var(--ink); }

/* narrow: stack the ego graph back under the index */
@media (max-width: 820px) {
  .graph-cols { flex-direction: column; gap: 0; }
  .graph-cols > .graph-right { position: static; margin: 1rem 0 0; }
}

@media (max-width: 640px) {
  .band-label { flex-basis: 3.2rem; }
  .chip { width: 2.6rem; height: 2.6rem; font-size: 1.4rem; }
}
