/* =====================================================================
   Theory: topic list on the left, the topic card in the middle, and the
   topic's mechanism from Nodes on the right.
   ===================================================================== */
#view-theory{
  --th-rail:292px; --th-side:348px;
  display:grid; grid-template-columns:var(--th-rail) minmax(0,1fr) var(--th-side);
}
#view-theory.home{grid-template-columns:var(--th-rail) minmax(0,1fr)}
#view-theory.home .th-side{display:none}

/* ---------------- rail ---------------- */
.th-rail{display:flex; flex-direction:column; min-height:0; background:var(--surface); border-right:1px solid var(--line)}
.th-rail-head{padding:16px 14px 12px; display:flex; flex-direction:column; gap:10px; border-bottom:1px solid var(--line-2)}
.th-search{position:relative}
.th-search svg{position:absolute; left:11px; top:10px; width:16px; height:16px; fill:none; stroke:var(--muted); stroke-width:1.9; stroke-linecap:round; pointer-events:none}
.th-search .search{padding-left:34px}
.th-toggles{display:flex; gap:6px; flex-wrap:wrap}
.th-progress{display:flex; align-items:center; gap:10px; font-family:var(--font-mono); font-size:11px; color:var(--muted)}
.th-progress .bar{flex:1; height:5px; border-radius:5px; background:var(--sunken); overflow:hidden}
.th-progress .bar i{display:block; height:100%; border-radius:5px; background:var(--accent); transition:width .4s ease}
.th-progress b{color:var(--ink); font-weight:600}

