:root {
  --bg: #14161a;
  --panel: #1a1d23;
  --panel-2: #21252c;
  --ink: #e8e6e1;
  --muted: #9aa0a8;
  --line: #2b2f37;
  --accent: #e6b277;        /* warm amber */
  --accent-ink: #f0c896;
  --xref: #7fb0d8;
  --place: #5bb3a6;         /* geographic places (teal) */
  --place-soft: rgba(91, 179, 166, .55);
  --place-sel: rgba(91, 179, 166, .18);
  --person: #b58fd6;        /* people (violet) */
  --person-soft: rgba(181, 143, 214, .55);
  --person-sel: rgba(181, 143, 214, .18);
  --group: #6aa6e0;         /* people groups / tribes / nations (blue) */
  --group-soft: rgba(106, 166, 224, .55);
  --group-sel: rgba(106, 166, 224, .18);
  --noun: #cf9f6b;          /* other proper nouns: deities, festivals, months (gold) */
  --noun-soft: rgba(207, 159, 107, .5);
  --noun-sel: rgba(207, 159, 107, .16);
  --fn: #d79b6e;
  --woj: #e06b5c;           /* words of Jesus (red-letter), tuned for dark bg */
  --sel: rgba(230, 178, 119, .16);
  --hover: #262b33;
  --sidebar-w: 320px;
  --word-panel-w: 400px;
  --topbar-h: 54px;
  --reading-size: 19.5px;
  /* ratio of the chosen reading size to the default — scales chrome (sidebar /
     tabs) alongside the reading text. Updated by the A-/A/A+ control. */
  --ui-scale: 1;
  --float-shadow: 0 6px 22px rgba(0, 0, 0, .45);
  --serif: "Iowan Old Style", "Palatino Linotype", "Source Serif 4", Georgia, serif;
  --sans: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* padding-top leaves room for the floating top bar; the safe-area inset keeps
   content clear of a phone status bar / notch (viewport-fit=cover). */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  padding-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
}

/* ---------- Floating top controls (no banner) ---------- */
#topbar {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px)); left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  pointer-events: none;            /* gaps let the reading show/scroll through */
  transition: right .24s cubic-bezier(.4, 0, .2, 1);
}
#topbar > * { pointer-events: auto; }
/* on desktop, keep the controls clear of the word panel */
body.word-panel-open #topbar { right: var(--word-panel-w); }

.topbar-btn {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.topbar-btn:hover { background: var(--hover); }

#sidebar-toggle { box-shadow: var(--float-shadow); }

/* text size as one floating pill */
#textsize {
  flex: 0 0 auto;                  /* always full size — search yields space, not this */
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--float-shadow);
}
#textsize .topbar-btn {
  width: 34px; height: 30px;
  border: 0;
  background: none;
  box-shadow: none;
  font-size: 15px;
}
#text-reset { font-size: 13px; }
#textsize-wrap { position: relative; flex: 0 0 auto; display: flex; }
#textsize-toggle { display: none; box-shadow: var(--float-shadow); }   /* mobile-only trigger */
.textsize-sep { width: 1px; align-self: stretch; margin: 4px 3px; background: var(--line); }
#color-toggle svg { width: 17px; height: 17px; }
#color-toggle.active { color: var(--accent); background: var(--sel); }

/* Limited ("low") color mode: entity links lose their TEXT color (go white) but keep their colored
   underline. Highlights, red-letter words of Jesus, verse numbers, and the SIL keyword stay. */
body.low-color .place-link,
body.low-color .person-link,
body.low-color .group-link,
body.low-color .noun-link,
body.low-color .word-link,
body.low-color .chat-person,
body.low-color .kw { color: var(--ink); }
/* inside the words of Jesus, everything stays red — links/keywords inherit the red, not white */
body.low-color .woj .kw,
body.low-color .woj .place-link,
body.low-color .woj .person-link,
body.low-color .woj .group-link,
body.low-color .woj .noun-link,
body.low-color .woj .word-link,
body.low-color .woj .chat-person { color: inherit; }

/* ---------- Search ---------- */
#search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;                    /* allow the bar to shrink past its content */
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--float-shadow);
}
#search:focus-within { border-color: var(--accent); }
/* Desktop: center the search bar over the READING COLUMN. The reading column is always
   viewport-centered (sidebar and word panel are overlays), but flex `margin: 0 auto`
   centered the bar in the LEFTOVER space between unequal sides (☰ vs. text-size pill +
   account), sitting it left of the text. Take it out of the flow and pin it to the
   topbar's center instead — the topbar box already narrows for the open word panel, so
   the bar stays clear of the panel exactly like #chapter-jump does. */
@media (min-width: 761px) {
  #search {
    position: absolute;
    top: 0;
    /* -- the reading column is centered in (viewport - reader scrollbar gutter), so shift
       by half the gutter (--sbw, measured by the app) to sit exactly over the text */
    left: calc(50% - var(--sbw, 0px) / 2);
    transform: translateX(-50%);
    width: min(620px, calc(100% - 480px));   /* never under ☰ or the right-side pills */
    margin: 0;
  }
  #textsize-wrap { margin-left: auto; }      /* search left the flow — push the pills right */
}
#search-scope {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 9px 6px 9px 11px;
  border-right: 1px solid var(--line);
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  outline: none;
}
#search-scope option { background: var(--panel-2); color: var(--ink); }
#search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 9px 10px;
  outline: none;
}
#search-input::placeholder { color: var(--muted); }
#search-input::-webkit-search-cancel-button,
#search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-clear {
  flex: 0 0 auto;
  border: 0; background: none;
  color: var(--muted);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  padding: 0 10px;
}
.search-clear:hover { color: var(--ink); }

#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55);
  padding: 6px;
  z-index: 1;
}
.sr-status {
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.sr-tabs {
  display: flex;
  gap: 6px;
  position: sticky;
  top: -6px;
  margin: -6px -6px 5px;
  padding: 10px 10px 9px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  overflow-x: auto;
  scrollbar-width: none;
  z-index: 2;
}
.sr-tabs::-webkit-scrollbar { display: none; }
.sr-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.sr-tab:hover { background: var(--hover); color: var(--ink); }
.sr-tab.active { background: var(--hover); color: var(--ink); border-color: var(--muted); }
.sr-tab-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--line);
  border-radius: 999px;
  padding: 0 6px;
  min-width: 16px;
  text-align: center;
}
.sr-tab.active .sr-tab-count { color: var(--accent-ink); }
.sr-group {
  padding: 10px 12px 4px;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.sr-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  padding: 9px 12px;
  border-radius: 8px;
}
.sr-item:hover, .sr-item.active { background: var(--hover); }
.sr-ref {
  font-weight: 700;
  color: var(--accent-ink);
  font-size: 13.5px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.sr-tag {
  font-size: 9.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1px 6px;
  font-weight: 600;
}
.sr-tag.sil { color: var(--accent); border-color: rgba(230,178,119,.4); }
.sr-tag.word { color: var(--xref); border-color: rgba(127,176,216,.4); }
/* entity (name / place / group / proper-noun / topic) search results, colour-coded by kind */
.sr-tag.place { color: var(--place); border-color: var(--place-soft); }
.sr-tag.group { color: var(--group); border-color: var(--group-soft); }
.sr-tag.person { color: var(--person); border-color: var(--person-soft); }
.sr-tag.noun { color: var(--noun); border-color: var(--noun-soft); }
.sr-entity-name { font-weight: 600; }
/* word search results: original-language word + gloss, opens its meaning tab */
.sr-word-translit { font-weight: 700; color: var(--accent-ink); }
.sr-word-lemma { font-family: var(--serif); font-size: 16px; color: var(--ink); margin-left: 8px; }
.sr-gloss { font-family: var(--sans); font-size: 13px; font-style: italic; }
.sr-snippet {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 3px;
}
.sr-snippet mark { background: var(--sel); color: var(--accent-ink); border-radius: 3px; padding: 0 1px; }

/* ---------- Sidebar ---------- */
/* The table of contents is a left-side OVERLAY (like the word panel on the right):
   it floats above the reading and the chat instead of pushing them aside, sliding
   in/out from the edge. z-index sits above the chat (48) but below the top bar (50)
   so the toggle stays reachable to close it. */
#sidebar {
  position: fixed;
  left: 0; bottom: 0;
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  z-index: 49;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 16px 0 48px rgba(0, 0, 0, .5);
  display: flex;
  flex-direction: column;
  transition: margin-left .26s cubic-bezier(.4, 0, .2, 1);
}
body.sidebar-collapsed #sidebar { margin-left: calc(-1 * var(--sidebar-w) - 24px); }

.side-head {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.side-head h1 {
  font-family: var(--serif);
  font-size: calc(19px * var(--ui-scale));
  font-weight: 600;
  letter-spacing: .2px;
  margin: 0 0 12px;
  color: var(--accent-ink);
}
#filter {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: calc(14px * var(--ui-scale));
  background: var(--bg);
  color: var(--ink);
  outline: none;
}
#filter::placeholder { color: var(--muted); }
#filter:focus { border-color: var(--accent); }

#tree { overflow-y: auto; flex: 1; padding: 8px 8px 48px; }
.side-foot { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 10px 14px; }
.side-foot a {
  display: block; font-family: var(--sans); font-size: 13px; font-weight: 600;
  color: var(--accent-ink); text-decoration: none;
}
.side-foot a:hover { text-decoration: underline; }

.testament {
  font-size: calc(11px * var(--ui-scale));
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 16px 12px 6px;
  font-weight: 600;
}

.book { margin-bottom: 1px; }
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 9px 11px;
  border-radius: 9px;
  color: var(--ink);
  line-height: 1.2;
}
.row:hover { background: var(--hover); }
.row.active { background: var(--sel); color: var(--accent-ink); font-weight: 600; }
.row .twisty {
  width: 12px;
  flex: 0 0 12px;
  color: var(--muted);
  transition: transform .16s ease;
  font-size: calc(10px * var(--ui-scale));
}
.row.open .twisty { transform: rotate(90deg); color: var(--accent); }
.book-row { font-size: calc(15px * var(--ui-scale)); }

/* chapter chip grid (replaces the old chapter rows + verse chips) */
.chapters {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  padding: 8px 12px 14px 30px;
}
.chapters.open { display: grid; }
.chip {
  text-align: center;
  padding: 7px 4px;
  font-size: calc(13px * var(--ui-scale));
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  cursor: pointer;
  color: var(--ink);
  transition: background .12s, border-color .12s;
}
.chip:hover { background: var(--hover); border-color: var(--accent); }
.chip.active { background: var(--accent); color: #1a1208; border-color: var(--accent); font-weight: 700; }
/* the book's "Introduction" entry — spans the chip grid, above the chapter numbers */
.chip-intro {
  grid-column: 1 / -1; text-align: left; padding: 7px 10px;
  font-family: var(--sans); font-weight: 600; color: var(--accent-ink);
  background: var(--panel-2);
}
.chip-intro.active { background: var(--accent); color: #1a1208; }

/* ---------- Reader ---------- */
/* Always reserve the scrollbar gutter so hiding the scrollbar (drawing / chat lock)
   doesn't widen the column and shift the text. */
#reader { flex: 1; overflow-y: auto; scroll-behavior: smooth; scrollbar-gutter: stable; }
/* While the chat is a takeover (keyboard-pinned or full-window), freeze the reading
   underneath so swiping inside the chat can't scroll the page behind it — which was
   revealing the text above/below the panel and the black bar under the input. The
   chat log keeps its own internal scroll (overscroll-behavior:contain). */
body.chat-locked #reader { overflow: hidden; }
body.chat-locked { overflow: hidden; }
#welcome, #chapter, #book-intro { max-width: 760px; margin: 0 auto; padding: 30px 36px 140px; }
/* Offline (Android): hide affordances that can only GENERATE new content on the server — they'd
   just fail. Already-generated data stays fully usable; body.offline is set by offline-init.js. */
body.offline #enhance-chapter,
body.offline .gen-btn:not(.has-sil),
body.offline .xref-info-btn,
body.offline .wp-more-usages,
body.offline .vs-research-all { display: none !important; }
/* Desktop note margin-cards live in #ann-notes (a child of #reader, not #chapter), so they'd
   otherwise linger — collapsing into the top-left — when a non-chapter page (intro, notes) is
   shown. Hide the overlay whenever the chapter isn't the active page; it returns with the chapter,
   and the note data is untouched. (#ann-hl highlights live inside #chapter, so they hide already.) */
#chapter[hidden] ~ #ann-notes { display: none; }
#book-intro-head { margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
#book-intro-title {
  font-family: var(--serif); font-weight: 600; letter-spacing: .2px;
  font-size: calc(28px * var(--ui-scale)); color: var(--accent-ink); margin: 0;
}
#welcome h2 { font-family: var(--serif); color: var(--accent-ink); font-weight: 600; }
#welcome p { color: var(--muted); line-height: 1.8; max-width: 52ch; }

#chapter-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
#chapter-title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  margin: 0;
  flex: 1;
  color: var(--accent-ink);
  letter-spacing: .3px;
}
.navbtn {
  border: 1px solid var(--line);
  background: var(--panel);
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--accent-ink);
  transition: background .15s;
}
.navbtn:hover:not(:disabled) { background: var(--hover); }
.navbtn:disabled { opacity: .28; cursor: default; }

/* Floating chapter switcher — hidden by default, slides down from under the
   top bar when the reader is flicked upward (see app.js). */
#chapter-jump {
  position: fixed;
  top: calc(var(--topbar-h) + 8px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  box-shadow: var(--float-shadow);
  transform: translate(-50%, -14px);
  opacity: 0;
  pointer-events: none;                /* invisible state can't be clicked */
  transition: opacity .22s ease, transform .22s cubic-bezier(.4, 0, .2, 1);
}
#chapter-jump.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
/* ride alongside the open word panel, like the top bar does */
body.word-panel-open #chapter-jump { left: calc(50% - var(--word-panel-w) / 2); }
#chapter-jump .navbtn { width: 34px; height: 34px; font-size: 19px; background: var(--panel); }
#jump-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-ink);
  white-space: nowrap;
  min-width: 6ch;
  text-align: center;
}

