/* ==========================================================================
   CAS · BERT — Bidirectional Encoder Representations from Transformers
   bert-models.css — Lecture-14-specific visuals on top of shared series styles.
   ========================================================================== */

/* ------------------------------------------------- sticky top nav */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 130;
  display: flex; align-items: center; gap: 1.4rem;
  padding: 0.55rem clamp(1rem, 3vw, 2rem);
  background: rgba(5, 8, 14, 0.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topnav-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text); flex: none; }
.topnav-brand:hover { text-decoration: none; }
.topnav-brand img { width: 2.1rem; height: 2.1rem; border-radius: 7px; }
.topnav-brand .tb-txt { display: flex; flex-direction: column; line-height: 1.1; }
.topnav-brand .tb-txt strong { font-family: var(--font-display); font-size: 0.85rem; letter-spacing: 0.05em; }
.topnav-brand .tb-txt small { font-family: var(--font-mono); font-size: 0.56rem; letter-spacing: 0.14em; color: var(--text-3); text-transform: uppercase; }
.topnav-links { display: flex; gap: 0.2rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-links a {
  font-size: 0.82rem; font-weight: 500; color: var(--text-2); text-decoration: none;
  padding: 0.35rem 0.65rem; border-radius: 7px; white-space: nowrap; transition: color 0.15s, background 0.15s;
}
.topnav-links a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.topnav-links a.active { color: var(--teal); }
.topnav-back {
  flex: none; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--line-2); border-radius: 8px; padding: 0.4rem 0.8rem; color: var(--text);
  text-decoration: none; transition: border-color 0.2s, color 0.2s;
}
.topnav-back:hover { border-color: var(--teal); color: var(--teal); text-decoration: none; }
@media (max-width: 900px) { .topnav-links { display: none; } }

main { padding-top: 3.2rem; }
.scroll-progress { top: 3.2rem; }
.rail-toggle { top: 4.4rem; }
.rail { padding-top: 4.6rem; }

/* ------------------------------------------------- hero */
.sec-hero { text-align: center; padding-top: clamp(3rem, 8vh, 5.5rem); }
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em; color: var(--teal);
  border: 1px solid rgba(94, 234, 212, 0.35); border-radius: 999px; padding: 0.42rem 1.1rem;
  background: rgba(94, 234, 212, 0.06); margin-bottom: 1.6rem;
}
.sec-hero .hero-title { margin-inline: auto; }
.sec-hero .hero-sub { margin-inline: auto; text-align: center; }
.sec-hero .def-banner { text-align: left; margin-inline: auto; }
.sec-hero .hero-stage-grid { margin-inline: auto; text-align: left; }

.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 1rem; max-width: 980px; margin: 0 auto 2.6rem; }
.hstat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1rem 0.95rem; text-align: center; transition: border-color 0.25s, transform 0.25s;
}
.hstat:hover { border-color: rgba(94, 234, 212, 0.45); transform: translateY(-3px); }
.hstat b { display: block; font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--teal); letter-spacing: -0.02em; }
.hstat span { display: block; font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); margin-top: 0.3rem; }
.hstat small { display: block; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.08em; color: var(--text-3); margin-top: 0.15rem; }