.th-source{display:flex; flex-wrap:wrap; gap:2px 8px; font-size:11px; line-height:1.4; color:var(--faint)}
.th-source span:first-child{color:var(--muted); font-weight:600}
.th-toc{flex:1; overflow-y:auto; min-height:0; padding:0 8px 28px}
.toc-b{margin-top:2px}
.toc-bh{
  position:sticky; top:0; z-index:1; display:grid; grid-template-columns:26px minmax(0,1fr) auto; gap:6px; align-items:baseline;
  padding:12px 8px 6px; margin:0 -8px; padding-left:16px; padding-right:16px;
  background:var(--surface); box-shadow:0 6px 8px -8px color-mix(in srgb,var(--ink) 25%,transparent);
  text-decoration:none; color:var(--muted);
}
.toc-bh .bn{font-family:var(--font-display); font-weight:750; font-size:12px; color:var(--accent); line-height:1; font-variant-numeric:tabular-nums}
.toc-bh .bt{font-family:var(--font-mono); font-size:10px; letter-spacing:.11em; text-transform:uppercase; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.toc-bh .bc{font-family:var(--font-mono); font-size:10px; color:var(--faint)}
.toc-bh:hover .bt{color:var(--ink)}
.toc-i{
  display:grid; grid-template-columns:26px minmax(0,1fr) 15px; gap:6px; align-items:center;
  padding:5px 8px; border-radius:8px; color:var(--ink-2); text-decoration:none; font-size:13px; line-height:1.3;
}
.toc-i:hover{background:var(--surface-2); color:var(--ink)}
.toc-i .n{font-family:var(--font-mono); font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums}
.toc-i.on{background:var(--accent-soft); color:var(--ink); font-weight:600}
.toc-i.on .n{color:var(--accent)}
.toc-i .tick{width:13px; height:13px; border-radius:50%; border:1.5px solid var(--line); position:relative}
.toc-i.read .tick{border-color:var(--accent); background:var(--accent)}
.toc-i.read .tick::after{content:""; position:absolute; left:3.5px; top:1.3px; width:3px; height:6px; border:solid var(--on-accent); border-width:0 1.6px 1.6px 0; transform:rotate(45deg)}
.toc-i .hits{font-family:var(--font-mono); font-size:9.5px; color:var(--accent); margin-left:4px; font-weight:500}
.toc-none{color:var(--muted); font-size:13px; padding:18px 10px}

/* ---------------- main column ---------------- */
.th-main{overflow-y:auto; overflow-x:hidden; min-height:0; outline:none; position:relative}
.th-mbar{display:none}
.th-scrim{display:none}

/* ---------------- topic ---------------- */
.th-topic{max-width:840px; margin:0 auto; padding:34px 48px 90px}
.th-crumbs{display:flex; gap:8px; flex-wrap:wrap; font-family:var(--font-mono); font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; color:var(--muted)}
.th-crumbs a{color:inherit; text-decoration:none}
.th-crumbs a:hover{color:var(--accent)}
.th-crumbs span{color:var(--faint)}
.th-titlerow{display:grid; grid-template-columns:auto minmax(0,1fr); gap:6px 20px; align-items:start; margin:18px 0 0}
.th-num{
  font-family:var(--font-display); font-weight:200; font-size:76px; line-height:.8; color:var(--accent);
  letter-spacing:-.05em; padding-top:2px; min-width:.9em; font-variant-numeric:lining-nums tabular-nums;
}
.th-topic h1{
  font-family:var(--font-display); font-weight:750; font-size:clamp(27px,2.7vw,36px); line-height:1.12;
  letter-spacing:-.03em; margin:0; text-wrap:balance;
}
.th-meta{font-family:var(--font-mono); font-size:11.5px; color:var(--muted); margin:10px 0 0}
.th-actions{display:flex; gap:8px; flex-wrap:wrap; margin:22px 0 0}
.th-actions .primary{background:var(--nodes); border-color:var(--nodes)}
.th-actions [data-read][aria-pressed="true"]{border-color:var(--accent-line); color:var(--accent); background:var(--accent-soft)}
.only-drawer{display:none!important}

/* the plan: numbered sections, stacked, joined by a thin line */
.th-plan{
  margin:28px 0 6px; background:var(--surface); border:1px solid var(--line); border-radius:16px;
  box-shadow:var(--shadow-sm); scroll-margin-top:18px; overflow:hidden;
}
.plan-h{display:flex; justify-content:space-between; align-items:center; padding:13px 18px 11px; border-bottom:1px solid var(--line-2); background:var(--surface-2)}
.plan-t{font-size:11px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; color:var(--accent)}
.plan-c{font-size:12px; color:var(--muted); font-variant-numeric:tabular-nums}
.th-plan ol{list-style:none; margin:0; padding:8px; position:relative}
.th-plan ol::before{   /* the spine through the numbers */
  content:""; position:absolute; left:29px; top:22px; bottom:22px; width:2px; border-radius:2px; background:var(--line-2);
}
.th-plan li{margin:0; padding:0}
.plan-i{
  position:relative; display:grid; grid-template-columns:28px minmax(0,1fr) auto; gap:14px; align-items:center;
  width:100%; padding:8px 12px 8px 8px; border:0; border-radius:10px; background:transparent; cursor:pointer;
  text-align:left; font:inherit; font-size:14.5px; line-height:1.35; color:var(--ink); transition:background .15s;
}
.plan-i:hover{background:color-mix(in srgb,var(--c) 7%,transparent)}
.plan-i .pn{
  width:28px; height:28px; border-radius:9px; display:grid; place-items:center; position:relative; z-index:1;
  font-size:12.5px; font-weight:700; font-variant-numeric:tabular-nums; color:var(--c);
  background:color-mix(in srgb,var(--c) 13%,var(--surface)); box-shadow:0 0 0 3px var(--surface);
  transition:background .15s, color .15s;
}
.plan-i .pt{font-weight:600; letter-spacing:-.01em}
.plan-i .pk{font-size:10.5px; font-weight:650; letter-spacing:.1em; text-transform:uppercase; color:var(--c); opacity:.8; white-space:nowrap}
.plan-i.on .pn,.plan-i:hover .pn{background:var(--c); color:var(--surface)}
.plan-i.on{background:color-mix(in srgb,var(--c) 9%,transparent)}

/* the slim bar that shows the current section once the plan is out of view */
.th-now{position:sticky; top:0; height:0; z-index:6}
.now-in{
  position:absolute; left:-10px; right:-10px; top:10px; display:flex; align-items:center; gap:10px;
  padding:5px 6px 5px 5px; border-radius:12px; border:1px solid var(--line);
  background:var(--surface); box-shadow:var(--shadow); opacity:0; transform:translateY(-8px); pointer-events:none; transition:opacity .18s, transform .18s;
}
.th-now.show .now-in{opacity:1; transform:none; pointer-events:auto}
.th-now{--c:var(--accent)}
.now-plan{
  display:inline-flex; align-items:center; gap:6px; border:1px solid var(--line); background:var(--surface-2); border-radius:8px;
  padding:4px 10px 4px 8px; font-size:12px; font-weight:600; color:var(--ink-2); cursor:pointer;
}
.now-plan:hover{border-color:var(--accent-line); color:var(--accent)}
.now-plan svg,.now-step svg{width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round}
.now-n{font-size:11.5px; font-weight:700; font-variant-numeric:tabular-nums; color:var(--surface); background:var(--c); border-radius:6px; padding:2px 7px}
.now-t{flex:1; min-width:0; font-size:13.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.now-step{width:30px; height:28px; display:grid; place-items:center; border:1px solid transparent; background:transparent; border-radius:8px; color:var(--muted); cursor:pointer}
.now-step:hover{border-color:var(--line); color:var(--ink)}

/* ---------------- the card's content ---------------- */
.th-body{font-size:15.5px; line-height:1.7; color:var(--ink); padding-top:6px}
.th-body .blk{padding:28px 0 6px; scroll-margin-top:64px; --c:var(--muted)}
.th-body .blk + .blk{border-top:1px dashed var(--line)}
.th-body .blk > h3,.th-body .hy > h3{
  display:inline-flex; align-items:center; gap:8px; margin:0 0 14px; padding:4px 11px 4px 9px; border-radius:7px;
  font-family:var(--font-mono); font-size:11px; font-weight:600; letter-spacing:.12em; text-transform:uppercase;
  color:var(--c); background:color-mix(in srgb,var(--c) 10%,transparent);
}
.th-body .blk > h3::before{content:""; width:7px; height:7px; border-radius:2px; background:var(--c)}
.th-body h3:has(.hn)::before{display:none}
.th-body h3 .hn{display:inline-grid; place-items:center; min-width:19px; height:19px; padding:0 5px; margin-left:-3px; border-radius:6px;
  background:var(--c); color:var(--surface); font-size:10.5px; font-weight:700; letter-spacing:0; font-variant-numeric:tabular-nums}
.th-body .def{--c:var(--c-def)} .th-body .eti{--c:var(--c-eti)} .th-body .mech{--c:var(--c-mech)}
.th-body .cls{--c:var(--c-cls)} .th-body .clin{--c:var(--c-clin)}
.th-body p{margin:0 0 13px; max-width:72ch}
.th-body ul,.th-body ol{margin:0 0 13px; padding-left:21px; max-width:72ch}
.th-body li{margin-bottom:6px; padding-left:2px}
.th-body li::marker{color:var(--faint)}
.th-body ul ul,.th-body ol ul{margin:6px 0 2px}
.th-body b,.th-body strong{font-weight:600}
.th-body em.term{font-style:normal; font-weight:600; background:linear-gradient(transparent 58%, color-mix(in srgb,var(--c,var(--accent)) 18%,transparent) 58%)}
.th-body .lat{font-style:italic; color:var(--ink-2)}
.th-body sub,.th-body sup{line-height:0}
.th-body code{font-size:.85em}

/* lists written with middle dots in the notes, one item per line */
.th-body .dotlist{margin:0 0 13px; max-width:72ch}
.th-body .dotlist > p{margin:0 0 4px}
.th-body ul.dots{list-style:none; margin:4px 0 13px; padding-left:18px; max-width:72ch}
.th-body .dotlist > ul.dots{margin-bottom:0}
.th-body ul.dots > li{position:relative; margin-bottom:5px; padding-left:0}
.th-body ul.dots > li::before{   /* the notes' own ·, kept as the bullet */
  content:"\B7"; position:absolute; left:-15px; top:0; width:10px; text-align:center;
  font-weight:900; color:var(--c,var(--accent)); transform:scale(1.7); transform-origin:50% 55%;
}
.th-body li > ul.dots{margin:5px 0 3px}
.th-body td ul.dots,.th-body th ul.dots{margin:2px 0 0; padding-left:14px}
.th-body td ul.dots > li,.th-body th ul.dots > li{margin-bottom:3px}
.th-body td ul.dots > li::before,.th-body th ul.dots > li::before{left:-13px}
.th-body td .dl-lead{margin-bottom:2px}
.th-body .chain ul.dots{margin:0; padding-left:16px; max-width:none}
.th-body .chain ul.dots > li{margin-bottom:2px}
.th-body .chain ul.dots > li::before{color:var(--c-mech)}
.th-body .chain .dl-lead{margin-bottom:2px}

/* mechanism chains: the arrows are the point */
.th-body .chain{
  position:relative; margin:6px 0 16px; padding:13px 18px 13px 20px; max-width:none;
  background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow-sm);
  font-size:14.8px; line-height:1.85; overflow-x:auto;
}
.th-body .chain::before{content:""; position:absolute; left:0; top:12px; bottom:12px; width:3px; border-radius:0 3px 3px 0; background:var(--c-mech)}
.th-body .chain .ar{color:var(--c-mech); font-weight:700; padding:0 4px}
.th-body .chain b{font-weight:650}
.nref{
  font:inherit; color:inherit; background:none; border:0; margin:0; padding:0 2px; cursor:pointer; border-radius:4px;
  text-decoration:underline dotted color-mix(in srgb,var(--nodes) 75%,transparent); text-decoration-thickness:1.6px; text-underline-offset:4px;
  transition:background .12s, color .12s;
}
.nref.x{text-decoration-style:solid; text-decoration-color:color-mix(in srgb,var(--nodes) 55%,transparent)}
.nref:hover,.nref.on{background:color-mix(in srgb,var(--nodes) 15%,transparent); color:var(--ink); text-decoration-color:var(--nodes)}
.nref.on{box-shadow:0 0 0 1px color-mix(in srgb,var(--nodes) 50%,transparent)}

.th-body .tblwrap{overflow-x:auto; margin:6px 0 18px; border:1px solid var(--line); border-radius:12px; background:var(--surface); box-shadow:var(--shadow-sm)}
.th-body table{border-collapse:collapse; width:100%; font-size:13.8px; line-height:1.55; min-width:460px}
.th-body th,.th-body td{text-align:left; vertical-align:top; padding:9px 14px; border-bottom:1px solid var(--line-2)}
.th-body thead th{
  font-family:var(--font-mono); font-size:10.5px; letter-spacing:.08em; text-transform:uppercase; font-weight:600;
  color:var(--muted); background:var(--surface-2); border-bottom-color:var(--line);
}
.th-body tbody th{font-weight:600; color:var(--ink); background:var(--surface-2); white-space:nowrap; width:1%}
.th-body tbody tr:last-child > *{border-bottom:0}
.th-body tbody tr:hover > td{background:color-mix(in srgb,var(--accent) 3.5%,transparent)}

.th-body .hy{
  --c:var(--hy-ink); position:relative; margin:30px 0 8px; padding:20px 24px 18px; border-radius:16px;
  background:var(--hy-bg); border:1px solid var(--hy-line); scroll-margin-top:64px;
}
.th-body .hy > h3{background:color-mix(in srgb,var(--hy-line) 30%,transparent)}
.th-body .hy > h3::before{content:"★"; font-size:12px; letter-spacing:0}
.th-body .hy ul{margin:0; padding-left:20px; max-width:none}
.th-body .hy li{color:var(--ink-2)}
.th-body .hy li::marker{color:var(--hy-line)}
.th-body .hy li:last-child{margin-bottom:0}

.th-body figure.fig{margin:8px 0 18px; padding:16px 16px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface); color:var(--ink-2)}
.th-body figure.fig svg{display:block; width:100%; height:auto}
.th-body figcaption{font-size:12.5px; color:var(--muted); margin-top:8px; line-height:1.5}