/* scripture text */
#chapter-body { font-family: var(--serif); font-size: var(--reading-size); line-height: 1.85; color: var(--ink); }
#chapter-body .heading {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--xref);
  margin: 30px 0 10px;
}
#chapter-body .subheading {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13.5px;
  font-style: italic;
  letter-spacing: .02em;
  color: var(--muted);
  margin: 20px 0 8px;
}
/* the Psalter's five book divisions: "BOOK I" over its range "Psalms 1–41" */
#chapter-body .superheading {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .14em;
  text-align: center;
  color: var(--accent-ink);
  margin: 34px 0 2px;
}
#chapter-body .bookrange {
  font-family: var(--sans);
  font-size: 13px;
  font-style: italic;
  letter-spacing: .03em;
  text-align: center;
  color: var(--muted);
  margin: 0 0 6px;
}
/* alphabetic-acrostic stanza marker (Psalm 119): Hebrew letter + its name */
#chapter-body .acrostic {
  font-family: var(--serif);
  color: var(--accent-ink);
  margin: 26px 0 8px;
}
#chapter-body .acrostic-letter { font-size: 1.35em; margin-right: .45em; }
#chapter-body .acrostic-name {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: .18em;
}
/* Song of Solomon voice labels ("The Bride") — between verses and mid-verse */
#chapter-body .speaker {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  font-style: italic;
  letter-spacing: .05em;
  color: var(--muted);
}
#chapter-body p.speaker { margin: 18px 0 4px; }
/* mid-verse label: a block inside the verse span; kill the poetry hanging indent */
#chapter-body .verse .speaker { display: block; margin: 14px 0 4px; text-indent: 0; }
#chapter-body p { margin: 0 0 16px; }
#chapter-body p.poetry { margin: 0; padding-left: 2.4em; text-indent: -1em; }
#chapter-body p.poetry.indent2 { padding-left: 3.8em; }

/* words of Jesus (red-letter) */
.woj { color: var(--woj); }
.woj .kw { color: inherit; }   /* keyword stays red inside Jesus's words, just underlined */
.sil-verse .woj { color: var(--woj); }         /* body of Jesus's words: normal red */
.sil-verse .woj .kw { color: #ec9c93; }        /* highlighted keywords: paler red */

/* parallel-passage reference line (sits under a section heading) */
#chapter-body p.parallel {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin: -4px 0 16px;
  letter-spacing: .01em;
}
#chapter-body p.parallel .reflink { color: var(--xref); }

.vnum {
  font-family: var(--sans);
  font-size: .58em;
  font-weight: 700;
  color: var(--accent);
  vertical-align: super;
  cursor: pointer;
  margin-right: 3px;
  /* enlarge tap target without shifting layout (see .noteref::after) */
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.vnum::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: max(150%, 1.9em);
  height: 2.1em;
}
.verse { scroll-margin-top: 96px; border-radius: 4px; transition: background-color 1.4s, box-shadow 1.4s; }
.verse-hl {
  background: var(--sel);
  box-shadow: 0 0 0 4px var(--sel);
  transition: none;
}

.sc { font-variant: small-caps; letter-spacing: .02em; }

/* clickable scripture references inside notes / popover */
.reflink {
  color: var(--xref);
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px dotted rgba(127, 176, 216, .5);
}
.reflink:hover { color: var(--accent-ink); border-bottom-color: var(--accent); }

.noteref {
  font-family: var(--sans);
  font-size: .58em;
  cursor: pointer;
  vertical-align: super;
  font-weight: 700;
  padding: 0 1px;
  /* Enlarge the tap target without affecting layout: an invisible, absolutely
     positioned overlay gives even narrow letters (i, f) a wide, tall hitbox.
     min width via max() guarantees a usable target regardless of glyph width. */
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.noteref::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: max(150%, 1.8em);
  height: 2.1em;
}
.noteref.xref { color: var(--xref); }
.noteref.fn { color: var(--fn); }
.noteref:hover { text-decoration: underline; }

/* notes section */
#notes {
  margin-top: 46px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
}
#notes h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.note-item { margin: 0 0 8px; line-height: 1.6; }
.note-item .note-verse {
  display: inline-block;
  min-width: 2.1em;
  margin-right: 8px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.note-item .note-verse:hover { color: var(--accent-ink); }
.note-item .nlabel { font-weight: 700; margin-right: 7px; }
.note-item.xref .nlabel { color: var(--xref); }
.note-item.fn .nlabel { color: var(--fn); }
.note-item i { color: var(--ink); }

/* popover */
#popover {
  position: fixed;
  max-width: 340px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 11px 14px;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
  z-index: 50;
}
#popover .pop-label { font-weight: 700; color: var(--accent-ink); margin-right: 7px; }
#popover i { color: var(--accent-ink); }

/* word panel: live-reading rotation renderings, a comma-separated line */
.wp-rots { line-height: 1.6; color: var(--ink); }
.wp-rot-orig { color: var(--accent-ink); font-weight: 600; }

/* ---------- Semantic Interlinear: reading-mode bar ---------- */
/* floating reading-mode switcher, pinned to the bottom-right of the reader */
#sil-bar {
  position: fixed;
  right: 24px;
  /* clear the bottom safe area / browser toolbar (exposed via the inset under
     viewport-fit=cover) so the reading-mode pill isn't hidden behind it */
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  font-family: var(--sans);
  transition: right .24s cubic-bezier(.4, 0, .2, 1), bottom .24s cubic-bezier(.4, 0, .2, 1);
}
#sil-bar[hidden] { display: none; }   /* keep hidden beating display:flex */
/* slide clear of the word-detail panel so it's never covered */
body.word-panel-open #sil-bar { right: calc(var(--word-panel-w) + 24px); }
.sil-modes {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.sil-mode {
  border: 0;
  background: none;
  color: var(--muted);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.sil-mode svg { width: 20px; height: 20px; }
.sil-mode:hover { color: var(--ink); background: var(--hover); }
.sil-mode:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sil-mode.active { background: var(--accent); color: #1a1208; }

/* Speaker toggle + its divider inside the reading-mode menu. Mobile only — on
   desktop the audio bar floats on its own, so these stay hidden (revealed in the
   narrow-screen media query when the chapter has audio). */
.sil-sep, .sil-audio-toggle { display: none; }
.sil-sep { width: 1px; align-self: stretch; margin: 3px 2px; background: var(--line); }
body.audio-open .sil-audio-toggle { background: var(--accent); color: #1a1208; }

/* chat toggle: always shown in the reading-mode pill */
.sil-chat-toggle { color: var(--accent-ink); }
body.chat-open .sil-chat-toggle { background: var(--accent); color: #1a1208; }

/* ---------- Grounded study chat panel ---------- */
#chat-panel {
  position: fixed; z-index: 48;
  right: 24px; bottom: 92px; top: auto;      /* sits above the reading-mode pill */
  /* --chat-w / --chat-h are set by dragging the left / top edges (persisted). */
  width: var(--chat-w, min(660px, calc(100vw - 36px)));
  height: var(--chat-h, min(64vh, 560px));
  min-width: 340px; min-height: 240px;
  max-width: calc(100vw - 36px);
  /* never reach above the header/search bar — shrinks if the window is short,
     grows back to the chosen height when there's room again */
  max-height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px) - 106px);
  display: flex; flex-direction: row;        /* history sidebar + chat main */
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  overflow: hidden; font-family: var(--sans);
  transition: bottom .24s cubic-bezier(.4, 0, .2, 1), max-height .24s cubic-bezier(.4, 0, .2, 1);
}
#chat-panel[hidden] { display: none; }
body.word-panel-open #chat-panel { right: calc(var(--word-panel-w) + 24px); }

/* resize grips — thin strips along the draggable edges (kept inside the panel so
   its overflow:hidden / rounded corners don't clip the grab area) */
.chat-rs { position: absolute; z-index: 6; touch-action: none; }
.chat-rs-t  { top: 0; left: 16px; right: 16px; height: 8px; cursor: ns-resize; }
.chat-rs-l  { left: 0; top: 16px; bottom: 16px; width: 8px; cursor: ew-resize; }
.chat-rs-tl { top: 0; left: 0; width: 16px; height: 16px; cursor: nwse-resize; z-index: 7; }
body.chat-resizing { user-select: none; }
body.chat-resizing #chat-panel { transition: none; }   /* follow the pointer 1:1 */

/* local chat-history sidebar */
.chat-history { flex: 0 0 184px; display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); background: rgba(0,0,0,.13); }
.chat-new {
  margin: 10px 10px 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); color: var(--accent-ink); font: inherit; font-size: calc(12.5px * var(--ui-scale)); font-weight: 600;
  cursor: pointer; text-align: left;
}
.chat-new:hover { background: var(--hover); border-color: var(--accent); }
.chat-history-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 2px 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.chat-hist-item { display: flex; align-items: center; gap: 4px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.chat-hist-item:hover { background: var(--hover); }
.chat-hist-item.active { background: var(--sel); }
.chat-hist-main { flex: 1; min-width: 0; }
/* wrap the whole (≤5-word) title; clamp to 3 lines so an outlier never grows the row */
.chat-hist-title {
  font-size: calc(12px * var(--ui-scale)); line-height: 1.25; color: var(--ink); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.chat-hist-time { font-size: calc(10px * var(--ui-scale)); color: var(--muted); margin-top: 1px; }
/* share + delete actions: hover-revealed on desktop, permanent on touch */
.chat-hist-actions { flex: 0 0 auto; display: flex; gap: 1px; opacity: 0; transition: opacity .12s; }
.chat-hist-item:hover .chat-hist-actions, .chat-hist-item:focus-within .chat-hist-actions { opacity: 1; }
.chat-hist-act { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; display: flex; align-items: center; border-radius: 6px; }
.chat-hist-act svg { width: 15px; height: 15px; display: block; }
.chat-hist-act:hover { background: var(--hover); color: var(--ink); }
.chat-hist-del:hover { color: var(--woj); }
.chat-hist-item.shared .chat-hist-share { color: var(--accent); }
/* right-click menu (desktop) */
.chat-ctx-menu { position: fixed; z-index: 1000; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.4); padding: 4px; min-width: 150px; }
.chat-ctx-row { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--ink); cursor: pointer; padding: 7px 10px; border-radius: 6px; font: inherit; font-size: calc(13px * var(--ui-scale)); }
.chat-ctx-row:hover { background: var(--hover); }
.chat-ctx-row.danger:hover { color: var(--woj); }
/* "a chat was shared with you" banner above a read-only shared conversation */
.chat-shared-note { margin: 6px 6px 12px; padding: 8px 12px; border-radius: 8px; background: var(--sel); color: var(--muted); font-size: calc(13px * var(--ui-scale)); line-height: 1.4; }
.chat-shared-note.err { color: var(--woj); }
@media (max-width: 760px) { .chat-hist-actions { opacity: 1; } }
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.chat-title { font-weight: 600; font-size: calc(14px * var(--ui-scale)); color: var(--accent-ink); }
.chat-sub { font-size: calc(11px * var(--ui-scale)); color: var(--muted); margin-top: 2px; max-width: 280px; }
.chat-close { border: 0; background: none; color: var(--muted); font-size: 21px; line-height: 1; cursor: pointer; padding: 0 4px; }
.chat-close:hover { color: var(--ink); }
.chat-head-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.chat-expand { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; display: flex; align-items: center; }
.chat-expand svg { width: 16px; height: 16px; display: block; }
.chat-expand:hover { color: var(--ink); }
.chat-expand .ic-collapse { display: none; }
#chat-panel.fullscreen .chat-expand .ic-expand { display: none; }
#chat-panel.fullscreen .chat-expand .ic-collapse { display: block; }

/* full-window mode: the panel fills the area BELOW the header bar (so the table of
   contents / search controls stay reachable). Resize grips are pointless here, and
   the context selector bar appears so the user can ground (or unground) the chat. */
#chat-panel.fullscreen {
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)) !important;
  left: 0 !important; right: 0 !important; bottom: 0 !important;
  width: auto !important; height: auto !important; max-width: none; max-height: none;
  min-width: 0; min-height: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0;
}
#chat-panel.fullscreen .chat-rs { display: none; }
/* a wider history rail, and the conversation itself held to the reading column
   width (centered) so lines stay comfortably short like the scripture text */
#chat-panel.fullscreen .chat-history { flex: 0 0 260px; }
/* hold the log / input / context content to the reading column, centered — but
   keep their separators (borders, backgrounds) spanning the full width */
#chat-panel.fullscreen .chat-log,
#chat-panel.fullscreen .chat-input,
#chat-panel.fullscreen .chat-suggest,
#chat-panel.fullscreen .chat-context {
  padding-left: max(14px, calc((100% - 760px) / 2));
  padding-right: max(14px, calc((100% - 760px) / 2));
}
/* the bar carries the hidden attr by default; only fullscreen reveals it (this
   selector outweighs the UA [hidden] rule, so no JS toggling of hidden is needed) */
