/* ═══════════════════════════════════════════════════════════════════════════
   adv.css — Advaita Śāradā study mirror.
   Palette and typographic idiom follow Sanskrit/Prasthanatrayi-With-Translation/
   prasthanatrayi-trans.html so the two readers feel like one shelf; the parts
   that corpus does not have (ṭīkā strata, pratīka, citations, footnotes,
   lineage tree) are new here.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --content-scale: 1;
  --bg: #f5eedb;
  --bg-card: #fbf6e8;
  --bg-elev: #ffffff;
  --bg-sunk: #efe6cd;
  --ink: #2b2540;
  --ink-soft: #6b6379;
  --ink-faint: #998fa3;
  --accent: #8a3a1c;
  --accent-soft: #b06b3a;
  --accent-bg: #f0d9b5;
  --tika: #3d5a80;
  --tika-soft: #6d8ab0;
  --tika-bg: #e6edf5;
  --rule: #e0d4b4;
  --rule-strong: #c8b88f;
  --highlight: #fff0a8;
  --shadow: 0 1px 2px rgba(43,37,64,.04), 0 4px 16px rgba(43,37,64,.06);
  --serif: 'Noto Serif Devanagari', 'Sanskrit 2003', 'Nirmala UI', serif;
  --serif-bn: 'Noto Serif Bengali', 'Vrinda', serif;
  --sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
html[data-theme="dark"] {
  --bg: #16141c;
  --bg-card: #1e1b26;
  --bg-elev: #262231;
  --bg-sunk: #121017;
  --ink: #e8e3f0;
  --ink-soft: #a79fb8;
  --ink-faint: #7a7288;
  --accent: #e0864f;
  --accent-soft: #c9743f;
  --accent-bg: #3a2418;
  --tika: #8fb4dd;
  --tika-soft: #6d8ab0;
  --tika-bg: #1a2432;
  --rule: #322c3f;
  --rule-strong: #4a4258;
  --highlight: #5c4a12;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.35);
}
html[data-theme="night"] {          /* pure-dark reading, no violet cast */
  --bg: #0f0f0f; --bg-card: #171717; --bg-elev: #1f1f1f; --bg-sunk: #0a0a0a;
  --ink: #e6e2da; --ink-soft: #a09a90; --ink-faint: #7a746b;
  --accent: #d9873f; --accent-soft: #b8712f; --accent-bg: #2e2114;
  --tika: #86aecb; --tika-soft: #5f819a; --tika-bg: #14202a;
  --rule: #2a2a2a; --rule-strong: #3e3e3e; --highlight: #4d3f10;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.dev, [lang="sa"] { font-family: var(--serif); }
body[data-script="beng"] .dev, body[data-script="beng"] [lang="sa"] { font-family: var(--serif-bn); }
body[data-script="iast"] .dev, body[data-script="iast"] [lang="sa"] { font-family: 'Gentium Plus', 'Charis SIL', Georgia, serif; }

/* ── top bar ──────────────────────────────────────────────────────────── */
header.topbar {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  transition: transform .25s ease;
}
/* Same pattern as Sanskrit/Upanishads108/tools/site/style.css's
   .topbar.scrolled-hidden — js/reader.js's setupAutoHide() toggles this
   class on phone viewports only, so scrolling down hands the reader the
   full screen and scrolling back up (or nearing the top) restores the bar. */
header.topbar.scrolled-hidden { transform: translateY(-100%); }
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: 12px 20px 10px; }
.topbar-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; flex-shrink: 0; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand .title { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; color: var(--accent); letter-spacing: .02em; }
.brand .subtitle { font-family: var(--serif); font-size: .82rem; color: var(--ink-soft); }

.search-main {
  flex: 1; min-width: 180px; padding: 8px 12px;
  border: 1px solid var(--rule-strong); background: var(--bg-elev); color: var(--ink);
  font-family: inherit; font-size: .92rem; border-radius: 6px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-main:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }

.tool-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 36px; height: 36px; padding: 0 9px;
  background: var(--bg-elev); border: 1px solid var(--rule-strong); border-radius: 6px;
  color: var(--ink-soft); cursor: pointer; flex-shrink: 0;
  font-family: inherit; font-size: .85rem; line-height: 1;
  transition: background .15s, color .15s, border-color .15s;
}
.tool-btn:hover { color: var(--accent); border-color: var(--accent-soft); }
.tool-btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.tool-btn.dev { font-family: var(--serif); font-size: 1rem; }
select.tool-sel {
  height: 36px; padding: 0 8px; border: 1px solid var(--rule-strong); border-radius: 6px;
  background: var(--bg-elev); color: var(--ink); font-family: inherit; font-size: .85rem; outline: none;
  max-width: 100%;
}
select.tool-sel:focus { border-color: var(--accent); }
.topbar-secondary { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spacer { flex: 1; }

/* pill toggles */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border: 1px solid var(--rule-strong); border-radius: 999px; cursor: pointer;
  background: var(--bg-elev); color: var(--ink-soft); user-select: none;
  font-size: .82rem; transition: all .15s;
}
.pill:hover { border-color: var(--accent-soft); color: var(--ink); }
.pill input { margin: 0; accent-color: var(--accent); }
.pill.on { background: var(--accent-bg); border-color: var(--accent-soft); color: var(--accent); font-weight: 500; }
.pill.tika-pill.on { background: var(--tika-bg); border-color: var(--tika-soft); color: var(--tika); }
.pill.dev { font-family: var(--serif); }