/* cram mode: high-yield boxes only */
#view-theory.th-cram .th-body .blk{display:none}
#view-theory.th-cram .th-body .hy{margin-top:12px}
#view-theory.th-cram .th-plan,#view-theory.th-cram .th-now{display:none}

/* sentence opened from Nodes, and filter matches */
::highlight(ps-quote){background-color:color-mix(in srgb,var(--nodes) 28%,transparent); color:var(--ink)}
::highlight(ps-term){background-color:var(--mark); color:var(--ink)}
.th-body .pulse{animation:pulse 2.4s ease-out}
@keyframes pulse{0%,35%{box-shadow:0 0 0 6px color-mix(in srgb,var(--nodes) 22%,transparent); background:color-mix(in srgb,var(--nodes) 7%,transparent)} 100%{box-shadow:0 0 0 0 transparent}}

/* pager */
.th-pager{display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:46px; padding-top:26px; border-top:1px solid var(--line)}
.pg{
  display:flex; flex-direction:column; gap:4px; padding:15px 18px 16px; border:1px solid var(--line); border-radius:14px;
  background:var(--surface); color:var(--ink); text-decoration:none; transition:border-color .15s, transform .15s, box-shadow .15s;
}
.pg:hover{border-color:var(--accent-line); box-shadow:var(--shadow); transform:translateY(-1px)}
.pg .d{font-family:var(--font-mono); font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; color:var(--muted)}
.pg .t{font-family:var(--font-display); font-size:16px; font-weight:680; line-height:1.3; letter-spacing:-.018em}
.pg.next{text-align:right; grid-column:2}