.chat-context { align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.1); flex-wrap: wrap; }
#chat-panel.fullscreen .chat-context { display: flex; }
/* phones open the chat as a full page (no .fullscreen class) — show the selector there too */
body.chat-page #chat-panel .chat-context { display: flex; }
.chat-context-label { font-size: calc(11px * var(--ui-scale)); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.chat-ctx-sel {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 8px; padding: 5px 8px; font: inherit; font-size: calc(13px * var(--ui-scale)); max-width: 60%; cursor: pointer;
}
.chat-ctx-sel:focus { border-color: var(--accent); outline: none; }

/* history drawer toggle + backdrop: mobile-only (the sidebar is always visible on
   desktop, so these are hidden there) */
.chat-history-toggle { display: none; flex: 0 0 auto; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; margin: -2px 2px -2px -2px; }
.chat-history-toggle svg { width: 20px; height: 20px; display: block; }
.chat-history-toggle:hover { color: var(--ink); }
.chat-history-backdrop { display: none; }
.chat-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
/* full conversation title pinned at the top of the log — so it's readable even
   when the sidebar entry is clipped */
.chat-conv-title {
  font-weight: 600; font-size: calc(13px * var(--ui-scale)); color: var(--accent-ink); text-align: center;
  overflow-wrap: anywhere; padding: 0 6px 10px; margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}
.chat-msg { display: flex; }
.chat-msg.chat-user { justify-content: flex-end; }
.chat-bubble {
  max-width: 90%; padding: 9px 13px; border-radius: 14px;
  font-size: calc(14px * var(--ui-scale)); line-height: 1.62; white-space: pre-wrap; word-wrap: break-word;
}
.chat-user .chat-bubble { background: var(--sel); color: var(--ink); border-bottom-right-radius: 4px; }
.chat-assistant .chat-bubble { background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-ref { color: var(--xref); text-decoration: none; border-bottom: 1px solid rgba(127,176,216,.45); white-space: nowrap; cursor: pointer; margin: 0 .2em; }
.chat-ref:hover { color: var(--accent-ink); }
.chat-word { color: var(--accent-ink); text-decoration: none; border-bottom: 1px dotted var(--accent); cursor: pointer; }
.chat-word:hover { background: var(--sel); }
.chat-place { color: var(--place); text-decoration: none; border-bottom: 1px dashed var(--place-soft); cursor: pointer; white-space: nowrap; }
.chat-place:hover { background: var(--place-sel); }

/* place panel: a map of the area + a short historical note */
.place-map { height: 220px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 8px; background: var(--panel-2); isolation: isolate; }
.place-map-fail { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: calc(13px * var(--ui-scale)); }
.place-coords { font-family: var(--sans); font-size: calc(12.5px * var(--ui-scale)); color: var(--muted); margin-bottom: 14px; }
.place-ext { color: var(--accent-ink); text-decoration: none; }
.place-ext:hover { text-decoration: underline; }
/* place names linked inline in the reading — understated so prose stays readable */
.place-link { color: var(--place); text-decoration: none; border-bottom: 1px dotted var(--place-soft); cursor: pointer; }
.place-link:hover { background: var(--place-sel); border-bottom-color: var(--place); }
.leaflet-container { font-family: var(--sans); }   /* keep Leaflet's UI in our font */

/* people: violet, parallel to places */
.chat-person { color: var(--person); text-decoration: none; border-bottom: 1px dashed var(--person-soft); cursor: pointer; white-space: nowrap; }
.chat-person:hover { background: var(--person-sel); }
.person-link { color: var(--person); text-decoration: none; border-bottom: 1px dotted var(--person-soft); cursor: pointer; }
.person-link:hover { background: var(--person-sel); border-bottom-color: var(--person); }
.group-link { color: var(--group); text-decoration: none; border-bottom: 1px dotted var(--group-soft); cursor: pointer; }
.group-link:hover { background: var(--group-sel); border-bottom-color: var(--group); }
.noun-link { color: var(--noun); text-decoration: none; border-bottom: 1px dotted var(--noun-soft); cursor: pointer; }
.noun-link:hover { background: var(--noun-sel); border-bottom-color: var(--noun); }
/* original-language words named in prose (notes): the SIL keyword amber, italic to set them apart */
.word-link { color: var(--accent-ink); font-style: italic; text-decoration: none; border-bottom: 1.5px dotted rgba(230,178,119,.55); cursor: pointer; }
.word-link:hover { background: var(--sel); border-bottom-color: var(--accent); }
/* topical-index themes: pill chips on the verse summary */
.topic-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.topic-chip {
  font-family: var(--sans); font-size: calc(12px * var(--ui-scale)); line-height: 1.3;
  color: var(--accent-ink); text-decoration: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: var(--panel-2);
}
.topic-chip:hover { border-color: var(--accent); background: var(--sel); }
/* person panel: family relationships */
.person-fam { font-family: var(--sans); font-size: calc(13px * var(--ui-scale)); display: flex; flex-direction: column; gap: 5px; }
.person-fam-row { display: grid; grid-template-columns: 72px 1fr; gap: 8px; align-items: baseline; }
.person-fam-label { color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: calc(10.5px * var(--ui-scale)); font-weight: 700; padding-top: 1px; }
.person-fam-names { color: var(--ink); }
.chat-quote { margin: 0 .12em; }
.chat-quote-text { font-family: var(--serif); font-style: italic; color: var(--accent-ink); }
.chat-quote .chat-ref { font-style: normal; font-size: calc(12px * var(--ui-scale)); margin-left: 0; }   /* ref sits at the quote's start */
.chat-think { color: var(--muted); font-style: italic; }
.chat-err { color: var(--woj); }
/* annotation-action card: the assistant added/edited a note or highlight on request */
.chat-ann-card {
  display: block; margin: 8px 0; padding: 9px 12px;
  font-family: var(--sans); font-size: calc(13px * var(--ui-scale)); line-height: 1.5;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  border-left: 3px solid var(--accent);
}
.chat-ann-card.failed, .chat-ann-card.undone { border-left-color: var(--line); opacity: .85; }
.chat-ann-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.chat-ann-kind {
  color: var(--accent-ink); font-weight: 700; font-size: calc(11px * var(--ui-scale));
  text-transform: uppercase; letter-spacing: .05em;
}
.chat-ann-card.failed .chat-ann-kind, .chat-ann-card.undone .chat-ann-kind { color: var(--muted); }
.chat-ann-text { margin-top: 5px; color: var(--ink); white-space: pre-wrap; }
.chat-ann-card.undone .chat-ann-text { text-decoration: line-through; color: var(--muted); }
.chat-ann-reason { margin-top: 5px; color: var(--muted); font-style: italic; }
.chat-ann-undo {
  margin-top: 7px; font-family: var(--sans); font-size: calc(11.5px * var(--ui-scale));
  color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 3px 10px; cursor: pointer;
}
.chat-ann-undo:hover { color: var(--ink); border-color: var(--accent); }
/* rate-limit notices: a centered pill — solid when blocked, softer as a heads-up */
.chat-limit {
  align-self: center; max-width: 92%; text-align: center;
  font-size: calc(12.5px * var(--ui-scale)); line-height: 1.5; color: var(--accent-ink);
  background: var(--panel-2); border: 1px solid var(--accent); border-radius: 12px;
  padding: 8px 14px;
}
.chat-limit.warn { color: var(--muted); border-color: var(--line); border-style: dashed; }
.chat-bubble.streaming::after {
  content: "▍"; color: var(--accent); margin-left: 1px;
  animation: chat-caret 1s steps(1) infinite;
}
@keyframes chat-caret { 50% { opacity: 0; } }
/* starter-prompt chips above the input; collapse smoothly once a chat begins */
.chat-suggest {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 14px 10px;
  overflow: hidden; max-height: 260px; opacity: 1;
  transition: max-height .32s cubic-bezier(.4, 0, .2, 1), opacity .22s ease,
              padding-top .32s cubic-bezier(.4, 0, .2, 1), padding-bottom .32s cubic-bezier(.4, 0, .2, 1);
}
.chat-suggest.hide { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; pointer-events: none; }
.chat-suggest-btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--accent-ink);
  border-radius: 14px; padding: 7px 12px; font: inherit; font-size: calc(12.5px * var(--ui-scale));
  line-height: 1.35; text-align: left; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.chat-suggest-btn:hover { background: var(--hover); border-color: var(--accent); }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-input textarea {
  flex: 1; resize: none; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 10px; padding: 8px 11px; font: inherit; font-size: calc(14px * var(--ui-scale)); line-height: 1.4;
  max-height: 120px; outline: none;
}
.chat-input textarea:focus { border-color: var(--accent); }
.chat-send {
  flex: 0 0 auto; width: 38px; height: 38px; border: 0; border-radius: 10px;
  background: var(--accent); color: #1a1208; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.chat-send:disabled { opacity: .5; cursor: default; }
.chat-send svg { width: 18px; height: 18px; }

/* ---------- Audio reading bar (bottom-left, opposite the mode switcher) ---------- */
#audio-bar {
  position: fixed;
  left: 24px;                 /* the sidebar overlays now, so no need to clear it */
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));   /* clear the bottom toolbar/safe area */
  z-index: 45;
  font-family: var(--sans);
  transition: left .26s cubic-bezier(.4, 0, .2, 1), bottom .24s cubic-bezier(.4, 0, .2, 1);
}
#audio-bar[hidden] { display: none; }
/* Desktop: the contents overlay sits on the left, so slide the audio bubble clear of
   it while it's open (mirrors how the reading-mode bubble slides clear of the word
   panel on the right). On phones the TOC is full-screen, so this doesn't apply. */
@media (min-width: 761px) {
  body:not(.sidebar-collapsed) #audio-bar { left: calc(var(--sidebar-w) + 24px); }
  /* Fixed width so the bubble is the SAME size playing or idle — the seek row (basis
     100%) must not be allowed to blow the shrink-to-fit bubble out to full width. */
  .audio-controls { width: 384px; box-sizing: border-box; }
}
.audio-controls {
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
/* transport (verse jump + prev/play/next) and the repeat cluster ride together as one
   centered group on the first line; the seek + volume drop to their own line below. */
.audio-main { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; justify-content: center; }
.audio-btn {
  border: 0; background: none; color: var(--muted);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px; cursor: pointer; transition: background .14s, color .14s;
}
.audio-btn:hover { color: var(--ink); background: var(--hover); }
.audio-btn svg { width: 22px; height: 22px; }
#audio-play .ic-pause { display: none; }
body.audio-playing #audio-play { color: var(--accent); }
body.audio-playing #audio-play .ic-play { display: none; }
body.audio-playing #audio-play .ic-pause { display: block; }
/* on-demand audio is being generated: spinner in place of the play/pause icon */
body.audio-loading #audio-play svg { display: none; }
body.audio-loading #audio-play::after {
  content: ""; width: 16px; height: 16px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: audio-spin .7s linear infinite;
}
@keyframes audio-spin { to { transform: rotate(360deg); } }
/* "Fetching audio…" label, only while an on-demand clip is being generated */
.audio-status { display: none; margin-left: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
body.audio-loading .audio-status { display: inline; }
/* jump-to-verse dropdown (left of the transport) */
.audio-versesel {
  margin-right: 4px; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 6px; border-radius: 8px; cursor: pointer; transition: border-color .14s;
}
.audio-versesel:focus { outline: none; border-color: var(--accent); }

/* seek + volume row — its own full-width line, shown only while a track is active */
.audio-track { display: none; flex: 0 0 100%; align-items: center; gap: 8px; padding: 0 2px 2px; }
body.audio-active .audio-track { display: flex; }
.audio-time {
  font-size: 10.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; min-width: 28px;
}
.audio-vol-ic { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; margin-left: 4px; }
.audio-range {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 3px; background: var(--line);
  cursor: pointer; outline: none;
}
.audio-seek { flex: 1 1 auto; min-width: 96px; }
.audio-vol { flex: 0 0 56px; width: 56px; }
.audio-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 0; cursor: pointer;
}
.audio-range::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 0; cursor: pointer;
}