/* ── chapter rail ─────────────────────────────────────────────────────── */
.rail { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); }
.rail:empty { display: none; }
.rail a {
  display: inline-block; min-width: 28px; height: 26px; line-height: 26px; padding: 0 7px;
  text-align: center; font-size: .76rem; font-weight: 500; color: var(--ink-soft);
  border-radius: 4px; text-decoration: none; transition: all .15s;
}
.rail a:hover { background: var(--accent-bg); color: var(--accent); text-decoration: none; }
.rail a.active { background: var(--accent); color: #fff; }

/* ── layout ───────────────────────────────────────────────────────────── */
.shell { display: flex; max-width: 1400px; margin: 0 auto; align-items: flex-start; }
nav.side {
  position: sticky; top: var(--bar-h, 120px); flex: 0 0 260px; width: 260px;
  max-height: calc(100vh - var(--bar-h, 120px)); overflow-y: auto;
  padding: 18px 12px 40px 20px; border-right: 1px solid var(--rule); font-size: .85rem;
}
body.side-off nav.side { display: none; }
nav.side .side-title { font-family: var(--serif); font-size: 1rem; color: var(--accent); margin: 0 0 10px; font-weight: 600; }
nav.side ol { list-style: none; margin: 0; padding: 0; }
nav.side li { margin: 1px 0; }
nav.side a { display: block; padding: 4px 8px; border-radius: 4px; color: var(--ink-soft); font-family: var(--serif); }
nav.side a:hover { background: var(--accent-bg); color: var(--accent); text-decoration: none; }
nav.side a.current { background: var(--accent); color: #fff; }
nav.side .topics { margin-left: 10px; border-left: 1px solid var(--rule); padding-left: 6px; }
nav.side .topics a { font-size: .8rem; padding: 3px 6px; }
nav.side .side-links { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }
nav.side .side-links .lbl { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .13em; color: var(--ink-faint); margin: 10px 0 4px; font-weight: 600; }

main.text { flex: 1; min-width: 0; max-width: 1000px; margin: 0 auto; padding: 20px 24px 120px; }

/* ── headings ─────────────────────────────────────────────────────────── */
.work-head { text-align: center; margin: 6px 0 24px; }
.work-head .wh-dev { font-family: var(--serif); font-size: 1.8rem; color: var(--accent); font-weight: 600; display: block; }
.work-head .wh-sub { display: block; font-size: .85rem; color: var(--ink-soft); margin-top: 6px; font-style: italic; }
.work-head .wh-meta { display: block; font-size: .72rem; color: var(--ink-faint); margin-top: 8px; letter-spacing: .1em; text-transform: uppercase; }

.chapter-heading { text-align: center; margin: 34px 0 16px; scroll-margin-top: 150px; }
.chapter-heading .ch-name { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); font-weight: 500; }
.chapter-heading::after { content: ""; display: block; width: 60px; height: 1px; background: var(--accent-soft); margin: 12px auto 0; }
.section-heading { text-align: center; margin: 28px 0 12px; scroll-margin-top: 150px; }
.section-heading .sec-name { font-family: var(--serif); font-size: 1.15rem; color: var(--ink-soft); font-weight: 500; }
.section-heading .sec-tr { margin: 4px auto 0; max-width: 42em; color: var(--ink-soft); font-size: calc(.92rem * var(--content-scale)); line-height: 1.5; }
.section-heading .sec-tr-en { font-style: italic; }
.section-heading .sec-tr-bn { font-family: var(--serif-bn); }

/* ── units ────────────────────────────────────────────────────────────── */
.unit { scroll-margin-top: 150px; }
.unit.hide { display: none; }

.u-verse {
  background: var(--bg-card); border: 1px solid var(--rule); border-radius: 8px;
  padding: 16px 26px 12px; margin: 14px 0; box-shadow: var(--shadow); position: relative;
}
.u-verse .verse-no {
  position: absolute; top: 10px; right: 14px; font-family: var(--sans);
  font-size: .7rem; font-weight: 600; letter-spacing: .08em; color: var(--accent); user-select: none;
}
.u-verse .vtext {
  font-family: var(--serif); font-size: calc(1.18rem * var(--content-scale)); line-height: 1.95;
  color: var(--ink); text-align: center; letter-spacing: .01em;
}

.u-prose {
  font-family: var(--serif); font-size: calc(1.05rem * var(--content-scale)); line-height: 1.9;
  margin: 10px 0; text-align: justify; hyphens: auto;
}
.u-bhashya { color: var(--ink); }
.u-avatarika, .u-mangala { color: var(--ink-soft); font-style: italic; border-left: 2px solid var(--accent-soft); padding-left: 12px; }
.u-colophon { text-align: center; color: var(--accent); font-size: calc(.98rem * var(--content-scale)); margin: 18px 0; }
.u-plain { color: var(--ink); }

/* the bhāṣya stratum gets a quiet left margin rule so the eye can tell
   Śaṅkara's own words from the mūla above and the ṭīkā below */
.stratum-b { border-left: 3px solid var(--accent-soft); padding-left: 14px; margin-left: 2px; }

.u-label {
  display: block; font-family: var(--sans); font-size: .64rem; text-transform: uppercase;
  letter-spacing: .14em; color: var(--accent); font-weight: 600; margin-bottom: 6px; user-select: none;
}

/* ── ṭīkā stratum ─────────────────────────────────────────────────────── */
.tika-wrap { margin: 8px 0 18px 0; }
.tika-block {
  background: var(--tika-bg); border-left: 3px solid var(--tika-soft); border-radius: 0 6px 6px 0;
  padding: 10px 16px; margin: 6px 0;
}
.tika-head {
  display: flex; align-items: baseline; gap: 8px; cursor: pointer; user-select: none;
  font-family: var(--sans); font-size: .66rem; text-transform: uppercase; letter-spacing: .13em;
  color: var(--tika); font-weight: 600;
}
.tika-head .count { color: var(--ink-faint); letter-spacing: 0; text-transform: none; font-size: .7rem; }
.tika-head::before { content: "›"; display: inline-block; transition: transform .18s; font-size: .95rem; }
.tika-block.open .tika-head::before { transform: rotate(90deg); }
.tika-body { display: none; margin-top: 8px; }
.tika-block.open .tika-body { display: block; }
.tika-unit {
  font-family: var(--serif); font-size: calc(.98rem * var(--content-scale)); line-height: 1.85;
  color: var(--ink); margin: 0 0 9px; text-align: justify; scroll-margin-top: 150px;
}
.tika-unit:last-child { margin-bottom: 0; }
body[data-script="beng"] .tika-unit, body[data-script="beng"] .u-prose,
body[data-script="beng"] .vtext { font-family: var(--serif-bn); }

/* ── inline markup ────────────────────────────────────────────────────── */
.pk { color: var(--accent); font-weight: 600; }
.pk.hd { display: inline; }
html[data-theme="dark"] .pk, html[data-theme="night"] .pk { color: var(--accent); }
.tika-unit .pk { color: var(--tika); }
.ur { font-size: .82em; color: var(--ink-faint); white-space: nowrap; }
.uv { font-weight: 600; color: var(--ink-soft); }
a.ul { color: var(--accent-soft); border-bottom: 1px dotted var(--accent-soft); cursor: pointer; }
a.ul:hover { color: var(--accent); background: var(--accent-bg); text-decoration: none; }
.ul.ext, .ul.pend { color: var(--ink-soft); border-bottom: 1px dotted var(--ink-faint); cursor: help; }
.nm {
  display: inline-block; cursor: pointer; color: var(--accent-soft); font-weight: 700;
  vertical-align: super; font-size: .74em; padding: 0 1px;
}
.nm:hover { color: var(--accent); }
mark, .hit { background: var(--highlight); color: inherit; border-radius: 2px; padding: 0 1px; }

/* footnote popover */
#note-pop {
  position: absolute; z-index: 300; max-width: 380px;
  background: var(--bg-elev); border: 1px solid var(--rule-strong); border-radius: 8px;
  box-shadow: var(--shadow); padding: 10px 14px;
  font-family: var(--serif); font-size: .95rem; line-height: 1.7; color: var(--ink);
}
#note-pop .nk {
  display: block; font-family: var(--sans); font-size: .62rem; text-transform: uppercase;
  letter-spacing: .13em; color: var(--accent); font-weight: 600; margin-bottom: 4px;
}
#note-pop[hidden] { display: none; }