/* ---------------- home ---------------- */
.th-home{max-width:1220px; margin:0 auto; padding:44px 44px 90px}
.hero{
  display:grid; grid-template-columns:minmax(0,1.55fr) minmax(280px,1fr); gap:40px; align-items:center;
  padding-bottom:34px; margin-bottom:30px; border-bottom:1px solid var(--line);
}
/* the logo, large, with the moon orbiting (the orbit traces itself in first) */
/* sized from its own column, so it never runs into the card beside it */
.hero .hero-logo{container-type:inline-size; margin:0; font-weight:760; line-height:1}
.hero .hero-logo em{font-weight:300; position:relative}
.hl-in{display:flex; align-items:center; gap:.3em; font-size:min(70px,13.4cqi); letter-spacing:-.04em}
/* "From Skripta, with ♥" hangs beside the p's descender with the heart centred
   under the last e: the e's middle is .223 of the wordmark's size in from the end
   of "Sphere", and the heart sits in a 1em box. Its baseline is on the bottom of
   the descender (1.174 below the top of "Sphere"; at line-height 1.2 a line's
   baseline is .9635 of its size below its top). --s is its size: the line is
   9.83 of it wide, so at .195 of the wordmark it starts just right of the p's stem. */
.hl-in{padding-bottom:.07em}
.hl-tag{
  --s:.195em; position:absolute; right:calc(.223em - .5 * var(--s)); top:calc(1.174em - .9635 * var(--s));
  font-weight:400; letter-spacing:normal; line-height:1.2; white-space:nowrap; color:var(--muted);
}
.hl-tag > span{display:block; font-size:var(--s)}
.hl-heart{display:inline-block; width:1em; text-align:center; letter-spacing:0; color:var(--ecg)}
/* smaller than 11px it would be hard to read, so it keeps 11px and moves just
   under the descender (the heart stays under the e) */