/* --- repeat a section: loop toggle + section chooser --- */
.audio-repeat { display: flex; align-items: center; gap: 4px; padding: 0 4px; }
.audio-repeat-btn { width: 34px; height: 34px; flex: 0 0 auto; }
.audio-repeat-btn svg { width: 18px; height: 18px; }
.audio-repeat-btn.on { color: var(--accent); background: var(--hover); }
.audio-sectionbtn {
  display: flex; align-items: center; gap: 2px;
  border: 1px solid var(--line); background: none; color: var(--ink);
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 5px 6px 5px 10px; border-radius: 8px; cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.audio-sectionbtn:hover { background: var(--hover); border-color: var(--accent); }
/* fixed width so the control cluster never reflows when the chosen range changes */
.audio-sec-label { width: 72px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-sec-caret { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; }
.audio-repeat-btn.on + .audio-sectionbtn { border-color: var(--accent); }

/* the section chooser popover */
.audio-section-pop {
  position: absolute; bottom: calc(100% + 8px); left: 0;
  width: 268px; max-width: calc(100vw - 32px); max-height: 60vh; overflow-y: auto;
  padding: 12px; box-sizing: border-box;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--float-shadow); z-index: 5;
}
.audio-section-pop[hidden] { display: none; }
.sec-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.sec-tab {
  flex: 1 1 0; border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 600;
  padding: 6px 4px; border-radius: 8px; cursor: pointer; transition: background .14s, color .14s, border-color .14s;
}
.sec-tab:hover { color: var(--ink); border-color: var(--accent); }
.sec-tab.on { background: var(--accent); border-color: var(--accent); color: #1a1208; }
.sec-body { display: flex; flex-direction: column; gap: 8px; min-height: 38px; }
.sec-row { display: flex; align-items: center; gap: 6px; }
.sec-lab { font-size: 12px; font-weight: 600; color: var(--muted); min-width: 42px; }
.sec-colon { color: var(--muted); font-weight: 700; }
.sec-note { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.sec-select {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font: inherit; font-size: 13px; padding: 5px 6px; border-radius: 7px; cursor: pointer;
}
.sec-select:focus { outline: none; border-color: var(--accent); }
.sec-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.sec-apply {
  border: 1px solid var(--accent); background: var(--accent); color: #1a1208;
  font: inherit; font-size: 12.5px; font-weight: 700;
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
}
.sec-apply:hover { filter: brightness(1.06); }

/* verses inside the active (or previewed) repeat section — same look as audio-on */
.verse.repeat-range {
  background: var(--sel);
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* the verse currently being read aloud */
.verse.audio-on {
  background: var(--sel);
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* mode-name label that pops above the switcher, then fades (persists in Expanded) */
.sil-label {
  max-width: 260px;
  padding: 7px 13px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
.sil-label.show { opacity: 1; transform: none; }
.sil-label.disclaimer {
  white-space: normal;
  text-align: right;
  font-weight: 500;
  font-style: italic;
  color: var(--accent-ink);
}

/* ---------- SIL inline markers ---------- */
/* Word Context: aligned keyword in the base verse */
.kw {
  cursor: pointer;
  color: var(--accent-ink);
  border-bottom: 1.5px dotted rgba(230, 178, 119, .55);
  border-radius: 2px;
  transition: background .12s, border-color .12s;
}
.kw:hover, .kw:focus-visible {
  background: var(--sel);
  border-bottom-color: var(--accent);
  outline: none;
}

/* Live / Expanded: semantic phrase */
.sem {
  cursor: pointer;
  color: var(--accent-ink);
  border-bottom: 1.5px dotted rgba(230, 178, 119, .5);
  border-radius: 2px;
  transition: opacity .2s ease, background .12s;
}
.sem:hover, .sem:focus-visible { background: var(--sel); outline: none; }
.sem.rotating {
  font-style: italic;
  display: inline-block;       /* a fixed reserved slot (width set in JS) so the word
                                  morphs in place without reflow… */
  text-align: center;          /* …and sits centered within that reserved area */
  text-indent: 0;              /* poetry verses set text-indent:-1em (hanging indent),
                                  which inherits and shrinks these slots — cancel it */
  white-space: nowrap;
  vertical-align: baseline;
  overflow: visible;
}

/* ---------- Interlinear mode ----------
   Each SIL verse becomes its own block: readable English on top, the full
   original-language line below, joined by colored connector lines. */
body.il-mode #chapter-body .prose,
body.il-mode #chapter-body .poetry { text-indent: 0; }
body.il-mode #chapter-body .verse {
  display: block;
  position: relative;
  padding-left: 1.8em;
  margin: .3em 0 1.5em;
}
body.il-mode #chapter-body .verse .vnum { position: absolute; left: 0; top: .25em; }
body.il-mode #chapter-body .sil-verse .gen-btn { display: none; }

.il-block { position: relative; }
.il-eng {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  line-height: 1.75;
}
.il-links {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}
.il-link {
  stroke-width: 1.6;
  opacity: .55;
  transition: opacity .12s, stroke-width .12s;
}
.il-block.il-tracing .il-link { opacity: .1; }
.il-link.il-hot { opacity: 1 !important; stroke-width: 2.6; }
/* exact trail for an uncurated word — drawn only while its pair is traced */
.il-link.il-grey { stroke: var(--muted); stroke-dasharray: 2 3; }

/* every original word's exact English span (invisible until traced) */
.il-en { border-radius: 3px; }
.il-en.il-hot { background: var(--sel); box-shadow: 0 1px 0 currentColor; }

.il-orig {
  position: relative;
  z-index: 1;
  margin-top: 1.7em;
  display: flex;
  flex-wrap: wrap;
  gap: .35em .8em;
  line-height: 1.35;
}
.il-tok {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 1px 3px 0;
  border-radius: 5px;
  transition: background .12s, opacity .12s;
}
.il-surf {
  font-family: var(--serif);
  font-size: 1.18em;
  color: var(--ink);
  border-bottom: 1.5px solid transparent;
  line-height: 1.25;
}
.il-tl {
  font-family: var(--sans);
  font-size: .68em;
  color: var(--muted);
  margin-top: 1px;
  letter-spacing: .01em;
}
/* uncurated words: muted (their exact link shows on hover), still readable + clickable */
.il-tok.il-unlinked .il-surf { color: var(--muted); }
.il-tok:hover, .il-tok:focus-visible { background: var(--hover); outline: none; }
.il-tok.il-unlinked:hover .il-surf { color: var(--ink); }

/* trace (hover or the open word's pin): dim the rest, light up the matched pair */
.il-block.il-tracing .il-tok:not(.il-hot),
.il-block.il-tracing .il-en:not(.il-hot) { opacity: .45; }
.il-tok.il-hot { background: var(--sel); }

/* Interlinear LTR/RTL bubble, floating above the reading-mode pill */
.il-dir {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  font-family: var(--sans);
}
.il-dir[hidden] { display: none; }
.il-dir-btn {
  border: 0;
  background: none;
  color: var(--muted);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.il-dir-btn svg { width: 18px; height: 18px; }
.il-dir-btn:hover { color: var(--ink); background: var(--hover); }
.il-dir-btn.active { background: var(--accent); color: #1a1208; }
.il-dir-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Word detail panel ---------- */
#word-panel {
  position: fixed;
  top: 0; right: 0;
  width: var(--word-panel-w);
  max-width: 92vw;
  height: 100%;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 48px rgba(0, 0, 0, .5);
  z-index: 60;
  overflow-y: auto;
  font-family: var(--sans);
  padding: 26px 24px 60px;
  animation: wp-in .22s cubic-bezier(.4, 0, .2, 1);
}
@keyframes wp-in { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
/* header buttons sit ABOVE the mobile drag handle so taps reach them, not the drag */
#word-panel-close, #word-panel-save, #word-panel-back { z-index: 3; }
#word-panel-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
#word-panel-close:hover { background: var(--hover); color: var(--ink); }
/* Save (star) — sits just left of the × */
#word-panel-save {
  position: absolute; top: 14px; right: 54px;
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
#word-panel-save svg { width: 17px; height: 17px; }
#word-panel-save:hover { background: var(--hover); color: var(--ink); }
#word-panel-save.saved { color: var(--accent); }
#word-panel-save.saved svg { fill: var(--accent); }
/* Back button: sits just left of the × — shown only when the word was opened from a
   verse summary, so the reader can return to it. */
#word-panel-back {
  position: absolute;
  top: 14px; right: 94px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
}
#word-panel-back[hidden] { display: none; }
#word-panel-back svg { width: 18px; height: 18px; display: block; }
#word-panel-back:hover { background: var(--hover); color: var(--ink); }

#word-panel-handle { display: none; }   /* only used as a drag grip on phones */

/* Scale the whole word-detail panel with the A-/A/A+ text-size control, the same
   as the reading text and the sidebar. zoom keeps the panel's size hierarchy
   (word, glosses, notes) proportional in one rule. */
#word-panel-body { zoom: var(--ui-scale); }

.wp-head { margin-bottom: 20px; padding-right: 36px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.wp-eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.wp-word {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  margin: 5px 0 4px;
  color: var(--accent-ink);
}
.wp-role { font-size: 13px; color: var(--muted); font-style: italic; }

.wp-sec { margin-bottom: 22px; }
.wp-h {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 9px;
  font-weight: 700;
}

.wp-token {
  position: relative;                 /* anchor for the pronunciation button */
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 46px 10px 13px;       /* right room reserved for the speaker button */
  margin-bottom: 8px;
}
.wp-surface { font-size: 26px; font-family: var(--serif); color: var(--ink); }
.wp-token-meta { display: flex; gap: 10px; align-items: baseline; margin-top: 2px; }
.wp-translit { font-style: italic; color: var(--accent-ink); font-size: 14px; }
.wp-strongs {
  font-size: 11px; font-weight: 700;
  color: var(--xref);
  background: rgba(127, 176, 216, .12);
  padding: 1px 7px; border-radius: 20px;
}
.wp-morph { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.wp-token-note { font-size: 12.5px; line-height: 1.5; color: var(--accent-ink); margin-top: 3px; font-style: italic; }

/* ---------- Verse summary panel ---------- */
.vs-base {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.vs-explainer { font-size: 14.5px; line-height: 1.65; color: var(--ink); margin: 0; }

/* one-time "is this summary helpful?" feedback prompt */
.vs-feedback {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255,255,255,.02);
}
.vsfb-q { font-family: var(--sans); font-size: 13px; color: var(--muted); }
.vsfb-btns { display: flex; gap: 8px; margin-left: auto; }
.vsfb-btn {
  font: inherit; font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 5px 16px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--accent-ink);
}
.vsfb-btn:hover { background: var(--hover); border-color: var(--accent); }
.vsfb-no { color: var(--muted); }
.vsfb-thanks { font-family: var(--sans); font-size: 13px; color: var(--accent-ink); }
/* compact word list: one header line (surface · translit · Strong's) + a short
   description, separated by hairline rules instead of bulky cards */
.vs-words {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  overflow: hidden;
}
/* "Original words" header row + Research-all button */
.vs-words-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.vs-words-head .wp-h { margin-bottom: 9px; }
.vs-research-all {                                   /* subtle, like .conn-find */
  flex: 0 0 auto; font: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--muted); background: none; border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 10px; cursor: pointer; white-space: nowrap;
  transition: background .14s, color .14s, border-color .14s;
}
.vs-research-all:hover:not(:disabled) { background: var(--hover); color: var(--ink); border-color: var(--muted); }
.vs-research-all:disabled { cursor: default; }
.vs-research-all.err { color: var(--woj); border-color: var(--woj); }
.vs-word { padding: 8px 13px; border-top: 1px solid var(--line); }
.vs-word-researched .vs-desc { color: var(--ink); }   /* freshly researched → fuller definition */

/* Cross-reference info: subtle inline button under a section's parallel refs, and
   the explanation shown in the word panel */
.xref-info-btn {
  font: inherit; font-family: var(--sans); font-size: 11.5px; font-weight: 600;
  color: var(--muted); background: none; border: 1px solid var(--line);
  border-radius: 7px; padding: 2px 8px; cursor: pointer; vertical-align: middle; white-space: nowrap;
  transition: background .14s, color .14s, border-color .14s;
}
.xref-info-btn:hover { background: var(--hover); color: var(--ink); border-color: var(--muted); }
.xref-links { display: flex; flex-wrap: wrap; gap: 2px 6px; font-family: var(--sans); font-size: 13px; margin-bottom: 12px; }
.xref-explain { font-family: var(--serif); font-size: 14.5px; line-height: 1.62; color: var(--ink); margin: 0; }
/* per-reference sections: each parallel's explanation, headed by its (clickable)
   reference and set off with an accent rail so it's clear which is which */
.xref-body { display: flex; flex-direction: column; gap: 18px; }
.xref-section { border-left: 2px solid rgba(127, 176, 216, .28); padding-left: 13px; }
.xref-section-ref {
  display: inline-block; margin-bottom: 6px;
  font-family: var(--sans); font-size: calc(13px * var(--ui-scale)); font-weight: 700; letter-spacing: .01em;
  color: var(--accent-ink); text-decoration: none;
}
.xref-section-ref:hover { color: var(--accent); text-decoration: underline; }
.xref-section .xref-explain { font-size: calc(14.5px * var(--ui-scale)); }

/* book introduction (rendered in the word panel) */
.bi-body { display: flex; flex-direction: column; gap: 20px; }
.bi-summary { font-family: var(--serif); font-size: calc(15px * var(--ui-scale)); line-height: 1.62; color: var(--ink); margin: 0; }
.bi-facts { display: flex; flex-direction: column; gap: 11px; }
.bi-fact { display: grid; grid-template-columns: 104px 1fr; gap: 12px; align-items: start; }
.bi-fact-label { font-family: var(--sans); font-size: calc(11px * var(--ui-scale)); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.bi-fact-val { font-family: var(--sans); font-size: calc(13.5px * var(--ui-scale)); line-height: 1.55; color: var(--ink); }
.bi-sec { display: flex; flex-direction: column; gap: 9px; }
.bi-sec-h { font-family: var(--sans); font-size: calc(12px * var(--ui-scale)); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-ink); }
.bi-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.bi-chip { font-family: var(--sans); font-size: calc(12.5px * var(--ui-scale)); color: var(--accent-ink); background: var(--sel, rgba(230,178,119,.14)); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; }
.bi-verse { font-family: var(--sans); font-size: calc(13.5px * var(--ui-scale)); line-height: 1.5; color: var(--ink); padding: 1px 0; }
.bi-verse .reflink { font-weight: 600; }
.bi-verse-why { color: var(--muted); }

/* Book-introduction journey map: a traced itinerary on the relief map + a colour legend. */
.journey-note { font-family: var(--sans); font-size: calc(12px * var(--ui-scale)); color: var(--muted); font-style: italic; margin: -2px 0 0; }
.journey-hint { font-family: var(--sans); font-size: calc(12.5px * var(--ui-scale)); color: var(--muted); margin: 0 0 2px; }
/* isolation keeps Leaflet's internal panes/controls (z-index up to ~1000) inside this box's own
   stacking context, so they never paint over the TOC overlay, reading-mode bubble, or other UI. */
.journey-map { height: 360px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); isolation: isolate; }
.journey-pin-wrap { background: none; border: 0; }
.journey-pin { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%;
  color: #fff; font-family: var(--sans); font-size: 12px; font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.85); }
.journey-pop { font-family: var(--sans); min-width: 120px; }
.journey-pop-where { font-weight: 700; color: var(--ink); font-size: calc(13.5px * var(--ui-scale)); }
.journey-pop-note { color: var(--muted); font-size: calc(12.5px * var(--ui-scale)); margin: 2px 0 4px; }
.journey-pop .reflink { font-weight: 600; }
/* Theme the Leaflet popup to the app's panel (it ships white, which washed out our light text). */
.journey-map .leaflet-popup-content-wrapper, .place-map .leaflet-popup-content-wrapper { background: var(--panel); color: var(--ink); box-shadow: 0 3px 14px rgba(0,0,0,.45); }
.journey-map .leaflet-popup-tip, .place-map .leaflet-popup-tip { background: var(--panel); }
.journey-map .leaflet-popup-content, .place-map .leaflet-popup-content { color: var(--ink); }
.journey-map .leaflet-popup-close-button, .place-map .leaflet-popup-close-button { color: var(--muted); }
.journey-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 4px; }
/* "Show all" (default) + one pill per journey; tap a journey to focus just it. */
.journey-all { font-family: var(--sans); font-size: calc(12.5px * var(--ui-scale)); font-weight: 600; color: var(--muted);
  background: none; border: 1px solid var(--line); padding: 4px 12px; margin: 0; border-radius: 999px; cursor: pointer; }
.journey-all:hover { border-color: var(--accent-ink); color: var(--ink); }
.journey-all.active { background: var(--sel, rgba(230,178,119,.14)); border-color: var(--accent-ink); color: var(--accent-ink); }
.journey-leg { display: flex; align-items: center; gap: 7px; font-family: var(--sans); font-size: calc(13px * var(--ui-scale));
  color: var(--ink); background: none; border: 1px solid transparent; padding: 3px 9px; margin: 0; border-radius: 999px; cursor: pointer; text-align: left; }
.journey-leg:hover { background: var(--panel-2); }
.journey-leg.active { background: var(--sel, rgba(230,178,119,.14)); border-color: var(--accent-ink); font-weight: 600; }
.journey-leg.dim { opacity: .38; }
.journey-swatch { width: 14px; height: 4px; border-radius: 2px; flex: none; }

@media (max-width: 460px) {
  .bi-fact { grid-template-columns: 1fr; gap: 2px; }
  .bi-fact-label { padding-top: 0; }
}
.vs-word:first-child { border-top: 0; }
.vs-word-link { cursor: pointer; transition: background .14s; }
.vs-word-link:hover, .vs-word-link:focus-visible { background: var(--hover); outline: none; }
.vs-word-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.vs-surface { font-family: var(--serif); font-size: 19px; color: var(--ink); line-height: 1.2; }
.vs-translit { font-style: italic; color: var(--accent-ink); font-size: 13px; }
.vs-strongs {
  font-size: 10px; font-weight: 700; color: var(--xref);
  background: rgba(127, 176, 216, .12); padding: 1px 6px; border-radius: 20px;
}
.vs-desc { font-size: 12.5px; line-height: 1.45; color: var(--muted); margin-top: 2px; }

/* ---------- Connected themes (semantic cross-references) ---------- */
.conn-lead { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin: 0 0 9px; }
.conn-find {
  display: block; width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 9px;
  background: none; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.conn-find:hover { background: var(--hover); color: var(--ink); border-color: var(--muted); }
.topic-chat-cta {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 2px 0 20px;
  padding: 7px 13px;
  border: 1px solid var(--line); border-radius: 9px;
  background: none; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
.topic-chat-cta:hover { background: var(--hover); color: var(--ink); border-color: var(--muted); }
.topic-chat-cta svg { width: 15px; height: 15px; flex: 0 0 auto; }
.conn-evidence { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.conn-evi {
  font-size: 12px; color: var(--muted);
  padding-left: 14px; position: relative; line-height: 1.45;
}
.conn-evi::before { content: "·"; position: absolute; left: 4px; color: var(--accent); }
.conn-list { display: flex; flex-direction: column; gap: 9px; }
/* "Search again" spinner is appended after existing cards — keep it clear of them. */
.conn-list + .gp-stage { margin-top: 14px; }
.conn-card {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px;
}
.conn-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.conn-ref { font-weight: 700; font-size: 13.5px; color: var(--accent-ink); text-decoration: none; }
a.conn-ref { border-bottom: 1px dotted rgba(230, 178, 119, .4); }
a.conn-ref:hover { color: var(--accent); border-bottom-color: var(--accent); }
.conn-type {
  font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; font-weight: 700;
  color: var(--accent); border: 1px solid rgba(230, 178, 119, .4);
  border-radius: 10px; padding: 1px 7px;
}
.conn-text { font-family: var(--serif); font-size: 14px; line-height: 1.5; color: var(--ink); margin: 7px 0 0; }
.conn-note { font-size: 12.5px; line-height: 1.55; color: var(--muted); margin: 6px 0 0; }
.conn-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.conn-badge {
  font-size: 10px; color: var(--xref);
  background: rgba(127, 176, 216, .12); border-radius: 10px; padding: 1px 7px;
}
.conn-refresh {
  margin-top: 10px; border: 0; background: none; color: var(--xref);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 0;
}
.conn-refresh:hover { color: var(--accent-ink); }
.conn-empty { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }

.wp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-bottom: 14px; }
.wp-fact { display: flex; flex-direction: column; gap: 2px; }
.wp-fact-label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.wp-fact-val { font-size: 15px; color: var(--ink); }

.wp-def { font-size: 14px; line-height: 1.6; color: var(--ink); margin: 0 0 10px; }
.wp-note { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0 0 12px; }

/* Copy button (verse summary text + word definition). Floats top-right so the
   text wraps around it; flashes a check on copy. */
.vs-textblock, .wp-defblock { display: flow-root; }
.wp-copy {
  float: right;
  margin: 0 0 6px 10px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel-2); color: var(--muted);
  cursor: pointer; transition: background .14s, color .14s, border-color .14s;
}
.wp-copy:hover { color: var(--ink); background: var(--hover); }
.wp-copy svg { width: 15px; height: 15px; }
.wp-copy .ic-check { display: none; }
.wp-copy.copied { color: var(--accent); border-color: var(--accent); }
.wp-copy.copied .ic-copy { display: none; }
.wp-copy.copied .ic-check { display: block; }

/* Pronunciation (speaker) button, top-right of an "Original word" box. */
.wp-say {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--muted);
  cursor: pointer; transition: background .14s, color .14s, border-color .14s;
}
.wp-say:hover { color: var(--ink); background: var(--hover); }
.wp-say svg { width: 16px; height: 16px; display: block; }
.wp-say .ic-say { transform: translateX(1.5px); }   /* speaker glyph sits left of centre — nudge it */
.wp-say .ic-spin { display: none; }
.wp-say.loading { cursor: default; }
.wp-say.loading .ic-say { display: none; }
.wp-say.loading .ic-spin { display: block; animation: gen-spin .8s linear infinite; }
.wp-say.playing { color: var(--accent); border-color: var(--accent); background: var(--hover); }
.wp-say.err { color: #e0626c; border-color: #e0626c; }

.vs-label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 5px;
}
.vs-exp { font-style: italic; color: var(--accent-ink); }
.wp-aln-note {
  border-left: 2px solid var(--accent);
  padding-left: 11px;
  font-style: italic;
}

.wp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.wp-chip {
  font-size: 12.5px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
}
/* Stack the (often long) category label above its chips so the chips get
   the full panel width to wrap across, instead of being squeezed into a
   narrow column beside the label. */
.wp-facet { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.wp-facet-label {
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}
.wp-facet .wp-chips { margin-bottom: 0; }

.wp-links { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.wp-link { color: var(--xref); text-decoration: none; font-size: 13px; border-bottom: 1px dotted rgba(127,176,216,.4); align-self: flex-start; }
.wp-link:hover { color: var(--accent-ink); }

.wp-usage {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 9px;
}
.wp-usage-ref { font-weight: 700; font-size: 13px; color: var(--accent-ink); margin-bottom: 4px; display: block; }
a.wp-usage-link { text-decoration: none; cursor: pointer; border-bottom: 1px dotted rgba(230, 178, 119, .4); }
a.wp-usage-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.wp-snippet { font-family: var(--serif); font-size: 14.5px; line-height: 1.55; color: var(--ink); margin: 0; }
.wp-match { background: var(--sel); color: var(--accent-ink); border-radius: 3px; padding: 0 2px; }
.wp-usage-note { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

.wp-more-usages {
  width: 100%;
  margin-top: 2px;
  padding: 9px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.wp-more-usages:hover:not(:disabled) { background: var(--hover); border-color: var(--accent); }
.wp-more-usages:disabled { cursor: default; color: var(--muted); }
.wp-more-usages.loading { color: var(--muted); border-style: solid; }

/* "See more" reveals already-stored usages — a quieter text toggle */
.wp-see-usages {
  display: block;
  width: 100%;
  margin: 0 0 9px;
  padding: 7px 12px;
  border: 0;
  background: none;
  color: var(--xref);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.wp-see-usages:hover { color: var(--accent-ink); }
.wp-see-usages[hidden], .wp-more-usages[hidden] { display: none; }

/* ---------- Per-verse generate (LLM) control ---------- */
.gen-btn { display: none; }              /* only when the backend API is present */
body.has-api .gen-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: inherit;                /* so em-based sizing scales with --reading-size */
  width: 1.5em; height: 1.5em;
  vertical-align: middle;            /* baseline anchor; `top` fine-tunes to cap-height center */
  top: -.12em;                       /* nudge up so the icon centers on the text, not the x-height */
  margin: 0 .12em 0 .04em;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  opacity: .55;
  transition: opacity .14s, color .14s;
  -webkit-tap-highlight-color: transparent;
}
.gen-btn svg { width: 80%; height: 80%; }
/* invisible overlay enlarges the tap target beyond the visible icon */
.gen-btn::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 2em; height: 2em;
}
.gen-btn:focus-visible { opacity: .8; }
.gen-btn:hover { opacity: 1; color: var(--accent); }
.gen-btn.has-sil { opacity: .9; color: var(--accent); }
/* Generated verses are locked in the cloud — remove their generate icon. Locally
   (body.sil-local) it stays so the verse can be regenerated or removed. */
body:not(.sil-local) .gen-btn.has-sil { display: none; }
.gen-btn.loading {
  opacity: 1; color: var(--accent);
  animation: gen-spin 1s linear infinite;
  pointer-events: none;
}
@keyframes gen-spin { to { transform: rotate(360deg); } }

#gen-toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  z-index: 70;
  max-width: min(540px, 92vw);
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  box-shadow: var(--float-shadow);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 11px;
}
#gen-toast[hidden] { display: none; }
#gen-toast.loading::before {
  content: "";
  flex: 0 0 auto;
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: gen-spin .8s linear infinite;
}
#gen-toast.ok { border-color: rgba(120, 190, 120, .45); color: var(--ink); }
#gen-toast.err { border-color: #b5524a; color: #e3a097; }

#gen-menu {
  position: fixed;
  z-index: 70;
  min-width: 132px;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--float-shadow);
  font-family: var(--sans);
}
#gen-menu[hidden] { display: none; }
.gen-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.gen-menu-item:hover { background: var(--hover); }

/* ---------- Enhance chapter (centred grey frame, empty centre) ---------- */
#enhance-chapter {
  display: block;
  width: fit-content;
  margin: 6px auto 22px;
  padding: 11px 26px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}
#enhance-chapter:hover:not(:disabled) { background: var(--hover); color: var(--ink); border-color: var(--muted); }
#enhance-chapter:disabled { cursor: default; color: var(--muted); }
#enhance-chapter[hidden], body:not(.has-api) #enhance-chapter { display: none; }

/* ---------- Confirm / cancel modal ---------- */
#modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  background: rgba(0, 0, 0, .55);
  animation: modal-fade .16s ease;
}
#modal[hidden] { display: none; }
#modal-box {
  width: 100%; max-width: 430px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  padding: 22px 24px;
  font-family: var(--sans);
  animation: modal-rise .2s cubic-bezier(.4, 0, .2, 1);
}
#modal-box h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--accent-ink);
}
#modal-box p { margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: var(--ink); }
#modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-ghost, .btn-primary {
  font: inherit; font-weight: 600; font-size: 13.5px;
  padding: 9px 16px; border-radius: 9px; cursor: pointer;
}
.btn-ghost { border: 1px solid var(--line); background: none; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }
.btn-primary { border: 1px solid var(--accent); background: var(--accent); color: var(--bg); }
.btn-primary:hover { filter: brightness(1.07); }
@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Live generation progress (inside the word panel) ---------- */
.gp-stage {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-ink);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.gp-stage.loading::before {
  content: "";
  flex: 0 0 auto;
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: gen-spin .8s linear infinite;
}
.gp-stage.done { color: #8fce8f; }
.gp-stage.err { color: #e3a097; }
.gp-base {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: 12px;
  margin: 0 0 18px;
}

.gp-keywords { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-chip {
  font-size: 13px;
  font-family: var(--serif);
  padding: 3px 11px;
  border-radius: 20px;
  background: var(--sel);
  color: var(--accent-ink);
  animation: gp-pop .2s ease;
}
@keyframes gp-pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

.gp-research { display: flex; flex-direction: column; gap: 9px; }
.gp-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  animation: gp-pop .2s ease;
}
.gp-card.loading { opacity: .7; }
.gp-card-phrase {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--accent-ink);
  display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap;
}
.gp-card-meta { font-size: 11px; font-style: italic; color: var(--muted); font-family: var(--sans); }
.gp-card-status { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 3px; }
.gp-card-glosses { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0 0; }
.gp-gloss {
  font-size: 11.5px; padding: 2px 8px; border-radius: 14px;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
}
.gp-card-def { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-top: 7px; }
.gp-card-related { font-size: 11.5px; color: var(--xref); margin-top: 6px; }

.gp-expanded {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0;
}
.gp-hl { color: var(--accent-ink); border-bottom: 1.5px dotted rgba(230, 178, 119, .5); }
.gp-hl.forming { opacity: .65; border-bottom-style: solid; }

/* ---------- Narrow screens (portrait phones) ---------- */
@media (max-width: 760px) {
  #welcome, #chapter, #book-intro { padding: 26px 22px 140px; }
  #chapter-title { font-size: 25px; }

  /* top bar: [☰] [search] [A▾] [account] — scope dropdown removed, size collapsed to a popover */
  body.word-panel-open #topbar { right: 0; }
  /* word detail is a bottom sheet here, so keep the switcher centred */
  body.word-panel-open #chapter-jump { left: 50%; }
  #topbar { gap: 8px; padding: 0 10px; }
  #search-scope { display: none; }                 /* no scope picker on mobile — always "All" */
  #search { max-width: none; }
  #search-input { font-size: 13px; padding: 9px 11px; }
  /* text size collapses to one button that pops the three options open beneath it */
  #textsize-toggle { display: flex; }
  #textsize {
    position: absolute; top: calc(100% + 6px); right: 0;
    display: none; z-index: 60;
  }
  #textsize.open { display: flex; }
  #textsize .topbar-btn { width: 38px; height: 34px; }

  /* Table of contents opens as a full page (overlay), not a side panel. z-index
     stays above the chat (incl. full-window) so it overlays rather than hides. */
  #sidebar {
    position: fixed;
    left: 0; top: var(--topbar-h);
    z-index: 49;
    width: 100vw;
    flex-basis: 100vw;
    height: calc(100% - var(--topbar-h));
    box-shadow: none;
  }
  body.sidebar-collapsed #sidebar { margin-left: -100vw; }

  /* --- Audio on mobile: a bottom-locked panel toggled by the speaker icon in
     the reading-mode menu. Hidden until toggled; the toggle itself only appears
     when the chapter actually has audio (body.has-audio). When open it shows the
     full controls (centered prev/play/next + verse picker, scrub bar, volume) and
     the reading-mode bar lifts above it. --- */
  body.has-audio .sil-sep { display: block; }
  body.has-audio .sil-audio-toggle { display: flex; }

  /* chat on mobile: a bottom sheet that sits ABOVE the reading-mode pill (and so
     above the audio bar too). Drag the top edge to make it taller; it never
     reaches above the header/search bar and shrinks/returns as the audio panel
     opens/closes. */
  #chat-panel {
    left: 8px; right: 8px; top: auto;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));   /* clear the reading-mode pill */
    width: auto;
    /* a comfortable default, freely draggable taller (the top edge resizes); the
       only ceiling is the header, so the user controls the size */
    height: var(--chat-h, 50dvh);
    min-width: 0;
    max-height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 104px);
  }
  body.audio-open #chat-panel {                  /* lift above the open audio panel */
    bottom: calc(var(--audio-h, 100px) + 76px + env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--audio-h, 100px) - 92px);
  }
  /* word-detail sheet open: sit above the sheet AND the reading-mode pill (--sheet-h
     tracks the sheet's live height). With audio also open, clear all three. */
  body.word-panel-open #chat-panel {
    right: 8px;
    bottom: calc(var(--sheet-h, 50vh) + 78px + env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--sheet-h, 50vh) - 94px);
  }
  body.audio-open.word-panel-open #chat-panel {
    bottom: calc(var(--sheet-h, 46vh) + var(--audio-h, 100px) + 76px + env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--sheet-h, 46vh) - var(--audio-h, 100px) - 92px);
  }

  /* Full-window mode is a special case: instead of FLOATING above a bottom panel
     (which leaves page content peeking through the gap), the chat fills the screen
     and attaches its bottom edge directly to the top of whatever bottom panel is
     open — the word-detail sheet and/or the audio bar — with no lift offset. */
  body.word-panel-open #chat-panel.fullscreen {
    bottom: var(--sheet-h, 50vh) !important;
    max-height: none !important;
  }
  body.audio-open #chat-panel.fullscreen {
    bottom: var(--audio-h, 100px) !important;
    max-height: none !important;
  }
  body.audio-open.word-panel-open #chat-panel.fullscreen {
    bottom: calc(var(--sheet-h, 46vh) + var(--audio-h, 100px)) !important;
    max-height: none !important;
  }

  /* keyboard up (chat input focused): app.js pins the panel to the VISIBLE viewport
     (visualViewport rect) via inline styles, so positioning lives there, not here —
     this avoids window.innerHeight, which jumps as Firefox toggles its URL bar and
     was flinging the panel to the top of the screen. body.kb-up just marks the state. */

  /* history becomes a slide-in drawer toggled from the chat header */
  .chat-history-toggle { display: flex; align-items: center; }
  .chat-history {
    position: absolute; z-index: 9; left: 0; top: 0; bottom: 0;
    flex-basis: auto; width: min(220px, 78%);
    transform: translateX(-100%); transition: transform .22s cubic-bezier(.4, 0, .2, 1);
    background: var(--panel); box-shadow: 6px 0 22px rgba(0, 0, 0, .4);
  }
  #chat-panel.history-open .chat-history { transform: translateX(0); }
  .chat-history-backdrop {
    position: absolute; inset: 0; z-index: 8; display: block;
    background: rgba(0, 0, 0, .42); opacity: 0; pointer-events: none;
    transition: opacity .22s ease;
  }
  #chat-panel.history-open .chat-history-backdrop { opacity: 1; pointer-events: auto; }
  .chat-hist-title { -webkit-line-clamp: 2; }   /* cut off long titles in the drawer */
  .chat-sub { display: none; }   /* save header room on small screens */
  .chat-rs-l, .chat-rs-tl { display: none; }   /* only top-resize on mobile */

  /* On phones the chat opens as its OWN full-screen page: the reading and all its
     chrome are hidden and the chat fills the viewport — no overlay, no layering, no
     fighting the page underneath. The close (×) button returns to reading. JS sizes
     the panel to the visible viewport (visualViewport) so it sits above the keyboard. */
  body.chat-page #topbar,
  body.chat-page #app,
  body.chat-page #sil-bar,
  body.chat-page #audio-bar,
  body.chat-page #chapter-jump { display: none !important; }
  body.chat-page #chat-panel {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: auto !important;
    width: auto !important; max-width: none !important;   /* fill the full screen width */
    height: 100dvh;                  /* JS overrides with the exact visualViewport height */
    max-height: none !important; min-height: 0 !important;
    border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    transition: none !important;     /* don't animate while tracking the keyboard */
  }
  body.chat-page .chat-expand,
  body.chat-page .chat-rs { display: none; }       /* always full page on a phone */
  #chat-suggestions { display: none !important; }  /* the starter chips are too tall here */

  /* roomier input on touch: a taller default box and a 16px font (stops iOS from
     auto-zooming on focus); keep the send button at a solid tap target */
  .chat-input { gap: 8px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .chat-input textarea { min-height: 44px; padding: 11px 13px; font-size: max(16px, calc(14px * var(--ui-scale))); max-height: 140px; }
  .chat-send { flex: 0 0 auto; width: 44px; height: 44px; align-self: flex-end; }
  .chat-send svg { width: 20px; height: 20px; }

  #audio-bar,
  body.sidebar-collapsed #audio-bar {          /* beat the desktop collapse offset */
    left: 0; right: 0; bottom: 0;
    /* animate `bottom` so the panel rides with the word sheet's snap/open
       animation (display none->block doesn't animate, so no slide on first show) */
    transition: bottom .26s cubic-bezier(.4, 0, .2, 1);
    display: none;                             /* shown only when toggled open */
  }
  body.audio-open #audio-bar:not([hidden]) { display: block; }
  /* same centered-cluster layout as desktop; only the panel chrome differs (bottom sheet).
     Controls are sized so transport + repeat ALWAYS fit on one line (no wrap → no stacking
     of the repeat row under the player) even on a ~320px phone. The seek row wraps below. */
  .audio-controls {
    border-radius: 16px 16px 0 0;
    gap: 5px;
    padding: 10px 10px calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -14px 48px rgba(0, 0, 0, .5);
  }
  .audio-repeat { padding: 0; gap: 3px; }
  .audio-sec-label { width: 52px; }
  .audio-versesel { padding: 5px 3px; font-size: 12px; }
  body.audio-open .audio-track { display: flex; }     /* always show scrub + volume */
  .audio-seek { min-width: 0; }
  .audio-section-pop { left: 16px; right: 16px; width: auto; max-width: none; }

  /* lift the reading-mode bar above the open panel (--audio-h measured in JS) */
  body.audio-open #sil-bar { bottom: calc(var(--audio-h, 100px) + 12px); }

  /* Word detail opens as a draggable bottom sheet (~half screen) */
  #word-panel {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%;
    max-width: none;
    height: 50vh;
    /* Never let the sheet (or its drag handle) slide under the status bar when
       pulled up — keep the top a safe distance below the inset. Clamps any
       height, whether from a class or the live drag. */
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - 8px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 8px);  /* dvh where supported */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -14px 48px rgba(0, 0, 0, .55);
    animation: sheet-in .26s cubic-bezier(.4, 0, .2, 1);
    transition: height .26s cubic-bezier(.4, 0, .2, 1);
  }
  #word-panel[hidden] { display: none; }        /* keep hidden beating display:flex */
  #word-panel.sheet-half { height: 50vh; }
  #word-panel.sheet-full { height: 94vh; }
  #word-panel.dragging { transition: none; }   /* follow the finger 1:1 */

  #word-panel-handle {
    display: block;
    flex: 0 0 auto;
    height: 26px;
    cursor: grab;
    touch-action: none;       /* let the drag own the gesture */
  }
  #word-panel-handle::before {
    content: "";
    display: block;
    width: 42px; height: 4px;
    margin: 10px auto 0;
    border-radius: 3px;
    background: var(--line);
  }
  #word-panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;   /* don't scroll the page behind */
    padding: 4px 22px 44px;
  }
  #word-panel-close { top: 8px; right: 12px; }
  #word-panel-save { top: 8px; right: 50px; }
  #word-panel-back { top: 8px; right: 90px; }

  /* lift the switcher above the bottom sheet so it stays reachable
     (capped near the top, where the expanded sheet covers it) */
  body.word-panel-open #sil-bar {
    right: 24px;
    bottom: min(calc(var(--sheet-h, 50vh) + 14px), calc(100vh - 78px));
  }
  body.word-panel-open #audio-bar {
    bottom: min(calc(var(--sheet-h, 50vh) + 14px), calc(100vh - 78px));
  }

  /* Audio panel + word sheet both open: drop the sheet a little, attach the audio
     panel flush to its top, and keep the reading-mode bar above the audio panel
     (not behind it). */
  body.audio-open #word-panel.sheet-half { height: 46vh; }
  body.audio-open #word-panel.sheet-full { height: 86vh; }
  body.audio-open.word-panel-open #audio-bar {
    bottom: var(--sheet-h, 46vh);                 /* attach to the word sheet's top */
  }
  body.audio-open.word-panel-open #sil-bar {
    z-index: 46;                                  /* always above the audio panel */
    bottom: min(calc(var(--sheet-h, 46vh) + var(--audio-h, 90px) + 12px), calc(100vh - 58px));
  }

  /* While actively dragging the sheet, the bars follow the finger 1:1 (no easing
     lag); on release the snap animation re-enables the transition above. */
  body.sheet-dragging #sil-bar,
  body.sheet-dragging #audio-bar,
  body.sheet-dragging #chat-panel { transition: none; }
}

