/* ==========================================================================
   CAS · GPT — Generative Pretrained Transformers — gpt-models.css
   Lecture-09-specific visuals on top of the shared series styles. Layout
   block (topnav/hero/tabs/kickers) copied per the shared-vs-lecture
   contract; everything below it is unique to this lecture's demos.
   ========================================================================== */

/* ------------------------------------------------- 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: 1040px; 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; font-family: var(--font-mono); font-size: 0.85rem; color: var(--text);
  background: rgba(94, 234, 212, 0.08); border: 1px solid rgba(94, 234, 212, 0.35);
  border-radius: 8px; padding: 0.42rem 0.6rem 0.3rem; 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.ghost { opacity: 0.35; border-style: dashed; }
@keyframes tokPop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tok-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 0.8rem; margin-top: 1.1rem; }
.pn-presets { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.7rem; }
.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.32rem 0.75rem;
  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(5.4rem, 10rem) minmax(6rem, 1fr);
  gap: 0.8rem; align-items: center; padding: 0.26rem 0.5rem; border-bottom: 1px dashed var(--line);
}
.qk-row:last-child { border-bottom: 0; }
.qk-row.win { background: rgba(94, 234, 212, 0.05); border-radius: 6px; }
.qk-tok { font-family: var(--font-mono); font-size: 0.82rem; 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% - 4rem); min-width: 3px; background: linear-gradient(90deg, rgba(94, 234, 212, 0.4), rgba(94, 234, 212, 0.9)); }
.qk-w b { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text); min-width: 3.6rem; 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.1em; color: var(--text-2); }
.range-val { color: var(--teal); font-weight: 700; }
.range-wrap input[type="range"] { width: 100%; accent-color: var(--teal); }

/* ------------------------------------------------- §01 hero loop */
.hr-out { margin-top: 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(5, 8, 14, 0.5); padding: 0.9rem 1rem; min-height: 3.4rem; }
.hr-bars { display: flex; flex-direction: column; gap: 0.1rem; min-height: 8rem; }
.hr-bar-row { display: grid; grid-template-columns: minmax(4rem, 7rem) 1fr; gap: 0.8rem; align-items: center; }

/* ------------------------------------------------- §02 lineage */
.lg-wrap { border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(5, 8, 14, 0.5); padding: 0.8rem; }
.lg-svg { width: 100%; max-width: 760px; display: block; height: auto; margin: 0 auto; }
.lg-group { transition: opacity 0.45s, filter 0.45s; }
.lg-cap { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; fill: var(--text-3); }
.lg-r { fill: rgba(8, 13, 24, 0.55); stroke: var(--line-2); stroke-width: 1.2; }
.lg-t { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.05em; fill: var(--text); }
.lg-s { font-family: var(--font-mono); font-size: 8px; fill: var(--text-3); }
.lg-a { stroke: #5b7290; stroke-width: 1.6; fill: none; }
.lg-kv { stroke: var(--sky); stroke-width: 1.8; }
.lg-kvl { font-family: var(--font-mono); font-size: 9px; fill: var(--sky); }
.lg-lab { font-family: var(--font-mono); font-size: 9.5px; fill: var(--text-3); }
.lg-n { font-family: var(--font-mono); font-size: 10px; fill: var(--text-2); }
.lg-att .lg-r { stroke: rgba(94, 234, 212, 0.55); fill: rgba(94, 234, 212, 0.07); }
.lg-att .lg-t { fill: var(--teal); }
.lg-ffn .lg-r { stroke: rgba(167, 139, 250, 0.5); fill: rgba(167, 139, 250, 0.06); }
.lg-ffn .lg-t { fill: var(--violet); }
.lg-xa .lg-r { stroke: rgba(56, 189, 248, 0.55); fill: rgba(56, 189, 248, 0.07); }
.lg-xa .lg-t { fill: var(--sky); }
.lg-an .lg-r { fill: rgba(148, 163, 184, 0.1); stroke: rgba(148, 163, 184, 0.45); }
.lg-io .lg-r { fill: rgba(5, 8, 14, 0.6); stroke: var(--line-2); }
.lg-out .lg-r { stroke: rgba(52, 211, 153, 0.5); fill: rgba(52, 211, 153, 0.05); }
.lg-out .lg-t { fill: var(--green); }

/* ------------------------------------------------- §03 objective */
.nt-grid { display: grid; grid-template-columns: minmax(300px, 1.1fr) minmax(280px, 1fr); gap: 1.4rem; }
@media (max-width: 880px) { .nt-grid { grid-template-columns: 1fr; } }
.nt-mask { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; max-width: 300px; }
.nt-cell {
  height: 30px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.8rem; border: 1px solid var(--line);
  background: rgba(8, 13, 24, 0.55); color: var(--text);
}
.nt-cell.ok { border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.08); color: var(--green); }
.nt-cell.no { border-style: dashed; border-color: rgba(251, 113, 133, 0.4); color: var(--rose); opacity: 0.7; }
.nt-cell.sel { outline: 2px solid rgba(94, 234, 212, 0.55); outline-offset: -1px; }