@container (max-width:420px){
  .hl-in{padding-bottom:calc(.07em + 17px)}
  .hl-tag{--s:11px; top:calc(100% + 3px)}
}
.hl-in > span{animation:hl-word .6s .15s cubic-bezier(.2,.8,.2,1) both}
.hl-mark{width:1.75em; height:auto; flex:none; overflow:visible}
.hl-planet{fill:var(--bg); stroke:var(--ink); stroke-width:7; transform-box:fill-box; transform-origin:center; animation:hl-pop .6s cubic-bezier(.2,.8,.2,1) both}
.hl-orbit{fill:none; stroke:var(--accent); stroke-width:6; stroke-dasharray:1; animation:hl-draw .45s .1s ease-in both}
.hl-orbit.front{animation-delay:.55s; animation-timing-function:ease-out}
.hl-moon{fill:var(--accent); animation:hl-fade .4s .9s both}
@keyframes hl-draw{from{stroke-dashoffset:1}}
@keyframes hl-fade{from{opacity:0}}
@keyframes hl-pop{from{opacity:0; transform:scale(.9)}}
@keyframes hl-word{from{opacity:0; transform:translateX(-8px)}}
.hero h1{font-family:var(--font-display); font-weight:780; font-size:clamp(36px,4.3vw,54px); line-height:1.03; letter-spacing:-.04em; margin:14px 0 0; text-wrap:balance}
.hero h1 em{font-style:normal; font-weight:250; color:var(--accent)}
.hero-card{
  background:var(--surface); border:1px solid var(--line); border-radius:18px; padding:20px 22px; box-shadow:var(--shadow);
  display:flex; flex-direction:column; gap:12px;
}
.hc-row{display:flex; align-items:baseline; gap:8px}
.hc-big{font-family:var(--font-display); font-weight:250; font-size:52px; line-height:.9; letter-spacing:-.045em; color:var(--accent); font-variant-numeric:tabular-nums}
.hc-of{font-family:var(--font-mono); font-size:12px; color:var(--muted)}
.hc-bar{height:6px; border-radius:6px; background:var(--sunken); overflow:hidden}
.hc-bar i{display:block; height:100%; background:var(--accent); border-radius:6px}
.hc-acts{display:flex; gap:8px; flex-wrap:wrap}
.hc-acts .primary{flex:1 1 100%; justify-content:center; min-width:0; padding-top:8px; padding-bottom:8px}
.hc-acts .primary span{overflow:hidden; text-overflow:ellipsis; white-space:nowrap}