/* narrow phones — claw back room so the text-size pill never clips.
   #search has min-width:0 and flex-shrink, #textsize is flex:0 0 auto,
   so the search bar gives up as much width as needed to keep A− A A+ on screen. */
@media (max-width: 560px) {
  #topbar { gap: 6px; padding: 0 8px; }
  #search-scope {
    flex: 0 1 auto;                /* let the scope shrink too if space is tight */
    font-size: 11px;
    padding: 9px 2px 9px 7px;
    max-width: 52px;
  }
  #search-input { font-size: 13px; padding: 9px 6px; }
  .search-clear { padding: 0 6px; }
  #textsize { padding: 3px; gap: 1px; }
  #textsize .topbar-btn { width: 28px; height: 28px; font-size: 14px; }
  #text-reset { font-size: 12px; }

  /* Compact the audio panel + reading-mode menu controls for narrow phones. */
  .audio-btn { width: 36px; height: 36px; }
  .audio-btn svg { width: 20px; height: 20px; }
  .audio-repeat-btn { width: 32px; height: 32px; }
  .audio-repeat-btn svg { width: 16px; height: 16px; }
  .audio-versesel { font-size: 12px; padding: 5px 3px; }
  .audio-track { gap: 8px; }
  .audio-time { min-width: 24px; font-size: 10.5px; }
  .audio-vol { flex: 0 0 64px; width: 64px; }
  .sil-modes { padding: 4px; }
  .sil-mode { width: 36px; height: 36px; }
  .sil-mode svg { width: 18px; height: 18px; }
}