/* ------------------------------------------------- §04 BPE */
.bp-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.3fr); gap: 1.4rem; }
@media (max-width: 880px) { .bp-grid { grid-template-columns: 1fr; } }
.bp-merges { display: flex; flex-direction: column; gap: 0.3rem; max-height: 20rem; overflow-y: auto; }
.bp-merge {
  display: flex; gap: 0.6rem; align-items: center;
  border: 1px solid var(--line); border-radius: 7px; background: rgba(8, 13, 24, 0.45); padding: 0.35rem 0.6rem;
  animation: tokPop 0.25s ease;
}
.bp-mnum { font-family: var(--font-mono); font-size: 0.6rem; color: var(--teal); border: 1px solid rgba(94, 234, 212, 0.4); border-radius: 5px; padding: 0.05rem 0.35rem; }
.bp-mrule { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text); }
.bp-corpus, .bp-probe-list { display: flex; flex-direction: column; gap: 0.3rem; }
.bp-word, .bp-probe { display: flex; gap: 0.7rem; align-items: center; border-bottom: 1px dashed var(--line); padding: 0.28rem 0.1rem; }
.bp-word:last-child, .bp-probe:last-child { border-bottom: 0; }
.bp-word b, .bp-probe b { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-3); margin-left: auto; }
.bp-pw { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-2); min-width: 5.2rem; }
.bp-toks { display: flex; gap: 3px; flex-wrap: wrap; }
.bp-toks i {
  font-style: normal; font-family: var(--font-mono); font-size: 0.74rem; color: var(--sky);
  background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.4); border-radius: 6px; padding: 0.14rem 0.4rem;
}

/* ------------------------------------------------- §05 pre-LN */
.pl-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 760px) { .pl-figs { grid-template-columns: 1fr; } }
.pl-diagram { border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(5, 8, 14, 0.5); padding: 1rem 1rem 0.7rem; }
.pl-diagram .pl-step { display: flex; align-items: center; gap: 0.7rem; margin: 0 0 0.55rem; }
.pl-diagram .pl-step span { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-2); }
.pl-diagram .pl-step em { font-style: normal; font-family: var(--font-mono); font-size: 0.6rem; color: var(--text-3); border: 1px solid var(--line-2); border-radius: 5px; padding: 0.08rem 0.4rem; }
.pl-diagram .pl-arrow { color: var(--text-3); text-align: center; font-size: 0.8rem; line-height: 1; margin-bottom: 0.55rem; }
.pl-diagram .pl-step .lnbox { color: var(--amber); border-color: rgba(251, 191, 36, 0.4); }
.pl-bars { display: flex; flex-direction: column; gap: 0.7rem; }
.pl-bar-row { display: grid; grid-template-columns: 4.4rem 1fr minmax(6.5rem, auto); gap: 0.8rem; align-items: center; }
.pl-bar-row span { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-2); }
.pl-barwrap { height: 16px; border-radius: 8px; background: rgba(148, 163, 184, 0.1); overflow: hidden; }
.pl-barwrap i { display: block; height: 100%; border-radius: 8px; transition: width 0.3s; }
.pl-barwrap i.post { background: linear-gradient(90deg, rgba(251, 113, 133, 0.5), var(--rose)); }
.pl-barwrap i.pre { background: linear-gradient(90deg, rgba(94, 234, 212, 0.5), var(--teal)); }
.pl-bar-row b { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text); text-align: right; }