.bgrid{display:grid; grid-template-columns:repeat(auto-fill,minmax(340px,1fr)); gap:18px}
.bcard{
  background:var(--surface); border:1px solid var(--line); border-radius:18px; padding:20px 22px 18px;
  display:flex; flex-direction:column; gap:10px; box-shadow:var(--shadow-sm); scroll-margin-top:20px;
  transition:box-shadow .2s, border-color .2s;
}
.bcard:hover{box-shadow:var(--shadow)}
.bcard.flash{animation:bflash 1.4s ease-out}
@keyframes bflash{0%,40%{border-color:var(--accent); box-shadow:0 0 0 4px var(--accent-soft)}}
.bc-top{display:flex; align-items:flex-start; justify-content:space-between; gap:12px}
.bc-num{font-family:var(--font-display); font-weight:200; font-size:48px; line-height:.8; letter-spacing:-.05em; color:var(--accent); font-variant-numeric:tabular-nums}
.bc-kick{font-family:var(--font-mono); font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; color:var(--muted); text-align:right; line-height:1.5}
.bcard h2{font-family:var(--font-display); font-weight:750; font-size:21px; line-height:1.18; margin:4px 0 0; letter-spacing:-.028em}
.bc-list{list-style:none; margin:4px 0 0; padding:10px 0 0; border-top:1px solid var(--line-2); display:grid; gap:1px}
.bc-list a{
  display:grid; grid-template-columns:24px minmax(0,1fr) 13px; gap:6px; align-items:center; padding:4px 6px; margin:0 -6px;
  border-radius:7px; color:var(--ink-2); text-decoration:none; font-size:13px; line-height:1.3;
}
.bc-list a:hover{background:var(--surface-2); color:var(--ink)}
.bc-list .n{font-family:var(--font-mono); font-size:11px; color:var(--muted)}
.bc-list .tick{width:11px; height:11px; border-radius:50%; border:1.5px solid var(--line)}
.bc-list .read .tick{background:var(--accent); border-color:var(--accent)}
.bc-foot{display:flex; align-items:center; gap:10px; margin-top:auto; padding-top:6px; font-family:var(--font-mono); font-size:10.5px; color:var(--muted)}
.bc-foot .hc-bar{flex:1; height:4px}