@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- First-run guided tour ---------- */
#tour { position: fixed; inset: 0; z-index: 300; }   /* captures clicks while shown */
#tour.tour-dim { background: rgba(8, 10, 14, .68); }  /* fallback dim for centered steps */
#tour-spot {
  position: fixed;
  border-radius: 10px;
  border: 2px solid var(--accent);
  /* the huge spread is the page dim; the rect itself stays clear (spotlight) */
  box-shadow: 0 0 0 9999px rgba(8, 10, 14, .68), 0 0 16px rgba(230, 178, 119, .4);
  pointer-events: none;
  transition: left .24s ease, top .24s ease, width .24s ease, height .24s ease;
}
#tour-card {
  position: fixed;
  width: min(320px, calc(100vw - 24px));
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--float-shadow);
  padding: 16px 16px 12px;
  font-family: var(--sans);
  animation: tour-pop .2s ease;
}
#tour-card.tour-center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); }
@keyframes tour-pop { from { opacity: 0; } }
.tour-ic {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; margin-bottom: 10px;
  background: var(--accent); color: #1a1208;
}
.tour-ic svg { width: 20px; height: 20px; }
.tour-text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink); }
.tour-text b { color: var(--accent-ink); font-weight: 600; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.tour-count { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.tour-acts { display: flex; align-items: center; gap: 6px; }
.tour-skip {
  border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 12.5px; cursor: pointer; padding: 7px 8px; border-radius: 8px;
}
.tour-skip:hover { color: var(--ink); }
.tour-next {
  border: 0; background: var(--accent); color: #1a1208;
  font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
  padding: 7px 16px; border-radius: 8px;
}
.tour-next:hover { filter: brightness(1.05); }

/* ===================== SIL Global Statistics page ===================== */
body.stats-page { overflow: auto; height: auto; }
#stats-head {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
#stats-head h1 { flex: 1; margin: 0; font-size: 20px; font-weight: 600; }
.stats-back {
  font-family: var(--sans); font-size: 13px; color: var(--muted);
  text-decoration: none; padding: 5px 10px; border: 1px solid var(--line); border-radius: 7px;
}
.stats-back:hover { color: var(--accent-ink); border-color: var(--accent); }
#stats { max-width: 1100px; margin: 0 auto; padding: 22px 24px 60px; }
.stats-intro { color: var(--muted); font-family: var(--sans); font-size: 14px; margin: 0 0 26px; max-width: 720px; }
.stats-block { margin: 0 0 40px; }
.stats-block-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.stats-block-head h2, .stats-block-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: .02em; }
.stats-summary { margin: 0; color: var(--muted); font-family: var(--sans); font-size: 13px; }
.stats-desc { margin: 0 0 14px; color: var(--muted); font-family: var(--sans); font-size: 12.5px; line-height: 1.6; max-width: 760px; opacity: .9; }

/* Grouped families (original languages / named entities / generated notes): a small section
   label above a responsive 2-column grid of the related stat blocks. */
.stats-group { margin: 0 0 44px; }
.stats-group-head {
  margin: 0 0 16px; padding-bottom: 9px; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--muted);
}
.stats-group-desc { margin: -4px 0 18px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 40px; }
.stats-grid .stats-block { margin: 0; }
@media (max-width: 760px) { .stats-grid { grid-template-columns: 1fr; gap: 30px; } }
.stats-help {
  margin: 8px auto 48px; padding: 22px 24px; max-width: 760px;
  font-family: var(--sans); background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
}
.stats-help h2 { margin: 0 0 10px; font-size: 18px; font-weight: 600; color: var(--ink); }
.stats-help p { margin: 0 0 10px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.stats-help ul { margin: 0 0 12px; padding-left: 20px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.stats-help li { margin: 0 0 2px; }
.stats-help .btn-primary { display: block; width: fit-content; margin: 10px auto 0; text-decoration: none; }

/* dedicated download page */
#dl-page { max-width: 720px; margin: 0 auto; padding: 0 18px 60px; }
.dl-card {
  margin-top: 18px; padding: 20px 22px; font-family: var(--sans);
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
}
.dl-title { font-family: var(--serif, Georgia, serif); font-size: 22px; margin: 0 0 6px; color: var(--ink); }
.dl-sub { font-size: 13.5px; line-height: 1.6; color: var(--muted); margin: 0 0 14px; }
.dl-state { font-size: 14px; line-height: 1.55; color: var(--ink); margin-bottom: 14px; }
.dl-warn-strong {
  font-size: 13px; line-height: 1.55; color: var(--accent-ink);
  background: var(--panel-2); border: 1px solid var(--accent); border-radius: 10px;
  padding: 10px 13px; margin-bottom: 12px;
}
.dl-warn {
  font-size: 12.5px; line-height: 1.6; color: var(--muted);
  border-left: 2px solid var(--line); padding: 2px 0 2px 12px; margin: 0 0 18px;
}
.dl-go-big {
  font: inherit; font-size: 15px; font-weight: 600; color: #1a1208; background: var(--accent);
  border: 0; border-radius: 11px; padding: 12px 22px; cursor: pointer;
}
.dl-go-big:hover { filter: brightness(1.06); }
.dl-go-big:disabled { opacity: .6; cursor: default; }
.dl-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.dl-note.dl-err { color: var(--woj); }
.stats-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-family: var(--sans); font-size: 12px; color: var(--muted); }
.legend-swatch { width: 12px; height: 12px; border-radius: 2px; border: 1px solid var(--line); }
.verse-row-wrap { margin-bottom: 18px; }
.testament-band {
  margin: 0 0 8px; font-family: var(--sans); font-size: 12px;
  font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--xref);
}
/* each testament wraps its (uniform-height) book boxes onto as many lines as needed */
.verse-row {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 7px;
}
.book-canvas { display: block; image-rendering: pixelated; cursor: pointer; flex: 0 0 auto; }