.flow-strip { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.45rem; max-width: 1080px; margin: 2rem auto 2.4rem; }
.fs-step {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em; color: var(--text-2);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 0.42rem 0.8rem;
  background: rgba(8, 13, 24, 0.55);
}
.fs-hl { color: var(--teal); border-color: rgba(94, 234, 212, 0.4); background: rgba(94, 234, 212, 0.06); }
.fs-model { color: #05231f; background: var(--teal); border-color: var(--teal); font-weight: 700; }
.fs-arw { color: var(--text-3); font-size: 0.8rem; }

/* ------------------------------------------------- shared demo primitives */
.tok-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.tok-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tok-chip {
  position: relative; display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--font-mono); font-size: 0.84rem; color: var(--text);
  background: rgba(94, 234, 212, 0.08); border: 1px solid rgba(94, 234, 212, 0.35);
  border-radius: 8px; padding: 0.4rem 0.65rem; animation: tokPop 0.25s ease;
}
.tok-chip.meta { color: var(--text-3); background: rgba(148, 163, 184, 0.07); border-color: rgba(148, 163, 184, 0.3); }
.tok-chip.qsel { border-color: var(--teal); background: rgba(94, 234, 212, 0.18); color: var(--teal); font-weight: 700; }
.tok-chip.mask-chip { border-color: var(--amber); background: rgba(251, 191, 36, 0.18); color: var(--amber); font-weight: 700; }
.tok-chip.rand-chip { border-color: var(--rose); background: rgba(251, 113, 133, 0.16); color: var(--rose); font-weight: 700; }
.tok-chip.keep-chip { border-color: var(--green); background: rgba(52, 211, 153, 0.16); color: var(--green); font-weight: 700; }
.tok-chip.wp-cont { border-color: rgba(56, 189, 248, 0.45); background: rgba(56, 189, 248, 0.11); color: var(--sky); }
.tok-chip.ghost { opacity: 0.32; border-style: dashed; }
.chip-wt { font-size: 0.62rem; color: var(--text-3); font-weight: 500; border-left: 1px solid var(--line-2); padding-left: 0.35rem; }
@keyframes tokPop { from { transform: scale(0.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.tok-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 0.8rem; margin-top: 1.1rem; }
.pn-presets { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.pn-preset {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; color: var(--text-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.34rem 0.78rem;
  background: rgba(8, 13, 24, 0.45); cursor: pointer; transition: all 0.15s;
}
.pn-preset:hover { color: var(--teal); border-color: rgba(94, 234, 212, 0.4); }
.pn-preset.on { color: #05231f; background: var(--teal); border-color: var(--teal); font-weight: 700; }

.qk-row {
  display: grid; grid-template-columns: minmax(6.5rem, 13rem) minmax(6rem, 1fr);
  gap: 0.8rem; align-items: center; padding: 0.28rem 0.5rem; border-bottom: 1px dashed var(--line);
}
.qk-row:last-child { border-bottom: 0; }
.qk-row.win { background: rgba(94, 234, 212, 0.06); border-radius: 6px; }
.qk-tok { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text); }
.qk-w { display: flex; align-items: center; gap: 0.5rem; }
.qk-w i {
  display: block; height: 10px; border-radius: 5px; flex: 1; max-width: calc(100% - 4.2rem); min-width: 3px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.45), rgba(56, 189, 248, 0.9));
}
.qk-w i.bar-win { background: linear-gradient(90deg, rgba(94, 234, 212, 0.45), var(--teal)); }
.qk-w i.bar-dim { background: linear-gradient(90deg, rgba(251, 113, 133, 0.35), var(--rose)); }
.qk-w b { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text); min-width: 3.8rem; text-align: right; }

.range-wrap { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1.1rem; }
.range-header { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.08em; color: var(--text-2); flex-wrap: wrap; gap: 0.4rem; }
.range-val { color: var(--teal); font-weight: 700; }
.range-wrap input[type="range"] { width: 100%; accent-color: var(--teal); }

.nt-grid { display: grid; grid-template-columns: minmax(280px, 1.1fr) minmax(260px, 1fr); gap: 1.4rem; }
@media (max-width: 880px) { .nt-grid { grid-template-columns: 1fr; } }

.kv-barwrap { height: 12px; border-radius: 6px; background: rgba(148, 163, 184, 0.12); overflow: hidden; }
.kv-barwrap i { display: block; height: 100%; border-radius: 6px; transition: width 0.25s; }

/* ------------------------------------------------- §00 top headlines & features showcase */
.hl-showcase {
  text-align: left;
  margin: 0 auto 2.4rem;
  padding: 1.65rem 1.75rem;
  border-radius: 16px;
  border: 1px solid rgba(94, 234, 212, 0.32);
  background:
    radial-gradient(circle at 12% 0%, rgba(94, 234, 212, 0.11), transparent 48%),
    radial-gradient(circle at 88% 100%, rgba(56, 189, 248, 0.09), transparent 52%),
    rgba(7, 12, 22, 0.88);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.hl-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.2rem;
  flex-wrap: wrap;
  padding-bottom: 1.15rem;
  margin-bottom: 1.35rem;
  border-bottom: 1px solid var(--line);
}
.hl-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--amber);
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 999px;
  padding: 0.28rem 0.85rem;
  margin-bottom: 0.55rem;
}
.hl-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  color: var(--text);
  letter-spacing: -0.02em;
}
.hl-title em {
  font-style: normal;
  color: var(--teal);
}
.hl-sub {
  margin: 0.4rem 0 0;
  font-size: 0.92rem;
  color: var(--text-2);
  max-width: 72ch;
  line-height: 1.55;
}
.hl-bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 1rem;
}
.hl-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.2rem 1.25rem;
  border-radius: 13px;
  border: 1px solid var(--line-2);
  background: rgba(10, 16, 29, 0.82);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  position: relative;
  overflow: hidden;
}
.hl-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--sky), var(--violet));
  opacity: 0.75;
}
.hl-card:hover {
  transform: translateY(-4px);
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45), 0 0 28px rgba(94, 234, 212, 0.08);
}
.hl-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.hl-num {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-2);
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
}
.hl-metric {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #04221e;
  background: var(--teal);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
}
.hl-metric.sky { background: var(--sky); color: #041d29; }
.hl-metric.amber { background: var(--amber); color: #241703; }
.hl-metric.violet { background: var(--violet); color: #190d33; }
.hl-card-title {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.hl-card-body {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.55;
}
.hl-vs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.3rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(5, 8, 14, 0.65);
  border: 1px dashed var(--line-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}
.hl-vs-old { color: var(--rose); }
.hl-vs-new { color: var(--teal); font-weight: 600; }
.hl-jump {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--teal);
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid rgba(94, 234, 212, 0.38);
  border-radius: 8px;
  padding: 0.38rem 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.hl-jump:hover {
  background: var(--teal);
  color: #05231f;
}

/* ------------------------------------------------- §01 hero cloze */
.hc-arc-wrap { margin-top: 0.7rem; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: rgba(5, 8, 14, 0.72); padding: 0.65rem 0.8rem; }
.hc-arc-svg { width: 100%; height: auto; display: block; }
.hc-arc-lbl { font-family: var(--font-mono); font-size: 12px; font-weight: 600; fill: #e2e8f0; }
.hc-arc-lbl.off { fill: #64748b; }

/* ------------------------------------------------- §02 direction lattice */
.dir-wrap { border: 1px solid rgba(94, 234, 212, 0.28); border-radius: 12px; background: radial-gradient(circle at 50% 45%, rgba(94, 234, 212, 0.06), rgba(5, 8, 14, 0.85)); padding: 1.1rem 1.2rem; margin: 0.9rem 0; }
.dir-svg { width: 100%; max-width: 1020px; height: auto; display: block; margin: 0 auto; }
.dir-rlab { font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; fill: #cbd5e1; }
.dir-ntxt { font-family: var(--font-mono); font-size: 13.5px; font-weight: 700; fill: #f8fafc; }
.dir-ntxt.blind { fill: #64748b; }
.dir-badge { font-size: 0.7rem; padding: 0.25rem 0.65rem; border-radius: 999px; border: 1px solid var(--line-2); }
.dir-badge.good { color: var(--teal); border-color: rgba(94, 234, 212, 0.45); background: rgba(94, 234, 212, 0.08); }
.dir-badge.leak { color: var(--rose); border-color: rgba(251, 113, 133, 0.45); background: rgba(251, 113, 133, 0.1); }
.dir-badge.warn { color: var(--amber); border-color: rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.08); }

/* ------------------------------------------------- §03 parameter breakdown */
.ac-row { display: flex; flex-direction: column; gap: 0.32rem; padding: 0.5rem 0; border-bottom: 1px dashed var(--line); }
.ac-row:last-child { border-bottom: 0; }
.ac-row-top { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; font-size: 0.78rem; color: var(--text-2); flex-wrap: wrap; }
.ac-total {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.8rem;
  margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px solid var(--line-2);
}

/* ------------------------------------------------- §04 Figure 2 Tri-Embedding */
.te-strip { display: flex; gap: 0.4rem; overflow-x: auto; padding: 0.5rem 0.2rem; }
.te-col {
  display: flex; flex-direction: column; gap: 4px; min-width: 4.5rem; padding: 0.4rem;
  border: 1px solid var(--line); border-radius: 9px; background: rgba(8, 13, 24, 0.5);
  cursor: pointer; transition: all 0.15s; font-family: var(--font-mono);
}
.te-col:hover { border-color: rgba(94, 234, 212, 0.45); }
.te-col.sel { border-color: var(--teal); background: rgba(94, 234, 212, 0.1); box-shadow: 0 0 0 1px var(--teal); }
.te-cell { display: block; text-align: center; font-size: 0.74rem; padding: 0.26rem 0.35rem; border-radius: 5px; }
.te-tok { background: rgba(94, 234, 212, 0.12); color: var(--teal); font-weight: 700; }
.te-seg { background: rgba(56, 189, 248, 0.12); color: var(--sky); }
.te-pos { background: rgba(167, 139, 250, 0.12); color: var(--violet); }
.te-cell.off { opacity: 0.3; text-decoration: line-through; }

.te-math { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0.9rem; }
.te-mrow {
  display: grid; grid-template-columns: minmax(13rem, 18rem) 1fr; gap: 0.8rem; align-items: center;
  padding: 0.42rem 0.65rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(5, 8, 14, 0.45);
}
@media (max-width: 760px) { .te-mrow { grid-template-columns: 1fr; } }
.te-mrow.total { border-color: rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.05); }
.te-mlab { font-size: 0.76rem; font-weight: 600; }
.te-vec-cells { display: grid; grid-template-columns: repeat(6, minmax(3.2rem, 1fr)); gap: 0.35rem; }
.te-vcell {
  display: flex; flex-direction: column; align-items: center; padding: 0.22rem 0.3rem;
  border: 1px solid var(--line); border-radius: 6px; background: rgba(8, 13, 24, 0.65); font-family: var(--font-mono);
}
.te-vcell small { font-size: 0.56rem; color: var(--text-3); }
.te-vcell b { font-size: 0.76rem; }

/* ------------------------------------------------- §05 WordPiece */
.wp-input {
  font-family: var(--font-mono); font-size: 0.88rem; color: var(--text);
  background: rgba(5, 8, 14, 0.7); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 0.42rem 0.75rem; min-width: 14rem;
}
.wp-step {
  border: 1px solid var(--line); border-radius: 8px; background: rgba(5, 8, 14, 0.45);
  padding: 0.55rem 0.75rem; margin-bottom: 0.45rem;
}
.wp-step-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.74rem; margin-bottom: 0.35rem; }
.wp-tried { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.wp-try {
  font-family: var(--font-mono); font-size: 0.72rem; padding: 0.16rem 0.48rem;
  border-radius: 5px; border: 1px solid var(--line);
}
.wp-try.miss { color: var(--text-3); background: rgba(148, 163, 184, 0.05); }
.wp-try.hit { color: var(--teal); border-color: rgba(94, 234, 212, 0.5); background: rgba(94, 234, 212, 0.12); font-weight: 700; }

/* ------------------------------------------------- §06 MLM & Table 8 */
.abl-card {
  border: 1px solid var(--line); border-radius: 8px; background: rgba(5, 8, 14, 0.45);
  padding: 0.7rem 0.9rem; margin-bottom: 0.55rem;
}
.abl-top { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.8rem; }
.abl-metrics { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-top: 0.35rem; font-size: 0.75rem; color: var(--text-2); }

/* ------------------------------------------------- §07 NSP */
.nsp-box {
  border: 1px solid var(--line); border-radius: 8px; background: rgba(5, 8, 14, 0.55);
  padding: 0.65rem 0.9rem; font-family: var(--font-mono); font-size: 0.84rem; color: var(--text);
}
.nsp-clue {
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  padding: 0.42rem 0.65rem; border: 1px dashed var(--line-2); border-radius: 7px; font-size: 0.8rem; margin-bottom: 0.4rem;
}

/* ------------------------------------------------- §08 Bidirectional Attention */
.ba-grid { display: flex; flex-direction: column; gap: 3px; overflow-x: auto; padding-bottom: 0.3rem; }
.ba-row {
  display: grid; grid-template-columns: 4.8rem repeat(12, minmax(2.05rem, 1fr)); gap: 3px;
  align-items: center; cursor: pointer; padding: 2px; border-radius: 5px;
}
.ba-row.ba-head { cursor: default; }
.ba-row.sel { outline: 1.5px solid var(--teal); background: rgba(94, 234, 212, 0.05); }
.ba-corner, .ba-row-lbl { font-size: 0.68rem; color: var(--text-2); text-align: right; padding-right: 0.35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ba-col-lbl { font-size: 0.6rem; color: var(--text-3); text-align: center; overflow: hidden; text-overflow: ellipsis; }
.ba-cell {
  height: 26px; border-radius: 4px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.64rem; color: var(--text); border: 1px solid rgba(148, 163, 184, 0.14);
}
.ba-cell.dead { border-style: dashed; border-color: rgba(251, 113, 133, 0.35); color: var(--rose); background: rgba(251, 113, 133, 0.05); }

/* ------------------------------------------------- §09 SQuAD & NER grid */
.sq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 0.5rem; }
.sq-col {
  display: flex; flex-direction: column; gap: 0.22rem; padding: 0.55rem 0.65rem;
  border: 1px solid var(--line); border-radius: 8px; background: rgba(5, 8, 14, 0.55);
}
.sq-col.win { border-color: var(--teal); background: rgba(94, 234, 212, 0.12); box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.35); }

/* ------------------------------------------------- comparison tables */
.cmp-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.cmp-table th, .cmp-table td { padding: 0.72rem 0.9rem; border-bottom: 1px solid var(--line); text-align: left; }
.cmp-table th { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); background: rgba(5, 8, 14, 0.5); }
.cmp-table tr:last-child td { border-bottom: 0; }
.cmp-hl { background: rgba(94, 234, 212, 0.05); color: var(--text); }

/* ------------------------------------------------- footer & kickers */
.cite-note { font-size: 0.8rem; color: var(--text-3); max-width: 78ch; line-height: 1.6; }
.sec-head .kicker { gap: 0.4rem; letter-spacing: 0.22em; }
.sec-head .kicker .knum { display: inline; border: 0; background: none; padding: 0; min-width: 0; height: auto; border-radius: 0; white-space: nowrap; }
.sec-head .kicker .knum::before { content: "— SECTION "; }
.sec-head .kicker .knum::after { content: " ·"; }

/* ------------------------------------------------- static print mode */
html.static .tok-chip { animation: none; transition: none; }

/* ------------------------------------------------- §03b stack explorer & modal */
.bs-stage-card { padding: 1.5rem 1.65rem; }
.bs-top-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.bs-inspector {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.5fr);
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(94, 234, 212, 0.42);
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.09), rgba(8, 14, 26, 0.92));
}
@media (max-width: 820px) { .bs-inspector { grid-template-columns: 1fr; } }
.bs-ins-left { display: flex; flex-direction: column; gap: 0.25rem; }
.bs-ins-kicker { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; color: var(--teal); }
.bs-ins-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; color: #f8fafc; margin: 0; }
.bs-ins-formula {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--amber);
  background: rgba(5, 8, 14, 0.75); border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 7px; padding: 0.35rem 0.65rem; margin-top: 0.25rem; display: inline-block;
}
.bs-ins-right { font-size: 0.88rem; color: #e2e8f0; line-height: 1.58; }
.bs-ins-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }

.gs-wrap {
  width: 100%;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid rgba(94, 234, 212, 0.28);
  background:
    radial-gradient(circle at 50% 42%, rgba(94, 234, 212, 0.08), transparent 62%),
    rgba(4, 8, 15, 0.94);
}
.gs-fig { width: 100%; max-width: 1040px; height: auto; display: block; margin: 0 auto; font-family: var(--font-mono); }
.gs-zone { fill: rgba(10, 17, 30, 0.55); stroke-width: 1.6; stroke-dasharray: 6 4; rx: 14px; }
.gs-zone-in { stroke: rgba(56, 189, 248, 0.45); fill: rgba(56, 189, 248, 0.03); }
.gs-zone-enc { stroke: rgba(94, 234, 212, 0.55); fill: rgba(94, 234, 212, 0.04); }
.gs-zone-head { stroke: rgba(251, 191, 36, 0.5); fill: rgba(251, 191, 36, 0.035); }
.gs-zone-lbl { font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.11em; }
.gs-r { fill: #0d1628; stroke: #475569; stroke-width: 2; transition: fill 0.15s, stroke 0.15s, transform 0.15s; }
.gs-r-an { fill: rgba(251, 191, 36, 0.1); stroke: rgba(251, 191, 36, 0.65); }
.gs-r-hot { stroke: #5eead4; stroke-width: 2.4; fill: rgba(94, 234, 212, 0.14); }
.gs-r-sky { stroke: #38bdf8; stroke-width: 2.2; fill: rgba(56, 189, 248, 0.13); }
.gs-r-violet { stroke: #a78bfa; stroke-width: 2.2; fill: rgba(167, 139, 250, 0.13); }
.gs-t { font-family: var(--font-mono); font-size: 14.5px; font-weight: 700; letter-spacing: 0.03em; fill: #f8fafc; }
.gs-s { font-family: var(--font-mono); font-size: 12px; font-weight: 500; fill: #cbd5e1; }
.gs-a { stroke: #94a3b8; stroke-width: 2.2; fill: none; transition: opacity 0.15s, stroke 0.15s; }
.gs-branch { stroke: #fbbf24; stroke-width: 2; stroke-dasharray: 5 3; }
.gs-looplab { font-family: var(--font-mono); font-size: 13.5px; font-weight: 700; letter-spacing: 0.05em; fill: #fbbf24; }
.gs-lab { font-family: var(--font-mono); font-size: 12px; font-weight: 600; fill: #e2e8f0; }
.gs-nx { font-family: var(--font-mono); font-size: 13px; font-weight: 700; fill: #5eead4; }
.gs-br { stroke: #5eead4; stroke-width: 2; fill: none; }
.gs-plus-c { fill: #0f172a; stroke: #fbbf24; stroke-width: 2.4; }
.gs-plus { stroke: #fbbf24; stroke-width: 2.4; }
.gs-flow { stroke: var(--teal); stroke-width: 3; stroke-dasharray: 3 13; stroke-linecap: round; fill: none; opacity: 0.9; animation: gsFlow 1.25s linear infinite; pointer-events: none; }
.gs-flow-hot { stroke: var(--amber); stroke-width: 3.4; opacity: 1; }
@keyframes gsFlow { to { stroke-dashoffset: -16; } }
@media (prefers-reduced-motion: reduce) { .gs-flow { animation: none; opacity: 0; } }
html.static .gs-flow { animation: none; opacity: 0; }
.gs-blk { cursor: pointer; outline: none; transition: opacity 0.15s; }
.gs-blk:hover .gs-r, .gs-blk:focus-visible .gs-r, .gs-blk.hot .gs-r, .gs-blk:hover .gs-plus-c { stroke: #5eead4; stroke-width: 3; fill: rgba(94, 234, 212, 0.22); }
.gs-fig.trace .gs-blk { opacity: 0.35; }
.gs-fig.trace .gs-blk.hot, .gs-fig.trace .gs-blk:hover { opacity: 1; }
.gs-fig.trace .gs-a { opacity: 0.18; }
.gs-fig.trace .gs-a.hot { opacity: 1; stroke: var(--teal); stroke-width: 2.8; }
.gs-fig.trace .gs-flow { opacity: 0.2; }

.gm-overlay { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.gm-overlay[hidden] { display: none; }
.gm-backdrop { position: absolute; inset: 0; background: rgba(3, 6, 10, 0.76); backdrop-filter: blur(6px); }
body.gm-open { overflow: hidden; }
.gm-card {
  position: relative; z-index: 1; width: min(760px, 100%); max-height: min(88vh, 900px);
  overflow-y: auto; background: #0a0f1a; border: 1px solid rgba(94, 234, 212, 0.35); border-radius: 14px;
  padding: 1.4rem 1.7rem 1.2rem; box-shadow: 0 0 60px rgba(94, 234, 212, 0.08), 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: gmIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes gmIn { from { transform: translateY(14px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }
html.static .gm-card { animation: none; }
.gm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.8rem; margin-bottom: 1rem; }
.gm-kicker { margin: 0; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.16em; color: var(--teal); }
.gm-title { margin: 0.25rem 0 0; font-family: var(--font-display); font-size: 1.35rem; color: var(--text); }
.gm-close {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text-2); font-size: 0.9rem; cursor: pointer; transition: all 0.15s;
}
.gm-close:hover { background: var(--teal); color: #05231f; border-color: var(--teal); }
.gm-formula {
  font-family: var(--font-mono); font-size: 0.9rem; color: var(--text); text-align: center;
  border: 1px solid rgba(94, 234, 212, 0.3); background: rgba(94, 234, 212, 0.05); border-radius: 8px; padding: 0.7rem 0.9rem; margin: 0 0 0.9rem;
}
.gm-note { margin: 0; font-size: 0.92rem; line-height: 1.65; color: var(--text-2); }
.gm-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: 0.8rem; }
.gm-seclink {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--teal); text-decoration: none;
  border: 1px solid rgba(94, 234, 212, 0.45); border-radius: 999px; padding: 0.45rem 0.95rem; transition: all 0.15s;
}
.gm-seclink:hover { background: var(--teal); color: #05231f; }
.gm-esc { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.12em; color: var(--text-3); }