/* ---------------- side: the topic in Nodes ---------------- */
.th-side{background:var(--surface); border-left:1px solid var(--line); overflow-y:auto; overflow-x:hidden; min-height:0; padding:20px 18px 48px}
.th-side *{max-width:100%}
.sd-kick{display:flex; align-items:center; gap:7px; font-family:var(--font-mono); font-size:10.5px; letter-spacing:.13em; text-transform:uppercase; font-weight:600; color:var(--nodes)}
.sd-kick .dot{width:7px; height:7px; border-radius:50%; background:var(--nodes); box-shadow:0 0 0 3px color-mix(in srgb,var(--nodes) 20%,transparent)}
.th-side h2{font-family:var(--font-display); font-weight:750; font-size:20px; line-height:1.2; margin:8px 0 8px; letter-spacing:-.025em; overflow-wrap:anywhere}
.sd-lead{font-size:12.8px; line-height:1.55; color:var(--muted); margin:0 0 12px}
.th-side .primary{background:var(--nodes); border-color:var(--nodes)}
.th-side .ghost:hover{border-color:color-mix(in srgb,var(--nodes) 45%,var(--line)); color:var(--nodes)}
.sd-tabs{display:flex; gap:3px; padding:3px; margin:16px 0 4px; background:var(--surface-2); border:1px solid var(--line-2); border-radius:10px}
.sd-tabs button{flex:1; border:0; background:transparent; padding:6px 8px; border-radius:7px; font-size:12.5px; font-weight:600; color:var(--muted); cursor:pointer}
.sd-tabs button span{font-family:var(--font-mono); font-size:10.5px; font-weight:500; margin-left:4px; opacity:.8}
.sd-tabs button[aria-selected="true"]{background:var(--surface); color:var(--ink); box-shadow:var(--shadow-sm)}
.sd-close{position:absolute; right:14px; top:14px}

.chead{font-family:var(--font-mono); font-size:10px; letter-spacing:.12em; text-transform:uppercase; font-weight:600; color:var(--muted); margin:18px 0 7px}
.cline{margin:0 0 10px; font-size:12.8px; line-height:2.05}
.cs{
  font:inherit; font-size:12.5px; line-height:1.45; border:1px solid var(--line); background:var(--surface-2); border-radius:7px;
  padding:1px 7px 2px; cursor:pointer; color:var(--ink-2); text-align:left; transition:border-color .12s, color .12s, background .12s;
}
.cs.shared{border-color:color-mix(in srgb,var(--nodes) 38%,var(--line)); background:color-mix(in srgb,var(--nodes) 7%,var(--surface)); color:var(--ink); font-weight:550}
.cs.dis{font-family:var(--font-display); font-weight:720; letter-spacing:-.01em}
.cs sup{font-family:var(--font-mono); font-size:9.5px; font-weight:600; color:var(--nodes); margin-left:3px; vertical-align:1px}
.cs:hover,.cs.on{border-color:var(--nodes); color:var(--nodes); background:color-mix(in srgb,var(--nodes) 11%,var(--surface))}
.car{color:var(--faint); margin:0 3px; font-size:12px}

.conn{padding:11px 2px; border-bottom:1px solid var(--line-2)}
.conn:last-child{border-bottom:0}
.conn-top{display:flex; align-items:baseline; gap:8px}
.conn-t{display:flex; gap:8px; align-items:baseline; min-width:0; flex:1; color:var(--ink); text-decoration:none; font-weight:600; font-size:13.3px; line-height:1.35}
.conn-t:hover{color:var(--accent)}
.conn-t .tn,.sd-topic .tn{font-family:var(--font-mono); font-size:11px; font-weight:600; color:var(--accent); flex:none}
.conn-c{font-family:var(--font-mono); font-size:10px; color:var(--muted); white-space:nowrap}
.conn-via{display:flex; flex-wrap:wrap; gap:4px; align-items:center; margin-top:7px; font-size:11.5px; color:var(--muted)}
.conn-via .cs{font-size:11.5px; padding:0 6px 1px}
.sd-subh{font-family:var(--font-mono); font-size:10px; letter-spacing:.12em; text-transform:uppercase; font-weight:600; color:var(--muted); margin:18px 0 4px}
.sd-empty{font-size:12.5px; color:var(--muted); padding:10px 2px}