/* ------------------------------------------------- §06 scale */
.sc-lab { display: grid; grid-template-columns: minmax(340px, 1.3fr) minmax(280px, 1fr); gap: 1.4rem; align-items: start; }
@media (max-width: 920px) { .sc-lab { grid-template-columns: 1fr; } }
#scCanvas { display: block; border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(5, 8, 14, 0.6); }
.sc-row { display: grid; grid-template-columns: minmax(7rem, 9rem) 1fr; gap: 0.9rem; padding: 0.6rem 0.2rem; border-bottom: 1px dashed var(--line); }
.sc-row:last-child { border-bottom: 0; }
.sc-name { font-family: var(--font-display); font-size: 0.95rem; color: var(--teal); }
.sc-cells { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.sc-cells i {
  font-style: normal; font-family: var(--font-mono); font-size: 0.66rem; color: var(--text-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.14rem 0.45rem; background: rgba(8, 13, 24, 0.45);
}
.sc-mode { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; color: var(--amber); border: 1px solid rgba(251, 191, 36, 0.4); border-radius: 6px; padding: 0.14rem 0.5rem; height: fit-content; }
.sc-note { grid-column: 1 / -1; margin: 0.25rem 0 0; font-size: 0.82rem; color: var(--text-2); line-height: 1.5; }

/* ------------------------------------------------- §07 sampling */
.sm-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 1.1rem; }

/* ------------------------------------------------- §08 kv cache */
.kv-stage { border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(5, 8, 14, 0.5); padding: 1rem 1.1rem; }
.kv-grid { display: flex; gap: 4px; flex-wrap: wrap; }
.kv-cell { width: 30px; height: 22px; border-radius: 5px; border: 1px dashed var(--line-2); transition: all 0.25s; }
.kv-cell.full { border-style: solid; border-color: rgba(94, 234, 212, 0.5); background: rgba(94, 234, 212, 0.12); }
.kv-meters { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.9rem; }
.kv-meter-row { display: grid; grid-template-columns: minmax(15rem, 22rem) 1fr minmax(7rem, auto); gap: 0.9rem; align-items: center; }
.kv-meter-row span { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-2); }
.kv-barwrap { height: 14px; border-radius: 7px; background: rgba(148, 163, 184, 0.1); overflow: hidden; }
.kv-barwrap i { display: block; height: 100%; border-radius: 7px; transition: width 0.3s; }
.kv-barwrap i.no { background: linear-gradient(90deg, rgba(251, 113, 133, 0.5), var(--rose)); }
.kv-barwrap i.yes { background: linear-gradient(90deg, rgba(94, 234, 212, 0.5), var(--teal)); }
.kv-meter-row b { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text); text-align: right; }

/* ------------------------------------------------- §09 context */
.cx-strip { border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(5, 8, 14, 0.5); padding: 0.9rem 1rem; }
.cx-chip.in { border-color: rgba(94, 234, 212, 0.45); }
.cx-chip.out { opacity: 0.25; border-style: dashed; }

/* ------------------------------------------------- §10 few-shot */
.fs-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 760px) { .fs-controls { grid-template-columns: 1fr; } }
.fs-grid { display: grid; grid-template-columns: minmax(300px, 1.15fr) minmax(260px, 1fr); gap: 1.4rem; }
@media (max-width: 880px) { .fs-grid { grid-template-columns: 1fr; } }
.fs-prompt {
  margin: 0; border: 1px solid var(--line); border-radius: var(--radius-s); background: #09101d;
  padding: 0.9rem 1rem; font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.6; color: var(--text);
  white-space: pre-wrap; min-height: 12rem;
}
.fs-out { border: 1px solid rgba(94, 234, 212, 0.35); border-radius: var(--radius-s); background: rgba(94, 234, 212, 0.05); padding: 0.9rem 1rem; font-size: 1.4rem; min-height: 3.4rem; }
.fs-out .ok { color: var(--green); font-size: 0.9rem; }
.fs-out .bad { color: var(--rose); font-size: 0.9rem; }

/* ------------------------------------------------- §11 RLHF */
.rh-stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
@media (max-width: 880px) { .rh-stages { grid-template-columns: 1fr; } }
.rh-stage { border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(8, 13, 24, 0.4); padding: 0.9rem 1rem; opacity: 0.55; transition: all 0.3s; }
.rh-stage b { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--text-2); }
.rh-stage p { margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--text-3); line-height: 1.5; }
.rh-stage.on { opacity: 1; border-color: rgba(94, 234, 212, 0.5); background: rgba(94, 234, 212, 0.04); }
.rh-stage.on b { color: var(--teal); }
.rh-stage.done { opacity: 0.85; }
.rh-choice {
  display: flex; flex-direction: column; gap: 0.35rem; width: 100%; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(8, 13, 24, 0.45);
  padding: 0.8rem 1rem; margin-bottom: 0.5rem; cursor: pointer; transition: border-color 0.2s, background 0.2s;
  font-family: inherit;
}
.rh-choice:hover { border-color: rgba(94, 234, 212, 0.5); background: rgba(94, 234, 212, 0.04); }
.rh-choice b { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.08em; color: var(--teal); }
.rh-choice span { font-size: 0.85rem; color: var(--text-2); line-height: 1.5; }