/* ── library (index.html) ─────────────────────────────────────────────── */
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 24px 100px; }
.hero { text-align: center; margin: 22px 0 30px; }
.hero h1 { font-family: var(--serif); font-size: 2.5rem; color: var(--accent); margin: 0; font-weight: 600; letter-spacing: .02em; }
.hero .tag { font-family: var(--serif); color: var(--ink-soft); margin-top: 6px; font-size: 1rem; }
.hero .tag-en { color: var(--ink-faint); font-size: .8rem; margin-top: 8px; letter-spacing: .07em; text-transform: uppercase; }
.hero .stats { color: var(--ink-faint); font-size: .78rem; margin-top: 12px; }

.section { margin: 38px 0; }
.section > h2 {
  font-family: var(--serif); font-size: 1.25rem; color: var(--accent); font-weight: 600;
  text-align: center; margin: 0 0 4px; display: flex; align-items: center; gap: 14px;
}
.section > h2::before, .section > h2::after { content: ""; flex: 1; height: 1px; background: var(--rule-strong); }
.sub-label {
  font-family: var(--serif); font-size: .95rem; color: var(--ink-soft); text-align: center;
  margin: 18px 0 8px; font-weight: 500;
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-card); border: 1px solid var(--rule); border-radius: 8px;
  padding: 14px 16px; box-shadow: var(--shadow); transition: all .15s; text-decoration: none;
}
.card:hover { border-color: var(--accent-soft); transform: translateY(-1px); text-decoration: none; box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 8px 22px rgba(0,0,0,.08); }
.card .kicker { font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; font-family: var(--serif); }
.card .card-title { font-family: var(--serif); font-size: 1.08rem; color: var(--ink); font-weight: 600; line-height: 1.4; }
.card .card-author { font-family: var(--serif); font-size: .82rem; color: var(--ink-soft); }
.card .card-extent { font-family: var(--serif); font-size: .76rem; color: var(--ink-faint); margin-top: 2px; }
.card .card-vy { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.card .vy-chip {
  font-family: var(--serif); font-size: .7rem; padding: 2px 8px; border-radius: 999px;
  background: var(--tika-bg); color: var(--tika); border: 1px solid var(--tika-soft);
}
.card.feature { background: linear-gradient(160deg, var(--accent-bg), var(--bg-card)); }

/* lineage tree */
.tree { font-family: var(--serif); font-size: .95rem; line-height: 1.9; }
.tree ul { list-style: none; margin: 0; padding-left: 20px; border-left: 1px dotted var(--rule-strong); }
.tree > ul { padding-left: 0; border-left: none; }
.tree li { position: relative; padding-left: 14px; }
.tree li::before { content: ""; position: absolute; left: 0; top: .95em; width: 10px; height: 1px; background: var(--rule-strong); }
.tree > ul > li::before { display: none; }
.tree .node-name { color: var(--ink); }
.tree .node-name.branch { color: var(--accent); font-weight: 600; }
.tree a.node-name:hover { color: var(--accent); }

/* ── search ───────────────────────────────────────────────────────────── */
.result {
  background: var(--bg-card); border: 1px solid var(--rule); border-radius: 8px;
  padding: 12px 16px; margin: 9px 0; box-shadow: var(--shadow);
}
.result .r-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 5px; }
.result .r-work { font-family: var(--serif); font-size: .84rem; color: var(--accent); font-weight: 600; }
.result .r-loc { font-size: .72rem; color: var(--ink-faint); letter-spacing: .05em; }
.result .r-kind { font-size: .62rem; text-transform: uppercase; letter-spacing: .11em; color: var(--ink-faint); border: 1px solid var(--rule-strong); border-radius: 999px; padding: 1px 7px; }
.result .r-text { font-family: var(--serif); font-size: calc(1rem * var(--content-scale)); line-height: 1.85; color: var(--ink); }
.result .r-text.beng { font-family: var(--serif-bn); }
.progress { height: 3px; background: var(--rule); border-radius: 2px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.muted { color: var(--ink-faint); font-size: .85rem; }
.facets { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }

/* devanāgarī keyboard */
.kbd { display: none; margin-top: 10px; padding: 10px; background: var(--bg-card); border: 1px solid var(--rule); border-radius: 8px; }
.kbd.on { display: block; }
.kbd .krow { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.kbd button {
  font-family: var(--serif); font-size: 1rem; min-width: 34px; height: 32px; padding: 0 6px;
  background: var(--bg-elev); border: 1px solid var(--rule-strong); border-radius: 5px;
  color: var(--ink); cursor: pointer;
}
.kbd button:hover { border-color: var(--accent-soft); color: var(--accent); }
.kbd .klabel { font-size: .64rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-faint); margin: 6px 0 3px; }

/* ── misc ─────────────────────────────────────────────────────────────── */
.crumbs { display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; font-size: .85rem; color: var(--ink-soft); font-family: var(--serif); }
.crumbs > * + *::before { content: "›"; color: var(--rule-strong); margin-right: 6px; }
footer.foot {
  border-top: 1px solid var(--rule); margin-top: 50px; padding: 22px 24px 40px;
  text-align: center; color: var(--ink-faint); font-size: .78rem; line-height: 1.8;
}
footer.foot a { color: var(--ink-soft); }
.notice {
  max-width: 760px; margin: 0 auto; background: var(--bg-card); border: 1px solid var(--rule);
  border-left: 3px solid var(--accent-soft); border-radius: 6px; padding: 12px 16px;
  font-size: .82rem; color: var(--ink-soft); line-height: 1.7;
}
details.intro { max-width: 900px; margin: 18px auto; }
details.intro > summary { cursor: pointer; color: var(--accent); font-size: .85rem; }
details.intro .intro-body { margin-top: 10px; font-size: .86rem; color: var(--ink-soft); line-height: 1.8; }
.empty { text-align: center; color: var(--ink-faint); padding: 50px 0; font-size: .9rem; }
.loading { text-align: center; color: var(--ink-faint); padding: 40px 0; font-size: .85rem; }

@media (max-width: 900px) {
  nav.side { display: none; }
  .shell { display: block; }
  main.text { padding: 16px 16px 100px; }
  .brand .subtitle { display: none; }
}
/* The chapter rail repeats the same links as #sideList in the ☰ side nav —
   on a phone it was 215 of 652px of header (nyāyanirṇaya's 28 chunks
   wrapped into 7 rows of 4), all read past before the first line of
   Sanskrit. nav.side is already hidden below 900px (above), so this leaves
   the ☰ toggle and the work-selector as the remaining ways to move between
   chapters on a phone; see tools/review/reader-fixes.md for the mūla-view
   fallback proposal filed alongside this. */
@media (max-width: 640px) {
  .rail { display: none; }
}
@media print {
  header.topbar, nav.side, .rail, footer.foot { display: none; }
  body { background: #fff; }
  .u-verse { break-inside: avoid; }
}

/* ── translation + grammar layers ─────────────────────────────────────── */
.tr { margin: 4px 0 12px; padding-left: 14px; border-left: 2px solid var(--rule-strong); }
.u-verse .tr { border-left: none; padding-left: 0; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); }
.tr-en, .tr-bn { font-size: calc(.94rem * var(--content-scale)); line-height: 1.7; color: var(--ink-soft); margin: 3px 0; }
.tr-bn { font-family: var(--serif-bn); font-size: calc(1rem * var(--content-scale)); }
.tr-lab {
  display: inline-block; font-family: var(--sans); font-size: .58rem; text-transform: uppercase;
  letter-spacing: .13em; color: var(--accent-soft); font-weight: 600; margin-right: 7px;
  vertical-align: 1px; user-select: none;
}
.tika-block .tr { border-left-color: var(--tika-soft); }
.tika-block .tr-lab { color: var(--tika); }

/* clickable words */
.w { cursor: pointer; border-radius: 3px; padding: 0 1px; }
.w:hover { background: var(--accent-bg); color: var(--accent); }
/* The cursor is the only affordance a prose block needs. An earlier version
   painted a gradient underline on :hover, which on a full bhāṣya paragraph
   read as a stray brown bar under the whole block rather than as a hint. */
.wordy { cursor: pointer; }
body[data-gram="all"] .tika-unit { cursor: pointer; }

#word-pop {
  position: absolute; z-index: 400; max-width: 430px; min-width: 240px;
  background: var(--bg-elev); border: 1px solid var(--rule-strong); border-radius: 8px;
  box-shadow: var(--shadow); padding: 12px 16px;
}
#word-pop[hidden] { display: none; }
#word-pop .wp-surface { font-family: var(--serif); font-size: 1.25rem; color: var(--accent); font-weight: 600; }
#word-pop .wp-split { font-family: var(--serif); font-size: 1rem; color: var(--ink); margin-top: 4px; }
#word-pop .wp-gram { font-family: var(--serif); font-size: .9rem; color: var(--ink-soft); margin-top: 6px; line-height: 1.6; }
#word-pop .wp-mean { font-size: .9rem; color: var(--ink); margin-top: 7px; line-height: 1.6; }
#word-pop .wp-bn { font-family: var(--serif-bn); font-size: .95rem; color: var(--ink-soft); margin-top: 4px; line-height: 1.7; }
#word-pop .wp-none { font-size: .85rem; color: var(--ink-faint); }
#word-pop .wp-x { float: right; cursor: pointer; color: var(--ink-faint); font-size: 1.1rem; line-height: 1; }
#word-pop .wp-x:hover { color: var(--accent); }