/* world map: recoloured world.svg with an additive access-glow overlay */
.worldmap {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); padding: 10px; overflow: hidden;
}
.worldmap-svg { width: 100%; height: auto; display: block; }
.worldmap-svg path { fill: #2c313b; stroke: var(--bg); stroke-width: .5; }
.worldmap-svg .glow-layer { mix-blend-mode: screen; }   /* overlapping glows add up */
.worldmap-svg circle { pointer-events: auto; }

/* word completion: a multi-segment percentage bar */
.pct-bar {
  display: flex; width: 100%; height: 26px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line); background: rgba(255,255,255,0.05);
}
.pct-seg { height: 100%; transition: width .4s ease; min-width: 0; }
.pct-breakdown { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.pct-breakdown .legend-item { font-size: 12.5px; }
.stats-foot { color: var(--muted); font-family: var(--sans); font-size: 13px; font-style: italic; margin-top: 36px; }
#stats-tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font-family: var(--sans); font-size: 12.5px; line-height: 1.45;
  color: var(--ink); box-shadow: 0 8px 28px rgba(0,0,0,.5); max-width: 240px;
}
#stats-tip b { color: var(--accent-ink); }

/* home-page completion strip */
.home-stats { margin: 0 auto; }
.home-stats .verse-maps { justify-content: center; }

/* sidebar link to the statistics page */
.tree-stats-link {
  display: flex; align-items: center; gap: 9px;
  margin: 6px 4px 4px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px;
  color: var(--accent-ink); text-decoration: none;
  font-size: calc(13.5px * var(--ui-scale)); font-weight: 600;
}
.tree-stats-link:hover { background: var(--hover); border-color: var(--accent); }
.tree-stats-link svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: .85; }

/* ===================== verse annotations ===================== */
#reader { position: relative; }
#chapter { position: relative; }

/* freehand drawing overlay: vector strokes over the text, above highlights; clicks
   pass through when not in draw mode (draw mode lays its own capture layer) */
#ann-draw { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; overflow: visible; }
#ann-draw path { stroke: none; }
body.draw-locked #reader { overflow: hidden; }

/* While drawing: hide the word panel + reading-mode bubble (all devices) and the
   table of contents (desktop) for a clean canvas. They're fixed overlays / hidden
   without reflowing the reader, so the drawing stays aligned — and because their
   open/closed state is untouched, they restore exactly as they were when Done. */
body.draw-mode #word-panel,
body.draw-mode #sil-bar { display: none !important; }
body.draw-mode #sidebar { visibility: hidden; }

/* full-viewport capture surface while drawing */
.draw-capture {
  position: fixed; inset: 0; z-index: 90;
  cursor: crosshair; touch-action: none; background: transparent;
  overscroll-behavior: contain;
}