/* ------------------------------------------------- footer */
.cite-note { font-size: 0.8rem; color: var(--text-3); max-width: 70ch; line-height: 1.6; }

/* ------------------------------------ series-standard section kickers */
.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, html.static .bp-merge { animation: none; transition: none; }

/* ------------------------------------------------- §02 GPT stack explorer */
.gs-wrap { width: 100%; }
.gs-fig { width: 100%; max-width: 760px; height: auto; display: block; margin: 0 auto; font-family: var(--font-mono); }
.gs-r { fill: rgba(8, 13, 24, 0.6); stroke: var(--line-2); stroke-width: 1.3; transition: fill 0.15s, stroke 0.15s; }
.gs-r-an { fill: rgba(148, 163, 184, 0.08); }
.gs-r-hot { stroke: rgba(94, 234, 212, 0.55); fill: rgba(94, 234, 212, 0.07); }
.gs-t { font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; fill: var(--text); }
.gs-s { font-family: var(--font-mono); font-size: 9px; fill: var(--text-3); }
.gs-a { stroke: #5b7290; stroke-width: 1.6; fill: none; transition: opacity 0.15s, stroke 0.15s; }
.gs-branch { stroke: #56617a; stroke-width: 1.1; }
.gs-loop { stroke: var(--amber); stroke-width: 2.1; }
.gs-looplab { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.18em; fill: var(--amber); }
.gs-lab { font-family: var(--font-mono); font-size: 10px; fill: var(--text-3); }
.gs-nx { font-family: var(--font-mono); font-size: 11.5px; fill: var(--text-2); }
.gs-br { stroke: #6b7177; stroke-width: 1.1; fill: none; }
.gs-plus-c { fill: rgba(5, 8, 14, 0.85); stroke: #878d93; stroke-width: 1.5; }
.gs-plus { stroke: #9aa4ad; stroke-width: 1.5; }
.gs-flow { stroke: var(--teal); stroke-width: 2.4; stroke-dasharray: 2 13; stroke-linecap: round; fill: none; opacity: 0.8; animation: gsFlow 1.25s linear infinite; pointer-events: none; }
.gs-flow-hot { stroke: var(--amber); stroke-width: 2.8; opacity: 0.95; }
@keyframes gsFlow { to { stroke-dashoffset: -15; } }
@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:hover .gs-plus-c { stroke: var(--teal); stroke-width: 2.2; fill: rgba(94, 234, 212, 0.12); }
.gs-fig.trace .gs-blk { opacity: 0.38; }
.gs-fig.trace .gs-blk.hot, .gs-fig.trace .gs-blk:hover { opacity: 1; }
.gs-fig.trace .gs-a { opacity: 0.14; }
.gs-fig.trace .gs-a.hot { opacity: 1; stroke: var(--teal); stroke-width: 2; }
.gs-fig.trace .gs-loop.hot { stroke: var(--amber); }
.gs-fig.trace .gs-flow { opacity: 0.15; }

/* ------------------------------------------------- §02b drill-down modal */
.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(860px, 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.92rem; 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 0 1rem; font-size: 0.92rem; line-height: 1.6; 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); }

/* micro-lab primitives inside the modal */
.gmk-lab { margin: 0.9rem 0 0.4rem; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em; color: var(--text-3); }
.gmk-stage { border: 1px solid var(--line); background: rgba(5, 8, 14, 0.55); border-radius: 8px; padding: 0.55rem; }
.gmk-read { margin: 0.7rem 0 0; font-size: 0.86rem; line-height: 1.6; color: var(--text-2); }
.gmk-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.6rem; }
.gmk-chip {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--text); border: 1px solid var(--line-2);
  background: var(--panel-2); border-radius: 7px; padding: 0.32rem 0.6rem; animation: tokPop 0.25s ease;
}
.gmk-chip.btn { cursor: pointer; transition: all 0.14s; }
.gmk-chip.btn.on { border-color: var(--teal); background: rgba(94, 234, 212, 0.15); color: var(--teal); font-weight: 700; }
.gm-mini-btn {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; color: var(--teal);
  border: 1px solid rgba(94, 234, 212, 0.45); background: none; border-radius: 999px; padding: 0.45rem 0.9rem; cursor: pointer; transition: all 0.15s;
}
.gm-mini-btn:hover { background: var(--teal); color: #05231f; }
.gm-mini-btn:disabled { opacity: 0.5; cursor: default; }
.gmk-row { display: grid; grid-template-columns: minmax(5rem, 9rem) minmax(6rem, 1fr); gap: 0.8rem; align-items: center; padding: 0.26rem 0.5rem; border-bottom: 1px dashed var(--line); }
.gmk-row:last-child { border-bottom: 0; }
.gmk-row.win { background: rgba(94, 234, 212, 0.05); border-radius: 6px; }
.gmk-row.off .gmk-w i { opacity: 0.15; }
.gmk-tok { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text); }
.gmk-w { display: flex; align-items: center; gap: 0.5rem; }
.gmk-w i { display: block; height: 10px; border-radius: 5px; flex: 1; max-width: calc(100% - 4rem); min-width: 3px; background: linear-gradient(90deg, rgba(94, 234, 212, 0.4), rgba(94, 234, 212, 0.9)); }
.gmk-w b { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text); min-width: 3.6rem; text-align: right; }
.gmk-wrow { display: flex; gap: 10px; align-items: flex-end; height: 86px; margin-top: 0.7rem; padding-left: 0.4rem; }
.gmk-wcell { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; height: 100%; }
.gmk-wcell i { display: block; width: 70%; max-width: 40px; border-radius: 3px 3px 0 0; background: #6b7280; }
.gmk-wcell.win i { background: var(--teal); }
.gmk-wcell b { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text-2); }
.gmk-wcell em { font-style: normal; font-family: var(--font-mono); font-size: 0.58rem; color: var(--text-3); }
.gmk-units { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.gmk-unit { display: inline-flex; flex-direction: column; align-items: center; gap: 0.1rem; border: 1px solid rgba(94, 234, 212, 0.5); border-radius: 8px; background: rgba(94, 234, 212, 0.08); padding: 0.32rem 0.6rem 0.26rem; }
.gmk-unit b { font-family: var(--font-mono); font-size: 0.85rem; color: var(--teal); }
.gmk-unit i { font-style: normal; font-family: var(--font-mono); font-size: 0.56rem; color: var(--text-3); }
.gmk-unit.dead { border-style: dashed; border-color: var(--line-2); background: none; }
.gmk-unit.dead b { color: var(--text-3); }
.gmk-lnrow { display: grid; grid-template-columns: minmax(8rem, 11rem) 1fr; gap: 0.8rem; align-items: center; margin-bottom: 0.45rem; }
.gmk-lnlab { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-2); text-align: right; }
.gmk-lnbars { display: flex; gap: 8px; align-items: flex-end; height: 64px; }
.gmk-lncell { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; }
.gmk-lncell i { display: block; width: 62%; max-width: 34px; border-radius: 3px; position: absolute; bottom: 16px; }
.gmk-lncell.pos i { background: var(--teal); }
.gmk-lncell.neg i { background: var(--rose); }
.gmk-lncell b { position: absolute; bottom: 0; font-family: var(--font-mono); font-size: 0.56rem; color: var(--text-3); font-weight: 500; }
.gmk-preln { display: flex; flex-direction: column; gap: 0.25rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(8, 13, 24, 0.45); padding: 0.6rem 0.8rem; margin-bottom: 0.5rem; }
.gmk-preln b { font-family: var(--font-mono); font-size: 0.68rem; color: var(--teal); }
.gmk-preln code { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text); }
.gmk-preln span { font-size: 0.78rem; color: var(--text-3); }
.gs-mini-r { fill: rgba(94, 234, 212, 0.06); stroke: rgba(94, 234, 212, 0.4); stroke-width: 1.2; }
.gs-mini-r.an { fill: rgba(148, 163, 184, 0.08); stroke: rgba(148, 163, 184, 0.4); }
.gs-mini-r.dead { stroke-dasharray: 4 3; fill: rgba(251, 113, 133, 0.05); stroke: rgba(251, 113, 133, 0.4); }
.gs-mini-r.sel { stroke: var(--teal); stroke-width: 2; }
.gs-mini-t { font-family: var(--font-mono); font-size: 8.5px; fill: var(--text-2); }