/* ── layer badges on library cards ───────────────────────────────────────
   Says at a glance whether a work can be read in translation and whether its
   words are clickable. Values come from data/catalogue.json (tools/mark_coverage.py). */
.card-layers { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.lay {
  font: 600 .66rem/1.5 var(--ui, system-ui), sans-serif;
  letter-spacing: .02em; padding: .1rem .42rem; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.lay.tr { background: #e8f0e4; color: #3c5c34; border-color: #cadfc2; }
.lay.gl { background: #efe7db; color: #6b5330; border-color: #ddceb8; }
.lay.part { opacity: .78; font-weight: 500; }
@media (prefers-color-scheme: dark) {
  .lay.tr { background: #24331f; color: #b3d6a4; border-color: #37502e; }
  .lay.gl { background: #33291c; color: #d9bd90; border-color: #4d3d28; }
}

/* Shown in मूलम् mode when the work has no root text of its own — 28 of the
   51 works are commentaries on commentaries, and used to render a blank page
   that was indistinguishable from a failed load. */
.mula-none { padding: 1.4rem 0; max-width: 52ch; }
.mula-none-lead { font-weight: 600; margin: 0 0 .45rem; }
.mula-none-body { margin: 0 0 .45rem; }
.mula-none-hint { opacity: .7; font-size: .93em; margin: 0; }
.mula-none a { text-decoration: underline; }