/* drawing toolbar — floats above the reading-mode / audio controls */
.draw-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 95; display: flex; align-items: center; gap: 4px;
  padding: 6px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 12px 34px rgba(0, 0, 0, .5);
  font-family: var(--sans);
}
.draw-sep { width: 1px; align-self: stretch; margin: 4px 3px; background: var(--line); }
.draw-btn {
  border: 0; background: none; color: var(--muted);
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; cursor: pointer; transition: background .14s, color .14s, opacity .14s;
}
.draw-btn svg { width: 20px; height: 20px; }
.draw-btn:hover:not(:disabled) { color: var(--ink); background: var(--hover); }
.draw-btn:disabled { opacity: .35; cursor: default; }
.draw-btn.active { background: var(--accent); color: #1a1208; }
.draw-btn.draw-done { color: var(--accent-ink); }
.draw-btn.draw-done:hover { color: #1a1208; background: var(--accent); }
.draw-color-dot { width: 20px; height: 20px; border-radius: 50%; box-shadow: 0 0 0 2px var(--panel-2), 0 0 0 3px var(--line); }

/* pop-ups above the toolbar (colours, thickness) */
.draw-pop {
  position: fixed; z-index: 96; display: flex; gap: 6px; padding: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
}
.draw-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.draw-swatch.active { border-color: var(--ink); }
.draw-swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.draw-sizes { align-items: center; }
.draw-size {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border: 0; background: none; border-radius: 9px; cursor: pointer;
}
.draw-size:hover { background: var(--hover); }
.draw-size.active { background: var(--sel); }
.draw-size-dot { background: var(--ink); border-radius: 50%; display: block; max-width: 20px; max-height: 20px; }

/* marquee selection: glow the chosen strokes, dashed marquee + bounding box */
.ann-draw-sel { filter: drop-shadow(0 0 2.5px #fff) drop-shadow(0 0 1px rgba(255, 255, 255, .85)); }
.ann-draw-marquee { fill: rgba(230, 178, 119, .12); stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 5 4; }
.ann-draw-selbox { fill: none; stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 5 4; }
/* selection action bar (floats above the chosen strokes) */
.draw-selbar {
  position: fixed; z-index: 96; display: flex; align-items: center; gap: 4px;
  padding: 5px 6px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5); font-family: var(--sans);
}
/* drag anchor to move the selected strokes */
.draw-selgrip {
  border: 0; background: none; color: var(--muted); padding: 0;
  width: 30px; height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; cursor: grab; touch-action: none;
}
.draw-selgrip:hover { color: var(--ink); background: var(--hover); }
.draw-selgrip:active { cursor: grabbing; }
.draw-selgrip svg { width: 20px; height: 20px; }

@media (max-width: 760px) {
  .draw-bar {
    left: 8px; right: 8px; transform: none; bottom: 0;
    border-radius: 14px 14px 0 0; justify-content: center;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }
}

/* highlight overlay (translucent marker over the text; clicks pass through) */
#ann-hl { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.ann-hl-rect { position: absolute; border-radius: 2px; pointer-events: none; }
.ann-hl-handle {
  position: absolute; width: 12px; margin-left: -6px; pointer-events: auto; cursor: ew-resize;
  z-index: 6; touch-action: none;
}
.ann-hl-handle::before {
  content: ""; position: absolute; left: 4px; top: -3px; bottom: -3px; width: 2px;
  background: var(--accent); border-radius: 2px;
}
.ann-hl-handle::after {
  content: ""; position: absolute; left: -1px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--panel-2); box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.ann-hl-handle.ann-h-start::after { top: -10px; }
.ann-hl-handle.ann-h-end::after { bottom: -10px; }
/* mobile: bigger grab circles, and BOTH below the text line so a finger doesn't cover the start */
@media (max-width: 760px) {
  .ann-hl-handle { width: 18px; margin-left: -9px; }
  .ann-hl-handle::before { left: 8px; }
  .ann-hl-handle::after {
    width: 22px; height: 22px; left: -2px;
    top: auto; bottom: -24px;     /* sit below the line for every handle */
  }
  .ann-hl-handle.ann-h-start::after { top: auto; bottom: -24px; }
  .ann-hl-handle.ann-h-end::after { bottom: -24px; }
}
/* "Save highlight" button floated above a previewed shared highlight */
.ann-hl-save {
  position: absolute; pointer-events: auto; z-index: 7; white-space: nowrap;
  padding: 5px 11px; border: 1px solid var(--accent); border-radius: 8px;
  background: var(--panel-2); color: var(--accent-ink); font: inherit;
  font-size: 12.5px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.ann-hl-save:hover { background: var(--accent); color: #1c1c1c; }

/* the action bubble */
.ann-bubble {
  position: fixed; z-index: 60; display: flex; gap: 2px; padding: 5px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0,0,0,.55);
}
.ann-bub-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 0; border-radius: 9px; background: none;
  color: var(--ink); cursor: pointer; transition: background .12s, color .12s;
}
.ann-bub-btn:hover { background: var(--hover); color: var(--accent-ink); }
.ann-bub-btn.disabled { opacity: .32; pointer-events: none; }
.ann-bub-btn.ann-bub-del:hover { color: #e0626c; }
.ann-bub-btn svg { width: 18px; height: 18px; }
.ann-pick { display: flex; gap: 5px; align-items: center; padding: 2px; }
.ann-swatch {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255,255,255,.16);
  cursor: pointer; padding: 0; transition: transform .1s;
}
.ann-swatch:hover { transform: scale(1.12); }
.ann-swatch.on { border-color: var(--accent); }
.ann-swatch-del {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel); color: var(--muted);
}
.ann-swatch-del svg { width: 13px; height: 13px; }

/* desktop margin note cards + connectors */
#ann-notes { position: absolute; top: 0; left: 0; width: 100%; pointer-events: none; z-index: 3; }
.ann-conn { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; }
.ann-note-card {
  position: absolute; pointer-events: auto; border-radius: 10px; color: var(--ink);
  border: 1px solid var(--line); box-shadow: 0 8px 22px rgba(0,0,0,.5); overflow: hidden;
}
.ann-note-card.dragging { opacity: .92; box-shadow: 0 12px 30px rgba(0,0,0,.6); }
.ann-note-bar { display: flex; align-items: center; justify-content: space-between; padding: 4px 5px 0; }
.ann-note-acts { display: flex; align-items: center; gap: 1px; }
.ann-note-grip, .ann-note-del, .ann-note-share {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 20px;
  border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 5px; padding: 0;
}
.ann-note-grip { cursor: grab; touch-action: none; }
.ann-note-grip:active { cursor: grabbing; }
.ann-note-grip:hover, .ann-note-share:hover { color: var(--ink); background: rgba(255,255,255,.06); }
.ann-note-del:hover { color: #e0626c; background: rgba(255,255,255,.06); }
.ann-note-grip svg, .ann-note-del svg, .ann-note-share svg { width: 14px; height: 14px; }
/* note body: a single always-editable box that shows entity/scripture links live as you type */
.ann-note-edit {
  position: relative; padding: 1px 11px 11px; outline: none; color: var(--ink);
  font: inherit; font-size: 13.5px; line-height: 1.55; cursor: text; min-height: 22px;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
}
.ann-note-edit.is-empty::before {
  content: attr(data-ph); color: var(--muted); font-style: italic; pointer-events: none;
}

/* mobile inline note dots by the verse number — one per note. `font: inherit` ties em to the
   reading text size so it scales with A-/A/A+. The button is a big transparent tap target; the
   visible circle is drawn smaller inside via ::before. */
.ann-note-dot {                /* mirrors .gen-btn exactly so dots sit at the icon's height */
  display: none; box-sizing: border-box; position: relative;
  align-items: center; justify-content: center;
  font-size: inherit;          /* em scales with --reading-size */
  width: 1.2em; height: 1.5em;  /* narrow box keeps dots tight; tall box keeps the vertical tap area */
  vertical-align: middle; top: -.12em;     /* same baseline anchor + cap-height nudge as .gen-btn */
  margin: 0 .02em 0 -.06em; padding: 0; border: 0; background: none; cursor: pointer;
}
@media (max-width: 760px) { .ann-note-dot { display: inline-flex; } }
.ann-note-dot::before {        /* the visible circle, centered in the larger tap target */
  content: ""; display: block; width: .58em; height: .58em;
  border-radius: 50%; background: currentColor;
  border: 1px solid rgba(0,0,0,.25); box-shadow: 0 1px 2px rgba(0,0,0,.3);
}

/* mobile note editor inside the word panel */
.ann-note-panel { display: flex; flex-direction: column; gap: 12px; }
.ann-note-pcard { border-radius: 10px; color: var(--ink); border: 1px solid var(--line); overflow: hidden; }
.ann-note-pcard .ann-note-bar { justify-content: flex-end; }   /* delete sits top-right (no swatches) */
.ann-note-swatches { display: flex; gap: 5px; }
.ann-note-pcard .ann-swatch { width: 18px; height: 18px; }
.ann-note-add {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border: 1px dashed var(--line); border-radius: 10px;
  background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
}
.ann-note-add:hover { background: var(--hover); color: var(--ink); }
.ann-note-add svg { width: 15px; height: 15px; }
/* "Save to my notes" CTA shown when viewing a shared note */
.ann-note-save {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 14px; padding: 10px 16px; border: 1px solid var(--accent); border-radius: 10px;
  background: none; color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer;
}
.ann-note-save:hover { background: var(--accent); color: #1c1c1c; }
.ann-note-save svg { width: 15px; height: 15px; }

/* ===================== updates / changelog page ===================== */
.updates { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.update {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); padding: 16px 20px;
}
.update-date {
  font-family: var(--sans); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.update-title { margin: 0 0 8px; font-size: 19px; color: var(--accent-ink); }
.update p { margin: 0; color: var(--ink); line-height: 1.7; }
.update p strong { color: var(--accent-ink); font-weight: 600; }
.update p em { color: var(--accent-ink); font-style: italic; }

/* ===================== accounts ===================== */
.account-btn svg { width: 18px; height: 18px; }
.account-btn.signed-in { color: var(--accent-ink); }
.acct-modal {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); padding: 20px;
}
.acct-card {
  position: relative; width: 100%; max-width: 380px; box-sizing: border-box;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6); padding: 24px 22px;
}
.acct-close {
  position: absolute; top: 8px; right: 12px; border: 0; background: none; color: var(--muted);
  font-size: 24px; line-height: 1; cursor: pointer; padding: 2px 6px;
}
.acct-close:hover { color: var(--ink); }
.acct-title { margin: 0 0 4px; font-size: 20px; color: var(--ink); }
.acct-sub { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.acct-note { margin: 12px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.acct-form { margin: 0; }
.acct-field { display: block; margin-bottom: 12px; }
.acct-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.acct-input {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; outline: none;
}
.acct-input:focus { border-color: var(--accent); }
.acct-err { margin: 2px 0 12px; color: #e0626c; font-size: 13px; line-height: 1.45; }
.acct-btn {
  display: block; width: 100%; padding: 11px 14px; border: 1px solid var(--accent); border-radius: 10px;
  background: var(--accent); color: #1c1c1c; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
}
.acct-btn:hover { filter: brightness(1.06); }
.acct-btn:disabled { opacity: .6; cursor: default; }
.acct-btn-ghost { background: none; color: var(--ink); border-color: var(--line); margin-top: 6px; }
.acct-btn-ghost:hover { background: var(--hover); filter: none; }
.acct-altrow { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.acct-link { border: 0; background: none; color: var(--accent-ink); font: inherit; font-size: 13px; cursor: pointer; padding: 0; }
.acct-link:hover { text-decoration: underline; }

/* ===================== Notes & Highlights page ===================== */
#annot-page { max-width: 760px; margin: 0 auto; padding: 30px 36px 140px; }
#annot-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
#annot-head h2 { margin: 0; font-size: 24px; color: var(--ink); }
#annot-search {
  width: 100%; box-sizing: border-box; margin-bottom: 18px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--ink); font: inherit; font-size: 15px; outline: none;
}
#annot-search:focus { border-color: var(--accent); }
.annot-count { color: var(--muted); font-family: var(--sans); font-size: 13px; margin-bottom: 18px; }
.annot-book { margin-bottom: 22px; }
.annot-book-h { margin: 0 0 2px; font-size: 18px; color: var(--accent-ink); }
.annot-ch {
  font-family: var(--sans); font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); margin: 13px 0 5px;
}
.annot-row {
  display: flex; gap: 11px; width: 100%; text-align: left; align-items: flex-start;
  border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer;
  padding: 9px 10px; border-radius: 9px;
}
.annot-row:hover { background: var(--hover); }
.annot-dot {
  flex: 0 0 auto; width: 14px; height: 14px; border-radius: 4px; margin-top: 4px;
  border: 1px solid var(--line);
}
.annot-row-main { min-width: 0; flex: 1 1 auto; }
.annot-row-head { display: flex; align-items: baseline; gap: 8px; }
.annot-ref { font-weight: 700; color: var(--accent-ink); font-size: 14px; flex: 0 0 auto; }
.annot-kind {
  font-family: var(--sans); font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 1px 6px;
}
.annot-text {
  margin: 3px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--ink);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.annot-empty-note { color: var(--muted); font-style: italic; }
.annot-empty { color: var(--muted); font-size: 15px; line-height: 1.7; padding: 20px 0; max-width: 54ch; }
/* saved-panel rows */
.annot-star { border: 0; background: none; color: var(--accent); margin-top: 2px; }
.annot-star svg { width: 15px; height: 15px; }
.annot-saved-name { color: var(--ink); font-weight: 600; }
.annot-kind-saved { color: var(--accent-ink); border-color: var(--accent-soft, var(--line)); }
.annot-remove {
  flex: 0 0 auto; align-self: center; width: 24px; height: 24px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
  font-size: 17px; line-height: 1; cursor: pointer;
}
.annot-remove:hover { color: #e0626c; background: rgba(255,255,255,.06); }
@media (max-width: 760px) { #annot-page { padding: 20px 16px 120px; } }

/* ============================== Topical Index page ==============================
   The TOC section after the books: every topic A-Z with its verse count, filterable;
   each opens the topic panel (note + every linked verse). */
#topics-page { max-width: 760px; margin: 0 auto; padding: 30px 36px 140px; }
#topics-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#topics-head h2 { margin: 0; font-size: 24px; color: var(--ink); }
.topics-lead { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.6; }
#topics-search {
  width: 100%; box-sizing: border-box; margin-bottom: 6px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--ink); font: inherit; font-size: 15px; outline: none;
}
#topics-search:focus { border-color: var(--accent); }
.topics-letter {
  font-family: var(--sans); font-size: 12px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent-ink); margin: 22px 0 9px; padding-bottom: 4px; border-bottom: 1px solid var(--line);
}
.topics-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.topics-item {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); color: var(--ink);
  font: inherit; font-size: 13.5px; padding: 6px 12px; cursor: pointer;
  transition: background .14s, border-color .14s;
}
.topics-item:hover { background: var(--hover); border-color: var(--accent); }
.topics-item-count { color: var(--muted); font-size: 11.5px; }
@media (max-width: 760px) { #topics-page { padding: 20px 16px 120px; } }

/* ============================== support / payments ==============================
   The support page (support.html), the two dismissible subscription mentions in
   the reader, and the audio bar's supporter extras (voice picker + original-
   language toggle). Everything here is optional UI: it hides itself when Stripe
   isn't configured or the user isn't subscribed. */
#support-page { max-width: 760px; margin: 0 auto; padding: 26px 22px 80px; }
#support-page .dl-card { margin: 0 0 22px; }
.support-banner {
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px;
  background: var(--panel); color: var(--ink); font-family: var(--sans);
  font-size: 14px; line-height: 1.55; padding: 14px 16px; margin: 0 0 22px;
}
.support-banner.ok { border-left-color: #7fbf7f; }
.support-disabled { opacity: .55; pointer-events: none; }
.support-field { display: block; margin: 0 0 14px; font-family: var(--sans); }
.support-field span { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 5px; }
.support-field input {
  width: 100%; max-width: 340px; padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font-size: 14px;
}
.support-field input:focus { outline: none; border-color: var(--accent); }
.support-amounts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.support-amt {
  font-family: var(--sans); font-size: 14.5px; font-weight: 600; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.support-amt:hover { border-color: var(--accent); }
.support-amt.selected { background: var(--accent); color: #1a1208; border-color: var(--accent); }
.support-amt-custom input {
  width: 74px; border: 0; background: transparent; color: inherit; font: inherit; outline: none;
}
.support-amt-custom input::placeholder { color: var(--muted); font-weight: 400; }
.support-amt.support-amt-custom.selected input::placeholder { color: rgba(26,18,8,.55); }
.support-features {
  margin: 0 0 12px; padding-left: 20px; color: var(--ink); font-family: var(--sans);
  font-size: 14px; line-height: 1.8;
}
.support-honest { font-style: italic; }
.support-signin { margin: 6px 0 4px; }
.support-link {
  border: 0; background: none; color: var(--accent-ink); font-family: var(--sans);
  font-size: 13px; cursor: pointer; padding: 6px 0; text-decoration: underline;
}
.support-active { font-family: var(--sans); font-size: 15px; color: var(--accent-ink); font-weight: 600; margin: 0 0 6px; }
.support-btn {
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 14px; cursor: pointer; margin: 6px 8px 0 0;
}
.support-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.support-btn:disabled { opacity: .6; cursor: default; }
.support-namerow { margin: 10px 0 6px; }
.support-foot { max-width: 760px; }
.support-foot a { color: var(--accent-ink); }
/* monthly / yearly chooser */
.support-interval { display: inline-flex; gap: 0; margin: 4px 0 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.support-seg {
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--muted);
  background: var(--panel-2); border: 0; padding: 8px 14px; cursor: pointer;
}
.support-seg + .support-seg { border-left: 1px solid var(--line); }
.support-seg.selected { background: var(--accent); color: #1a1208; }

/* --- audio bar: supporter extras (voice picker + original-language toggle) --- */
.audio-extra { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.audio-extra[hidden] { display: none; }
.audio-voice {
  font-family: var(--sans); font-size: 12.5px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px;
  max-width: 190px;
}
.audio-orig-btn {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 10px; cursor: pointer;
}
.audio-orig-btn[aria-pressed="true"] { color: #1a1208; background: var(--accent); border-color: var(--accent); }

/* --- the small, dismissible subscription mentions (never modal, never nagging:
       each shows once, and "Don't show again" is permanent) --- */
.sub-nag {
  position: fixed; left: 14px; bottom: 84px; z-index: 60; max-width: 320px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--float-shadow); padding: 12px 14px; font-family: var(--sans);
  font-size: 13px; line-height: 1.5; color: var(--ink);
}
.sub-nag p { margin: 0 0 8px; }
.sub-nag-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sub-nag-actions a { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.sub-nag-actions a:hover { text-decoration: underline; }
.sub-nag-dismiss, .sub-nag-never {
  border: 0; background: none; color: var(--muted); font-family: var(--sans);
  font-size: 12.5px; cursor: pointer; padding: 0;
}
.sub-nag-dismiss:hover, .sub-nag-never:hover { color: var(--ink); }
@media (max-width: 760px) { .sub-nag { left: 10px; right: 10px; max-width: none; bottom: 96px; } }

/* --- "Don't ask again" row inside the shared #modal (chat-limit mention) --- */
.modal-checkrow {
  display: flex; align-items: center; gap: 8px; margin: 12px 0 0;
  font-family: var(--sans); font-size: 13px; color: var(--muted); cursor: pointer;
}
.modal-checkrow input { accent-color: var(--accent); }

/* --- account panel: subscription status / quiet mention --- */
.acct-sub-note { font-family: var(--sans); font-size: 13px; color: var(--muted); line-height: 1.55; margin: 12px 0 0; }
.acct-sub-note a { color: var(--accent-ink); }
.acct-sub-active { font-family: var(--sans); font-size: 13.5px; color: var(--accent-ink); margin: 12px 0 2px; }
.acct-sub-billing { margin: 2px 0 0; }
.acct-sub-link { color: var(--xref); text-decoration: underline; cursor: pointer; font-size: 13px; font-family: var(--sans); }
.acct-sub-link:hover { filter: brightness(1.15); }

/* ============================== legal pages (terms / privacy) ============================== */
.legal {
  max-width: 760px; margin: 0 auto; padding: 26px 22px 90px;
  font-family: var(--sans); color: var(--ink); font-size: 15px; line-height: 1.7;
}
.legal p { margin: 0 0 14px; }
.legal-updated { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.legal-callout {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 14px 16px; margin: 0 0 24px; font-size: 14.5px;
}
.legal-toc {
  background: rgba(255,255,255,.02); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 18px 14px 8px; margin: 0 0 28px;
}
.legal-toc ol { margin: 0; padding-left: 28px; columns: 2; column-gap: 28px; }
.legal-toc li { margin: 3px 0; break-inside: avoid; }
.legal-toc a { color: var(--accent-ink); text-decoration: none; font-size: 13.5px; }
.legal-toc a:hover { text-decoration: underline; }
.legal section { margin: 0 0 26px; scroll-margin-top: 70px; }
.legal h2 {
  font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--accent-ink);
  margin: 0 0 12px; padding-top: 4px;
}
.legal h3 { font-size: 15px; font-weight: 700; color: var(--ink); margin: 18px 0 8px; }
.legal ul { margin: 0 0 14px; padding-left: 22px; }
.legal li { margin: 0 0 7px; }
.legal a { color: var(--accent-ink); }
.legal-entity { color: var(--muted); font-size: 13px; margin-top: 6px; }
.legal-foot { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line);
  text-align: center; font-size: 13.5px; }
.legal-foot a { color: var(--accent-ink); text-decoration: none; }
@media (max-width: 620px) { .legal-toc ol { columns: 1; } }

/* --- account: delete (danger zone) --- */
.acct-danger { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.acct-danger-link {
  border: 0; background: none; color: #d0707a; font-family: var(--sans); font-size: 13px;
  cursor: pointer; padding: 4px 0; text-decoration: underline;
}
.acct-danger-link:hover { color: #e0626c; }
.acct-danger-warn { color: var(--muted); font-size: 12.5px; line-height: 1.55; margin: 6px 0 10px; }
.acct-btn-danger { background: #7c2b31; border: 1px solid #9b3b42; color: #fff; margin-top: 10px; }
.acct-btn-danger:hover { filter: brightness(1.08); }
.acct-btn-danger:disabled { opacity: .6; cursor: default; }

/* ============================== admin dashboard ============================== */
#admin-page { max-width: 900px; margin: 0 auto; padding: 26px 22px 90px; font-family: var(--sans); }
.admin-gate { max-width: 380px; margin: 40px auto; text-align: center; color: var(--muted); font-size: 14px; }
.admin-gate .acct-field, .admin-gate .support-field { text-align: left; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 8px 0 26px; }
.admin-stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
}
.admin-stat-num { font-size: 30px; font-weight: 700; color: var(--accent-ink); font-family: var(--serif); line-height: 1.1; }
.admin-stat-label { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.admin-stat-sub { color: var(--muted); font-size: 11.5px; margin-top: 6px; }
.admin-section { margin: 0 0 28px; }
.admin-section h2 { font-family: var(--serif); font-size: 20px; color: var(--ink); font-weight: 600; margin: 0 0 12px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th, .admin-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.admin-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.admin-lookup { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.admin-lookup input {
  flex: 1; min-width: 220px; padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font-size: 14px;
}
.admin-lookup input:focus { outline: none; border-color: var(--accent); }
.admin-lookup button {
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: #1a1208;
  background: var(--accent); border: 0; border-radius: 9px; padding: 9px 16px; cursor: pointer;
}
.admin-lookup-result { font-size: 13.5px; color: var(--ink); line-height: 1.6; }
.admin-note { color: var(--muted); font-size: 12px; margin-top: 4px; }
.admin-refresh { font-size: 12px; color: var(--muted); }
.admin-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.admin-badge.on { background: rgba(127,191,127,.18); color: #8fce8f; }
.admin-badge.off { background: rgba(208,112,122,.16); color: #d0707a; }
