

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ink: #26241f;
  --muted: #70695f;
  --faint: #746b5f;
  --accent: #8b3e2e;
  --on-accent: #ffffff;
  --accent-soft: #f4e8e3;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f6f3ed;
  --line: #e7e2d8;
  --line-strong: #d9d1c3;
  --shadow: 0 14px 50px rgba(56, 43, 31, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--paper); scrollbar-color: var(--line-strong) var(--paper); scrollbar-width: thin; scrollbar-gutter: stable; }
::selection { background: var(--accent-soft); color: var(--ink); }
input { caret-color: var(--accent); }
input::placeholder { color: var(--muted); opacity: 1; }
input[type="range"] { cursor: pointer; }
.rail, .context-panel, .chapter-sheet, .settings-drawer, .book-grid { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  --reader-font-size: 21px;
  --reader-line-height: 1.75;
  --reader-width: 740px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  transition: background .25s, color .25s;
}

.theme-sepia {
  --ink: #342a20;
  --muted: #766a5b;
  --faint: #6f604c;
  --accent: #925128;
  --accent-soft: #eadcc7;
  --paper: #f1e8d7;
  --surface: #f8f1e4;
  --surface-2: #eadfcd;
  --line: #ddd0ba;
  --line-strong: #cdbca1;
}

/* Dusty rose accents and lightly tinted paper keep long reading sessions calm. */
.theme-rose {
  color-scheme: light;
  --ink: #35272d;
  --muted: #725c64;
  --faint: #775e67;
  --accent: #964c65;
  --accent-soft: #f1dfe6;
  --paper: #faf1f4;
  --surface: #fffafb;
  --surface-2: #f3e6eb;
  --line: #e6d3dc;
  --line-strong: #c9abb8;
  --shadow: 0 14px 50px rgba(82, 45, 60, .08);
}

.theme-dark {
  color-scheme: dark;
  --ink: #f4eee5;
  --muted: #c4baae;
  --faint: #9f968b;
  --accent: #efa18c;
  --on-accent: #211710;
  --accent-soft: #4a2d28;
  --paper: #131310;
  --surface: #211f1a;
  --surface-2: #2b2821;
  --line: #423d33;
  --line-strong: #625a4c;
  --shadow: 0 20px 60px rgba(0, 0, 0, .28);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 78px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 30px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: max-content;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand-icon { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 3px 8px rgba(25, 35, 52, .12)); }

.brand-copy { display: grid; text-align: left; }
.brand-copy strong { font: 600 20px Georgia, serif; letter-spacing: .01em; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }

.location-pill {
  min-width: 205px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 24px;
  padding: 10px 14px 9px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
  cursor: pointer;
  text-align: left;
}
.location-pill span { grid-column: 1; max-width: 190px; overflow: hidden; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.location-pill b { grid-column: 1; font-size: 14px; font-weight: 600; }
.location-pill .icon { grid-column: 2; grid-row: 1 / 3; color: var(--muted); font-size: 18px; }

.top-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.round-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.round-button:hover, .location-pill:hover { border-color: var(--line-strong); background: var(--surface-2); }
.reader-controls button:not(:disabled):hover, .chapter-end button:hover, .chapter-grid button:not(:disabled):hover, .book-grid button:hover { border-color: var(--accent); background: var(--accent-soft); }
.round-button .icon { font-weight: 600; }
.desktop-markers-button { position: relative; }
.desktop-markers-button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.account-button { display: inline-flex; align-items: center; justify-content: center; margin-left: 4px; border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.account-button:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }

.search-strip { position: sticky; top: 78px; z-index: 25; padding: 10px 24px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 96%, transparent); backdrop-filter: blur(18px); }
.search-shell { max-width: 820px; margin: auto; }
.search-shell form { display: flex; gap: 8px; }
.search-field { min-width: 0; height: 44px; flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.search-field:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-strip input { min-width: 0; flex: 1; border: 0; outline: none; color: var(--ink); background: transparent; }
.search-field input:focus-visible { outline: none; }
.search-strip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.search-strip .search-ai { flex: 0 0 44px; height: 42px; padding: 0; border-radius: 8px; color: var(--ink); font-size: 12px; font-weight: 700; transition: color .2s, background .2s; }
.search-strip .search-ai:hover { background: var(--surface-2); }
.search-strip .search-ai[aria-pressed="true"] { background: var(--ai-tint); color: var(--ai-ink); }
.search-strip .search-ai:disabled, .search-strip .search-submit:disabled { cursor: wait; opacity: .7; }
.search-shell { --ai-ink: #5642a4; --ai-tint: #f0edfc; --ai-violet: #9270ed; --ai-blue: #4bb7d1; }
.theme-dark .search-shell { --ai-ink: #d3c6ff; --ai-tint: #302744; }
/* Fixed light textures: only opacity and transform animate, never the blur or gradient. */
.search-field.is-ai { position: relative; isolation: isolate; border-color: #b49af4; box-shadow: 0 0 0 1px #9270ed, 0 0 7px #9270ed66; }
.search-field.is-ai::before, .search-field.is-ai::after { content: ""; position: absolute; z-index: -1; inset: -3px; border-radius: 15px; padding: 3px; pointer-events: none; background: linear-gradient(110deg, #9270ed, #bc75e2 22%, #85dbe0 48%, #7361e5 72%, #e993c4); mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask-composite: exclude; }
.search-field.is-ai::before { opacity: .8; animation: ai-neon-flow 5s ease-in-out infinite paused; }
.search-field.is-ai::after { z-index: -2; inset: -8px -5px; padding: 0; border-radius: 17px; mask: none; background: radial-gradient(ellipse, #bc75e2, transparent 70%) left top / 65% 14px, radial-gradient(ellipse, #9270ed, transparent 70%) right bottom / 70% 12px, radial-gradient(ellipse, #9270ed, transparent 70%) left center / 12px 100%, radial-gradient(ellipse, #bc75e2, transparent 70%) right center / 12px 100%; background-repeat: no-repeat; filter: blur(5px); opacity: .4; animation: ai-neon-mist 6s ease-in-out infinite paused; }
.search-field.is-ai[data-motion-active="true"]::before, .search-field.is-ai[data-motion-active="true"]::after, .search-field.is-ai[data-motion-active="true"] ~ .search-submit::before, .search-field.is-ai[data-motion-active="true"] ~ .search-submit::after { animation-play-state: running; }
.search-field.is-ai:focus-within { outline-color: var(--ai-ink); }
.search-field.is-ai input { caret-color: var(--ai-ink); }
.search-scope .ai-search-hint { color: var(--ai-ink); }
.search-strip .ai-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; padding: 3px 6px; border-radius: 5px; background: var(--ai-tint); color: var(--ai-ink); font: 700 10px/1.3 ui-sans-serif, system-ui, sans-serif; letter-spacing: .02em; }
.search-group-title { display: flex; align-items: center; gap: 8px; margin: 16px 10px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.search-group-title:first-child { margin-top: 8px; }
.search-result-list .ai-search-result { background: color-mix(in srgb, var(--ai-tint) 35%, var(--surface)); }
.search-result-list .ai-search-result:hover { background: var(--ai-tint); }
.ai-search-empty, .ai-search-loading { margin: 0; padding: 14px 10px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.ai-search-loading { display: flex; align-items: center; gap: 12px; }
.ai-loading-orbit { width: 18px; height: 18px; flex: 0 0 18px; border: 2px solid var(--ai-tint); border-top-color: var(--ai-ink); border-radius: 50%; animation: ai-orbit 1s linear infinite; }
@keyframes ai-neon-flow { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes ai-neon-mist { 0%, 100% { opacity: .28; transform: translate3d(0, 1px, 0) scaleY(.96); } 50% { opacity: .52; transform: translate3d(0, -3px, 0) scaleY(1.12); } }
@keyframes ai-orbit { to { transform: rotate(360deg); } }
.search-strip .search-clear { position: relative; isolation: isolate; flex: 0 0 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.search-strip .search-clear::before { content: ""; position: absolute; z-index: -1; inset: 6px; border-radius: 7px; }
.search-strip .search-clear:hover::before, .search-strip .search-clear:active::before { background: var(--surface-2); }
.search-strip .search-clear:hover { color: var(--ink); }
.search-strip .search-submit { min-width: 86px; padding: 0 18px; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; }
.search-strip .search-submit:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.search-strip .search-field.is-ai ~ .search-submit { position: relative; isolation: isolate; color: #fff; background: linear-gradient(110deg, #6542aa, #573ca1 48%, #365e87); box-shadow: 0 0 0 1px #b49af4, 0 0 7px #9270ed66; }
.search-field.is-ai ~ .search-submit::before, .search-field.is-ai ~ .search-submit::after { content: ""; position: absolute; z-index: -1; inset: 0; border-radius: inherit; pointer-events: none; }
.search-field.is-ai ~ .search-submit::before { background: linear-gradient(110deg, #65459e, #396782 48%, #74429b); opacity: .8; animation: ai-neon-flow 5s ease-in-out infinite paused; }
.search-field.is-ai ~ .search-submit::after { z-index: -2; inset: -8px -4px; background: radial-gradient(ellipse, #bc75e2, transparent 70%) center top / 100% 14px, radial-gradient(ellipse, #9270ed, transparent 70%) center bottom / 100% 12px; background-repeat: no-repeat; filter: blur(5px); opacity: .4; animation: ai-neon-mist 6s ease-in-out infinite paused; }
.search-strip .search-field.is-ai ~ .search-submit:hover { box-shadow: 0 0 0 2px #b49af4, 0 0 10px #9270ed80; }
.search-strip .search-field.is-ai ~ .search-submit:focus-visible { outline: 2px solid var(--ai-ink); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) { .search-field.is-ai::before, .search-field.is-ai::after, .search-field.is-ai ~ .search-submit::before, .search-field.is-ai ~ .search-submit::after, .ai-loading-orbit { animation: none; } }
.search-scope { margin: 8px 3px 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 18px; color: var(--faint); font-size: 12px; line-height: 1.5; }
.search-recent-shell { position: relative; z-index: 24; max-width: 820px; margin: 10px auto 0; padding: 0 12px; }
.recent-history { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: color-mix(in srgb, var(--surface) 96%, transparent); box-shadow: 0 9px 28px rgba(35, 27, 20, .08); }
.recent-history-row { min-width: 0; display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: center; gap: 10px; }
.recent-history-row > span { color: var(--faint); font-size: 10px; line-height: 1.4; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.recent-history-row > div { min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.recent-history-row > div::-webkit-scrollbar { display: none; }
.recent-history-row button { flex: 0 0 auto; display: flex; align-items: baseline; gap: 5px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); cursor: pointer; }
.recent-history-row button:hover { border-color: var(--line-strong); background: var(--accent-soft); }
.recent-history-row b { font: 600 12px/1.4 Georgia, serif; }
.recent-history-row small { flex-shrink: 0; color: var(--accent); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.search-state { padding: 24px 10px 16px; color: var(--muted); font: italic 14px Georgia, serif; text-align: center; }
.search-state.error { color: var(--accent); }
.global-search-results { margin-top: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.search-results-head { min-height: 58px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 6px 10px 6px 15px; border-bottom: 1px solid var(--line); }
.search-results-head b { min-width: 0; font: 600 15px Georgia, serif; font-variant-numeric: tabular-nums; }
.search-testaments { display: flex; flex-shrink: 0; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.search-testaments button { min-width: 44px; min-height: 44px; padding: 0 10px; border: 1px solid transparent; border-radius: 7px; color: var(--faint); font-size: 11px; font-weight: 600; }
.search-testaments button:hover { background: var(--surface); color: var(--ink); }
.search-testaments button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.search-result-list { max-height: min(58vh, 620px); overflow-y: auto; overscroll-behavior: contain; }
.search-result-list > button { width: 100%; display: block; padding: 13px 15px; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.search-result-list > button:hover { background: var(--surface-2); }
.search-result-list > button > span { display: flex; align-items: center; gap: 8px; }
.search-result-list b { color: var(--accent); font-size: 11px; }
.search-result-list i { margin-left: auto; flex-shrink: 0; padding: 3px 6px; border-radius: 4px; background: var(--surface-2); color: var(--faint); font-size: 10px; font-style: normal; }
.search-result-list p { margin: 5px 0 0; color: var(--ink); font: 15px/1.55 Georgia, serif; overflow-wrap: anywhere; }
.search-strip .search-more { width: 100%; min-height: 44px; padding: 13px; background: var(--surface-2); color: var(--accent); font-size: 11px; font-weight: 700; }
.search-strip .search-more:hover { background: var(--accent-soft); }
.russian-search-note { margin: 0; padding: 11px 15px; background: var(--accent-soft); color: var(--muted); font-size: 10px; line-height: 1.45; }

.layout {
  min-height: calc(100vh - 78px);
  display: grid;
  grid-template-columns: 258px minmax(520px, 1fr) 286px;
}

.rail {
  position: sticky;
  top: 78px;
  height: calc(100vh - 78px);
  padding: 30px 18px 22px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 46%, var(--paper));
  overflow-y: auto;
}

.rail-section + .rail-section { margin-top: 30px; }
.rail-label { display: block; margin: 0 10px 12px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.book-current { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 11px 10px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; }
.book-current:hover { background: var(--surface); }
.book-icon { width: 36px; height: 42px; display: grid; place-items: center; border-radius: 3px 8px 8px 3px; background: var(--accent); box-shadow: inset 4px 0 rgba(255,255,255,.16); color: var(--on-accent); font: 700 17px Georgia, serif; }
.book-current b, .book-current small { display: block; }
.book-current b { font: 600 14px/1.3 Georgia, serif; text-wrap: balance; }
.book-current small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.book-current > .icon { color: var(--faint); }

.chapter-list { display: grid; gap: 4px; }
.chapter-list > button { position: relative; width: 100%; display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 8px; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; }
.chapter-list > button:hover { background: var(--surface); }
.chapter-list > button.active { background: var(--accent-soft); box-shadow: none; }
.chapter-list > button > span:first-child { color: var(--muted); font: 500 18px Georgia, serif; text-align: center; }
.chapter-list > button.active > span:first-child, .chapter-list > button.active b { color: var(--accent); }
.chapter-list b, .chapter-list small { display: block; }
.chapter-list b { font-size: 12px; }
.chapter-list small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.chapter-list button i { position: absolute; right: 0; width: 3px; height: 23px; border-radius: 3px 0 0 3px; background: var(--accent); }
.future-chapters { margin-top: 7px; padding: 10px; display: flex; gap: 5px; align-items: center; border-top: 1px solid var(--line); color: var(--faint); }
.future-chapters span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; font-size: 11px; }
.future-chapters em { margin-left: auto; font-size: 9px; font-style: normal; letter-spacing: .08em; text-transform: uppercase; }

.rail-note { margin-top: 22px; display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 13px; border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line)); border-radius: 12px; background: var(--accent-soft); }
.rail-note .icon { color: var(--accent); }
.rail-note p { margin: 0; }
.rail-note b, .rail-note span { display: block; }
.rail-note b { color: var(--accent); font-size: 11px; }
.rail-note span { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }

.reader-column { min-width: 0; padding: 56px clamp(38px, 5vw, 88px) 100px; }
.reader-head { max-width: var(--reader-width); margin: 0 auto; text-align: center; }
.eyebrow { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.eyebrow span { width: 26px; height: 1px; background: color-mix(in srgb, var(--accent) 50%, transparent); }
.reader-head h1 { margin: 20px 0 2px; font: 400 clamp(38px, 4.2vw, 58px)/1.06 Georgia, "Times New Roman", serif; letter-spacing: -.025em; text-wrap: balance; }
.reader-head h1 b { font-weight: 400; }
.reader-head h1 i { color: var(--accent); font-style: normal; }
.reader-head > p { margin: 10px 0 18px; color: var(--muted); font: italic 16px Georgia, serif; }
.reader-head > .chapter-description { line-height: 1.5; text-wrap: balance; }
.chapter-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; color: var(--muted); font-size: 11px; letter-spacing: .02em; }
.chapter-facts b { font-weight: 400; font-variant-numeric: tabular-nums; }
.chapter-facts span { display: flex; align-items: center; gap: 5px; }
.chapter-facts .icon { font-size: 13px; }

.reader-controls { max-width: var(--reader-width); margin: 24px auto 28px; padding-bottom: 18px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; }
.reader-toggles, .reader-actions { display: flex; align-items: center; gap: 6px; min-width: 0; }
.reader-controls button { min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; white-space: nowrap; }
.reader-controls button.active { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); background: var(--accent-soft); }
.reader-controls button:disabled { cursor: default; opacity: .78; }
.reader-controls .icon, .reader-controls .original-icon { width: 18px; height: 18px; flex: 0 0 18px; color: inherit; }
.reader-actions button { border-color: transparent; }
.reader-controls .copy-control:disabled { opacity: .55; }
.reader-controls .copy-control.active { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.reader-controls .markers-control.active { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.reader-controls .markers-control b { min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 8px; }
.reader-controls .future-control { opacity: .55; }
.reader-controls .future-control em { font-size: 9px; font-style: normal; }
.switch { width: 25px; height: 14px; padding: 2px; border-radius: 12px; background: var(--line-strong); transition: .2s; }
.switch::after { content: ""; display: block; width: 10px; height: 10px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.reader-controls button.active .switch { background: var(--accent); }
.reader-controls button.active .switch::after { transform: translateX(11px); }
.results-note { max-width: var(--reader-width); margin: 0 auto 18px; color: var(--muted); font-size: 12px; }

.verses { max-width: var(--reader-width); margin: 0 auto; }
.verse { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 16px; margin: 0 -20px; padding: 8px 20px 13px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; transition: background .18s, border-color .18s; }
.verse:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.verse.selected { z-index: 2; border-color: var(--line-strong); background: var(--surface); box-shadow: none; }
.verse.selected.selection-joins-previous { margin-top: -1px; border-top-color: transparent; border-top-left-radius: 0; border-top-right-radius: 0; }
.verse.selected.selection-joins-next { border-bottom-color: transparent; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.verse.selection-anchor { z-index: 4; }
.verse.marked { background: color-mix(in srgb, var(--marker) 30%, transparent); }
.verse.marked.marker-joins-previous { border-top-left-radius: 2px; border-top-right-radius: 2px; }
.verse.marked.marker-joins-next { border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; }
.verse.marked.selected { background: color-mix(in srgb, var(--marker) 22%, var(--surface)); }
.verse.marked .english { color: color-mix(in srgb, var(--ink) 88%, var(--marker)); }
.marker-yellow { --marker: #f4c94e; }
.marker-green { --marker: #8bc69b; }
.marker-blue { --marker: #85bfe0; }
.marker-rose { --marker: #e8a2a4; }
.marker-lemon { --marker: #e4d77a; }
.marker-peach { --marker: #edb88e; }
.marker-coral { --marker: #eaa08b; }
.marker-blush { --marker: #e6bac9; }
.marker-lilac { --marker: #c6b1de; }
.marker-honey { --marker: #d9b963; }
.marker-apricot { --marker: #e6ab75; }
.marker-terracotta { --marker: #cd9582; }
.marker-mauve { --marker: #c99bae; }
.marker-lavender { --marker: #b5a6d5; }
.marker-sand { --marker: #d6c39a; }
.marker-caramel { --marker: #c6a583; }
.marker-clay { --marker: #bc9b8c; }
.marker-heather { --marker: #b5a0b9; }
.marker-periwinkle { --marker: #a2aed9; }
.marker-ice { --marker: #b5d4dc; }
.marker-aqua { --marker: #8ecbd0; }
.marker-mint { --marker: #a8d6bd; }
.marker-pistachio { --marker: #c4d29a; }
.marker-olive { --marker: #b9bd86; }
.marker-cornflower { --marker: #93b0d9; }
.marker-turquoise { --marker: #78bebc; }
.marker-seafoam { --marker: #8fc4ad; }
.marker-fern { --marker: #9dbb8e; }
.marker-moss { --marker: #a5b28b; }
.marker-slate { --marker: #9cabbc; }
.marker-lagoon { --marker: #85afb3; }
.marker-eucalyptus { --marker: #95b3a5; }
.marker-sage { --marker: #a9b6a0; }
.marker-stone { --marker: #b7afa1; }
.verse-number { width: 32px; height: 32px; margin-top: 2px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--accent); cursor: pointer; font: 600 12px Georgia, serif; }
.verse:hover .verse-number, .verse.selected .verse-number { background: var(--accent-soft); }
.russian { margin: 0; color: var(--ink); font: 400 var(--reader-font-size)/var(--reader-line-height) Georgia, "Times New Roman", serif; letter-spacing: .002em; text-wrap: pretty; }
.russian em, .english em { font-style: italic; }
.kjv-primary { color: var(--ink); }
.source-label { display: inline-flex; margin-right: 9px; color: var(--accent); font: 700 8px/1 Inter, sans-serif; letter-spacing: .13em; vertical-align: .24em; }
.paragraph-start { margin-top: 18px; }
.english { margin: 12px 0 3px; padding-left: 13px; border-left: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); color: var(--muted); font: 400 calc(var(--reader-font-size) * .71)/1.55 Georgia, serif; }
.english-source { display: block; margin-bottom: 3px; color: var(--accent); font: 700 8px/1 Inter, sans-serif; letter-spacing: .14em; }
.parallel-row { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.parallel-row > span { margin-right: 3px; color: var(--faint); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; }
.parallel-row button { min-height: 28px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--accent); cursor: pointer; font-size: 11px; }
.marker-dot { position: absolute; top: 15px; right: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--marker); }
.verse-tools { position: absolute; z-index: 6; bottom: calc(100% + 6px); left: 52px; display: flex; align-items: center; gap: 2px; width: max-content; padding: 4px; border-radius: 12px; background: var(--surface); box-shadow: 0 6px 24px rgba(56, 43, 31, .18); cursor: default; }
.verse-tools[data-placement="below"] { top: calc(100% + 6px); bottom: auto; }
.verse-tools button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.verse-tools button:hover { background: var(--surface-2); color: var(--ink); }
.verse-tools .verse-color-strip button::before { content: ''; width: 18px; height: 18px; border-radius: 50%; background: var(--marker); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.verse-tools button.chosen::before { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Only the color strip scrolls; the three actions keep their fixed positions. */
.verse-color-strip { --color-size: 36px; --color-gap: 2px; display: flex; align-items: center; gap: var(--color-gap); flex: 0 0 calc(4 * var(--color-size) + 3 * var(--color-gap)); width: calc(4 * var(--color-size) + 3 * var(--color-gap)); min-width: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; user-select: none; }
.verse-color-strip::-webkit-scrollbar { display: none; }
.verse-color-strip button { scroll-snap-align: start; }
.verse-color-strip button:focus-visible { outline-offset: -2px; }
.verse-tools .tool-action { color: var(--muted); }
.verse-tools .note-action { color: var(--accent); }

.empty-state { max-width: var(--reader-width); min-height: 260px; margin: auto; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); text-align: center; }
.empty-state .icon { font-size: 34px; color: var(--faint); }
.empty-state span { font-size: 12px; }
.chapter-end { max-width: var(--reader-width); margin: 65px auto 0; padding-top: 22px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); }
.chapter-end > span { color: var(--faint); font-size: 10px; letter-spacing: .11em; text-transform: uppercase; }
.chapter-end button { min-width: 145px; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 20px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; text-align: left; }
.chapter-end button small, .chapter-end button b { display: block; }
.chapter-end button small { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.chapter-end button b { margin-top: 2px; font: 600 14px Georgia, serif; }
.chapter-end button .icon { color: var(--accent); }
.translation-copyright { max-width: var(--reader-width); margin: 56px auto 0; padding-top: 22px; display: grid; grid-template-columns: .8fr 1.25fr .75fr; gap: 28px; border-top: 1px solid var(--line); }
.translation-copyright p { margin: 0; }
.translation-copyright span, .translation-copyright b { display: block; }
.translation-copyright span { margin-bottom: 6px; color: var(--faint); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.translation-copyright b { color: var(--muted); font-size: 10px; font-weight: 400; line-height: 1.55; }
.translation-copyright a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; }
.translation-copyright .salvation-link { grid-column: 1 / -1; justify-self: start; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--accent); background: var(--surface); font-size: 13px; font-weight: 500; text-decoration: none; }
.translation-copyright .salvation-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.translation-copyright .salvation-link .icon { margin: 0; color: inherit; }

.modal-backdrop.account-backdrop, .static-sheet.account-backdrop { align-items: center; }
.chapter-sheet.account-sheet, .static-sheet .account-sheet { width: min(460px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; }
.account-backdrop[data-closing="true"] { pointer-events: none; }
.account-sheet .account-description { margin: 16px 0 22px; font-size: 13px; line-height: 1.6; }
.account-providers { display: grid; gap: 10px; }
.account-providers button { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 13px; text-align: left; cursor: default; }
.account-providers small { flex-shrink: 0; color: var(--accent); font-size: 11px; }
.account-benefits { margin-top: 28px; }
.account-benefits h3 { margin: 0 0 12px; color: var(--ink); font-size: 13px; font-weight: 600; }
.account-benefits ul { display: grid; gap: 12px; margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.account-benefits li::marker { color: var(--accent); }

.context-panel { position: sticky; top: 78px; height: calc(100vh - 78px); padding: 34px 24px; border-left: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 45%, var(--paper)); overflow-y: auto; }
.context-card { min-height: 200px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.context-card:has(.context-empty) { min-height: 180px; padding: 12px; border-color: transparent; background: transparent; }
.context-kicker, .context-label { color: var(--faint); font-size: 9px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.context-card h2 { margin: 10px 0 9px; color: var(--accent); font: 600 20px Georgia, serif; }
.context-card > p { margin: 0; color: var(--ink); font: 15px/1.65 Georgia, serif; }
.context-divider { height: 1px; margin: 18px 0; background: var(--line); }
.context-links { display: grid; gap: 5px; margin-top: 9px; }
.context-links button { display: flex; justify-content: space-between; padding: 7px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--accent); cursor: pointer; font-size: 11px; text-align: left; }
.context-links button i { color: var(--faint); font-size: 8px; font-style: normal; }
.context-links .all-refs { margin-top: 7px; justify-content: center; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-weight: 700; }
.context-links small { color: var(--muted); line-height: 1.5; }
.context-empty { min-height: 150px; display: grid; place-items: center; align-content: center; color: var(--faint); text-align: center; }
.context-empty .icon { font-size: 22px; }
.context-empty p { max-width: 190px; margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.reading-tip { margin-top: 16px; padding: 20px 0; border-top: 1px solid var(--line); }
.reading-tip span { color: var(--accent); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.reading-tip p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }

.mobile-nav { display: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; padding: 20px; background: rgba(22, 18, 15, .42); backdrop-filter: blur(5px); animation: fade .18s ease-out; }
.chapter-sheet { width: min(580px, 100%); padding: 12px 24px 28px; border-radius: 20px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.25); animation: rise .25s ease-out; }
.sheet-handle { width: 38px; height: 4px; margin: 0 auto 13px; border-radius: 4px; background: var(--line-strong); }
.sheet-head, .settings-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head > div { min-width: 0; }
.sheet-head small, .settings-head small { color: var(--accent); font-size: 9px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.sheet-head h2, .settings-head h2 { max-width: 680px; margin: 4px 0 0; font: 500 25px/1.18 Georgia, serif; text-wrap: balance; overflow-wrap: anywhere; }
.sheet-head button, .settings-head button { width: 44px; height: 44px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); cursor: pointer; font-size: 22px; }
.chapter-sheet > p { margin: 20px 0 10px; color: var(--muted); font-size: 11px; }
.chapter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chapter-grid button { min-height: 82px; display: grid; align-content: center; gap: 3px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; text-align: center; }
.chapter-grid button b { font: 500 22px Georgia, serif; }
.chapter-grid button span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.chapter-grid button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chapter-grid button:disabled { opacity: .45; cursor: default; }

.language-notice {
  max-width: var(--reader-width);
  margin: 24px auto -13px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 11px;
  background: var(--accent-soft);
}
.language-notice > span { padding-top: 2px; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.language-notice p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.language-notice b { color: var(--ink); }

.modal-backdrop.library-backdrop, .static-sheet.library-backdrop {
  --library-viewport-height: 100vh;
  top: var(--library-viewport-top, 0px);
  bottom: auto;
  height: var(--library-viewport-height);
  padding: max(12px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
}
@supports (height: 100dvh) {
  .modal-backdrop.library-backdrop, .static-sheet.library-backdrop { --library-viewport-height: 100dvh; }
}
.library-sheet {
  width: min(840px, 100%);
  max-height: min(820px, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.library-sheet > .sheet-handle, .library-sheet > .sheet-head, .library-sheet > .book-search, .library-sheet > .library-view-toolbar { flex-shrink: 0; }
.library-views { position: relative; display: grid; grid-template-rows: minmax(0, 1fr); flex: 1 1 auto; min-height: min(360px, max(0px, calc(var(--library-viewport-height) - 280px))); }
.library-standard-view { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
/* The standard view reserves the same space while the alternate view fills it. */
.library-standard-view[aria-hidden="true"] { visibility: hidden; pointer-events: none; }
.book-search {
  height: 42px;
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
.book-search:focus-within, .search-strip label:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.book-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; }
.testament-tabs { display: flex; gap: 6px; margin: 11px 0; }
.testament-tabs button { min-height: 36px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.testament-tabs button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.library-view-toolbar { display: flex; align-items: center; gap: 8px; }
.library-view-toolbar .testament-tabs { flex: 1; }
.library-view-toggle { appearance: none; -webkit-appearance: none; flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--muted); cursor: pointer; touch-action: manipulation; }
.library-view-toggle span { display: flex; }
.library-view-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.book-navigator { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; padding-top: 6px; }
.book-navigator-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); flex: 1; min-height: 0; gap: 24px; }
.book-navigator-columns[hidden] { display: none; }
.navigator-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.navigator-column-head { display: flex; align-items: baseline; justify-content: space-between; flex-shrink: 0; gap: 8px; margin-bottom: 12px; padding: 0 12px; }
.navigator-column-head > span { font-size: 13px; font-weight: 600; }
.navigator-column-head small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.navigator-wheel-frame { position: relative; flex: 1; min-height: 0; }
.navigator-options { position: relative; height: 100%; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; padding: 4px; border-radius: 12px; background: var(--paper); }
.navigator-options:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.navigator-options [role="option"] { min-width: 0; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 12px; border-radius: 7px; color: var(--muted); cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; transition: color .16s ease-out, background-color .16s ease-out; }
.navigator-options [role="option"][aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.navigator-row { display: flex; align-items: center; justify-content: inherit; gap: 8px; width: 100%; height: 100%; }
.navigator-books .navigator-row > span { flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
.navigator-books [role="option"] small { font-size: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.navigator-chapters .navigator-options { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: 44px; align-content: start; gap: 4px; }
.navigator-chapters [role="option"] { justify-content: center; height: 44px; padding: 0; border-radius: 10px; font-size: 13px; font-variant-numeric: lining-nums tabular-nums; }
.navigator-footer { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.navigator-hint { color: var(--muted); font-size: 12px; }
.navigator-open { appearance: none; -webkit-appearance: none; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-size: 13px; cursor: pointer; touch-action: manipulation; }
.navigator-open:disabled { opacity: .5; cursor: default; }
.navigator-open b { font-weight: 600; }
.navigator-empty { padding: 40px 12px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
@media (hover: hover) and (pointer: fine) {
  .library-view-toggle:hover { border-color: var(--accent); color: var(--accent); }
  .navigator-options [role="option"]:hover { background: var(--surface-2); color: var(--ink); }
  .navigator-open:not(:disabled):hover { background: color-mix(in srgb, var(--accent) 90%, var(--ink)); }
}
@media (max-width: 820px) {
  .modal-backdrop.library-backdrop, .static-sheet.library-backdrop { padding: max(10px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  .library-views { min-height: 0; }
  .book-navigator { --wheel-row: 60px; }
  .library-view-toolbar .testament-tabs { gap: 5px; }
  .library-view-toolbar .testament-tabs button { min-height: 44px; padding: 8px 9px; }
  .book-navigator-columns { grid-template-columns: minmax(0, 1fr) 96px; gap: 12px; }
  .navigator-column-head { height: 24px; align-items: center; padding: 0 10px; margin-bottom: 8px; }
  .navigator-column-head small { font-size: 10px; white-space: nowrap; }
  .navigator-chapters .navigator-column-head { justify-content: center; padding: 0; gap: 5px; }
  .navigator-wheel-frame { isolation: isolate; overflow: hidden; }
  .navigator-options, .navigator-chapters .navigator-options { display: block; padding: 0; scroll-snap-type: y mandatory; scroll-padding-block: calc((100% - var(--wheel-row)) / 2); scrollbar-width: none; border-radius: 0; background: transparent; touch-action: pan-y pinch-zoom; cursor: grab; }
  .navigator-options::before, .navigator-options::after { content: ""; display: block; height: calc((100% - var(--wheel-row)) / 2); }
  .navigator-options::-webkit-scrollbar { display: none; }
  .navigator-options[data-dragging="true"] { cursor: grabbing; }
  .navigator-options [role="option"], .navigator-chapters [role="option"] { position: relative; height: var(--wheel-row); border-radius: 0; scroll-snap-align: center; background: transparent; -webkit-user-select: none; transition: none; cursor: inherit; }
  .navigator-row { transform-origin: center; backface-visibility: hidden; }
  .navigator-options [role="option"][aria-selected="true"] { background: transparent; }
  .navigator-options [role="option"]:hover { background: transparent; }
  .navigator-wheel-frame::before { content: ""; position: absolute; top: 50%; height: var(--wheel-row); left: 0; right: 0; transform: translateY(-50%); background: var(--surface-2); border-radius: 10px; pointer-events: none; }
  .navigator-wheel-frame:has(.navigator-options:focus-visible)::before { outline: 2px solid var(--accent); outline-offset: -2px; }
  .navigator-options:focus-visible { outline: none; }
  .navigator-books .navigator-row > span { font-size: 17px; font-weight: inherit; line-height: 1.25; }
  .navigator-books [role="option"] small { display: none; }
  .navigator-chapters .navigator-row { font-size: 17px; line-height: 1.25; }
  .navigator-footer { display: block; margin-top: 10px; padding-top: 14px; }
  .navigator-hint { display: block; text-align: center; margin-bottom: 12px; }
  .navigator-open { width: 100%; }
}
@media (max-width: 820px) and (max-height: 740px) {
  .book-navigator { --wheel-row: 52px; }
  .navigator-footer { margin-top: 8px; padding-top: 10px; }
  .navigator-hint { display: none; }
}
@media (max-width: 360px) {
  .library-view-toolbar .testament-tabs { gap: 4px; }
  .library-view-toolbar .testament-tabs button { padding-inline: 6px; font-size: 10px; }
  .library-view-toggle { width: 44px; }
}
@media (max-height: 500px) {
  .library-sheet { overflow-y: auto; }
  .library-views { flex: 0 0 260px; min-height: 260px; }
}
.library-backdrop[data-compact="true"] .library-sheet { overflow-y: auto; }
.library-backdrop[data-compact="true"] .library-views { flex: 0 0 260px; min-height: 260px; }
.library-backdrop[data-compact="true"] .book-navigator { --wheel-row: 52px; }
.library-backdrop[data-compact="true"] .navigator-footer { margin-top: 8px; padding-top: 10px; }
.library-backdrop[data-compact="true"] .navigator-hint { display: none; }
@media (prefers-reduced-motion: reduce) {
  .navigator-options [role="option"] { transition: none; }
}
.book-grid { max-height: 300px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 2px 2px 10px; overflow-y: auto; }
.book-grid button { min-width: 0; min-height: 52px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 3px 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); cursor: pointer; text-align: left; }
.book-grid button b { grid-row: 1 / 3; color: var(--accent); font-size: 9px; }
.book-grid button span { font-size: 12px; font-weight: 600; line-height: 1.32; text-wrap: balance; overflow-wrap: anywhere; }
.book-grid button small { grid-column: 2; color: var(--muted); font-size: 10px; white-space: nowrap; }
.book-grid button.active { border-color: var(--accent); background: var(--accent-soft); }
/* Muted group hues blend into each theme's paper; text keeps theme contrast. */
.book-group-law { --book-group-color: #967445; }
.book-group-history { --book-group-color: #64846c; }
.book-group-poetry { --book-group-color: #a07b42; }
.book-group-major { --book-group-color: #80709c; }
.book-group-minor { --book-group-color: #a76f7b; }
.book-group-gospels { --book-group-color: #598999; }
.book-group-acts { --book-group-color: #729087; }
.book-group-paul { --book-group-color: #697fa8; }
.book-group-general { --book-group-color: #a17d69; }
.book-group-revelation { --book-group-color: #92768f; }
.book-grid.divided-books button { background: color-mix(in srgb, var(--book-group-color) 12%, var(--paper)); border-color: color-mix(in srgb, var(--book-group-color) 40%, var(--line)); border-left: 3px solid var(--book-group-color); }
.book-grid.divided-books button b { color: var(--ink); }
.book-grid.divided-books button small { color: var(--muted); }
.book-grid.divided-books button:hover { background: color-mix(in srgb, var(--book-group-color) 20%, var(--paper)); }
.book-grid.divided-books button.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-dark .book-grid.divided-books button { background: color-mix(in srgb, var(--book-group-color) 18%, var(--paper)); }
.theme-dark .book-grid.divided-books button:hover { background: color-mix(in srgb, var(--book-group-color) 26%, var(--paper)); }
.no-books, .no-refs { grid-column: 1 / -1; padding: 28px; color: var(--muted); text-align: center; font-size: 11px; }
.library-chapters-head { display: flex; justify-content: space-between; margin: 14px 2px 9px; color: var(--faint); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.chapter-grid.compact { grid-template-columns: repeat(10, 1fr); }
.chapter-grid.compact button { min-height: 44px; }
.chapter-grid.compact button b { font-size: 15px; }

.refs-sheet { width: min(600px, 100%); max-height: min(82vh, 720px); overflow-y: auto; }
.refs-sheet > p { margin: 17px 0 10px; color: var(--muted); font-size: 10px; }
.refs-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.ref-card { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--accent); cursor: pointer; text-align: left; }
.ref-card span { font-size: 11px; font-weight: 650; }
.ref-card i { color: var(--faint); font-size: 8px; font-style: normal; white-space: nowrap; }
.empty-state button { margin-top: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--accent); cursor: pointer; }

.markers-sheet { width: min(680px, 100%); max-height: min(86vh, 760px); overflow-y: auto; }
.markers-summary { margin: 16px 0 11px; }
.markers-list { display: grid; gap: 8px; }
.marked-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); overflow: hidden; }
.marked-jump { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 12px 13px; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.marked-jump:hover { background: var(--surface-2); }
.marked-jump > span { min-width: 0; }
.marked-jump b, .marked-jump small { display: block; }
.marked-jump b { color: var(--accent); font: 600 13px Georgia, serif; }
.marked-jump small { margin-top: 4px; overflow: hidden; display: -webkit-box; color: var(--muted); font: 11px/1.45 Georgia, serif; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.marked-jump .icon { color: var(--faint); font-size: 17px; }
.marked-swatch { width: 9px; height: 32px; border-radius: 7px; background: var(--marker, var(--accent)); }
.marked-remove { width: 44px; min-height: 44px; border: 0; border-left: 1px solid var(--line); background: var(--surface); color: var(--faint); cursor: pointer; font-size: 19px; }
.marked-remove:hover { color: var(--accent); background: var(--accent-soft); }

.copy-toast { position: fixed; z-index: 120; left: var(--toast-x); top: var(--toast-y); display: flex; align-items: center; gap: 8px; padding: 10px 13px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 11px; background: color-mix(in srgb, var(--surface) 96%, transparent); box-shadow: 0 12px 36px rgba(24, 20, 16, .18); color: var(--ink); pointer-events: none; transform: translate(12px, 12px); animation: toast-in .16s ease-out; }
.copy-toast .icon { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 10px; }
.copy-toast span { font-size: 11px; font-weight: 650; white-space: nowrap; }
.reference-return { position: fixed; z-index: 70; right: 24px; bottom: 24px; display: flex; align-items: center; gap: 8px; padding: 10px 13px; border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--surface) 95%, transparent); box-shadow: 0 12px 34px rgba(24, 20, 16, .16); color: var(--muted); backdrop-filter: blur(14px); cursor: pointer; animation: rise .18s ease-out; }
.reference-return:hover { background: var(--accent-soft); color: var(--ink); }
.reference-return .icon { color: var(--accent); font-size: 15px; }
.reference-return span { font-size: 10px; white-space: nowrap; }
.reference-return b { color: var(--ink); font: 600 11px Georgia, serif; }
.markers-empty { min-height: 230px; display: grid; place-items: center; align-content: center; gap: 7px; color: var(--muted); text-align: center; }
.markers-empty .icon { color: var(--accent); font-size: 25px; }
.markers-empty b { color: var(--ink); font: 500 17px Georgia, serif; }
.markers-empty span { max-width: 290px; font-size: 12px; line-height: 1.6; }

.chapter-list.full { padding-right: 2px; }
.chapter-list.full > button { min-height: 50px; }
.chapter-end { gap: 10px; }
.chapter-end > button { flex: 1; }
.chapter-end > button.next { margin-left: auto; }
.chapter-end > button.previous { grid-template-columns: auto 1fr; }
.chapter-end > button.next { grid-template-columns: 1fr auto; }

.settings-drawer { width: min(440px, 100%); height: 100%; margin-left: auto; display: flex; flex-direction: column; background: var(--surface); box-shadow: -16px 0 64px rgba(22,18,15,.16); overflow: hidden; animation: slide .25s ease-out; }
.settings-backdrop, .modal-backdrop:has(.settings-drawer) { padding: 0; align-items: stretch; justify-content: stretch; }
.settings-head { flex: 0 0 auto; gap: 16px; padding: 24px 28px 20px; border-bottom: 1px solid var(--line); }
.settings-head h2 { margin: 0; font: 500 25px/1.2 Georgia, serif; letter-spacing: -.025em; }
.settings-head button { width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.settings-head button:hover { background: var(--surface-2); color: var(--ink); }
.settings-body { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 26px 28px 12px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.settings-section { padding: 0 0 24px; }
.settings-section + .settings-section { padding-top: 24px; border-top: 1px solid var(--line); }
.settings-section h3 { margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.4; font-weight: 600; }
.theme-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.theme-options button { display: grid; gap: 10px; padding: 0 0 5px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; line-height: 1.4; }
.theme-options button.chosen { color: var(--ink); font-weight: 600; }
.theme-swatch { position: relative; display: grid; place-items: center; height: 66px; border: 1px solid var(--line-strong); border-radius: 12px; font: 26px/1 Georgia, serif; transition: border-color .18s ease; }
.theme-options button:hover .theme-swatch { border-color: var(--accent); }
.theme-options button.chosen .theme-swatch { border: 2px solid var(--accent); }
.light-swatch { background: #fbfaf7; color: #26241f; }
.sepia-swatch { background: #f1e8d7; color: #392c20; }
.dark-swatch { background: #171713; color: #f4eee5; }
.rose-swatch { background: #faf1f4; color: #35272d; }
.theme-check { position: absolute; right: -5px; bottom: -5px; display: none; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.theme-check .icon { width: 12px; height: 12px; flex-basis: 12px; }
.chosen .theme-check { display: grid; }
.preview-type { display: flex; flex-direction: column; justify-content: center; gap: 10px; min-height: 124px; margin: 0 0 18px; padding: 18px 20px; border-radius: 12px; background: var(--paper); }
.preview-type p { margin: 0; color: var(--ink); font-family: Georgia, serif; overflow-wrap: break-word; }
.preview-type sup { padding-right: 8px; color: var(--accent); font: 500 11px/1 ui-sans-serif, sans-serif; }
.preview-type > span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.range-setting { display: block; padding: 9px 0; }
.range-setting > span { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.range-setting b { font-size: 13px; line-height: 1.5; font-weight: 500; }
.range-setting output { flex-shrink: 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.range-setting input { display: block; width: 100%; height: 30px; margin: 5px 0 0; padding: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
.range-setting input::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: linear-gradient(to right, var(--accent) 0 var(--range-fill), var(--line-strong) var(--range-fill) 100%); }
.range-setting input::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7.5px; border: 2px solid var(--accent); border-radius: 50%; background: var(--surface); box-shadow: 0 2px 4px rgba(22,18,15,.12); }
.range-setting input::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line-strong); }
.range-setting input::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--accent); }
.range-setting input::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid var(--accent); border-radius: 50%; background: var(--surface); box-shadow: 0 2px 4px rgba(22,18,15,.12); }
.range-setting input:focus-visible { outline-offset: 3px; border-radius: 4px; }
.toggle-setting { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 0; }
.toggle-setting + .toggle-setting { border-top: 1px solid var(--line); }
.toggle-setting b, .toggle-setting small { display: block; }
.toggle-setting b { font-size: 13px; line-height: 1.5; font-weight: 500; }
.toggle-setting small { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.toggle-setting .resource-note { margin-top: 7px; font-size: 11px; }
.toggle-setting > button { position: relative; width: 44px; height: 44px; flex: 0 0 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.toggle-setting > button::before { content: ''; position: absolute; inset: 10px 0; border: 1px solid var(--line-strong); border-radius: 24px; background: var(--surface-2); transition: background-color .18s ease, border-color .18s ease; }
.toggle-setting > button i { position: absolute; left: 4px; top: 14px; display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .18s ease, background-color .18s ease; }
.toggle-setting > button.active::before { background: var(--accent); border-color: var(--accent); }
.toggle-setting > button.active i { transform: translateX(20px); background: var(--on-accent); }
.toggle-setting > button:hover::before { border-color: var(--accent); }
.settings-foot { flex: 0 0 auto; margin: 0; padding: 15px 28px max(15px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.5; }
.offline-setting { padding-top: 24px; border-top: 1px solid var(--line); }
.offline-setting h3 { display: flex; align-items: center; gap: 10px; }
.offline-heading-icon { width: 22px; height: 22px; flex: 0 0 22px; color: var(--accent); }
.offline-setting p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.offline-setting button { width: 100%; min-height: 44px; padding: 12px 16px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: var(--on-accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.offline-setting button:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.offline-setting button:disabled { opacity: .65; cursor: wait; }
.offline-setting .offline-install { margin-top: 10px; background: transparent; color: var(--accent); }
.offline-setting .offline-install:hover { background: var(--accent-soft); }
.offline-status-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; }
.offline-setting .offline-status { flex: 1; min-width: 0; margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.offline-setting .offline-help { margin: 12px 0 0; }
.offline-meter { position: relative; margin-top: 18px; }
.offline-meter-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 9px; color: var(--muted); font-size: 11px; }
.offline-percent { color: var(--accent); font-variant-numeric: tabular-nums; }
.offline-track { height: 8px; overflow: hidden; border-radius: 4px; background: var(--surface-2); }
.offline-fill { position: relative; display: block; width: 100%; height: 100%; overflow: hidden; border-radius: inherit; background: var(--accent); transform: scaleX(0); transform-origin: left center; }
.offline-glint { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--on-accent) 30%, transparent), transparent); animation: offline-glint 1.8s ease-in-out infinite; animation-play-state: paused; }
.offline-setting[data-motion-active="true"] .offline-glint { animation-play-state: running; }
.offline-setting[data-offline-phase="ready"] .offline-glint { opacity: 0; }
.offline-setting .offline-native-progress { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.offline-success-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); transform-origin: center; }
.offline-success-icon svg { width: 22px; height: 22px; }
.offline-check { stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes offline-glint { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .offline-glint { animation: none; opacity: 0; } }
.offline-setting [hidden] { display: none; }

.not-found-page {
  --not-found-art: #8a6d52;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vw, 72px) 22px;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--not-found-art) 7%, transparent), transparent 42%),
    var(--paper);
  color: var(--ink);
}
.not-found-page.theme-sepia, html.theme-sepia .not-found-page { --not-found-art: #7f6247; }
.not-found-page.theme-rose, html.theme-rose .not-found-page { --not-found-art: #966879; }
.not-found-page.theme-dark, html.theme-dark .not-found-page { --not-found-art: #92979d; }
.not-found-shell { width: min(620px, 100%); display: grid; justify-items: center; text-align: center; }
.not-found-brand { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .18em; text-transform: uppercase; }
.not-found-art { width: min(330px, 78vw); margin: 26px 0 14px; color: var(--not-found-art); }
.not-found-art g { stroke-width: 3; }
.not-found-bible { opacity: .82; }
.not-found-sword { stroke-width: 2.7 !important; }
.not-found-copy > p { margin: 0 0 10px; color: var(--not-found-art); font-size: 10px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.not-found-copy h1 { max-width: 560px; margin: 0; font: 400 clamp(31px, 6vw, 52px)/1.08 Georgia, "Times New Roman", serif; letter-spacing: -.025em; text-wrap: balance; }
.not-found-return { min-width: min(330px, 100%); margin: 32px auto 0; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 18px; padding: 13px 15px 13px 18px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-align: left; text-decoration: none; transition: transform .18s, border-color .18s, background .18s; }
.not-found-return:hover { border-color: var(--not-found-art); background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .not-found-return:hover { transform: translateY(-2px); }
}
.not-found-return span, .not-found-return b { display: block; }
.not-found-return span { color: var(--muted); font-size: 9px; letter-spacing: .04em; }
.not-found-return b { margin-top: 3px; color: var(--not-found-art); font: 600 15px Georgia, serif; }
.not-found-return i { grid-column: 2; grid-row: 1 / 3; color: var(--not-found-art); font-size: 19px; font-style: normal; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translate(12px, 18px) scale(.96); } }
@keyframes toast-mobile-in { from { opacity: 0; transform: translate(-50%, 7px) scale(.96); } }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 226px minmax(480px, 1fr); }
  .context-panel { display: none; }
  .reader-column { padding-inline: clamp(36px, 6vw, 74px); }
}

@media (max-width: 820px) {
  .topbar { height: 62px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding: 0 12px; }
  .brand-copy { display: none; }
  .brand-icon { width: 37px; height: 37px; }
  .location-pill { justify-self: center; min-width: 116px; min-height: 44px; padding: 7px 10px 7px 13px; }
  .location-pill span { display: none; }
  .location-pill b { font-size: 13px; }
  .location-pill .icon { grid-row: 1; }
  .top-actions { justify-self: end; gap: 5px; }
  .top-actions .round-button { width: 40px; height: 44px; border-color: transparent; border-radius: 10px; }
  .top-actions .account-button { order: -1; width: 44px; margin-left: 0; background: transparent; color: var(--ink); }
  .top-actions .account-button:hover { background: var(--surface-2); }
  .desktop-markers-button { display: none; }
  .layout { display: block; min-height: calc(100vh - 62px); }
  .rail { display: none; }
  .reader-column { padding: 38px 23px 120px; }
  .reader-head h1 { font-size: clamp(34px, 9vw, 44px); line-height: 1.08; }
  .reader-head > p { font-size: 14px; }
  .reader-controls { display: grid; margin: 22px auto 22px; padding-bottom: 14px; gap: 4px; }
  .reader-toggles, .reader-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .reader-controls button { min-width: 0; min-height: 44px; gap: 5px; padding: 7px 5px; line-height: 1.3; }
  .reader-controls .future-control em { display: none; }
  .reader-controls button span { font-size: 11px; }
  .reader-controls .icon { width: 18px; height: 18px; flex-basis: 18px; }
  .verse { grid-template-columns: 28px minmax(0, 1fr); gap: 9px; margin-inline: -8px; padding: 7px 8px 11px; border-radius: 9px; }
  .verse-number { width: 27px; height: 28px; }
  .russian { font-size: clamp(18px, var(--reader-font-size), 27px); line-height: var(--reader-line-height); }
  .english { font-size: calc(var(--reader-font-size) * .68); }
  .verse-tools { left: 50%; transform: translateX(-50%); gap: 0; }
  .verse-tools button { flex-basis: 44px; width: 44px; height: 44px; }
  .verse-color-strip { --color-size: 44px; --color-gap: 0px; }
  .chapter-end { margin-top: 50px; gap: 12px; }
  .chapter-end > span { max-width: 80px; }
  .translation-copyright { margin-top: 44px; grid-template-columns: 1fr; gap: 18px; }
  .mobile-nav { position: fixed; left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 45; height: 64px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 17px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(18px); box-shadow: 0 10px 40px rgba(35, 27, 20, .16); }
  .copy-toast { left: 50%; top: auto; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); border-radius: 18px; animation-name: toast-mobile-in; }
  .reference-return { left: 50%; right: auto; bottom: calc(84px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); transform: translateX(-50%); border-radius: 18px; animation: none; }
  .mobile-nav button { min-width: 0; display: grid; grid-template-rows: 24px 14px; place-items: center; align-content: center; gap: 2px; padding: 4px 0; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; }
  .mobile-nav button.active { border-color: color-mix(in srgb, var(--accent) 22%, var(--line)); background: var(--accent-soft); color: var(--accent); }
  .mobile-nav button:disabled { opacity: .55; cursor: default; }
  .mobile-nav button > .icon, .mobile-nav button > .original-icon { width: 24px; height: 24px; flex: 0 0 24px; color: inherit; }
  .mobile-nav button > span:last-child { font-size: 10px; line-height: 14px; white-space: nowrap; }
  .search-strip { top: 62px; }
  .search-strip { padding: 8px 10px; }
  .search-strip .search-submit { min-width: 68px; padding: 0 12px; }
  .search-strip input { font-size: 16px; }
  .search-scope { display: block; line-height: 1.5; }
  .search-scope span { display: block; }
  .search-scope span:last-child { display: none; }
  .search-recent-shell { margin-top: 8px; padding: 0 10px; }
  .recent-history { padding: 9px; }
  .recent-history-row { grid-template-columns: 1fr; gap: 5px; }
  .search-results-head { padding-left: 10px; }
  .search-result-list { max-height: 55vh; }
  .search-result-list p { font-size: 14px; }
  .modal-backdrop { padding: 10px; }
  .modal-backdrop.account-backdrop, .static-sheet.account-backdrop { align-items: flex-end; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .chapter-sheet { padding: 10px 16px 23px; }
  .chapter-grid { grid-template-columns: repeat(3, 1fr); }
  .library-sheet { height: 100%; max-height: 100%; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 38vh; }
  .chapter-grid.compact { grid-template-columns: repeat(6, 1fr); }
  .refs-list { grid-template-columns: 1fr; }
  .parallel-row button, .ref-card { min-height: 44px; }
  .book-search input { font-size: 16px; }
  .markers-sheet { max-height: 92vh; }
  .marked-jump { gap: 9px; padding: 11px 10px; }
  .marked-jump small { max-width: calc(100vw - 150px); }
  .language-notice { margin-top: 20px; }
  .settings-head { padding: max(16px, env(safe-area-inset-top)) 22px 14px; }
  .settings-head h2 { font-size: 24px; }
  .settings-body { padding: 22px 22px 12px; }
  .settings-foot { padding-inline: 22px; }
  .range-setting input { height: 44px; }
  .theme-swatch { height: 64px; }
}

@media (max-width: 360px) {
  .topbar { gap: 6px; padding-inline: 10px; }
  .top-actions { gap: 4px; }
}

@media (max-width: 350px) {
  .verse-tools { padding: 0; }
}

@media (max-width: 520px) {
  .settings-drawer { width: 100%; }
}

@media (max-width: 390px) {
  .reader-column { padding-inline: 17px; }
  .reader-controls button span { font-size: 10px; }
  .chapter-facts { gap: 10px; }
  .not-found-return { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Lucide Animated icons share a consistent stroke and footprint. */
.icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: 0 0 20px; vertical-align: middle; }
.icon > .icon { width: 100%; height: 100%; }
.icon svg { display: block; width: 100%; height: 100%; }
.icon > div { display: flex; align-items: center; justify-content: center; }
.sheet-head button, .settings-head button, .tool-action, .marked-remove { display: inline-flex; align-items: center; justify-content: center; }
button, a { -webkit-tap-highlight-color: transparent; }
button { transition: background-color .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease, scale .16s var(--ease-out); }
button:not(:disabled):active { scale: .97; }
button:focus-visible:active { scale: 1; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.search-strip, .search-recent-shell { animation: content-reveal .2s var(--ease-out); }
.static-sheet .chapter-sheet, .static-settings .settings-drawer, .modal-backdrop, .modal-backdrop .chapter-sheet, .modal-backdrop .settings-drawer { animation: none; }
.copy-toast { animation: none; }
@starting-style { .copy-toast { opacity: 0; } }
.copy-toast { transition: opacity .16s var(--ease-out); }
@keyframes content-reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  button:not(:disabled):active { scale: 1; }
  .modal-backdrop, .chapter-sheet, .settings-drawer, .search-strip, .search-recent-shell, .copy-toast, .reference-return { animation: none; }
  button, .app { transition: background-color .1s ease, color .1s ease, border-color .1s ease, opacity .1s ease; }
  .toggle-setting > button i { transition: background-color .1s ease; }
  .not-found-return:hover { transform: none; }
}

/* Preserve source whitespace, accents, line breaks, notes and Psalm headings. */
.russian { white-space: pre-wrap; }
.russian u { text-decoration: underline; text-underline-offset: .12em; }
.source-footnote { color: var(--muted); font-size: .65em; vertical-align: super; }
.verse-heading { display: block; margin: 0 0 12px; color: var(--accent); font: 600 12px/1.5 Georgia, serif; letter-spacing: .06em; white-space: pre-wrap; }

.continuous-mode > .verses, .continuous-mode > .chapter-end, .continuous-mode > .single-chapter { display: none; }
.continuous-reader { overflow-anchor: none; }
.continuous-chapter { max-width: var(--reader-width); margin: 0 auto; padding-top: 30px; }
.continuous-heading { margin: 0 0 28px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--ink); font: 400 30px/1.25 Georgia, serif; text-align: center; }
.continuous-heading:has(+ .continuous-description) { margin-bottom: 10px; }
.continuous-description { margin: 0 0 28px; color: var(--muted); font: italic 16px/1.5 Georgia, serif; text-align: center; text-wrap: balance; }
.continuous-status { max-width: var(--reader-width); margin: 20px auto; color: var(--muted); font-size: 12px; text-align: center; }
.continuous-status:empty { display: none; }
.continuous-status button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); background: var(--surface); cursor: pointer; }
.toggle-setting > span { padding-right: 12px; }
.toggle-setting > button { flex-shrink: 0; }
.toggle-setting small.resource-note { margin-top: 7px; font-size: 11px; line-height: 1.5; }

.original-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: 0 0 20px; color: inherit; vertical-align: middle; }
.original-icon svg { display: block; width: 100%; height: 100%; transition: transform .16s var(--ease-out), opacity .16s var(--ease-out); }
.original-stroke { transform-origin: 12px 12px; transition: transform .16s var(--ease-out); }
.original-icon[data-feedback="true"] [data-language="he"] .original-stroke-0 { transform: rotate(-6deg) scale(.94); }
.original-icon[data-feedback="true"] [data-language="grc"] .original-stroke-0 { transform: translate(.4px, .6px) rotate(2deg); }
.original-icon[data-feedback="true"] [data-language="grc"] .original-stroke-1 { transform: translate(-.4px, -.6px) rotate(-2deg); }
.icon svg { transition: transform .16s var(--ease-out), opacity .16s var(--ease-out); }
.icon[data-feedback="true"] svg { transform: scale(.9); opacity: .6; }
.original-icon[data-feedback="true"] svg { opacity: .75; }
@media (prefers-reduced-motion: reduce) {
  .original-icon svg, .icon svg { transition: opacity .1s ease; }
  .original-icon .original-stroke { transition: none; }
  .original-icon[data-feedback="true"] svg[data-language] .original-stroke { transform: none; }
  .original-icon[data-feedback="true"] svg, .icon[data-feedback="true"] svg { transform: none; }
}
.original { margin: 13px 0 5px; padding: 2px 0 2px 13px; border-left: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); }
.original-source { display: block; margin-bottom: 5px; color: var(--accent); font: 600 10px/1.4 Inter, sans-serif; }
.original-text { margin: 0; color: var(--ink); font: 400 calc(var(--reader-font-size) * .85)/1.8 Georgia, "Times New Roman", serif; overflow-wrap: anywhere; }
.original-text[dir="rtl"] { font-size: calc(var(--reader-font-size) * 1.02); line-height: 1.9; text-align: right; }
.original-status { margin: 10px 0; color: var(--muted); font: 12px/1.6 Inter, sans-serif; }
.original-load-error { max-width: var(--reader-width); margin: 12px auto; color: var(--muted); font-size: 12px; }
.original-load-error button { border: 0; background: transparent; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* Personal verse notes share the reader's quiet surfaces and all four themes. */
.verse-note-indicator { position: absolute; top: 1px; right: 0; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--accent); cursor: pointer; }
.verse-note-indicator:hover { background: var(--accent-soft); }
.verse:has(> .verse-note-indicator) .verse-body { padding-right: 20px; }
.verse:has(> .verse-note-indicator) .marker-dot { display: none; }
.note-card .marked-jump { grid-template-columns: auto minmax(0, 1fr); }
.note-card .marked-jump small { white-space: normal; overflow-wrap: anywhere; font-family: inherit; font-size: 13px; line-height: 1.55; }
.note-card-label { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.note-backdrop, .static-sheet.note-backdrop { align-items: center; }
.note-sheet { width: min(600px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; }
.note-sheet .sheet-head h2 { margin: 0; }
.note-sheet .sheet-head > button { min-width: 44px; min-height: 44px; }
.note-sheet .note-reference { margin: 6px 0 24px; color: var(--accent); font: 16px/1.5 Georgia, serif; overflow-wrap: anywhere; }
.note-sheet form > label { display: block; margin-bottom: 8px; color: var(--ink); font-size: 14px; font-weight: 600; }
.note-sheet textarea { display: block; width: 100%; min-height: 200px; max-height: 45dvh; resize: vertical; padding: 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--paper); color: var(--ink); font-family: inherit; font-size: 16px; line-height: 1.6; caret-color: var(--accent); }
.note-sheet textarea::placeholder { color: var(--muted); opacity: 1; }
.note-sheet textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.note-meta { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.note-meta output { font-variant-numeric: tabular-nums; white-space: nowrap; }
.note-meta .at-limit { color: var(--accent); font-weight: 600; }
.note-color-field { margin: 24px 0; padding: 0; border: 0; }
.note-color-field legend { margin-bottom: 8px; padding: 0; color: var(--ink); font-size: 13px; font-weight: 600; }
.note-colors { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.note-colors button, .note-color-none { min-height: 44px; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); cursor: pointer; touch-action: manipulation; }
.note-colors button:hover, .note-color-none:hover { background: var(--surface-2); }
.note-colors .chosen, .note-color-none.chosen { outline: 2px solid var(--accent); outline-offset: 2px; }
.note-colors button:focus-visible, .note-color-none:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.note-color-swatch { position: relative; width: 44px; flex: 0 0 44px; }
.note-color-swatch::before { content: ''; display: block; width: 24px; height: 24px; margin: auto; border-radius: 50%; background: var(--marker); box-shadow: inset 0 0 0 1px #26241f26; }
.note-color-swatch.chosen::after { content: ''; position: absolute; top: 14px; left: calc(50% - 3px); width: 6px; height: 10px; border: solid #26241f; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.note-colors-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; color: var(--muted); }
.note-colors-toggle > .icon { transition: transform .24s var(--ease-out); }
.note-colors-toggle[aria-expanded="true"] > .icon { transform: rotate(180deg); }
.note-palette-disclosure { display: grid; grid-template-rows: 0fr; opacity: 0; visibility: hidden; transition: grid-template-rows .24s var(--ease-out), opacity .2s var(--ease-out), visibility 0s .24s; }
.note-palette-disclosure[data-expanded="true"] { grid-template-rows: 1fr; opacity: 1; visibility: visible; transition-delay: 0s; }
.note-palette-clip { min-height: 0; overflow: hidden; }
.note-colors-extra { display: grid; grid-template-columns: repeat(5, 44px); gap: 8px; margin-top: 16px; padding: 16px 4px 4px; border-top: 1px solid var(--line); }
.note-color-options { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.note-color-none { padding: 8px 12px; color: var(--ink); font-size: 13px; }
.note-color-current { color: var(--muted); font-size: 12px; }
@media (min-width: 640px) { .note-colors-extra { grid-template-columns: repeat(10, 44px); } }
@media (prefers-reduced-motion: reduce) { .note-colors-toggle > .icon { transition: none; } .note-palette-disclosure { transition: opacity .1s var(--ease-out), visibility 0s .1s; } .note-palette-disclosure[data-expanded="true"] { transition-delay: 0s; } }
.note-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.note-footer button { min-height: 44px; padding: 10px 14px; border: 0; border-radius: 8px; font-size: 13px; cursor: pointer; }
.note-delete { margin-right: auto; background: transparent; color: var(--accent); }
.note-cancel { background: var(--surface-2); color: var(--ink); }
.note-save { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.note-save:disabled { opacity: .5; cursor: default; }
.note-error { color: var(--accent); font-size: 13px; line-height: 1.6; }
.note-backdrop, .static-sheet.note-backdrop { z-index: 90; }
.note-read-text { max-height: 55dvh; overflow-y: auto; overscroll-behavior: contain; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); font-size: 16px; line-height: 1.75; padding: 0 4px 24px 0; }
.note-view-sheet .note-reference { margin-bottom: 20px; }
.note-view-footer button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.note-delete-confirm > p { margin: 20px 0 12px; color: var(--ink); font-weight: 600; }
.note-view-footer[hidden], .note-delete-confirm[hidden] { display: none; }

/* Saved verses expand into a searchable library, retaining the reading context. */
.markers-sheet { display: flex; flex-direction: column; overflow: hidden; }
.markers-sheet .sheet-head { flex-shrink: 0; gap: 16px; }
.markers-sheet .sheet-head h2 { margin: 0; }
.saved-head-actions { display: flex; gap: 4px; }
.saved-head-actions button { min-width: 44px; min-height: 44px; }
.theme-sepia .markers-sheet { --muted: var(--faint); }
.markers-sheet .markers-summary { flex-shrink: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.markers-sheet .markers-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; grid-auto-rows: max-content; align-content: start; padding-right: 4px; }
.saved-expand-footer { flex-shrink: 0; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.saved-expand { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 14px; border: 0; border-radius: 8px; background: var(--surface-2); color: var(--accent); font-size: 14px; cursor: pointer; }
.saved-expand:hover { background: var(--accent-soft); }
.markers-backdrop:not(.is-expanded) .saved-tools, .markers-backdrop:not(.is-expanded) [data-action="collapse-markers"] { display: none; }
.markers-backdrop.is-expanded { padding: 0; align-items: stretch; }
.is-expanded .markers-sheet { width: 100%; height: 100dvh; max-height: none; padding: max(28px, env(safe-area-inset-top)) max(32px, calc((100vw - 1200px) / 2)) max(24px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; background: var(--paper); box-shadow: none; }
.is-expanded .markers-sheet .sheet-head h2 { font-size: 26px; }
.is-expanded .markers-summary { margin: 2px 0 24px; font-size: 12px; }
.is-expanded .markers-counts { display: none; }
.is-expanded .sheet-handle, .is-expanded .saved-expand-footer { display: none; }
.is-expanded .markers-list { flex: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 8px; }
.is-expanded .marked-jump { padding: 18px; align-items: start; }
.is-expanded .marked-jump b { font-size: 16px; line-height: 1.5; }
.is-expanded .marked-jump small { font-size: 14px; line-height: 1.65; max-width: none; }
.is-expanded .marked-card { align-self: start; }
.saved-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; flex-shrink: 0; margin: 8px 0 16px; }
.saved-search { display: flex; align-items: center; gap: 10px; flex: 1 1 320px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--paper); color: var(--muted); }
.saved-search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.saved-search input { min-width: 0; width: 100%; min-height: 44px; border: 0; background: transparent; outline: none; color: var(--ink); font: inherit; font-size: 16px; }
.saved-search input::placeholder { color: var(--muted); opacity: 1; }
.saved-filters { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.saved-filters button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.saved-filters button[aria-pressed="true"] { background: var(--surface); color: var(--accent); }
.saved-filters button:hover { color: var(--ink); }
.saved-filters span { font-size: 11px; font-variant-numeric: tabular-nums; }
.saved-no-results { color: var(--muted); font-size: 14px; line-height: 1.7; }
.marked-card[hidden] { display: none; }
.markers-list .markers-empty { grid-column: 1 / -1; }
@media (max-width: 820px) {
  .verse:has(> .verse-note-indicator) .verse-body { padding-right: 28px; }
  .note-backdrop, .static-sheet.note-backdrop { align-items: flex-end; padding: 8px; }
  .note-sheet { max-height: calc(100dvh - 16px); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .note-sheet textarea { min-height: 160px; }
  .note-sheet .note-reference { margin-bottom: 18px; }
  .note-footer .note-delete { flex: 1 0 100%; margin: 0; text-align: left; }
  .note-cancel, .note-save { flex: 1; }
  .is-expanded .markers-sheet { padding: max(20px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
  .is-expanded .markers-sheet .sheet-head { align-items: flex-start; gap: 8px; }
  .is-expanded .markers-sheet .sheet-head h2 { font-size: 24px; line-height: 1.3; }
  .is-expanded .markers-list { grid-template-columns: minmax(0, 1fr); }
  .is-expanded .marked-jump { padding: 14px; }
  .saved-tools { gap: 10px; }
  .saved-search { flex-basis: 100%; }
  .saved-filters { width: 100%; }
  .saved-filters button { flex: 1; min-width: 0; gap: 5px; padding: 8px 5px; font-size: 12px; }
  .note-view-footer .note-delete { justify-content: flex-start; }
}

/* Public legal documents use the reader's quiet, warm typography. */
.policy-links { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.policy-links a, .policy-links a:visited { display: inline-flex; align-items: center; min-height: 32px; color: var(--muted); text-decoration: none; text-underline-offset: 4px; }
.policy-links a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); }
.translation-copyright > .policy-links, .translation-copyright > .reader-policy-footer { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--line); }
.account-legal { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); }
.account-legal .policy-links { gap: 2px 16px; }
@media (max-width: 820px) { .policy-links a { min-height: 44px; } }
.policy-page { min-height: 100vh; background: #fbfaf7; color: #292723; font-family: Arial, sans-serif; }
.policy-page header, .policy-page main, .policy-page footer { width: min(760px, calc(100% - 40px)); margin-inline: auto; }
.policy-page header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-block: 28px; border-bottom: 1px solid #dedbd4; font-size: 14px; }
.policy-page a { color: inherit; text-underline-offset: 4px; overflow-wrap: anywhere; }
.policy-page a:focus-visible, .policy-links a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.policy-brand { font: bold 26px Georgia, serif; text-decoration: none; }
.policy-brand span { display: block; margin-top: 5px; font: normal 12px Arial, sans-serif; }
.policy-page main { padding-block: 48px; }
.policy-kicker, .policy-date { font-size: 13px; color: #625e57; }
.policy-page h1 { margin-block: 16px; font: normal clamp(30px, 6vw, 48px)/1.12 Georgia, serif; overflow-wrap: anywhere; }
.policy-page h2 { margin-block: 32px 14px; font: normal 25px/1.3 Georgia, serif; }
.policy-page section p { font-size: 16px; line-height: 1.8; margin-block: 14px; }
.policy-page footer { border-top: 1px solid #dedbd4; padding-block: 24px 40px; }
@media print { .policy-page header, .policy-page footer { display: none; } .policy-page { background: white; color: black; } .policy-page main { width: 100%; padding: 0; } }

/* Profile pictures stay on the provider's servers. */
.account-button.is-signed-in { width: auto; max-width: 230px; height: 46px; gap: 9px; padding: 3px 11px 3px 3px; border-color: transparent; background: transparent; color: var(--ink); text-align: left; }
.account-button.is-signed-in:hover { background: transparent; border-color: transparent; }
.account-avatar { position: relative; display: inline-grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; overflow: hidden; padding: 2px; border-radius: 50%; background: #1877f2; color: var(--ink); font-size: 16px; font-weight: 600; }
.account-avatar-google { background: conic-gradient(#4285f4 0deg 90deg, #34a853 90deg 180deg, #fbbc05 180deg 270deg, #ea4335 270deg 360deg); }
.account-avatar-content { position: relative; display: grid; place-items: center; width: 100%; height: 100%; overflow: hidden; border-radius: 50%; background: var(--surface-2); }
.account-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account-button-copy { display: grid; gap: 2px; min-width: 0; }
.account-button-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.account-button-copy small { font-size: 10px; color: var(--muted); white-space: nowrap; }
.account-identity { display: flex; align-items: center; gap: 14px; margin: 24px 0 14px; }
.account-identity .account-avatar { width: 60px; height: 60px; flex-basis: 60px; font-size: 24px; }
.account-identity > div { display: grid; gap: 4px; min-width: 0; }
.account-identity strong { overflow-wrap: anywhere; font-size: 19px; }
.account-identity > div > span { color: var(--muted); font-size: 12px; }
.account-providers .account-facebook { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 48px; padding: 12px 16px; border: 0; border-radius: 10px; background: #1877f2; color: white; text-decoration: none; font: inherit; font-size: 14px; font-weight: 600; }
.account-providers .account-facebook:hover { background: #1266d3; }
.account-providers .account-facebook:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.account-quota { margin: 18px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.account-quota > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.account-quota strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.account-quota strong small { color: var(--muted); font-size: 15px; font-weight: 400; }
.account-quota p { margin: 8px 0 4px; color: var(--muted); font-size: 12px; }
.account-quota > small { color: var(--faint); font-size: 11px; }
.account-sync { min-height: 20px; color: var(--muted); font-size: 12px; }
.account-error { color: #bd3434; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; }
.account-conflict, .account-delete-confirm { margin-top: 18px; padding: 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-2); }
.account-conflict p, .account-delete-confirm p { font-size: 13px; line-height: 1.6; }
.account-delete-confirm h3 { margin: 0; font-size: 16px; }
.account-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.account-actions button { min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.account-actions button:hover { background: var(--surface-2); }
.account-actions button:disabled { opacity: .55; cursor: wait; }
.account-actions .account-delete { margin-left: auto; border-color: transparent; color: #bd3434; }
.account-actions .account-danger { background: #b82e2e; border-color: #b82e2e; color: white; }
.account-actions .account-danger:hover { background: #9f2525; }
.account-sheet a:focus-visible, .account-sheet button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 820px) {
  .top-actions .account-button.is-signed-in { width: 44px; max-width: 44px; padding: 2px; background: transparent; }
  .account-button-copy { display: none; }
  .account-actions { flex-direction: column; }
  .account-actions .account-delete { margin-left: 0; }
}

.account-providers { display: grid; gap: 10px; }
.account-providers .account-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 48px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; font: inherit; font-size: 14px; font-weight: 600; }
.account-providers .account-google:hover { background: var(--surface-2); }
.account-providers .account-google:disabled { color: var(--muted); cursor: not-allowed; }
.account-providers a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* Public reading destinations beside the salvation link. */
.reader-footer-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Saved records: one readable list, with organization revealed as needed. */
.saved-organizer { position: relative; display: flex; flex: 1; flex-direction: column; min-height: 180px; min-width: 0; overflow: hidden; color: var(--ink); }
.saved-organizer button, .note-folder-picker button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.saved-organizer button:focus-visible, .saved-organizer select:focus-visible, .note-folder-picker button:focus-visible, .note-folder-picker select:focus-visible, .folder-editor input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.saved-organizer button:disabled { opacity: .4; cursor: default; }
.saved-organizer svg, .note-folder-picker svg { flex-shrink: 0; }
/* The collection rail and workspace share one quiet, paper-like surface. */
.organizer-layout { display: flex; flex: 1; min-height: 0; min-width: 0; overflow: hidden; }
.organizer-workspace { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.folder-nav { display: none; min-width: 0; }
.folder-nav-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.folder-nav-heading > b { font-weight: 500; letter-spacing: .02em; }
.folder-nav-heading > button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.organizer-new-folder { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 16px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--accent); text-align: left; font-size: 13px !important; }
.folder-actions button, .folder-editor-heading button { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.folder-nav-items { display: flex; flex: 1; flex-direction: column; gap: 4px; min-height: 0; overflow: auto; padding: 3px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; overscroll-behavior: contain; }
.folder-nav-item { position: relative; display: flex; flex: 0 0 auto; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px !important; text-align: left; transition: background-color .15s ease-out, color .15s ease-out; }
.folder-nav-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-nav-item small { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; }
.folder-nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.folder-nav-item:nth-child(2) { margin-bottom: 16px; }
.organizer-gesture-hint { flex-shrink: 0; max-width: 24ch; margin: 8px 12px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.gesture-mouse { display: none; }
.saved-color-dot { display: inline-block; flex-shrink: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--marker); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 18%, transparent); }
.folder-nav-item > .saved-color-dot { width: 14px; height: 14px; margin: 2px; }
.folder-content-heading { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; margin-bottom: 20px; }
.folder-heading-copy { display: flex; flex-wrap: wrap; align-items: baseline; min-width: 0; gap: 4px 14px; }
.folder-content-heading h3 { min-width: 0; margin: 0; font: 400 28px/1.3 Georgia, serif; overflow-wrap: anywhere; text-wrap: balance; }
.folder-heading-actions { display: flex; flex-shrink: 0; align-items: center; gap: 4px; }
.folder-actions:empty { display: none; }
.folder-nav-toggle, .organizer-filter-toggle { display: flex; flex-shrink: 0; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px !important; }
.organizer-search-area { position: relative; flex-shrink: 0; }
.organizer-tools { display: flex; align-items: center; flex-shrink: 0; gap: 12px; }
.organizer-tools .saved-search { flex: 1; min-width: 0; background: var(--surface); }
.organizer-filter-toggle[aria-expanded="true"], .organizer-filter-toggle.has-filters { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.organizer-filter-toggle b { font-size: 12px; font-weight: 500; }
.organizer-filter-panel { display: flex; flex-shrink: 0; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; max-height: 36dvh; overflow-y: auto; padding: 16px; margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.organizer-filter-panel[hidden] { display: none; }
.organizer-color-section { flex: 1 1 200px; min-width: 0; }
.organizer-color-section > span, .organizer-sort { color: var(--muted); font-size: 12px; line-height: 1.5; }
.used-color-filters { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; margin: 4px -6px -6px; }
.organizer-sort { display: flex; flex-direction: column; gap: 4px; }
.organizer-sort select { width: 100%; min-height: 44px; padding: 8px 28px 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; }
.organizer-reset { min-height: 44px; padding: 8px; border: 0; border-radius: 6px; background: transparent; color: var(--accent); font-size: 13px !important; }
.organizer-workspace > .saved-filters { flex-shrink: 0; gap: 24px; margin: 12px 0 0; padding: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.organizer-workspace > .saved-filters button { min-width: 44px; position: relative; flex: 0 1 auto; gap: 8px; min-height: 48px; padding: 10px 0; border-radius: 0; font-size: 13px; }
.organizer-workspace > .saved-filters button[aria-pressed="true"] { color: var(--accent); background: transparent; }
.organizer-workspace > .saved-filters button[aria-pressed="true"]::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--accent); content: ""; }
.organizer-workspace > .saved-filters span { font-size: 12px; }
.organizer-main { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 4px 16px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.organizer-main:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.saved-color-choice { display: grid; flex: 0 0 44px; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); }
.saved-palette-dot { position: relative; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--marker); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 24%, transparent); }
.saved-palette-dot.is-neutral { background: var(--paper); color: var(--muted); }
.saved-color-choice[aria-checked="true"] .saved-palette-dot::after, .saved-color-choice[aria-pressed="true"] .saved-palette-dot::after { position: absolute; inset: -4px; border: 2px solid var(--accent); border-radius: 50%; content: ""; }
.clear-color-filter { flex-shrink: 0; min-height: 44px; padding: 6px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--accent); font-size: 12px !important; }
.organizer-status { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.organizer-entries { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; }
.saved-entry { min-width: 0; padding: 12px 12px 8px; border-bottom: 1px solid var(--line); border-radius: 8px; -webkit-touch-callout: none; }
.saved-entry-top { display: flex; align-items: flex-start; gap: 8px; }
.entry-menu { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.saved-entry-open { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 8px; padding: 8px 0; border: 0; border-radius: 4px; background: transparent; color: var(--ink); text-align: left; }
.saved-entry-reference { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.saved-entry-reference b { font: 400 19px/1.4 Georgia, serif; overflow-wrap: anywhere; }
.saved-entry-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; max-width: 112px; }
.saved-entry-open > .saved-entry-preview { max-inline-size: 75ch; text-wrap: pretty; display: -webkit-box; width: 100%; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--ink); font: 16px/1.65 Georgia, serif; overflow-wrap: anywhere; white-space: normal; }
.saved-entry[data-entry-kind="note"] .saved-entry-preview { color: var(--muted); font-family: inherit; font-size: 15px; }
.saved-entry-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 20px; min-height: 44px; color: var(--muted); font-size: 12px; }
.saved-entry-type { display: flex; align-items: center; gap: 6px; }
.saved-entry-type svg, .saved-entry-folder svg { width: 14px; height: 14px; }
.saved-color-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.saved-entry-folder { display: flex; align-items: center; gap: 6px; min-width: 44px; min-height: 44px; max-width: 100%; padding: 4px 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px !important; text-align: left; }
.saved-entry-folder span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-action-panel { margin: 8px 0 4px; padding: 16px; border-radius: 8px; background: var(--surface-2); }
.entry-action-panel > label, .folder-editor label, .note-folder-row label { display: flex; flex-direction: column; gap: 7px; min-width: 0; color: var(--muted); font-size: 12px; }
.entry-action-panel select, .folder-editor input, .note-folder-row select { width: 100%; min-width: 0; min-height: 44px; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; }
.entry-action-buttons, .folder-settings-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.entry-action-buttons button, .folder-settings-actions button { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 0; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.folder-settings-actions [data-delete-folder] { margin-left: auto; }
.organizer-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 36px 16px; text-align: center; }
.organizer-empty > svg { width: 28px; height: 28px; color: var(--muted); }
.organizer-empty b { font: 400 20px/1.4 Georgia, serif; }
.organizer-empty p { max-width: 40ch; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.organizer-empty button { min-height: 44px; padding: 10px; border: 0; border-radius: 7px; background: var(--surface-2); color: var(--accent); }
.folder-edit-host { position: absolute; z-index: 5; inset: 0; display: flex; align-items: safe center; justify-content: center; overflow-y: auto; overscroll-behavior: contain; padding: 16px; background: color-mix(in srgb, var(--paper) 92%, transparent); }
.folder-edit-host[hidden] { display: none; }
.folder-edit-host > div { width: min(480px, 100%); margin: auto; padding: 24px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow); }
.folder-editor, .folder-delete-confirm { margin-bottom: 16px; padding: 16px; border-radius: 10px; background: var(--surface-2); }
.folder-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.folder-editor output { display: block; margin: 5px 0 14px; text-align: right; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.folder-color-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.folder-color-caption b { color: var(--ink); font-weight: 400; }
.folder-color-palette { display: flex; gap: 0; overflow-x: auto; padding: 6px 3px; margin-top: 3px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; overscroll-behavior-x: contain; touch-action: pan-x; }
.folder-color-help, .folder-delete-confirm p { margin: 10px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.folder-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.folder-editor-actions button { min-height: 44px; padding: 10px 14px; border: 0; border-radius: 7px; background: var(--paper); color: var(--ink); font-size: 13px; }
.folder-editor-actions .folder-primary { background: var(--accent); color: var(--on-accent); }
.folder-error { color: var(--accent); font-size: 13px; line-height: 1.6; }
.note-folder-picker { margin: 20px 0; }
.note-folder-row { display: flex; align-items: flex-end; gap: 8px; }
.note-folder-row label { flex: 1; color: var(--ink); font-size: 14px; font-weight: 500; }
.note-folder-row select { font-weight: 400; }
.folder-add { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 7px; background: var(--surface-2); color: var(--accent); font-size: 13px !important; }
.note-folder-hint { margin: 8px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.saved-notice:empty { display: none; }
.saved-notice { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.saved-notice > span { min-width: 0; overflow-wrap: anywhere; }
.saved-notice button { min-height: 44px; padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--accent); }
.saved-drop-tray { position: absolute; z-index: 4; right: 8px; bottom: 8px; left: 8px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.saved-drop-tray[hidden], .saved-drag-preview[hidden] { display: none; }
.saved-drop-caption { display: block; margin: 0 8px 8px; color: var(--muted); font-size: 12px; }
.saved-drop-folders { display: flex; flex-direction: column; gap: 4px; max-height: min(32dvh, 280px); overflow-y: auto; padding: 3px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; overscroll-behavior: contain; }
.saved-drop-folders button { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; min-height: 48px; padding: 10px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); font-size: 13px; text-align: left; }
.saved-drop-folders button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-drag-preview { position: fixed; z-index: 151; top: 0; left: 0; display: flex; align-items: flex-start; gap: 10px; width: min(260px, calc(100vw - 16px)); padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); pointer-events: none; }
.saved-drag-preview:not([hidden]) { will-change: transform; }
.saved-drag-preview > svg { flex-shrink: 0; margin-top: 2px; }
.saved-drag-preview > span { min-width: 0; }
.saved-drag-preview b, .saved-drag-preview small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-drag-preview b { font: 400 16px/1.5 Georgia, serif; }
.saved-drag-preview small { margin-top: 4px; color: var(--muted); font: 12px/1.5 ui-sans-serif, sans-serif; }
.is-drag-source { opacity: .4; }
.is-dragging { user-select: none; cursor: grabbing; }
.is-drop-target { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft) !important; }
.folder-nav-item.is-drop-before::before, .folder-nav-item.is-drop-after::after { position: absolute; right: 0; left: 0; height: 2px; border-radius: 1px; background: var(--accent); content: ""; }
.folder-nav-item.is-drop-before::before { top: -3px; }
.folder-nav-item.is-drop-after::after { bottom: -3px; }
.is-expanded .saved-organizer { margin-top: 0; }
@media (hover: hover) {
  .folder-nav-item:hover, .entry-menu:hover, .folder-actions button:hover, .folder-editor-heading button:hover { background: var(--surface-2); color: var(--ink); }
  .saved-entry-open:hover b, .folder-nav-heading > button:hover, .entry-action-buttons button:hover, .folder-settings-actions button:hover { color: var(--accent); }
  .saved-color-choice:hover .saved-palette-dot { box-shadow: inset 0 0 0 2px var(--muted); }
}
@media (hover: hover) and (pointer: fine) {
  .saved-organizer .saved-entry-open, .saved-organizer .folder-nav-item, .saved-entry { cursor: grab; }
  .saved-organizer.is-dragging, .saved-organizer.is-dragging * { cursor: grabbing !important; }
  .saved-entry:hover:not(.is-drag-source), .saved-entry:focus-within:not(.is-drag-source) { background: var(--surface-2); }
  .saved-entry-folder:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
  .gesture-mouse { display: inline; }
  .gesture-touch { display: none; }
}
.saved-organizer button:active { background-color: var(--accent-soft); }
.organizer-filter-toggle:hover, .folder-nav-toggle:hover, .organizer-new-folder:hover { background-color: var(--surface-2); color: var(--ink); }
@media (min-width: 821px) {
  .is-expanded .organizer-layout { gap: 40px; }
  .is-expanded .folder-nav { display: flex; flex: 0 0 224px; flex-direction: column; min-height: 0; padding-right: 24px; border-right: 1px solid var(--line); }
  .folder-nav-heading > button, .folder-nav-toggle { display: none; }
}
@media (max-width: 820px) {
  .is-expanded .markers-sheet { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .is-expanded .markers-summary { margin: 0 0 20px; }
  .is-expanded .markers-sheet .sheet-head { align-items: center; gap: 8px; }
  .is-expanded .markers-sheet .sheet-head h2 { font-size: 23px; }
  .folder-content-heading { gap: 8px; margin-bottom: 12px; }
  .folder-content-heading h3 { font-size: 24px; }
  .folder-heading-copy { flex-direction: column; gap: 2px; }
  .organizer-status { font-size: 12px; }
  .folders-open .folder-nav { position: absolute; z-index: 3; inset: 0 0 auto; display: flex; flex-direction: column; max-height: 100%; padding: 16px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
  .folders-open .folder-nav-items { max-height: 50dvh; }
  .saved-entry { padding: 12px 4px 8px; }
  .saved-entry[data-entry-kind="note"] .saved-entry-preview { font-size: 16px; }
  .organizer-workspace > .saved-filters { gap: 20px; }
  .folder-add span { display: none; }
  .saved-expand-footer { padding-top: 10px; margin-top: 8px; }
  .folder-settings-actions { gap: 4px 10px; }
  .folder-settings-actions [data-delete-folder] { margin-left: 0; }
  .organizer-sort { flex: 1 1 170px; min-width: 0; }
  .organizer-sort select { font-size: 16px; }
}
@media (max-width: 380px) {
  .is-expanded .markers-sheet .sheet-head h2 { font-size: 21px; }
  .organizer-tools { gap: 8px; }
  .organizer-filter-toggle { gap: 4px; padding-inline: 8px; }
  .organizer-workspace > .saved-filters { gap: 16px; }
  .saved-entry-footer { gap: 4px 12px; }
}
@media (max-height: 500px) and (max-width: 820px) {
  .is-expanded .markers-summary { display: none; }
  .folder-content-heading { margin-bottom: 4px; min-height: 44px; }
  .organizer-workspace > .saved-filters { margin-top: 4px; }
  .saved-entry { padding-block: 8px; }
  .organizer-filter-panel { position: absolute; z-index: 3; top: 100%; right: 0; left: 0; max-height: 50dvh; box-shadow: var(--shadow); }
}
@media (prefers-reduced-motion: reduce) { .folder-nav-item { transition: none; } }
.saved-organizer:not(.organizer-expanded) .organizer-search-area,
.saved-organizer:not(.organizer-expanded) .organizer-tools,
.saved-organizer:not(.organizer-expanded) .folder-nav,
.saved-organizer:not(.organizer-expanded) .folder-content-heading,
.saved-organizer:not(.organizer-expanded) .folder-edit-host,
.saved-organizer:not(.organizer-expanded) .organizer-filter-panel,
.saved-organizer:not(.organizer-expanded) .saved-filters,
.saved-organizer:not(.organizer-expanded) .organizer-sort,
.saved-organizer:not(.organizer-expanded) .organizer-status { display: none; }
.saved-organizer:not(.organizer-expanded) .organizer-entries { gap: 8px; }
.saved-organizer:not(.organizer-expanded) .marked-remove { display: grid; place-items: center; }
.saved-organizer:not(.organizer-expanded) .organizer-main { padding: 0; }
.markers-backdrop:not(.is-expanded) .markers-sheet { height: auto; }
.saved-organizer:not(.organizer-expanded) { flex: 0 1 auto; }
.saved-page-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0 4px; }
.saved-page-controls button { min-width: 72px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.saved-page-controls button:hover:enabled { border-color: var(--accent); color: var(--accent); }
.saved-page-controls span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.library-app { min-height: 100dvh; -webkit-tap-highlight-color: var(--accent-soft); }
.library-app button, .library-app a, .library-app summary { touch-action: manipulation; }
.library-app a { color: inherit; text-decoration: none; }
.library-app a:focus-visible, .library-app summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.library-app [hidden], .library-enhanced { display: none !important; }
.library-ready .library-enhanced:not([hidden]) { display: flex !important; }
.library-topbar { grid-template-columns: 1fr auto 1fr; padding-left: max(30px, env(safe-area-inset-left)); padding-right: max(30px, env(safe-area-inset-right)); }
.library-topbar nav { display: flex; gap: 30px; align-items: center; height: 100%; }
.library-topbar nav a { display: flex; align-items: center; height: 100%; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; }
.library-topbar nav a:hover, .library-topbar nav a[aria-current] { color: var(--accent); border-bottom-color: var(--accent); }
.library-topbar > button { justify-self: end; display: inline-flex; align-items: center; justify-content: center; }
.lib-icon { width: 20px; height: 20px; flex: 0 0 20px; vertical-align: middle; }
.library-skip { position: fixed; top: -80px; left: 20px; z-index: 100; padding: 12px 18px; background: var(--accent); color: var(--on-accent) !important; border-radius: 8px; }
.library-skip:focus { top: 12px; }
.library-main { max-width: 1120px; margin: 0 auto; padding: 86px 40px 100px; }
.library-intro { padding-bottom: 55px; }
.library-intro h1 { margin: 0; font: 500 clamp(44px, 5.5vw, 72px)/1.05 Georgia, serif; letter-spacing: -.035em; }
.library-intro > p { margin: 23px 0 0; max-width: 52ch; color: var(--muted); font: 19px/1.6 Georgia, serif; }
.library-intro-scripture { margin: 28px 0 0; max-width: 68ch; font: 17px/1.7 Georgia, serif; }
.library-intro-scripture p { margin: 0; }
.library-intro-scripture mark { position: relative; white-space: nowrap; isolation: isolate; padding: .06em .14em; border-radius: .16em; background: transparent; color: var(--ink); line-height: 1.25; }
.library-intro-scripture mark::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: color-mix(in srgb, var(--marker) 30%, var(--paper)); }
@keyframes library-scripture-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes library-scripture-rise { from { transform: translate3d(0, 8px, 0); } to { transform: translate3d(0, 0, 0); } }
@keyframes library-scripture-highlight { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: no-preference) {
  .library-intro-scripture { animation: library-scripture-appear 640ms var(--ease-drawer) both, library-scripture-rise 640ms var(--ease-out) both; }
  .library-intro-scripture mark::before { animation: library-scripture-highlight 480ms var(--ease-drawer) 640ms both; }
}
@media (prefers-reduced-motion: reduce) {
  .library-intro-scripture { animation: library-scripture-appear 180ms linear both; }
}
.library-intro-scripture cite { display: block; margin-top: 10px; color: var(--muted); font: normal 14px/1.5 Georgia, serif; }
.library-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.library-tabs { display: flex; gap: 5px; }
.library-tabs button { min-height: 44px; padding: 0 19px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 14px; white-space: nowrap; cursor: pointer; }
.library-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.library-tabs button:hover:not([aria-pressed="true"]) { background: var(--surface-2); color: var(--ink); }
.library-search { display: flex; align-items: center; gap: 10px; width: min(340px, 36%); min-width: 180px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--muted); }
.library-search:focus-within { border-color: var(--accent); outline: 1px solid var(--accent); }
.library-search input { width: 100%; min-width: 0; height: 44px; border: 0; outline: none; color: var(--ink); background: transparent; font-size: 13px; }
.library-filter-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px 0 24px; }
.library-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.library-tags > span { margin-right: 8px; font-size: 12px; color: var(--muted); }
.library-tags button { padding: 0 12px; min-height: 36px; border: 1px solid var(--line-strong); border-radius: 100px; font-size: 12px; cursor: pointer; background: transparent; }
.library-tags button:hover, .library-tags button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.library-results { display: grid; grid-auto-flow: dense; grid-template-columns: minmax(0, 1fr); }
.library-entry-copy { min-width: 0; }
.library-entry { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 54px; align-items: center; padding: 26px 0 46px; }
.library-entry + .library-entry { border-top: 1px solid var(--line); padding-top: 46px; }
.library-cover-link { display: flex; justify-content: center; align-items: center; min-height: 410px; padding: 28px; background: var(--surface-2); overflow: hidden; border-radius: 12px; perspective: 1000px; }
.library-cover { container-type: inline-size; display: flex; flex-direction: column; width: 238px; min-height: 338px; padding: 27px 24px 22px 30px; background: var(--cover-paper, #e9dcca); color: var(--cover-ink, #5d2921); box-shadow: -7px 10px 24px rgba(62, 39, 23, .18), inset 6px 0 6px rgba(86, 51, 29, .12); border-radius: 2px 5px 5px 2px; transform: rotate(var(--cover-rotation, -3deg)); transition: transform .65s var(--ease-out), box-shadow .65s var(--ease-out); }
.library-cover-link:hover .library-cover, .library-cover-link:focus-visible .library-cover { transform: rotate(0deg) translateY(-5px); box-shadow: -9px 18px 32px rgba(62, 39, 23, .22), inset 6px 0 6px rgba(86, 51, 29, .12); }
.cover-author { font-size: 11px; letter-spacing: .06em; }
.cover-title { min-width: 0; padding-right: 4px; margin-top: 24px; font: 500 min(29px, 15cqi)/1.16 Georgia, serif; letter-spacing: -.025em; text-wrap: balance; overflow-wrap: anywhere; }
.cover-title em { font-weight: 400; }
.library-cover-security .cover-title { font-size: min(24px, 13cqi); }
.library-cover-sermon .cover-title { margin-top: 45px; font-size: min(22px, 12cqi); line-height: 1.3; }
.library-cover-sermon .cover-title em { font-size: min(1.45em, 18cqi); }
.cover-rule { margin-top: auto; padding-top: 24px; border-bottom: 1px solid currentColor; opacity: .55; width: 34px; }
.cover-foot { margin-top: 12px; max-width: 150px; font: 11px/1.5 Georgia, serif; }
.library-item-meta { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: 12px; }
.library-entry-copy h2 { margin: 19px 0 14px; font: 500 clamp(26px, 3vw, 36px)/1.2 Georgia, serif; letter-spacing: -.025em; text-wrap: balance; overflow-wrap: anywhere; }
.library-entry-copy h2 a:hover { color: var(--accent); }
.library-author { margin: 0; font-size: 14px; }
.library-description { margin: 23px 0; color: var(--muted); font: 16px/1.7 Georgia, serif; max-width: 45ch; }
.library-entry-tags { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }
.library-entry-tags a { font-size: 12px; color: var(--accent); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 5px; }
.library-entry-tags a:hover { text-decoration-color: var(--accent); }
.library-entry-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; margin-top: 30px; }
.library-read-link { display: inline-flex; align-items: center; justify-content: center; gap: 34px; min-height: 48px; padding: 0 21px; border-radius: 8px; background: var(--accent); color: var(--on-accent) !important; font-size: 14px; transition: background .2s; }
.library-read-link:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.library-resume-link { color: var(--accent) !important; font-size: 12px; text-decoration: underline !important; text-underline-offset: 5px; }
.library-empty { padding: 64px 20px 80px; text-align: center; }
.library-empty h2 { margin: 0 0 16px; font: 500 30px/1.25 Georgia, serif; }
.library-empty p { color: var(--muted); font-size: 15px; line-height: 1.6; }
.library-empty button { display: inline-flex; gap: 12px; align-items: center; margin-top: 15px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; cursor: pointer; }
.library-footer { max-width: 1040px; margin: 0 auto; padding: 28px 0 40px; border-top: 1px solid var(--line); display: flex; gap: 24px; justify-content: space-between; font-size: 13px; }
.library-footer a, .book-colophon > a { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); min-height: 44px; }
.library-footer a:hover, .book-colophon > a:hover { color: var(--accent); }
.library-settings { position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0; max-width: 100%; max-height: 100dvh; height: 100dvh; color: var(--ink); border: 0; }
.library-settings:not([open]) { display: none; }
.library-settings::backdrop { background: rgba(22,18,15,.48); backdrop-filter: blur(6px); }
.library-settings .settings-head { display: flex; align-items: center; justify-content: space-between; }
.library-settings .settings-head button { display: grid; place-items: center; cursor: pointer; }
.library-settings .preview-type p { font-size: var(--reader-font-size); line-height: var(--reader-line-height); }
.library-noscript { margin: 0; padding: 16px 24px; text-align: center; color: var(--muted); font-size: 13px; }
.book-progress { position: fixed; z-index: 31; top: 77px; left: 0; right: 0; height: 2px; background: transparent; }
.book-progress span { display: block; width: 100%; height: 100%; transform: scaleX(0); transform-origin: left; background: var(--accent); }
.book-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); max-width: 1400px; margin: 0 auto; }
.book-contents { position: sticky; top: 78px; height: calc(100dvh - 78px); overflow-y: auto; padding: 28px 20px 40px 26px; border-right: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.book-back { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; color: var(--muted) !important; font-size: 13px; }
.book-toc { margin-top: 24px; }
.book-toc summary { display: flex; justify-content: space-between; align-items: center; padding: 12px 9px; cursor: pointer; font-size: 14px; font-weight: 600; list-style: none; }
.book-toc summary::-webkit-details-marker { display: none; }
.book-toc[open] summary .lib-icon { transform: rotate(180deg); }
.book-toc nav { display: grid; gap: 2px; margin-top: 10px; }
.book-toc nav a { display: block; padding: 10px 10px; border-radius: 7px; font-size: 12px; line-height: 1.55; color: var(--muted); }
.book-toc nav a:hover, .book-toc nav a[aria-current] { color: var(--accent); background: var(--accent-soft); }
.book-toc nav .toc-subsection { padding-left: 23px; font-size: 11px; }
.book-toc nav .toc-detail { padding-left: 34px; }
.book-column { min-width: 0; width: 100%; max-width: calc(var(--reader-width) + 96px); padding: 64px 48px 80px; margin: 0 auto; }
.book-title-page { margin-bottom: 50px; padding-bottom: 38px; border-bottom: 1px solid var(--line); }
.book-publication { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.book-title-page h1 { margin: 25px 0; font: 500 clamp(32px, 3.7vw, 48px)/1.14 Georgia, serif; letter-spacing: -.03em; text-wrap: balance; }
.book-edition { margin: 25px 0 0; font-size: 12px; color: var(--muted); }
.book-resume { gap: 10px; align-items: center; margin-top: 22px; min-height: 44px; color: var(--accent) !important; font-size: 13px; }
.book-related { margin-top: 72px; padding-top: 38px; border-top: 1px solid var(--line-strong); scroll-margin-top: 110px; }
.book-related > h2 { margin: 0; font: 500 clamp(27px, 3vw, 36px)/1.18 Georgia, serif; letter-spacing: -.025em; text-wrap: balance; }
.book-related-intro { margin: 16px 0 28px; color: var(--faint); font: 16px/1.6 Georgia, serif; }
.book-related-list { display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-flow: dense; margin: 0; padding: 0; list-style: none; }
.book-related-list > li { border-bottom: 1px solid var(--line); }
.book-related-link { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 0; }
.book-related-copy { min-width: 0; }
.book-related-meta { margin: 0 0 10px; color: var(--faint); font-size: 12px; line-height: 1.6; }
.book-related-meta > span { white-space: normal; }
.book-related-link h3 { margin: 0; font: 500 clamp(22px, 2.4vw, 27px)/1.28 Georgia, serif; letter-spacing: -.02em; text-wrap: pretty; overflow-wrap: anywhere; transition: color .2s; }
.book-related-description { margin: 12px 0 0; color: var(--faint); font: 15px/1.6 Georgia, serif; }
.book-related-topics { margin: 12px 0 0; color: var(--accent); font-size: 12px; line-height: 1.5; }
.book-related-link > .lib-icon { color: var(--accent); transition: transform .25s var(--ease-out); }
.book-related-link:hover h3, .book-related-link:focus-visible h3 { color: var(--accent); }
.book-related-link:hover > .lib-icon, .book-related-link:focus-visible > .lib-icon { transform: translateX(4px); }
.book-related-more > summary { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 14px 0; color: var(--faint); font-size: 13px; cursor: pointer; list-style: none; }
.book-related-more > summary::-webkit-details-marker { display: none; }
.book-related-more > summary > .lib-icon { margin-left: auto; }
.book-related-more[open] > summary > .lib-icon { transform: rotate(180deg); }
.book-related-more > summary:hover { color: var(--accent); }
.book-related-catalogue { display: inline-flex; align-items: center; gap: 14px; min-height: 48px; margin-top: 22px; color: var(--accent) !important; font-size: 13px; }
.book-related-catalogue:hover { text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 580px) {
  .book-related { margin-top: 56px; padding-top: 30px; }
  .book-related-link { gap: 16px; padding: 22px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .book-related-link h3, .book-related-link > .lib-icon { transition: none; }
  .book-related-link:hover > .lib-icon, .book-related-link:focus-visible > .lib-icon { transform: none; }
}
.book-text { font: var(--reader-font-size)/var(--reader-line-height) Georgia, serif; overflow-wrap: break-word; }
.book-text p { margin: 0 0 1.3em; }
.book-text .book-front-matter { margin-bottom: .4em; color: var(--muted); font: .72em/1.5 ui-sans-serif, system-ui, sans-serif; }
.book-text h2 { margin: 2.4em 0 .8em; font: 500 1.5em/1.25 Georgia, serif; letter-spacing: -.02em; text-wrap: balance; }
.book-text h3 { margin: 1.8em 0 .7em; font: 600 1.15em/1.35 Georgia, serif; text-wrap: balance; }
.book-text h4 { margin: 1.5em 0 .65em; font: 600 1em/1.4 Georgia, serif; text-wrap: balance; }
.book-note-ref { margin-left: .12em; font: .65em/1 system-ui, sans-serif; }
.book-note-ref a { padding: .25em; text-decoration: underline; text-underline-offset: .15em; }
.book-notes { margin: 2em 0 3em; font-size: .8em; }
.book-notes ol { padding-left: 2em; }
.book-notes li { padding-left: .35em; margin-bottom: 1.1em; }
.book-notes li p { margin-bottom: .4em; }
.book-note-back { font: .85em/1.5 system-ui, sans-serif; text-underline-offset: .2em; }
.book-table-wrap { margin: 1.8em 0; }
.book-table { width: 100%; border-collapse: collapse; font: inherit; font-size: .85em; }
.book-table caption { margin-bottom: .7em; text-align: left; font-weight: 600; }
.book-table th, .book-table td { width: 50%; padding: .5em .7em; border: 1px solid var(--line-strong); text-align: left; overflow-wrap: anywhere; vertical-align: top; }
.book-table th { background: var(--surface-2); font-size: .85em; letter-spacing: .03em; }
.book-text [id], #bookText { scroll-margin-top: 115px; }
.book-inline-scripture { text-decoration: underline !important; text-decoration-color: var(--line-strong) !important; text-underline-offset: 4px; }
.book-inline-scripture:hover { color: var(--accent); text-decoration-color: var(--accent) !important; }
.book-scripture { margin: 1.6em 0; padding: 1.2em 1.3em; background: var(--surface-2); border-radius: 8px; }
.book-scripture blockquote { margin: 0; font: inherit; }
.book-scripture figcaption { margin-top: 16px; font: 12px/1.7 ui-sans-serif, system-ui, sans-serif; color: var(--faint); }
.book-scripture figcaption a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.book-colophon { margin-top: 64px; padding-top: 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.8; }
.book-colophon strong { font-weight: 500; }
.book-colophon p a { text-decoration: underline; text-underline-offset: 4px; }
.book-colophon > a { margin-right: 24px; }
.library-cover-history .cover-title { margin-top: 45px; font-size: min(29px, 13cqi); }
.library-cover-history .cover-title em { font-size: min(1.35em, 18cqi); }
.library-cover-romanism .cover-title em { font-size: 1.1em; }
.book-diagram { margin: 1.8em 0; }
.book-diagram > a { display: block; cursor: zoom-in; background: #fff; }
.book-diagram img { display: block; width: 100%; height: auto; }
.book-illustration > a { background: transparent; }
.book-illustration img { margin-inline: auto; }
.book-text .book-poetry { text-align: start; padding-inline-start: 1em; }
.book-text .book-source-note { font-size: .85em; color: var(--muted); }
.book-text .book-source-list { margin: 0 0 1.2em; padding-inline-start: 1.3em; }
.book-text .book-source-list li { margin-bottom: .65em; padding-inline-start: .2em; }
.book-app[data-book-slug="Daniels-Septuagint-Before-Christ"] .book-historical-quote { margin-inline-start: 1.2em; padding-inline-start: 1em; border-inline-start: 2px solid var(--muted); }
.book-chapter-outline { margin: 0 0 1.8em; color: var(--muted); font-size: .85em; line-height: 1.65; }
.book-chapter-outline summary { width: fit-content; padding-block: 10px; cursor: pointer; color: var(--accent); }
.book-chapter-outline ul { margin: .5em 0 0; padding-inline-start: 1.2em; }
.book-chapter-outline li { margin-block: .65em; }
.book-app[data-book-slug="Dowling-History-of-Romanism"] .book-heading-volume { margin: 3em 0 1em; padding-top: 1.2em; border-top: 1px solid var(--line-strong); font: 500 1.65em/1.25 Georgia, serif; letter-spacing: -.02em; }
.book-app[data-book-slug="Dowling-History-of-Romanism"] .book-heading-chapter { font: 600 1.25em/1.35 Georgia, serif; letter-spacing: -.01em; text-wrap: balance; }
.book-app[data-book-slug="Dowling-History-of-Romanism"] .book-toc nav [data-toc-kind="volume"] { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-weight: 650; color: var(--ink); }
.book-diagram figcaption { margin-top: 12px; font: 13px/1.6 ui-sans-serif, system-ui, sans-serif; color: var(--muted); }
.book-diagram figcaption span { display: block; margin-top: 4px; }
.book-diagram-viewer { position: fixed; inset: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; padding: 0; border: 0; background: var(--paper); color: var(--ink); }
.book-diagram-viewer[open] { display: flex; flex-direction: column; }
.book-diagram-viewer::backdrop { background: var(--paper); }
.book-diagram-toolbar { display: flex; align-items: center; gap: 16px; flex-shrink: 0; padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); }
.book-diagram-toolbar h2 { flex: 1; margin: 0; font: 500 16px/1.4 ui-sans-serif, system-ui, sans-serif; }
.book-diagram-toolbar button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); font: 13px/1.4 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.book-diagram-toolbar button:hover { background: var(--surface-2); }
.book-diagram-toolbar button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.book-diagram-stage { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; background: #fff; scrollbar-width: thin; scrollbar-color: #70695f #fff; }
.book-diagram-stage img { display: block; width: 100%; height: 100%; object-fit: contain; }
.book-diagram-stage.is-enlarged img { width: 1580px; min-width: 100%; height: auto; max-width: none; }
@media (max-width: 580px) {
  .book-diagram-toolbar { flex-wrap: wrap; gap: 8px; }
  .book-diagram-toolbar h2 { font-size: 14px; }
  .book-diagram-toolbar button { padding-inline: 10px; }
}
.book-app > .library-footer { max-width: none; margin: 0 40px; }
@media (max-width: 1100px) { .library-footer { margin: 0 40px; } .book-column { padding-inline: 36px; } .book-layout { grid-template-columns: 220px minmax(0,1fr); } }
@media (max-width: 820px) {
  .library-topbar { height: 62px; padding: 0 18px; gap: 16px; }
  .library-topbar nav { gap: 18px; }
  .library-main { padding: 52px 24px 60px; }
  .library-intro { padding-bottom: 36px; }
  .library-intro h1 { font-size: 52px; }
  .library-entry { grid-template-columns: 240px minmax(0,1fr); gap: 30px; }
  .library-cover-link { min-height: 335px; padding: 28px 18px; }
  .library-cover { width: 185px; min-height: 280px; padding: 22px 19px 18px 25px; }
  .library-entry-copy h2 { font-size: 28px; }
  .library-description { font-size: 15px; }
  .library-entry-actions { gap: 14px; }
  .library-footer { margin: 0 24px; }
  .book-progress { top: 61px; }
  .book-layout { display: block; }
  .book-contents { position: relative; top: auto; height: auto; overflow: visible; padding: 22px 24px 0; border-right: 0; }
  .book-toc { margin-top: 10px; border-block: 1px solid var(--line); }
  .book-toc nav { padding-bottom: 16px; max-height: 48dvh; overflow-y: auto; }
  .book-toc summary { padding: 16px 0; }
  .book-toc nav a { min-height: 44px; }
  .book-column { padding: 38px 24px 56px; max-width: calc(var(--reader-width) + 48px); }
  .book-title-page h1 { font-size: clamp(31px, 5vw, 42px); }
  .book-text [id], #bookText { scroll-margin-top: 85px; }
}
@media (max-width: 580px) {
  .library-topbar { grid-template-columns: 1fr auto auto; gap: 12px; padding-inline: 16px; }
  .library-topbar .brand-icon { width: 32px; height: 32px; }
  .library-topbar .brand { gap: 7px; }
  .library-topbar .brand-copy strong { font-size: 18px; }
  .library-topbar .brand-copy small { display: none; }
  .library-topbar nav { gap: 14px; }
  .library-topbar nav a { font-size: 12px; }
  .library-topbar .round-button { width: 38px; height: 38px; }
  .library-intro h1 { font-size: clamp(40px, 11vw, 52px); }
  .library-intro > p { font-size: 17px; }
  .library-desktop-break { display: none; }
  .library-toolbar { flex-direction: column; align-items: stretch; gap: 16px; }
  .library-tabs { justify-content: space-between; }
  .library-tabs button { flex: 1; padding-inline: 10px; }
  .library-search { width: 100%; }
  .library-filter-row { align-items: flex-start; gap: 8px; padding-bottom: 4px; }

  .library-tags { gap: 6px; }
  .library-tags > span { display: none; }
  .library-entry { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-top: 22px; }
  .library-cover-link { min-height: 330px; }
  .library-cover { min-height: 280px; width: 198px; }
  .library-entry-copy h2 { font-size: 30px; }
  .library-description { font-size: 16px; }
  .library-entry-actions { margin-top: 27px; }
  .library-footer { flex-wrap: wrap; gap: 8px 22px; padding-top: 20px; }
  .book-publication { flex-direction: column; gap: 8px; }
  .book-title-page h1 { font-size: 33px; text-wrap: pretty; }
  .book-title-page { margin-bottom: 32px; padding-bottom: 30px; }
  .book-scripture { padding: 1em; }
  .book-text h2 { font-size: 1.35em; }
  .book-app > .library-footer { margin-inline: 24px; }
}
@media (prefers-reduced-motion: reduce) { .library-cover { transition: none; transform: none; } .library-app { transition: none; } }

/* The catalogue reuses its existing content for every view; covers need no image assets. */
/* Muted cloth and paper tones; the slug-based selection survives catalogue reordering. */
.library-cover[data-cover-tone="0"] { --cover-paper: #e9dcca; --cover-ink: #5d2921; }
.library-cover[data-cover-tone="1"] { --cover-paper: #dbe5dc; --cover-ink: #244638; }
.library-cover[data-cover-tone="2"] { --cover-paper: #dbe5ec; --cover-ink: #29475c; }
.library-cover[data-cover-tone="3"] { --cover-paper: #e5dce9; --cover-ink: #503657; }
.library-cover[data-cover-tone="4"] { --cover-paper: #eddbd5; --cover-ink: #633b36; }
.library-cover[data-cover-tone="5"] { --cover-paper: #eee3c9; --cover-ink: #574322; }
.library-cover[data-cover-tone="6"] { --cover-paper: #ded9c9; --cover-ink: #343f35; }
.library-cover[data-cover-tone="7"] { --cover-paper: #e3e0ed; --cover-ink: #40385c; }
.library-cover[data-cover-tone="8"] { --cover-paper: #dae5e2; --cover-ink: #294a45; }
.library-cover[data-cover-tone="9"] { --cover-paper: #703831; --cover-ink: #fff0da; }
.library-cover[data-cover-tone="10"] { --cover-paper: #2d4b44; --cover-ink: #f4ecd8; }
.library-cover[data-cover-tone="11"] { --cover-paper: #38495c; --cover-ink: #f3e9d8; }
.library-cover[data-cover-tilt="0"] { --cover-rotation: -4deg; }
.library-cover[data-cover-tilt="1"] { --cover-rotation: 2.5deg; }
.library-cover[data-cover-tilt="2"] { --cover-rotation: -1.5deg; }
.library-cover[data-cover-tilt="3"] { --cover-rotation: 4deg; }
.library-cover[data-cover-tilt="4"] { --cover-rotation: -2.5deg; }
.library-cover[data-cover-tilt="5"] { --cover-rotation: 1deg; }
.library-cover[data-cover-tilt="6"] { --cover-rotation: 3deg; }
.library-cover[data-cover-slug="Rice-OSAS"] { --cover-paper: #e9dcca; --cover-ink: #5d2921; }
.library-cover[data-cover-slug="Rice-Salvation"] { --cover-paper: #dbe5dc; --cover-ink: #244638; }
.library-cover[data-cover-slug="Rice-First-Steps-for-New-Converts"] .cover-title em { font-size: .72em; overflow-wrap: anywhere; }
.library-cover[data-cover-slug="Daniels-Septuagint-Before-Christ"] .cover-title { font-size: min(24px, 12cqi); }
.library-cover[data-cover-slug="Daniels-Septuagint-Before-Christ"] .cover-title em { font-size: .85em; overflow-wrap: anywhere; }
.library-cover[data-cover-slug="Rice-First-Steps-for-New-Converts"],
.library-cover[data-cover-slug="Ray-Baptist-Succession"],
.library-cover[data-cover-slug="Wilkinson-Our-Authorized-Bible-Vindicated"] { --cover-list-size: 10cqi; }
.library-cover[data-cover-slug="Hyles-council"] { --cover-list-size: 13cqi; }
.library-cover[data-cover-slug="Hutson-Repentance"] { --cover-paper: #e5dce9; --cover-ink: #503657; }
.library-cover[data-cover-slug="Holybiblebeliever-100-OSAS"] { --cover-paper: #dbe5ec; --cover-ink: #29475c; }
.library-cover[data-cover-slug="Carroll-Trail-of-Blood"] { --cover-paper: #703831; --cover-ink: #fff0da; }
.library-cover[data-cover-slug="Ray-Baptist-Succession"] { --cover-paper: #2d4b44; --cover-ink: #f4ecd8; }
.library-cover[data-cover-slug="Ray-Baptist-Succession"] .cover-title { font-size: min(20px, 11cqi); }
.library-cover[data-cover-slug="Ray-Baptist-Succession"] .cover-title em { font-size: .9em; }
.library-cover[data-cover-slug="Christian-History-of-the-Baptists"] .cover-title em { font-size: .9em; }
.library-cover[data-cover-slug="Hyles-Enemies-of-Soul-Winning"] { --cover-paper: #ded9c9; --cover-ink: #343f35; }
.library-cover[data-cover-slug="Hyles-Enemies-of-Soul-Winning"] .cover-title { font-size: min(20px, 13cqi); }
.library-cover[data-cover-slug="Wilkinson-Our-Authorized-Bible-Vindicated"] .cover-title { font-size: min(19px, 11.5cqi); }
.library-cover[data-cover-slug="Wilkinson-Our-Authorized-Bible-Vindicated"] .cover-title em { font-size: 1.25em; }
.library-cover[data-cover-slug="Baptist-Martyrs-Memorials"] .cover-title { font-size: min(20px, 13cqi); line-height: 1.18; }
.library-cover[data-cover-slug="Baptist-Martyrs-Memorials"] .cover-title em { font-size: 1.1em; }
.library-cover[data-cover-slug="Hyles-council"] { --cover-paper: #eee3c9; --cover-ink: #574322; }
.library-cover[data-cover-slug="Mejia-Alcohol"] { --cover-paper: #dae5e2; --cover-ink: #294a45; }
.library-cover[data-cover-slug="Anderson-Trinity"] { --cover-paper: #e3e0ed; --cover-ink: #40385c; }
.library-cover[data-cover-format="brochures"] { position: relative; border-radius: 1px; box-shadow: -3px 7px 17px rgba(62,39,23,.13); }
.library-cover[data-cover-format="brochures"]::after { content: ""; position: absolute; inset: 0 0 auto auto; width: 21px; height: 21px; background: color-mix(in srgb, var(--cover-paper) 80%, var(--cover-ink)); clip-path: polygon(0 0, 100% 100%, 0 100%); }
.library-cover[data-cover-format="sermons"] { border-radius: 1px; box-shadow: 3px 7px 17px rgba(62,39,23,.12); }
.library-cover[data-cover-format="sermons"] .cover-author { padding-bottom: 15px; border-bottom: 1px solid currentColor; }
.library-cover[data-cover-format="sermons"] .cover-rule { width: 100%; }
.library-cover-link:hover .library-cover[data-cover-format], .library-cover-link:focus-visible .library-cover[data-cover-format] { transform: rotate(0deg) translateY(-5px); }
.library-app button:focus-visible, .library-sort select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.library-reset { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; min-height: 44px; padding: 0 8px; color: var(--accent); background: transparent; border: 0; font-size: 12px; cursor: pointer; }
.library-reset:hover { text-decoration: underline; text-underline-offset: 4px; }
.library-reset .lib-icon { width: 15px; height: 15px; flex-basis: 15px; }
.library-display-row { align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 24px; }
.library-result-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; min-height: 44px; }
.library-result-summary > p { margin: 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.library-display-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; }
.library-sort { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); }
.library-sort select { max-width: 100%; min-height: 44px; padding: 0 27px 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background-color: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
.library-sort select:hover { border-color: var(--accent); }
.library-views { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--line-strong); border-radius: 8px; }
.library-views button { min-height: 38px; padding: 0 12px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.library-views button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }
.library-views button:hover { color: var(--accent); }
.library-views .lib-icon { display: none; }
.library-results[data-view="cards"] { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 40px 32px; }
.library-results[data-view="cards"] .library-entry { display: flex; flex-direction: column; align-items: stretch; gap: 24px; padding: 0 0 32px; border-top: 0; border-bottom: 1px solid var(--line); }
.library-results[data-view="cards"] .library-cover-link { min-height: 330px; padding: 24px; }
.library-results[data-view="cards"] .cover-title { margin-top: 20px; }
.library-results[data-view="cards"] .library-cover { width: 205px; min-height: 280px; padding: 22px; }
.library-results[data-view="cards"] .library-entry-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.library-results[data-view="cards"] h2 { font-size: 28px; margin-top: 14px; }
.library-results[data-view="cards"] .library-description { font-size: 15px; margin-block: 18px; }
.library-results[data-view="cards"] .library-entry-actions { margin-top: auto; padding-top: 24px; }
.library-results[data-view="list"] .library-entry { grid-template-columns: 90px minmax(0,1fr); gap: 28px; padding: 26px 0; border-bottom: 1px solid var(--line); border-top: 0; }
.library-results[data-view="list"] .library-cover-link { min-height: 124px; padding: 12px; border-radius: 8px; }
.library-results[data-view="list"] .library-cover { width: 65px; min-height: 96px; padding: 9px 7px; box-shadow: 1px 3px 8px rgba(62,39,23,.15); }
.library-results[data-view="list"] .cover-title, .library-results[data-view="list"] .cover-title em { padding-right: 0; font-size: min(10px, var(--cover-list-size, 15cqi)); line-height: 1.2; margin: 0; }
.library-results[data-view="list"] .cover-author, .library-results[data-view="list"] .cover-foot, .library-results[data-view="list"] .cover-rule { display: none; }
.library-results[data-view="list"] .library-cover::after { width: 10px; height: 10px; }
.library-results[data-view="list"] h2 { margin: 8px 0; font-size: 26px; }
.library-results[data-view="list"] .library-description { max-width: 65ch; margin-block: 12px; font-size: 15px; }
.library-results[data-view="list"] .library-entry-tags { display: none; }
.library-results[data-view="list"] .library-entry-actions { margin-top: 14px; }
.library-results[data-view="list"] .library-read-link { min-height: 44px; gap: 14px; padding-inline: 14px; }
@media (max-width: 820px) {
  .library-toolbar { flex-wrap: wrap; gap: 16px; }
  .library-search { width: 100%; }
  .library-display-row { flex-wrap: wrap; }
  .library-display-controls { width: 100%; justify-content: space-between; gap: 12px; }
  .library-sort > span { display: none; }
  .library-results[data-view="cards"] { gap: 28px 22px; }
  .library-results[data-view="cards"] h2 { font-size: 25px; }
  .library-results[data-view="cards"] .library-cover-link { padding-inline: 16px; }
}
@media (max-width: 580px) {
  .library-tabs { gap: 2px; }
  .library-tabs button { padding-inline: 8px; font-size: 12px; }
  .library-filter-row { flex-wrap: wrap; padding-block: 16px; }
  .library-tags button { min-height: 44px; }
  .library-display-row { gap: 12px; }
  .library-display-controls { gap: 10px; }
  .library-result-summary { width: 100%; justify-content: space-between; }
  .library-sort { flex: 1; min-width: 0; }
  .library-sort select { width: 100%; }
  .library-views { flex: 0 0 auto; padding: 0; gap: 0; }
  .library-views button { display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; }
  .library-views .lib-icon { display: block; }
  .library-views button > span { display: none; }
  .library-results[data-view="cards"] { grid-template-columns: minmax(0,1fr); }
  .library-results[data-view="list"] .library-entry { grid-template-columns: 66px minmax(0,1fr); gap: 16px; align-items: start; }
  .library-results[data-view="list"] .library-cover-link { min-height: 100px; padding: 9px; }
  .library-results[data-view="list"] .library-cover { width: 47px; min-height: 77px; padding: 7px 5px; }
  .library-results[data-view="list"] h2 { font-size: 22px; text-wrap: pretty; overflow-wrap: anywhere; }
  .library-results[data-view="list"] .library-item-meta { font-size: 11px; gap: 7px; }
  .library-results[data-view="list"] .library-author { font-size: 12px; }
  .library-results[data-view="list"] .library-description { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .library-cover[data-cover-format], .library-cover-link:hover .library-cover[data-cover-format], .library-cover-link:focus-visible .library-cover[data-cover-format] { transform: none; }
}

/* Both volumes share visual roles while retaining their semantic heading levels. */

.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-historical-quote { margin-inline-start: 1.2em; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-table-wrap { overflow-x: auto; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-table { min-width: 560px; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-table th,
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-table td { width: auto; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-chapter-summary { font-size: .88em; font-style: italic; line-height: 1.65; color: var(--muted); }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-table-number { white-space: nowrap; font-variant-numeric: tabular-nums; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-heading-volume { margin: 3em 0 1.2em; padding-top: 1.2em; border-top: 1px solid var(--line-strong); font: 500 1.65em/1.25 Georgia, serif; letter-spacing: -.02em; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-heading-part { margin: 3em 0 1.5em; padding-block: 1em; border-block: 1px solid var(--line); color: var(--muted); font: 600 .85em/1.6 ui-sans-serif, system-ui, sans-serif; letter-spacing: .02em; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-heading-chapter,
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-heading-preface { margin: 2.5em 0 .9em; font: 600 1.25em/1.35 Georgia, serif; letter-spacing: -.01em; text-wrap: balance; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-heading-section { margin: 1.8em 0 .8em; font: 600 1.05em/1.4 Georgia, serif; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-heading-references { margin: 2.2em 0 1em; padding-top: 1.2em; border-top: 1px solid var(--line); font: 600 .85em/1.5 ui-sans-serif, system-ui, sans-serif; color: var(--muted); }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-text .book-source-note { margin-bottom: .85em; font-size: .85em; line-height: 1.6; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-toc nav [data-toc-kind="volume"] { margin-top: 20px; padding: 16px 10px 10px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 650; color: var(--ink); }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-toc nav [data-toc-kind="volume"]:first-child { margin-top: 0; padding-top: 10px; border-top: 0; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-toc nav [data-toc-kind="part"] { margin-top: 14px; padding: 10px 10px 8px; font-size: 12px; font-weight: 600; color: var(--ink); }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-toc nav [data-toc-kind="chapter"],
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-toc nav [data-toc-kind="preface"] { padding: 10px 10px 6px 18px; font-size: 12px; }
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-toc nav [data-toc-kind="references"],
.book-app[data-book-slug="Christian-History-of-the-Baptists"] .book-toc nav [data-toc-kind="section"] { margin-bottom: 6px; padding: 6px 10px 10px 34px; font-size: 11px; }

.book-version-selector { --version-index: 0; position: relative; isolation: isolate; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 30px; padding: 5px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.book-version-selector > a { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; padding: 11px 8px; min-height: 48px; border-radius: 8px; color: var(--muted); font-size: 13px; line-height: 1.5; text-align: center; }
.book-version-selector > a:hover { color: var(--ink); }
.book-version-selector > a[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.book-version-selector small { font-size: 11px; font-weight: 400; color: var(--faint); white-space: nowrap; }
.book-version-slider { display: none; position: absolute; z-index: 0; inset: 5px auto 5px 5px; width: calc((100% - 14px) / 2); border-radius: 8px; background: var(--paper); box-shadow: 0 2px 5px rgb(0 0 0 / .09); transform: translateX(calc(var(--version-index) * (100% + 4px))); transition: transform .25s var(--ease-out); }
.library-ready .book-version-slider { display: block; }
.library-ready .book-version-title { display: none; }
[data-book-version] { scroll-margin-top: 100px; }
.book-version-invite { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line-strong); font-family: var(--font-sans, Arial, sans-serif); }
.book-text .book-version-invite h2 { margin: 0 0 14px; font-size: 27px; }
.book-text .book-version-invite p { margin: 0 0 18px; color: var(--muted); font-size: 16px; line-height: 1.6; }
.book-version-invite > a { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 12px 18px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 14px; line-height: 1.5; text-decoration: none; }
.book-version-invite > a:hover { background: var(--ink); }
@media (prefers-reduced-motion: reduce) { .book-version-slider { transition: none; } }
@media (max-width: 480px) { .book-version-selector > a { flex-direction: column; font-size: 12px; } }