.sd-back{border:0; background:none; padding:0; margin:0 0 12px; cursor:pointer; color:var(--muted); font-size:12.5px; display:inline-flex; gap:6px; align-items:center}
.sd-back:hover{color:var(--nodes)}
.sd-def{background:var(--surface-2); border:1px solid var(--line-2); border-radius:12px; padding:11px 13px 12px; margin:6px 0 12px}
.sd-def h4{display:flex; justify-content:space-between; gap:8px; align-items:baseline; margin:0 0 5px; font-family:var(--font-mono); font-size:10px; letter-spacing:.12em; text-transform:uppercase; color:var(--nodes); font-weight:600}
.sd-def h4 span{letter-spacing:.02em; text-transform:none; color:var(--muted); font-weight:500}
.sd-def h4 a{color:var(--accent); text-decoration:none}
.sd-def p{margin:0; font-size:13.6px; line-height:1.55; color:var(--ink)}
.sd-note{font-size:12.8px; line-height:1.55; color:var(--ink-2); background:var(--surface-2); border-left:3px solid var(--nodes); padding:8px 11px; border-radius:0 9px 9px 0; margin:0 0 12px}
.sd-sec{margin-top:18px}
.sd-sec h4{display:flex; justify-content:space-between; align-items:baseline; margin:0 0 5px; font-family:var(--font-mono); font-size:10px; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); font-weight:600}
.sd-row{
  display:grid; grid-template-columns:14px minmax(0,1fr); gap:2px 7px; width:100%; text-align:left; align-items:start;
  border:0; background:transparent; border-radius:9px; padding:7px 6px 8px; cursor:pointer; font-size:13px; color:var(--ink);
}
.sd-row:hover{background:var(--surface-2)}
.sd-row .ar{color:var(--muted); font-size:12px; line-height:1.45}
.sd-row .t{font-weight:500; overflow-wrap:anywhere}
.sd-row .tp{grid-column:2; font-family:var(--font-mono); font-size:10px; color:var(--muted)}
.sd-row .why{grid-column:2; font-size:12px; line-height:1.45; color:var(--muted); display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden}
.sd-topic{display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:8px; align-items:baseline; padding:6px 6px; border-radius:8px; color:var(--ink-2); text-decoration:none; font-size:13px}
.sd-topic:hover{background:var(--surface-2); color:var(--ink)}
.sd-topic.cur{color:var(--ink); font-weight:600}
.sd-topic em{font-style:normal; font-family:var(--font-mono); font-size:9.5px; text-transform:uppercase; letter-spacing:.08em; color:var(--nodes)}

/* ---------------- narrower windows ---------------- */
@media (max-width:1360px){ #view-theory{--th-rail:262px; --th-side:318px} .th-topic{padding:30px 38px 80px} }
/* the Nodes panel becomes a drawer */
@media (max-width:1180px){
  #view-theory{grid-template-columns:var(--th-rail) minmax(0,1fr)}
  .th-side{
    position:absolute; z-index:25; top:0; right:0; bottom:0; width:min(380px,92vw);
    transform:translateX(102%); transition:transform .24s ease; box-shadow:var(--shadow-lg); border-left:1px solid var(--line);
  }
  #view-theory.side-open .th-side{transform:none}
  #view-theory.side-open .th-scrim,#view-theory.rail-open .th-scrim{display:block; position:absolute; inset:0; z-index:24; background:var(--scrim)}
  .only-drawer{display:inline-flex!important}
}
/* the topic list becomes a drawer too */
@media (max-width:880px){
  #view-theory,#view-theory.home{grid-template-columns:minmax(0,1fr)}
  .th-rail{
    position:absolute; z-index:25; top:0; left:0; bottom:0; width:min(320px,88vw);
    transform:translateX(-102%); transition:transform .24s ease; box-shadow:var(--shadow-lg);
  }
  #view-theory.rail-open .th-rail{transform:none}
  .th-mbar{display:flex; position:absolute; z-index:6; top:10px; left:12px; right:12px; gap:8px; pointer-events:none}
  .th-mbar button{pointer-events:auto; background:color-mix(in srgb,var(--surface) 92%,transparent); backdrop-filter:blur(8px); box-shadow:var(--shadow-sm)}
  .th-mbar .only-topic{margin-left:auto}
  #view-theory.home .th-mbar .only-topic{display:none}
  .th-actions .only-drawer{display:none!important}   /* the floating bar has it */
  .th-topic{padding:62px 20px 70px}
  .th-home{padding:64px 18px 70px}
  .th-num{font-size:56px}
  .hero{grid-template-columns:1fr; gap:22px}
  .bgrid{grid-template-columns:1fr}
  .th-plan{margin-left:-6px; margin-right:-6px}
  .plan-i .pk{display:none}
  .now-in{top:54px; left:-8px; right:-8px}
  .th-body{font-size:15px}
  .th-pager{grid-template-columns:1fr}
  .pg.next{grid-column:auto}
}
