/* ============================================================
   BibleBridge Reader — reader.css
   Logos-inspired: clean typography, sidebar nav, warm white
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-width: 220px;
    --header-height: 60px;
    --brand-dark: #1a1512;
    --brand-mid: #2a1f15;
    --accent: #8a6a1e;
    --accent-hover: #644d16;
    --text-primary: #1a1a1a;
    --text-secondary: #5c5248;
    --text-muted: #938a7e;
    --bg-page: #faf9f7;
    --bg-sidebar: #1a1512;
    --bg-sidebar-hover: rgba(255,255,255,0.06);
    --bg-sidebar-active: rgba(255,255,255,0.12);
    --border-light: #e8e4de;
    --border-divider: #ccc7bf;
    --verse-font-size: 1.15rem;
    --verse-line-height: 1.6;
    /* layered depth — tight contact shadow + soft ambient (warm-tinted) */
    --shadow-card: 0 1px 2px rgba(40,32,24,0.05), 0 4px 16px rgba(60,50,40,0.06);
    --shadow-card-hover: 0 2px 4px rgba(40,32,24,0.06), 0 8px 28px rgba(60,50,40,0.10);
    /* surface vars — swap for dark mode */
    --bg-card: #fffdfa;
    --bg-subtle: #f5f3ef;
    --bg-hover: rgba(158,118,64,0.07);
    --highlight-bg: #fef8e4;
    --highlight-border: #c49226;
    /* Matches .verse-selected:hover's background exactly (rgba(160,105,46,0.18)
       composited over --bg-page) rather than inventing a new highlight color —
       reuses an emphasis treatment already proven in both themes. No separate
       text color (see .search-result-text em) — background + bold carry the
       emphasis, same as light mode already did by coincidence (its old
       search-em-color happened to match --text-primary exactly; dark mode's
       didn't, which was the actual inconsistency). */
    --search-em-bg: #eadfd2;
    --badge-bg: #ede9e3;
    --badge-color: #7a6e64;
    --rel-type-bg: #ede9e3;
}

/* ============================================================
   DARK MODE — toggled via [data-theme="dark"] on <html>
   Applied before first paint by inline script in <head>
   ============================================================ */
[data-theme="dark"] {
    --text-primary:    #ddd8ce;
    --text-secondary:  #9a9285;
    --text-muted:      #8f857a;
    --bg-page:         #191815;
    --bg-sidebar:      #0f0e0c;
    --bg-sidebar-hover: rgba(255,255,255,0.05);
    --bg-sidebar-active: rgba(255,255,255,0.10);
    --border-light:    #2c2924;
    --border-divider:  #3a3530;
    --accent:          #c49840;
    --accent-hover:    #a07828;
    --brand-dark:      #0c0b09;
    --brand-mid:       #181610;
    --bg-card:         #222018;
    --bg-subtle:       #1e1c16;
    --bg-hover:        rgba(196,152,64,0.08);
    --highlight-bg:    #28220e;
    --highlight-border: #c49226;
    --search-em-bg:    #5d4a2e;
    --badge-bg:        #292520;
    --badge-color:     #66605a;
    --rel-type-bg:     #252118;
    /* dark depth — shadows carry the whole lift on near-black surfaces */
    --shadow-card:       0 1px 2px rgba(0,0,0,0.4), 0 4px 18px rgba(0,0,0,0.35);
    --shadow-card-hover: 0 2px 4px rgba(0,0,0,0.45), 0 10px 30px rgba(0,0,0,0.5);
}

/* Smooth theme transitions */
body {
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Dark mode: recolor light-coded edge/relation badges */
[data-theme="dark"] .te-edge-leadsto,
[data-theme="dark"] .rel-type[data-type="leads-to"]    { background: #0e2232; color: #60b4e8; }
[data-theme="dark"] .te-edge-resultsin,
[data-theme="dark"] .rel-type[data-type="results-in"]  { background: #0e2218; color: #4ecf84; }
[data-theme="dark"] .te-edge-cause,
[data-theme="dark"] .rel-type[data-type="cause"]        { background: #2a1010; color: #d46060; }
[data-theme="dark"] .te-edge-determines,
[data-theme="dark"] .te-edge-dependson,
[data-theme="dark"] .rel-type[data-type="depends-on"]  { background: #261c0a; color: #c89050; }
[data-theme="dark"] .te-edge-reverses,
[data-theme="dark"] .rel-type[data-type="reverses"]    { background: #280e1e; color: #d470a8; }
[data-theme="dark"] .te-edge-transformsto,
[data-theme="dark"] .te-edge-parentchild,
[data-theme="dark"] .rel-type[data-type="parent_child"]{ background: #1c1030; color: #a060e0; }

html { overflow-x: hidden; overflow-y: scroll; background: var(--bg-page) !important; }
body { font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif; background: var(--bg-page) !important; color: var(--text-primary); overflow-x: hidden; }

/* Applied by inline <script> before first paint — sidebar stays closed with no transition */
html[data-sidebar="closed"] .reader-sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
html[data-sidebar="closed"] .reader-main    { margin-left: 0; }

/* ============================================================
   HEADER
   ============================================================ */
.reader-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--brand-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background-color 0.2s ease;
}

body.admin-bar { --admin-bar-height: 32px; }
@media screen and (max-width: 782px) {
    body.admin-bar { --admin-bar-height: 46px; }
}
body.admin-bar .reader-header  { top: var(--admin-bar-height); }
body.admin-bar .reader-sidebar { top: calc(var(--admin-bar-height) + var(--header-height)); height: calc(100dvh - var(--admin-bar-height) - var(--header-height)); }
body.admin-bar .xref-panel     { top: calc(var(--admin-bar-height) + var(--header-height)); height: calc(100dvh - var(--admin-bar-height) - var(--header-height)); }
body.admin-bar .bk-panel       { top: calc(var(--admin-bar-height) + var(--header-height)); height: calc(100dvh - var(--admin-bar-height) - var(--header-height)); }

.reader-header-left  { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.reader-header-center { flex: 1; display: flex; justify-content: center; padding: 0 1rem; }
.reader-header-right { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; justify-content: flex-end; }

.reader-logo {
    color: #fff !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    opacity: 0.9;
}
.reader-logo:hover { opacity: 1; background: transparent; }

.reader-location {
    color: rgba(255,255,255,0.75);
    font-size: 0.9rem;
    font-weight: 500;
}

.reader-api-cta {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    transition: all 0.15s;
}
.reader-api-cta:hover { color: #fff; border-color: rgba(255,255,255,0.5); }

/* ============================================================
   SIDEBAR TOGGLE (hamburger)
   ============================================================ */
.sidebar-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 28px;
    height: 28px;
    background: none !important;
    border: none;
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
}
.sidebar-toggle span {
    display: block;
    height: 2px;
    background: rgba(255,255,255,0.75);
    border-radius: 2px;
    transition: background 0.15s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.08) !important; }
.sidebar-toggle:hover span { background: #fff; }

/* ============================================================
   VERSION PICKER
   ============================================================ */
.version-picker { position: relative; }

.version-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.version-btn:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.15); color: #fff; }

.version-dropdown * { background: transparent !important; }
.version-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card) !important;
    border: none !important;
    outline: none !important;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    min-width: 100px;
    z-index: 200;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.version-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.version-option {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.85rem;
    text-decoration: none;
    color: var(--text-primary) !important;
    font-size: 0.85rem;
    transition: background 0.1s;
}
.version-option:hover { background: var(--bg-hover) !important; }
.version-option.active { background: var(--accent) !important; color: #fff !important; }
.version-option.active .version-label { color: rgba(255,255,255,0.75) !important; }
[data-theme="dark"] .version-option.active { color: #1a1a1a !important; }
[data-theme="dark"] .version-option.active .version-label { color: rgba(0,0,0,0.6) !important; }
.version-code { font-weight: 600; font-size: 0.8rem; min-width: 32px; }
.version-label { color: var(--text-secondary); font-size: 0.78rem; }

/* ============================================================
   FONT CONTROLS
   ============================================================ */
.font-controls { display: flex; gap: 6px; flex-shrink: 0; }

/* Theme-aware, not the old hardcoded white-on-dark values — .font-btn now
   lives inside .font-dropdown's light/dark card surface, not the dark
   header bar it was originally styled for. */
.font-btn {
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}
.font-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.font-btn sup { font-size: 0.6em; }

/* Aa / Saved — same toggle-dropdown mechanism as .version-picker, so the JS
   (open/close, outside-click, aria-expanded) and visual language match exactly. */
.font-picker, .saved-picker { position: relative; }

/* One height for every header chip — each was deriving its own from
   font/icon size + padding, drifting up to 3px across the row */
.theme-toggle, .version-btn, .parallel-toggle-btn, .font-picker-btn, .saved-picker-btn {
    height: 28px;
    align-items: center;
}

.font-picker-btn, .saved-picker-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.font-picker-btn:hover, .saved-picker-btn:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.15); color: #fff; }
.saved-picker-btn { padding: 0.4rem; }

.font-dropdown, .saved-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card);
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    min-width: 150px;
    z-index: 200;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.font-dropdown.open, .saved-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.font-dropdown { min-width: 190px; }
.font-dropdown-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
}
.font-dropdown-label { color: var(--text-primary); font-size: 0.85rem; white-space: nowrap; }

/* Saved dropdown items — populated by JS (highlight browser + sync entry points) */
.saved-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: none;
    background: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
}
/* Hover mirrors .version-option.active — solid accent, same contrast text */
.saved-dropdown-item:hover { background: var(--accent); color: #fff; }
.saved-dropdown-item:hover svg,
.saved-dropdown-item.sync-active:hover svg,
.saved-dropdown-item:hover .saved-dropdown-count,
.saved-dropdown-item:hover .saved-status-connected { color: rgba(255,255,255,0.85); }
[data-theme="dark"] .saved-dropdown-item:hover { color: #1a1a1a; }
[data-theme="dark"] .saved-dropdown-item:hover svg,
[data-theme="dark"] .saved-dropdown-item.sync-active:hover svg,
[data-theme="dark"] .saved-dropdown-item:hover .saved-dropdown-count,
[data-theme="dark"] .saved-dropdown-item:hover .saved-status-connected { color: rgba(0,0,0,0.65); }
.saved-dropdown-item svg { flex-shrink: 0; color: var(--text-secondary); }
.saved-dropdown-item.sync-active svg { color: var(--accent); }
.saved-status-connected { color: var(--accent); font-size: 0.78rem; }
.saved-dropdown-count { margin-left: auto; color: var(--text-secondary); font-size: 0.75rem; }

/* ============================================================
   LAYOUT
   ============================================================ */
.reader-layout {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    min-height: calc(100dvh - var(--header-height));
}

/* Theme hardening: these structural wrappers carry no background of their own —
   they should reveal the forced body surface (var(--bg-page)). Forcing transparent
   is a no-op normally and only overrides an aggressive parent theme that paints
   them white, which would otherwise cascade down through transparent children. */
body.reader-index-page .reader-layout,
body.reader-index-page .reader-main,
body.reader-index-page .reader-content,
body.reader-index-page .te-browse-main,
body.reader-index-page .te-main { background: transparent !important; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.reader-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    background: var(--bg-sidebar);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    z-index: 50;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.reader-sidebar::-webkit-scrollbar { width: 4px; }
.reader-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ============================================================
   SCROLLBARS — one rule for every contained scroll region.

   The rule: the PAGE owns the native scrollbar. It's the dominant scroll and the
   one people reach for without thinking, so it should look like the OS control.
   A CONTAINED region — a panel, a sheet, a dropdown — gets a subordinate one:
   thin, low-contrast, inside its own bounds, reading as chrome belonging to that
   surface rather than a second page control.

   Two scrollbars of equal visual weight sitting next to each other is what makes
   a user ask "which one moves what". Nested scroll regions are fine — editors and
   devtools are full of them — but only when the inner one is visibly demoted.

   .reader-sidebar already had this treatment and nothing else did, so the
   cross-reference panel rendered a full-weight OS scrollbar hard against the
   page's. (The sidebar keeps its own rule above: its surface is always dark
   chrome, so its white thumb is correct there and already has a nav_light
   variant. Everything else is theme-driven and uses the token below.)

   color-scheme is the other half. It was only ever set on .search-filter-select,
   so the browser was never told the page was dark — which is why UA-rendered
   scrollbars stayed light in dark mode. Declaring it at the root fixes the
   scrollbars AND every native form control in one go.
   ============================================================ */
:root               { color-scheme: light; --scroll-thumb: rgba(0,0,0,0.20); }
[data-theme="dark"] { color-scheme: dark;  --scroll-thumb: rgba(255,255,255,0.18); }

.xref-panel-body,
.bk-panel-body,
.hl-browser-body,
.search-suggest-dropdown {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) transparent;
}
.xref-panel-body::-webkit-scrollbar,
.bk-panel-body::-webkit-scrollbar,
.hl-browser-body::-webkit-scrollbar,
.search-suggest-dropdown::-webkit-scrollbar { width: 6px; }

.xref-panel-body::-webkit-scrollbar-track,
.bk-panel-body::-webkit-scrollbar-track,
.hl-browser-body::-webkit-scrollbar-track,
.search-suggest-dropdown::-webkit-scrollbar-track { background: transparent; }

.xref-panel-body::-webkit-scrollbar-thumb,
.bk-panel-body::-webkit-scrollbar-thumb,
.hl-browser-body::-webkit-scrollbar-thumb,
.search-suggest-dropdown::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb);
    border-radius: 3px;
}

.sidebar-inner { padding: 0.5rem 0 0; }


/* Header nav — Read / Plans / Topics */
.reader-header-nav {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    margin-left: 0.75rem;
}
.reader-header-nav-link {
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255,255,255,0.5) !important;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}
.reader-header-nav-link:hover { color: rgba(255,255,255,0.9) !important; background: rgba(255,255,255,0.07); }
.reader-header-nav-link.active { color: rgba(255,255,255,0.9) !important; }

@media (max-width: 640px) {
    .reader-header-nav { display: none; }
}

.sidebar-section { border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-section:last-child { border-bottom: none; }

.sidebar-testament-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.65rem 1rem;
    background: none !important;
    border: none;
    color: rgba(255,255,255,0.5) !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.15s;
}
.sidebar-testament-btn:hover { color: rgba(255,255,255,0.8) !important; background-color: rgba(255,255,255,0.08) !important; }
.sidebar-testament-btn.open { color: rgba(255,255,255,0.7) !important; }
.sidebar-testament-btn:focus-visible { outline: 2px solid rgba(255,255,255,0.4); outline-offset: -2px; }
.sidebar-testament-btn svg { transition: transform 0.2s; flex-shrink: 0; }
.sidebar-testament-btn.open svg { transform: rotate(180deg); }

.sidebar-book-list {
    display: none;
    list-style: none;
    padding: 0;
}
.sidebar-book-list.open { display: block; }

body.reader-index-page .sidebar-book-btn {
    display: block;
    width: 100%;
    padding: 0.4rem 1rem 0.4rem 1.25rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    transition: all 0.1s;
}
.sidebar-book-btn:hover { color: #fff; background: var(--bg-sidebar-hover); }
.sidebar-book-btn.active { color: #fff; background: var(--bg-sidebar-active); font-weight: 600; }
.sidebar-book-btn:focus-visible { outline: 2px solid rgba(255,255,255,0.4); outline-offset: -2px; }

.sidebar-chapter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0.35rem 0.75rem 0.5rem 1.5rem;
    list-style: none;
}

.sidebar-chapter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5) !important;
    text-decoration: none;
    transition: all 0.1s;
}
.sidebar-chapter:hover { background: var(--bg-sidebar-hover); color: #fff !important; }
.sidebar-chapter.active { background: var(--accent); color: #fff !important; font-weight: 600; }

/* ============================================================
   MAIN READING PANE
   ============================================================ */
.reader-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    transition: margin-left 0.25s ease;
}

.reader-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 2.5rem 2rem 4rem;
}
/* Dark mode: ONE contained reading surface for every theme.
   Mobile = flat #17171b edge-to-edge; desktop = a #17171b sheet with subtle
   rounded edges, floating on a darker #0e0e11 desk. */
[data-theme="dark"] .reader-content { background: #17171b; }
@media (min-width: 768px) {
    /* Contained reading sheet — SAME geometry (incl. the 1px border) in light &
       dark so toggling themes only repaints colour, never reflows the column. */
    .reader-content {
        margin: 1.25rem auto 3rem;
        border-radius: 14px;
        border: 1px solid transparent;
    }
    [data-theme="dark"] .reader-main { background: #08080a; }
    [data-theme="dark"] .reader-content {
        border-color: rgba(255, 255, 255, 0.06);
        box-shadow: 0 22px 60px -30px rgba(0, 0, 0, 0.85);
    }
    /* Light desktop: contained reading sheet on the universal page colour — NO darker
       desk (Derek: the desk read too dark and it only got applied to some pages, so the
       ambient stays the original #faf9f7 app-wide and the sheet floats via its own
       border + soft shadow). !important beats the theme-hardening transparent rule. */
    :root:not([data-theme="dark"]) body[data-bb-route="read"] .reader-content {
        background: var(--bg-page) !important;
        border-color: var(--border-light);
        box-shadow: 0 1px 2px rgba(35, 28, 14, 0.045), 0 20px 44px -30px rgba(35, 28, 14, 0.28);
    }
}
.reader-content:has(.parallel-grid) {
    max-width: 960px;
}

/* ============================================================
   CHAPTER NAVIGATION
   ============================================================ */
.chapter-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}
.chapter-nav-bottom {
    margin-top: 2rem;
    margin-bottom: 0;
    border-top: 1px solid var(--border-light);
    border-bottom: none;
    padding-top: 1rem;
}

.chapter-nav-btn {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    background: none !important;
    transition: background 0.1s;
}
.chapter-nav-btn:hover { background: var(--bg-hover) !important; }
.chapter-nav-btn.disabled { color: var(--text-muted); pointer-events: none; opacity: 0.4; }

.chapter-nav-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.of-total { color: var(--text-muted); font-weight: 400; }

/* Running head — book name top-left, like the head of a printed page */
.runhead-book {
    font-family: 'Lora', Georgia, serif;
    font-variant: small-caps;
    letter-spacing: 0.15em;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.12s;
}
/* On the plan day view the running head links back to the plan overview. */
a.runhead-book:hover { color: var(--accent); }
.chapter-nav-arrows {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ============================================================
   CHAPTER HEADING
   ============================================================ */
.chapter-heading {
    font-family: 'Lora', Georgia, serif;
    text-align: center;
    margin: 1.25rem 0 0;
    padding-bottom: 1rem;
}
/* Book name lives in the running head on screen; kept in markup for print only. */
.chapter-book { display: none; }
/* Chapter number — the large gold figure, like a printed opener */
.chapter-number {
    display: block;
    font-family: 'Lora', Georgia, serif;
    font-size: 2.9rem;
    font-weight: 400;
    line-height: 1;
    color: var(--accent);
    letter-spacing: -0.01em;
}
/* Psalm superscription — shown as an italic subtitle under the chapter heading */
.chapter-heading.has-superscription {
    border-bottom: none;
    padding-bottom: 0.4rem;
}
.chapter-superscription {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--text-secondary);
    text-align: center;
    max-width: 42ch;
    margin: 0 auto;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
    line-height: 1.5;
    text-wrap: balance;
}
/* Acrostic stanza headings (Psalm 119: ALEPH … TAU) */
.stanza-label {
    display: block;
    font-family: 'Lora', Georgia, serif;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-indent: 0.22em;
    color: var(--accent);
    text-align: center;
    margin: 2.25rem 0 0.85rem;
}
.verse:first-of-type + .stanza-label,
.stanza-label:first-child { margin-top: 0.5rem; }
.stanza-label-row {
    grid-column: 1 / -1;
    margin: 1.75rem 0 0.5rem;
}
.stanza-label-row .stanza-label { margin: 0; }

/* ============================================================
   VERSES
   ============================================================ */
.verses-block { margin-top: 1.5rem; }

.verse {
    font-family: 'Lora', Georgia, serif;
    font-size: var(--verse-font-size);
    line-height: var(--verse-line-height);
    color: var(--text-primary);
    margin-bottom: 0.55rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s;
    display: block;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.verse:not(.verse-hl-yellow):not(.verse-hl-green):not(.verse-hl-blue):not(.verse-hl-pink):hover { background: rgba(160,105,46,0.13); }
[data-theme="dark"] .verse:not(.verse-hl-yellow):not(.verse-hl-green):not(.verse-hl-blue):not(.verse-hl-pink):hover { background: #2a2824; }
.verse:not(.verse-hl-yellow):not(.verse-hl-green):not(.verse-hl-blue):not(.verse-hl-pink).verse-selected { background: rgba(160,105,46,0.16); }
[data-theme="dark"] .verse:not(.verse-hl-yellow):not(.verse-hl-green):not(.verse-hl-blue):not(.verse-hl-pink).verse-selected { background: #5d4a2e; color: #faf8f1; }
.verse:not(.verse-hl-yellow):not(.verse-hl-green):not(.verse-hl-blue):not(.verse-hl-pink).verse-selected:hover { background: rgba(160,105,46,0.18); }
[data-theme="dark"] .verse:not(.verse-hl-yellow):not(.verse-hl-green):not(.verse-hl-blue):not(.verse-hl-pink).verse-selected:hover { background: #5d4a2e; color: #faf8f1; }
.verse.verse-hl-yellow:hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.verse.verse-hl-yellow.verse-selected { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25); }
.verse.verse-hl-green:hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.verse.verse-hl-green.verse-selected { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25); }
.verse.verse-hl-blue:hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.verse.verse-hl-blue.verse-selected { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25); }
.verse.verse-hl-pink:hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.verse.verse-hl-pink.verse-selected { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25); }

[data-theme="dark"] .verse.verse-hl-yellow:hover { box-shadow: inset 0 1px 0 rgba(0,0,0,0.35); }
[data-theme="dark"] .verse.verse-hl-yellow.verse-selected { box-shadow: inset 0 1px 0 rgba(0,0,0,0.50), 0 0 8px rgba(199,154,58,0.28); }
[data-theme="dark"] .verse.verse-hl-green:hover { box-shadow: inset 0 1px 0 rgba(0,0,0,0.35); }
[data-theme="dark"] .verse.verse-hl-green.verse-selected { box-shadow: inset 0 1px 0 rgba(0,0,0,0.50), 0 0 8px rgba(199,154,58,0.28); }
[data-theme="dark"] .verse.verse-hl-blue:hover { box-shadow: inset 0 1px 0 rgba(0,0,0,0.35); }
[data-theme="dark"] .verse.verse-hl-blue.verse-selected { box-shadow: inset 0 1px 0 rgba(0,0,0,0.50), 0 0 8px rgba(199,154,58,0.28); }
[data-theme="dark"] .verse.verse-hl-pink:hover { box-shadow: inset 0 1px 0 rgba(0,0,0,0.35); }
[data-theme="dark"] .verse.verse-hl-pink.verse-selected { box-shadow: inset 0 1px 0 rgba(0,0,0,0.50), 0 0 8px rgba(199,154,58,0.28); }
.verse.verse-highlight { border-left: 3px solid var(--highlight-border); padding-left: 0.7rem; border-radius: 0; margin-top: 0; margin-bottom: 0; }
.verse.verse-range { border-left: 3px solid var(--highlight-border); padding-left: 0.7rem; border-radius: 0; margin-top: 0; margin-bottom: 0; }
.verse-range-label { font-size: 0.8rem; font-weight: 600; color: var(--accent); margin-top: 1.2rem; margin-bottom: 0; padding-left: 1.8rem; padding-top: 0.4rem; border-radius: 0; }
.verse.verse-omitted, .plan-verse.verse-omitted { cursor: default; pointer-events: none; opacity: 0.45; }
.verse.verse-omitted:hover { background: transparent; }
.verse-omitted-label { font-style: italic; font-family: 'Inter', sans-serif; font-size: 0.85em; }

.vnum {
    font-family: 'Inter', sans-serif;
    font-size: 0.62em;
    font-weight: 400;
    color: var(--text-muted);
    vertical-align: super;
    margin-right: 0.28em;
    user-select: none;
    line-height: 0;
}
/* Warm, receded verse number in dark — matches the reader's-edition tone */
[data-theme="dark"] .vnum { color: #6d665a; }

/* ============================================================
   VERSE ACTIONS — shown on click/select (desktop) + long-press sheet (mobile)
   ============================================================ */
.verse-actions {
    display: none;
    gap: 4px;
    margin-top: 4px;
    margin-left: 1.6rem;
    opacity: 0;
    transition: opacity 150ms ease;
}
.verse.verse-selected .verse-actions {
    display: flex;
    opacity: 0.5;
}
.verse.verse-selected .verse-actions:hover {
    opacity: 1;
}

.va-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: transparent !important;
    border: none;
    border-radius: 3px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    transition: opacity 0.1s, color 0.1s;
    flex-shrink: 0;
}
.va-btn:hover { opacity: 1; color: var(--text-primary); background: var(--bg-hover) !important; }
.va-btn.va-done { opacity: 1; color: var(--accent); }

/* auto-dismiss: icons fade out after inactivity, highlight stays */
.verse.verse-icons-hidden .verse-actions { opacity: 0.25; }

/* On touch devices, show actions on selected verse (no hover needed) */
@media (hover: none) {
    .verse.verse-selected .verse-actions { display: flex; opacity: 0.6; }
}

/* ============================================================
   HINT SYSTEM
   ============================================================ */
/* Single keyframe driven by a custom property so light/dark only ever change
   the pulse COLOR, never the animation-name — switching animation-name (the
   old bb-pulse/bb-pulse-dark split) restarts the animation from 0%, which
   made the hint box hard-cut to invisible then slowly re-fade every time the
   theme toggled mid-pulse. Matches .verse:hover's dark value (line ~598). */
@keyframes bb-pulse {
    0%, 100% { background: transparent; }
    60%       { background: var(--hint-pulse-color, rgba(160, 105, 46, 0.13)); }
}
@keyframes bb-fade-in {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}
.verse-hint-pulse {
    --hint-pulse-color: rgba(160, 105, 46, 0.13);
    animation: bb-pulse 2.4s ease-in-out infinite;
}
[data-theme="dark"] .verse-hint-pulse {
    --hint-pulse-color: #2a2824;
}
.verse-hint-label {
    display: block;
    margin-top: 4px;
    margin-left: 1.6rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    color: var(--text-muted);
    pointer-events: none;
    animation: bb-fade-in 0.6s ease both;
}

/* Action sheet — mobile long-press */
.vas-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 400;
}
.vas-backdrop.open { display: block; }

/* Blanket reset — explicit backgrounds on child rules override as expected */
.verse-action-sheet * { background: transparent; }
/* Bottom-anchored surfaces share a 16px top radius (matches .xref-panel on
   mobile) — a user meets both on the chapter page.

   Deliberately NOT a bottom sheet: no grab handle, no swipe-to-dismiss. This is
   an action sheet — a short menu you choose from, not content you read — and it
   exits via the full-width Cancel button at thumb height, which is the reliable
   dismissal channel. Swipe is the unreliable one (users miss the handle; the
   gesture collides with the notification drawer), so it earns nothing here.

   If this ever grows tall enough to scroll, it inherits the bug the xref sheet
   had: a downward drag inside scrollable content reads as a dismiss. Today it's
   243px — 38% of a 640px screen — and does not scroll. Keep it that way. */
.verse-action-sheet {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    border-radius: 16px 16px 0 0;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
    z-index: 401;
    transition: bottom 0.22s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--text-primary);
}
.verse-action-sheet.open { bottom: 0; }

.vas-ref {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0 0.25rem 0.25rem;
    background: transparent;
}

.vas-action-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.8rem 0.9rem;
    background: var(--bg-subtle);
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}
.vas-action-btn:active { background: var(--bg-hover); }
.vas-cancel {
    background: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    justify-content: center;
    margin-top: 0.1rem;
}

/* Mobile highlight color row */
.vas-hl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.vas-hl-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.vas-hl-dots {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}
.vas-hl-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
.vas-hl-dot:active { transform: scale(1.15); }
.vas-hl-dot-yellow { background: #facc15; }
.vas-hl-dot-green  { background: #22c55e; }
.vas-hl-dot-blue   { background: #3b82f6; }
.vas-hl-dot-pink   { background: #ec4899; }
.vas-hl-dot-remove {
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   PERMISSIONS
   ============================================================ */
.reader-permission {
    margin-top: 2.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* ============================================================
   CROSS-REF / TOPICS PANEL  (fixed overlay — never in flow)
   ============================================================ */
/* Blanket reset so aggressive themes can't paint inner elements white.
   Explicit backgrounds on child rules below override this as expected. */
.xref-panel * { background: transparent; }
.xref-panel {
    position: fixed;
    right: 0;
    top: var(--header-height);
    width: 320px;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    background: var(--bg-subtle);
    border-left: 1px solid var(--border-divider);
    box-shadow: -4px 0 20px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 60;
    overflow: hidden;
}
.xref-panel.open {
    transform: translateX(0);
}

.xref-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;              /* so the pinned verse can drop to its own line */
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    background: transparent;
}

/* The pinned verse — shown in BOTH layouts.

   On mobile the sheet covers the verse it references, so without this you'd be
   comparing cross-references against a passage you can no longer see.

   On desktop it isn't redundant either, which was the first instinct and the
   wrong one. The pane doesn't sit beside the VERSE — it sits beside the column,
   and the verse is at whatever height it happened to be, while the reference
   list always starts at the top of the pane. You end up comparing across a gap
   at two different heights, and the moment you scroll the column for context the
   verse leaves and the panel stays. Pinning it makes the panel a self-contained
   comparison unit in both layouts: source at the top, connections beneath.

   Clamped, because some verses are long and the list is the panel's job. */
.panel-verse-text {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-basis: 100%;
    margin: 0.5rem 0 0;
    font-family: 'Lora', Georgia, serif;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-secondary);
}
.panel-verse-text[hidden] { display: none; }

/* Panel verse label lives in the header row now */
.panel-verse-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tabs */
.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    background: transparent;
}
.panel-tab {
    flex: 1;
    background: transparent;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.1s, border-color 0.1s;
    margin-bottom: -1px;
}
.panel-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel-tab:hover:not(.active) { color: var(--text-secondary); background: transparent; }

/* Topic items */
.topic-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
}
.topic-item:last-child { border-bottom: none; }
.topic-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}
.topic-name {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.topic-type-badge {
    font-family: 'Inter', sans-serif;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    flex-shrink: 0;
}
.topic-type-doctrine   { background: rgba(100,120,200,0.12); color: #6478c8; }
.topic-type-virtue     { background: rgba(80,160,80,0.12);   color: #3a8c3a; }
.topic-type-practice   { background: rgba(180,130,60,0.14);  color: var(--accent); }
.topic-type-experience { background: rgba(160,80,160,0.12);  color: #a050a0; }
[data-theme="dark"] .topic-type-doctrine   { color: #8898e8; }
[data-theme="dark"] .topic-type-virtue     { color: #60b860; }
[data-theme="dark"] .topic-type-experience { color: #c070c0; }

.topic-relations { display: flex; flex-direction: column; gap: 0.3rem; }
.topic-rel-row { display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
.topic-rel-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.67rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    font-style: italic;
}
.topic-rel-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.topic-rel-chip {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: 3px;
    padding: 0.12rem 0.4rem;
    text-decoration: none;
    transition: color 0.1s, border-color 0.1s;
}
.topic-rel-chip:hover { color: var(--accent); border-color: var(--accent); }
.xref-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    /* minimum 44×44px tap target on mobile */
    padding: 0.5rem;
    margin: -0.5rem;
    border-radius: 4px;
    transition: color 0.1s;
}
.xref-close:hover { color: var(--text-primary); background: transparent; }
.xref-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.xref-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;

    /* Snap to whole cross-references. Each item is a verse — a discrete thing to
       read — so a scroll that stops halfway through one leaves you looking at a
       fragment of scripture, which is the one thing this panel shouldn't do.

       `mandatory` is safe here and measured, not assumed: across a 35-item list
       the tallest item is 219px against a 327px scrollport on mobile (median
       138px). Nothing exceeds the viewport, so no item can trap the scroll —
       which is the failure mode that would otherwise argue for `proximity`.
       If items ever grow taller than the scrollport, drop to `proximity`. */
    scroll-snap-type: y mandatory;
    overscroll-behavior: contain;   /* don't chain the scroll into the page behind */
}
.xref-item { scroll-snap-align: start; }
.xref-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
}
.xref-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 1.5rem;
}

@keyframes xref-spin {
    to { transform: rotate(360deg); }
}
.xref-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: xref-spin 0.6s linear infinite;
    flex-shrink: 0;
}

.xref-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}
.xref-item:last-child { border-bottom: none; }
.xref-ref {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    margin-top: 0.3rem;
}
.xref-ref:hover { text-decoration: underline; }
.xref-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-primary);
}
.xref-weight {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    font-family: 'Inter', sans-serif;
}

/* Verse highlighting — persistent color marks */
.verse-hl-yellow { background: rgba(250, 204, 21, 0.25); border-radius: 2px; }
.verse-hl-green  { background: rgba(34, 197, 94, 0.20); border-radius: 2px; }
.verse-hl-blue   { background: rgba(59, 130, 246, 0.18); border-radius: 2px; }
.verse-hl-pink   { background: rgba(236, 72, 153, 0.18); border-radius: 2px; }

[data-theme="dark"] .verse-hl-yellow { background: rgba(250, 204, 21, 0.35); }
[data-theme="dark"] .verse-hl-green  { background: rgba(34, 197, 94, 0.32); }
[data-theme="dark"] .verse-hl-blue   { background: rgba(59, 130, 246, 0.30); }
[data-theme="dark"] .verse-hl-pink   { background: rgba(236, 72, 153, 0.30); }

.va-highlight { position: relative; }
.va-hl-active { color: var(--accent) !important; }

/* Highlight color picker */
.hl-color-picker {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    display: flex;
    gap: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 5px 7px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    z-index: 20;
    white-space: nowrap;
}
.hl-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s;
    padding: 0;
}
.hl-dot:hover { transform: scale(1.2); border-color: var(--text-primary); }
.hl-dot-yellow { background: #facc15; }
.hl-dot-green  { background: #22c55e; }
.hl-dot-blue   { background: #3b82f6; }
.hl-dot-pink   { background: #ec4899; }

/* Explained cross-references — topic connections */
.xref-themes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-light);
}
.xref-theme-chip {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--bg-hover);
    text-decoration: none;
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
    border: 1px solid var(--border-light);
    transition: background 0.12s, border-color 0.12s;
}
.xref-theme-chip:hover {
    border-color: var(--accent);
    background: var(--bg-subtle);
}
.xref-explain {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.35rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    line-height: 1.4;
}
.xref-explain-label {
    color: var(--text-muted);
    font-weight: 500;
}
.xref-explain-topic {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}
.xref-explain-topic:hover { text-decoration: underline; }
.xref-explain-sep { color: var(--text-muted); }

/* ============================================================
   TOPIC GRAPH PANEL
   ============================================================ */
.topic-item {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
}
.topic-item:last-child { border-bottom: none; }

.topic-name {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.topic-type-badge {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: var(--badge-bg);
    color: var(--badge-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.topic-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.topic-relations { display: flex; flex-direction: column; gap: 3px; }

.topic-relation {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    line-height: 1.4;
}
.rel-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.rel-type {
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    color: var(--text-muted);
    background: var(--rel-type-bg);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    flex-shrink: 0;
    white-space: nowrap;
}
.rel-topic {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.78rem;
}
.rel-topic:hover { text-decoration: underline; }

/* colour-code relation types */
.rel-type[data-type="leads-to"]      { background: #e8f4fd; color: #1a6fa0; }
.rel-type[data-type="depends-on"]    { background: #fef3e8; color: #9a5c00; }
.rel-type[data-type="results-in"]    { background: #e8fdf0; color: #1a7a45; }
.rel-type[data-type="cause"]         { background: #fde8e8; color: #9a1a1a; }
.rel-type[data-type="parent_child"]  { background: #f0e8fd; color: #5c1a9a; }
.rel-type[data-type="reverses"]      { background: #fde8f4; color: #9a1a6a; }
.rel-type[data-type="related"]       { background: var(--rel-type-bg); color: var(--text-muted); }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 49;
}

/* ============================================================
   PANEL BACKDROP (mobile bottom sheet)
   ============================================================ */
.panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 79;
}
.panel-backdrop.open { display: block; }

/* ============================================================
   BOOKMARKS
   ============================================================ */
.bk-panel * { background: transparent; }
.bk-panel {
    position: fixed;
    right: 0;
    top: var(--header-height);
    width: 320px;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    background: var(--bg-card);
    border-left: 1px solid var(--border-light);
    box-shadow: -4px 0 20px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 65;
    overflow: hidden;
}
.bk-panel.open { transform: translateX(0); }

.bk-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
}
.bk-panel-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.bk-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
}
.bk-close:hover { color: var(--text-primary); background: transparent; }
.bk-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0;
}
.bk-item {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}
.bk-item:last-child { border-bottom: none; }
.bk-ref {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 0.25rem;
}
.bk-ref:hover { text-decoration: underline; }
.bk-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--text-primary);
    margin: 0;
}
.bk-remove {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0.45;
    padding: 0.2rem 0.35rem;
    line-height: 1;
}
.bk-remove:hover { opacity: 1; background: transparent; }
.bk-hint {
    padding: 2rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
}
.bk-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 64;
}
.bk-backdrop.open { display: block; }

/* Mobile home button — hidden on desktop, shown on mobile before search icon */
.mobile-home-btn {
    display: none;
    background: none !important;
    border: none !important;
    color: #a0a0a0 !important;
    cursor: pointer;
    padding: 0.45rem;
    border-radius: 4px;
    align-items: center;
    transition: background 0.1s, color 0.1s;
}
.mobile-home-btn:hover { background: rgba(255,255,255,0.08); color: #fff !important; }

/* No persistent border for bookmarked verses — it collided with the
   navigation-anchor/verse-range border (same visual channel, same
   specificity) and moving it to background would've just collided with
   the highlighter colors instead. Bookmark state is still fully visible
   via the Library panel and the verse-actions icon (filled vs. empty). */
/* Straight left accent (square the left corners) on highlighted verses so
   the accent bar is flat, matching the rest of the site. */
.verse.verse-highlight {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Resume banner on index page */
.resume-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.25rem;
    padding: 0.5rem 0.85rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
}
.resume-label { color: var(--text-muted); }
.resume-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.resume-link:hover { text-decoration: underline; }

/* ============================================================
   PARALLEL TOGGLE BUTTON
   ============================================================ */
.parallel-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    white-space: nowrap;
}
.parallel-toggle-btn:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.15);
    color: #fff;
}
.parallel-toggle-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.parallel-toggle-btn.active:hover {
    /* header is a dark surface — darkening (--accent-hover) sinks the chip
       into the bar; brighten instead so hover reads as a lift on any preset */
    background: var(--accent);
    border-color: var(--accent);
    filter: brightness(1.15);
}
@media (max-width: 480px) {
    .parallel-toggle-btn span { display: none; }
}

/* ============================================================
   PARALLEL GRID
   ============================================================ */
.parallel-grid { margin-top: 1.5rem; }

.parallel-header-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 0 0.5rem 0.5rem calc(1.8em + 0.5rem);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 0.25rem;
}
.parallel-col-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary); /* version code — legible, tells you which column is which */
}
.parallel-col-sublabel {
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--text-muted); /* descriptor — quiet, single mechanism (was opacity-on-muted) */
}

/* Override .verse block display for parallel rows */
.parallel-grid .verse {
    display: grid;
    grid-template-columns: 1.8em 1fr 1fr;
    gap: 0 1.5rem;
    align-items: baseline;
    margin-bottom: 0;
    padding: 0.45rem 0.5rem;
}
.parallel-grid .verse .vnum {
    grid-column: 1;
    grid-row: 1;
    vertical-align: baseline;
    line-height: inherit;
    align-self: start;
    padding-top: 0.2em;
}
.parallel-kjv {
    grid-column: 2;
    grid-row: 1;
    font-family: 'Lora', Georgia, serif;
    font-size: var(--verse-font-size);
    line-height: var(--verse-line-height);
}
.parallel-web {
    grid-column: 3;
    grid-row: 1;
    font-family: 'Lora', Georgia, serif;
    font-size: var(--verse-font-size);
    line-height: var(--verse-line-height);
    /* Equal weight with KJV — parallel/compare is symmetric, not primary+reference.
       Column label + divider carry the differentiation. */
    border-left: 1px solid var(--border-divider);
    padding-left: 1rem;
}

/* Range label uses the single-column indent (1.8rem) by default, which
   doesn't correspond to anything in the two-column verse grid here. Match
   where the KJV text column actually starts: the verse row's own left
   padding (0.5rem) + the vnum column width (1.8 × the verse's own font
   size, not the label's — the label renders at 0.8rem, so a bare "1.8em"
   here would undershoot) + the grid gap between vnum and text (1.5rem). */
.parallel-grid .verse-range-label {
    padding-left: calc(0.5rem + 1.8 * var(--verse-font-size) + 1.5rem);
}

/* verse-actions float right in the last column — reposition */
.parallel-grid .verse-actions {
    grid-column: 3;
    grid-row: 1;
    position: static;
    transform: none;
    align-self: start;
    justify-self: end;
    margin-top: 0.3em;
}

/* First-visit "Click any verse to explore" hint — appended as a plain child
   of .verse (reader.js), which is fine in single-column flow but becomes an
   unplaced grid item here, collapsing into the ~1.8em vnum column and
   wrapping one word per line. Span both text columns on their own row instead. */
.parallel-grid .verse-hint-label {
    grid-column: 2 / -1;
    grid-row: 2;
    margin-left: 0;
}

/* Mobile: stack KJV above WEB per verse */
@media (max-width: 640px) {
    .parallel-header-row { display: none; }
    .parallel-grid .verse {
        grid-template-columns: 1.8em 1fr;
        grid-template-rows: auto auto;
        gap: 0;
    }
    .parallel-grid .verse .vnum {
        grid-column: 1;
        grid-row: 1;
    }
    .parallel-kjv {
        grid-column: 2;
        grid-row: 1;
    }
    .parallel-web {
        grid-column: 2;
        grid-row: 2;
        border-left: none;
        padding-left: 0;
        padding-top: 0.3rem;
        margin-top: 0.3rem;
        border-top: 1px solid var(--border-light);
        font-size: 0.93em;
    }
    .parallel-web::before {
        content: 'WEB  ';
        font-family: 'Inter', sans-serif;
        font-size: 0.6em;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-muted);
        margin-right: 0.4em;
    }
    .parallel-grid .verse-actions { display: none; }
    /* Row 2 is taken by the stacked BSB text here — push the hint to row 3. */
    .parallel-grid .verse-hint-label {
        grid-row: 3;
    }
}

/* Mobile: bookmark panel as bottom sheet */
@media (max-width: 768px) {
    .bk-panel {
        width: 100%;
        height: clamp(320px, 65vh, 80vh);
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        border-left: none;
        border-top: 1px solid var(--border-light);
        box-shadow: 0 -4px 24px rgba(0,0,0,0.14);
        transform: translateY(100%);
        border-radius: 16px 16px 0 0;
        z-index: 85;
    }
    .bk-panel.open { transform: translateY(0); }
    .bk-panel-header { position: relative; padding-top: 20px; }
    .bk-panel-header::before {
        content: '';
        display: block;
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: var(--border-light);
        border-radius: 2px;
    }
    .bk-backdrop { z-index: 84; background: rgba(0,0,0,0.35); }
}

/* ============================================================
   INDEX PAGE
   ============================================================ */
.reader-index-page { background: var(--bg-page); }

.reader-index-main {
    max-width: 900px;
    margin: 0 auto;
    padding: calc(var(--header-height) + 2.5rem) 1.5rem 4rem;
}

.reader-index-hero {
    text-align: center;
    margin-bottom: 3rem;
}
.reader-index-hero h1 {
    font-family: 'Lora', Georgia, serif;
    font-size: 2.25rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.reader-index-hero p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.testament-section { margin-bottom: 3rem; }
.testament-heading {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

/* Library section — strong divider, signals "you are now in the reference area" */
.index-section-library {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-light);
}
.library-heading {
    margin-bottom: 1.25rem;
}
.library-heading h2 {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.library-heading p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* Collapsible testament sections */
.testament-details {
    margin-bottom: 0.5rem;
}
.testament-details + .testament-details {
    margin-top: 0.25rem;
}
.testament-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
    border-bottom: 1px solid var(--border-light);
    user-select: none;
    transition: color 0.12s;
}
.testament-summary::-webkit-details-marker { display: none; }
.testament-summary::before {
    content: '›';
    font-size: 1rem;
    line-height: 1;
    transition: transform 0.15s;
    display: inline-block;
}
.testament-details[open] .testament-summary::before { transform: rotate(90deg); }
.testament-summary:hover { color: var(--text-secondary); background: transparent; }
.testament-count {
    font-weight: 400;
    opacity: 0.8;
    text-transform: none;
    letter-spacing: 0;
}
.testament-details .book-grid {
    padding: 0.75rem 0 0.5rem;
}

/* Book grid — dense reference layout */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.3rem;
}

/* Book cards — quiet, reference-style */
.book-card {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.1s, border-color 0.1s;
}
.book-card:hover {
    background: var(--bg-subtle);
    border-color: var(--border-light);
}
.book-card-name {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.book-card:hover .book-card-name { color: var(--text-primary); }
.book-card-chapters {
    font-size: 0.65rem;
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.6;
}

.reader-index-cta {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.reader-index-cta a { color: var(--accent); text-decoration: none; font-weight: 500; }
.reader-index-cta a:hover { text-decoration: underline; }

/* ============================================================
   READING PROGRESS BAR
   ============================================================ */
.reading-progress-bar {
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width);
    right: 0;
    height: 2px;
    background: var(--accent);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.1s linear;
    z-index: 40;
    pointer-events: none;
}

/* ============================================================
   INDEX PAGE — SECTIONS
   ============================================================ */
.index-section {
    margin-bottom: 3rem;
}
.index-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.index-section-heading {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
    flex: 1;
}
/* when used standalone (no header wrapper) keep bottom spacing */
.index-section > .index-section-heading {
    margin-bottom: 1rem;
}
.index-section-link {
    font-size: 0.78rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    margin-left: 1rem;
    flex-shrink: 0;
    padding-bottom: 0.5rem;
}
.index-section-link:hover { text-decoration: underline; }

/* ============================================================
   CONTINUE READING CARD
   ============================================================ */
.resume-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    margin-bottom: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 8px;
    text-decoration: none;
    transition: box-shadow 0.15s, transform 0.15s;
}
.resume-card:hover {
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}
.resume-card-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--accent);
    flex-shrink: 0;
}
.resume-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}
.resume-card-arrow {
    color: var(--accent);
    font-size: 1rem;
    flex-shrink: 0;
}

/* ============================================================
   INDEX — PRIMARY HERO (VOTD + CTA)
   ============================================================ */
.index-hero-section {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
    margin-bottom: 2.5rem;
    padding: 1.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
}
.votd-block {
    flex: 1;
    min-width: 0;
    border-right: 1px solid var(--border-light);
    padding-right: 1.5rem;
}
.votd-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
}
.votd-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-style: italic;
    margin: 0 0 0.75rem;
}
body.reader-index-page .votd-text {
    font-family: 'Lora', Georgia, serif !important;
    color: var(--text-primary) !important;
    font-style: italic !important;
}
body.reader-index-page .votd-text::before,
body.reader-index-page .votd-text::after { content: none; }
.votd-ref a {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    font-style: normal;
}
.votd-ref a:hover { text-decoration: underline; }

.votd-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.votd-read-btn {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    text-decoration: none;
    padding: 0.35rem 0.85rem;
    border-radius: 5px;
    transition: background 0.15s;
    white-space: nowrap;
}
.votd-read-btn:hover { background: var(--accent-hover); }

.hero-cta-block {
    flex: 0 0 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-align: center;
}
.hero-cta-btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    transition: background 0.15s;
    white-space: nowrap;
}
.hero-cta-btn:hover { background: var(--accent-hover); }
.hero-cta-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

@media (max-width: 600px) {
    .index-hero-section { flex-direction: column; }
    .votd-block { border-right: none; border-bottom: 1px solid var(--border-light); padding-right: 0; padding-bottom: 1.25rem; }
    .hero-cta-block { flex: none; flex-direction: row; justify-content: flex-start; text-align: left; }
}

/* ============================================================
   INDEX — ENTRY POINT TILES
   ============================================================ */
.entry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
.entry-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    padding: 1rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s;
}
.entry-tile:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    transform: translateY(-1px);
}
.entry-tile-icon { font-size: 1.3rem; margin-bottom: 0.1rem; }
.entry-tile-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}
.entry-tile-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
@media (max-width: 480px) {
    .entry-grid { grid-template-columns: 1fr; }
    .entry-tile { flex-direction: row; align-items: center; gap: 0.75rem; }
    .entry-tile-icon { margin-bottom: 0; font-size: 1.1rem; }
}

/* ============================================================
   INDEX — POPULAR BOOKS
   ============================================================ */
.popular-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}
.popular-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.75rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--accent);
    border-radius: 0 6px 6px 0;
    text-decoration: none;
    transition: all 0.15s;
}
.popular-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
.popular-card-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}
.popular-card-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
}
@media (max-width: 640px) {
    .popular-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px) {
    .popular-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   START HERE CARD
   ============================================================ */
.start-here-card {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
}
.start-here-body { flex: 1; min-width: 0; }
.start-here-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.4rem;
}
.start-here-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.start-here-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}
.start-here-btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    transition: background 0.15s;
}
.start-here-btn:hover { background: var(--accent-hover); }
.start-here-verse {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem 1.1rem;
    background: var(--bg-subtle);
    border-left: 3px solid var(--accent);
    border-radius: 0 6px 6px 0;
    margin: 0;
}
.start-here-verse p {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.82rem;
    line-height: 1.75;
    color: var(--text-primary);
    font-style: italic;
    margin-bottom: 0.5rem;
}
.start-here-verse cite {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    font-style: normal;
}
@media (max-width: 600px) {
    .start-here-card { flex-direction: column; }
    .start-here-verse {
        flex: none;
        border-left: none;
        border-top: 2px solid var(--accent);
        border-radius: 0 0 6px 6px;
    }
}

/* ============================================================
   READING PLAN CARDS
   ============================================================ */
.plan-card-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.plan-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: var(--shadow-card);
    text-decoration: none;
    transition: all 0.15s;
}
.plan-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}
.plan-card-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
}
.plan-card-body {
    flex: 1;
    min-width: 0;
}
.plan-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}
.plan-card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}
.plan-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
}
.plan-card-days {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.plan-card-progress {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
}
.plan-card-progress-bar {
    width: 80px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
}
.plan-card-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}
.plan-card-progress-label {
    font-size: 0.68rem;
    color: var(--accent);
    font-weight: 600;
}

@media (max-width: 480px) {
    .plan-card-progress-bar { width: 56px; }
    .plan-card-icon { font-size: 1.1rem; }
}

.reader-error {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem;
}

/* ============================================================
   SEARCH BAR (header)
   ============================================================ */

/* Focus ring colour. The preset accents are chosen to read on the light
   reading page, so they have no luminance headroom left against a dark nav —
   a solid accent ring measures 1.39:1 on Forest and 1.40:1 on Burgundy, i.e.
   invisible, and fails SC 1.4.11 (AA). Gold is the one hue that clears 3:1
   against every dark nav in the catalog. It only works BELOW a nav luminance
   of ~0.098 (about #585858), so the two nav_light presets take ink instead —
   there is no light nav where gold can work. See the nav-light block below. */
:root { --bb-focus-ring: #c9a35a; }

.reader-search-form {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.06) !important;
    /* 2px, not 1px: SC 2.4.13 wants the indicator to cover at least the area
       of a 2px perimeter, and holding the width constant between rest and
       focus keeps the pill from shifting when it lights. */
    border: 2px solid rgba(255,255,255,0.11);
    border-radius: 20px;
    overflow: hidden;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
    max-width: 420px;
}
.reader-search-form:focus-within {
    /* was rgba(255,255,255,0.28) — 1.60:1 to 1.84:1 against the resting
       border, below the 3:1 floor on every preset. Gold runs 3.80:1 (Forest,
       the tightest) to 6.22:1 (Obsidian). */
    border-color: var(--bb-focus-ring);
    background: rgba(255,255,255,0.11) !important;
}
.reader-search-input {
    background: none !important;
    border: none !important;
    outline: none !important;
    color: #fff !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    padding: 0.45rem 0.75rem;
    width: 100%;
    min-width: 0;
}
.reader-search-input::placeholder { color: rgba(255,255,255,0.38) !important; }
.reader-search-btn {
    background: none !important;
    border: none !important;
    border-left: 1px solid rgba(255,255,255,0.12) !important;
    color: rgba(255,255,255,0.5) !important;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.reader-search-btn:hover { color: #fff !important; background: rgba(255,255,255,0.08); }

/* Mobile search toggle — hidden on desktop */
.mobile-search-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: none !important;
    border: none;
    color: #a0a0a0 !important;
    padding: 0.45rem;
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
}
.mobile-search-toggle:hover { color: #fff !important; background: rgba(255,255,255,0.08); }
.mobile-search-close { display: none; }
.reader-search-book {
    -webkit-appearance: none;
    appearance: none;
    background-color: rgba(255,255,255,0.07) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='rgba(255,255,255,0.45)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    border: none;
    border-left: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.75) !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    padding: 0.45rem 1.6rem 0.45rem 0.6rem;
    cursor: pointer;
    flex-shrink: 0;
    outline: none;
    max-width: 140px;
}
.reader-search-book:hover { color: #fff !important; background-color: rgba(255,255,255,0.12) !important; }

/* Search typeahead dropdown */
.search-suggest-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 300;
    overflow: hidden;
    max-height: 360px;
    overflow-y: auto;
}
.search-suggest-item {
    display: block;
    padding: 0.6rem 0.85rem;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    transition: background 0.08s;
}
.search-suggest-item:last-child { border-bottom: none; }
.search-suggest-item:hover,
.search-suggest-item.active { background: var(--bg-hover); }
.search-suggest-ref {
    background: var(--bg-subtle);
}
.search-suggest-ref .ssi-go {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-right: 0.35rem;
}
.ssi-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}
.ssi-text {
    display: block;
    font-family: 'Lora', Georgia, serif;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reader-search-book option,
.reader-search-book optgroup { background: #1a1512; color: #ddd8ce; }

/* ============================================================
   SEARCH RESULTS PAGE
   ============================================================ */
/* Search — the same contained book-page as the reader: a centred .search-sheet
   floating on a full-width .search-main desk, matching .day-main/.day-sheet
   (not .reader-content, which is gated to body[data-bb-route="read"] only). */
.search-main {
    margin-top: var(--header-height);
    padding: 0 0 90px;
    display: flow-root;
}
.search-sheet {
    max-width: 720px;
    margin: 0 auto;
    padding: 2.5rem 2rem 4rem;
    background: var(--bg-page);
    transition: background-color 0.2s ease;
}
[data-theme="dark"] .search-sheet { background: #17171b; }
@media (min-width: 768px) {
    .search-sheet {
        margin: 1.25rem auto 3rem;
        border-radius: 14px;
        border: 1px solid var(--border-light);
        box-shadow: 0 1px 2px rgba(35, 28, 14, 0.045), 0 20px 44px -30px rgba(35, 28, 14, 0.28);
    }
    [data-theme="dark"] .search-sheet {
        border-color: rgba(255, 255, 255, 0.06);
        box-shadow: 0 22px 60px -30px rgba(0, 0, 0, 0.85);
    }
}
@media (max-width: 640px) {
    .search-sheet { padding: 1.5rem 1.25rem 3rem; }
}
.search-results-heading {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}
.search-results-heading span { color: var(--text-secondary); font-weight: 400; }
.search-result-item {
    padding: 1.1rem 1.25rem 1rem 1.1rem;
    border: 1px solid var(--border-light);
    border-left-width: 3px;
    border-radius: 0 6px 6px 0;
    background: var(--bg-card);
    margin-bottom: 0.85rem;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.search-result-item.sr-ot,
.search-result-item.sr-nt { border-left-color: var(--accent); }
/* No hover lift. The card is a container, not a control — the two links
   inside it are. A card that rises under the cursor and does nothing is an
   affordance that lies, and it's what made the dead zones feel broken. */
.search-result-ref {
    display: block;
    /* The target must match the text. As a full-width block anchor, "John 3:16"
       (~80px of type) had a hit area spanning the entire card, so tapping the
       empty space beside the reference silently navigated — which is what made
       a mistap while dismissing the keyboard yank you off your own results. */
    width: fit-content;
    max-width: 100%;
    font-family: 'Lora', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 0.15rem;
}
.search-result-ref:hover { color: var(--accent); }
.search-result-meta {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}
.search-result-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 0.65rem;
}
.search-result-context {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
}
.search-result-context:hover { color: var(--accent); text-decoration: underline; }
.search-result-text em {
    background: var(--search-em-bg);
    color: inherit;
    font-style: normal;
    font-weight: 600;
    border-radius: 2px;
    padding: 0 1px;
}
.search-empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 3rem 1rem;
}
.search-theme-groups {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    margin-bottom: 2rem;
}
.search-theme-group {}
.search-theme-label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.search-theme-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}
/* A quiet pill, not a link that happens to gain a shape on hover — the
   accent-tinted fill and border give it a real (if soft) container at
   rest; hover just strengthens that fill and adds lift as a bonus, not
   as the only cue that it's tappable. */
.search-suggestion-chip {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    padding: 0.35rem 0.7rem;
    border: 1px solid rgba(138, 106, 30, 0.16);
    border-radius: 8px;
    background: rgba(138, 106, 30, 0.09);
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
[data-theme="dark"] .search-suggestion-chip {
    border-color: rgba(196, 152, 64, 0.22);
    background: rgba(196, 152, 64, 0.12);
}
.search-suggestion-chip:hover {
    background: rgba(138, 106, 30, 0.16);
    border-color: var(--accent);
    box-shadow: 0 3px 10px rgba(35,28,14,0.10);
    transform: translateY(-1px);
}
[data-theme="dark"] .search-suggestion-chip:hover {
    background: rgba(196, 152, 64, 0.20);
    box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}
/* Curated topic groups (unlike Recent, which stays a pill row — see
   .search-suggestion-chip) render as a quiet citation index: a small-caps
   label inline at the head of a hairline row, serif terms trailing after
   it, no boxes. Reads like a concordance rather than a filter bar. */
.search-topic-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-light);
    padding-top: 0.65rem;
}
.search-topic-row-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-right: 0.9rem;
    white-space: nowrap;
}
.search-topic-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0 1.1rem;
}
.search-topic-term {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-decoration: none;
}
.search-topic-term:hover { color: var(--accent); }
@media (max-width: 640px) {
    .search-topic-row { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
    .search-topic-row-label { margin-right: 0; }
}
.search-back {
    display: inline-block;
    color: var(--accent);
    font-size: 0.85rem;
    text-decoration: none;
    margin-bottom: 1.25rem;
}
.search-back:hover { text-decoration: underline; }
/* Book/topic match shortcuts above search results — one row of icon
   buttons (not a mix of buttons and sentence-links), so a book match and
   a topic match read as the same kind of thing side by side. */
.search-match-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}
.search-match-label {
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
}
.search-match-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem 0.5rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary) !important;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none !important;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.search-match-btn svg { color: var(--accent); flex-shrink: 0; }
.search-match-btn:hover { border-color: var(--accent); background: var(--bg-hover); color: var(--accent) !important; }
.search-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 0.35rem 0 1.25rem;
}
.search-count {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.search-filter-bar {
    display: flex;
    align-items: center;
    margin: 0;
}
.search-filter-select {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-divider);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
}
.search-filter-select:focus {
    outline: none;
    border-color: var(--accent);
}
[data-theme="dark"] .search-filter-select {
    color-scheme: dark;
}
[data-theme="dark"] .search-filter-select option {
    background: #1a1812;
    color: #ddd8ce;
}
.search-book-select {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    padding: 0 0.5rem;
    height: 100%;
    color: rgba(255,255,255,0.7);
    background: transparent !important;
    border: none;
    border-left: 1px solid rgba(255,255,255,0.1);
    border-radius: 0;
    cursor: pointer;
    max-width: 160px;
}
.search-book-select:focus {
    outline: none;
}
.search-book-select option {
    background: var(--bg-page);
    color: var(--text-primary);
}
.search-pagination {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
}
.search-page-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--accent);
    text-decoration: none;
    background: var(--bg-card);
    transition: border-color 0.12s, background 0.12s;
}
.search-page-btn:hover { border-color: var(--accent); background: var(--bg-subtle); }
.search-page-btn.disabled { color: var(--text-muted); pointer-events: none; opacity: 0.5; }
.search-page-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex: 1;
    text-align: center;
}

/* ============================================================
   SIDEBAR COLLAPSE — desktop toggle
   ============================================================ */
.reader-layout.sidebar-closed .reader-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}
.reader-layout.sidebar-closed .reader-main {
    margin-left: 0;
}
.reader-sidebar { transition: transform 0.25s ease; }
.reader-main    { transition: margin-left 0.25s ease; }

/* Prevent panel showing below sidebar width on small desktops */
@media (min-width: 769px) {
    .xref-panel { display: flex; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .xref-panel { width: 280px; }
}

@media (max-width: 768px) {
    :root { --sidebar-width: 240px; }

    .reader-sidebar { transform: translateX(-100%); }
    .reader-sidebar.open { transform: translateX(0); }
    .reader-layout.sidebar-closed .reader-sidebar { transform: translateX(-100%); }
    .reader-sidebar { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
    .sidebar-overlay.open { display: block; }

    .reader-main { margin-left: 0 !important; }
    .reader-layout.sidebar-closed .reader-main { margin-left: 0; }
    .reading-progress-bar { left: 0; }

    /* Bottom sheet on mobile — replaces side panel */
    .xref-panel {
        display: flex;
        width: 100%;
        height: clamp(320px, 60vh, 75vh);
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        border-left: none;
        border-top: 1px solid var(--border-light);
        box-shadow: 0 -4px 24px rgba(0,0,0,0.14);
        transform: translateY(100%);
        border-radius: 16px 16px 0 0;
        z-index: 80;
    }
    .xref-panel.open { transform: translateY(0); }

    /* Drag handle visual cue */
    .xref-panel-header::before {
        content: '';
        display: block;
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: var(--border-light);
        border-radius: 2px;
    }
    .xref-panel-header { position: relative; padding-top: 20px; }

    /* Tighter on the sheet — screen height is the scarce resource here, and the
       list is what the user came for. 3 lines, not 4. */
    .panel-verse-text {
        -webkit-line-clamp: 3;
        margin: 0.45rem 0 0;
        font-size: 0.86rem;
        line-height: 1.5;
    }

    .reader-content { padding: 1.5rem 1.25rem 3rem; }
    .chapter-heading { margin: 1rem 0 1.5rem; }
    .chapter-book { font-size: 0.95rem; }
    .chapter-number { font-size: 2.3rem; }
    .reader-search-form { max-width: 100%; }
}

@media (max-width: 600px) {
    /* Logo/site name stays on mobile (links home — no separate home icon);
       ellipsis-truncates against the control cluster on the right */
    .reader-header-left { flex: 1; min-width: 0; gap: 0.5rem; }
    .reader-logo {
        font-size: 0.85rem;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    /* image logos carry inline height:40px — rein in on small screens */
    .reader-logo img { height: 30px !important; max-width: 150px; object-fit: contain; }
    .parallel-toggle-btn { display: none; }
    .reader-header { justify-content: flex-start; gap: 0.75rem; }
    .reader-header-center { flex: 0 0 auto; margin-left: auto; padding: 0; gap: 0.75rem; }

    /* Mobile: no top search icon — search lives in the bottom nav.
       The hidden form still auto-expands on the search route (reader.js). */
    .reader-search-form { display: none; }

    .reader-header-center.search-expanded {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        padding: 0 0.75rem;
        z-index: 110;
        background: var(--brand-dark);
        display: flex;
        align-items: center;
        gap: 0;
    }
    /* Dim the page while inline search is open — entering search from the
       bottom nav reads as a mode. Sits above header (100), below the
       expanded search bar (110); bottom nav (200) stays interactive.
       (Tried backdrop-filter blur here — too much going on behind the
       search bar's own glow; a plain dim reads cleaner.) */
    .bb-search-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 105;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.22s ease, visibility 0.22s;
    }
    .bb-search-backdrop.open { opacity: 1; visibility: visible; }
    /* While search mode is open the header rides above the backdrop, so the
       expanded bar (which covers the full header strip) stays undimmed */
    .reader-header.search-mode { z-index: 106; }
    .reader-header-center.search-expanded .mobile-home-btn,
    .reader-header-center.search-expanded .mobile-search-toggle {
        display: none;
    }
    .reader-header-center.search-expanded .reader-search-form {
        display: flex;
        max-width: 100%;
        flex: 1;
        min-width: 0;
        opacity: 1;
    }
    .reader-header-center.search-expanded .reader-search-input {
        font-size: 1rem;
        padding: 0.55rem 0.75rem;
    }
    /* Coordinated entrance: the bar scales/fades in on the same beat as the
       backdrop's blur, instead of just popping into place the instant
       display flips from none to flex. reader.js adds .search-form-in one
       frame after .search-expanded (a display:none element can't transition,
       so it needs a painted starting frame to animate away from) and strips
       both together on close. Gated to no-preference so reduced-motion users
       just get the opacity:1 base above with no transform at all. */
    @media (prefers-reduced-motion: no-preference) {
        .reader-header-center.search-expanded .reader-search-form {
            transform: scale(0.97);
            opacity: 0;
            transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.16s ease;
        }
        .reader-header-center.search-expanded.search-form-in .reader-search-form {
            transform: scale(1);
            opacity: 1;
        }
    }
    /* Accent glow on focus while in the full-screen mobile search moment —
       replaces the default outline so the sequence (tap icon -> frost ->
       glowing input) reads as one deliberate moment, not three separate
       UI states bolted together. */
    .reader-header-center.search-expanded .reader-search-form:focus-within {
        /* The 22px accent bloom is gone. Blur cannot carry a focus indicator:
           every pixel in it is a different opacity, so none of it reaches 3:1
           and there is no edge to measure. It read as a blurred duplicate of
           the pill rather than as light — loud, and below threshold. Same
           gold ring as desktop; the dimmed page does the drama. */
        border-color: var(--bb-focus-ring);
    }
    .mobile-search-close {
        display: none;
        background: none;
        border: none;
        color: rgba(255,255,255,0.6);
        width: 36px;
        height: 36px;
        padding: 0;
        cursor: pointer;
        flex-shrink: 0;
        justify-content: center;
    }
    .mobile-search-close:hover { color: #fff; background: transparent; }
    .reader-header-center.search-expanded .mobile-search-close {
        display: flex;
        align-items: center;
    }
}

/* ============================================================
   TOPIC EXPLORER — shared
   ============================================================ */
.te-page { }

.te-main {
    max-width: 760px;
    margin: 0 auto;
    padding: calc(var(--header-height) + 2rem) 1.5rem 5rem;
}

.te-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.te-breadcrumb a { color: var(--accent); text-decoration: none; }
.te-breadcrumb a:hover { text-decoration: underline; }

.te-section {
    margin-top: 2rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border-light);
}
.te-section-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* summary + meaning sentences */
.te-topic-summary {
    font-family: 'Lora', Georgia, serif;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-top: 1.25rem;
    font-style: italic;
}
.te-topic-meaning {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* tier shelves on browse (Phase 1a Task 7.5c) — intentional editorial cut, not data-model labels */
.te-tier {
    margin-top: 2.5rem;
}
.te-tier:first-of-type {
    margin-top: 1.5rem;
}
.te-tier-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 0.5rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-light);
}
/* tier intro caption (Task 7.5d copy layer; tightened rhythm Task 7.5e) */
.te-tier-intro {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin: 0 0 0.6rem;
    max-width: 60ch;
}

/* card click-energy polish (Task 7.5e) */
.te-cluster-anchors { color: var(--text-secondary); }
.te-cluster-arrow { opacity: 0.85; }
.te-cluster-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.10);
}
/* footer search affordance on browse (Task 7.5d copy layer) */
.te-browse-footer-search {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}
.te-browse-footer-search a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-left: 0.4rem;
}
.te-browse-footer-search a:hover { text-decoration: underline; }

/* anchor preview on browse cards (Phase 1a Task 7.5) */
.te-cluster-anchors {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* copy all verses (Phase 1a Task 5) */
.te-copy-all {
    float: right;
    margin-top: -0.15rem;
    background: none !important;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.te-copy-all:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: transparent;
}
.te-copy-all--ok {
    color: #3a8c3a;
    border-color: #3a8c3a;
    background: rgba(80, 160, 80, 0.08);
}
.te-copy-all--err {
    color: #c0392b;
    border-color: #c0392b;
    background: rgba(192, 57, 43, 0.08);
}
.te-copy-all:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* xref walker — anchor verse trigger (Phase 1a Task 4) */
.te-anchor-xref {
    display: inline-block;
    background: none;
    border: none;
    padding: 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: color 0.12s;
}
.te-anchor-xref:hover { color: var(--accent); text-decoration: underline; background: none; }
.te-anchor-xref:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* shared-verse adjacency (Phase 1a Task 3) */
.te-adjacency-intro {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin: 0 0 1rem;
}
.te-adjacency-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem 1.25rem;
}
.te-adjacency-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-light);
}
.te-adjacency-link {
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}
.te-adjacency-link:hover {
    text-decoration: underline;
    color: var(--accent);
}
.te-adjacency-count {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* section group — "How X Works" wrapper */
.te-section-group {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}
.te-section-group-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0;
}
.te-section-group > .te-section {
    margin-top: 1.75rem;
    padding-top: 1.5rem;
}
.te-section-group > .te-section:first-of-type {
    margin-top: 1.25rem;
}

/* "includes" bullet list */
.te-includes-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.te-includes-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}
.te-includes-link::before { content: '– '; color: var(--text-muted); }
.te-includes-link:hover { text-decoration: underline; }

/* ============================================================
   TOPIC EXPLORER — grid mode
   ============================================================ */
.te-hero {
    text-align: center;
    margin-bottom: 2.5rem;
}
.te-hero-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.te-hero-sub {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.te-cluster-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.te-cluster-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.4rem 1.25rem 1rem;
    background: var(--cluster-bg, var(--bg-subtle));
    border: 1px solid transparent;
    border-radius: 0 8px 8px 0;
    text-decoration: none;
    transition: all 0.18s;
    border-left: 4px solid var(--cluster-accent, var(--accent));
}
.te-cluster-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.te-cluster-card-body { margin-bottom: 1rem; }
.te-cluster-title {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--cluster-accent, var(--text-primary));
    margin-bottom: 0.4rem;
}
.te-cluster-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.te-cluster-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.te-cluster-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cluster-accent, var(--text-muted));
    opacity: 0.75;
}
.te-cluster-arrow {
    font-size: 1rem;
    color: var(--cluster-accent, var(--accent));
    opacity: 0.6;
    transition: opacity 0.15s, transform 0.15s;
}
.te-cluster-card:hover .te-cluster-arrow { opacity: 1; transform: translateX(3px); }

.te-grid-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}
.te-alt-link { color: var(--accent); text-decoration: none; }
.te-alt-link:hover { text-decoration: underline; }

/* ============================================================
   TOPIC EXPLORER — cluster mode
   ============================================================ */
.te-cluster-hero {
    padding: 1.5rem 1.5rem 1.25rem;
    background: var(--cluster-bg, var(--bg-subtle));
    border-left: 4px solid var(--cluster-accent, var(--accent));
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.75rem;
}
.te-cluster-hero h1 {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--cluster-accent, var(--text-primary));
    margin-bottom: 0.35rem;
}
.te-cluster-hero p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.te-topic-list { display: flex; flex-direction: column; gap: 0; }
.te-topic-row {
    display: block;
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    transition: background 0.12s, padding-left 0.12s;
    border-radius: 4px;
}
.te-topic-row:hover { background: var(--bg-subtle); padding-left: 1rem; }
.te-topic-row:last-child { border-bottom: none; }
.te-topic-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.te-topic-row-header {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.te-topic-row-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}
.te-topic-anchor-chip {
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent);
    opacity: 0.7;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.te-topic-row-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.te-topic-row-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.te-meta-chip {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--badge-bg);
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    white-space: nowrap;
}
.te-row-arrow {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: color 0.12s, transform 0.12s;
}
.te-topic-row:hover .te-row-arrow { color: var(--accent); transform: translateX(3px); }

/* ============================================================
   TOPIC EXPLORER — topic detail: header
   ============================================================ */
.te-topic-header {
    margin-bottom: 0.5rem;
}
.te-topic-name {
    font-family: 'Lora', Georgia, serif;
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}
.te-topic-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 0.75rem;
}
.te-topic-meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.te-type-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    background: var(--bg-subtle);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    text-decoration: none;
}
.te-type-badge:hover { background: var(--bg-hover); }
.te-parent-chip {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.te-parent-chip a { color: var(--accent); text-decoration: none; }
.te-parent-chip a:hover { text-decoration: underline; }

/* ============================================================
   TOPIC EXPLORER — directed relation rows
   ============================================================ */
.te-rel-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.te-rel-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow: hidden;
}

.te-rel-node {
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.te-rel-node--current {
    background: var(--brand-dark);
    color: #fff;
    font-family: 'Lora', Georgia, serif;
    font-size: 0.9rem;
}

.te-rel-node--link {
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    text-decoration: none;
}
.te-rel-node--link:hover { color: var(--accent); text-decoration: underline; }

.te-rel-arr {
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.te-rel-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
}

/* edge type badges */
.te-edge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: lowercase;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    background: var(--badge-bg);
    color: var(--badge-color);
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.te-edge-leadsto     { background: #e8f4fd; color: #1a6fa0; }
.te-edge-resultsin   { background: #e8fdf0; color: #1a7a45; }
.te-edge-cause       { background: #fde8e8; color: #9a1a1a; }
.te-edge-determines  { background: #fef3e8; color: #9a5c00; }
.te-edge-reverses    { background: #fde8f4; color: #9a1a6a; }
.te-edge-transformsto{ background: #f4e8fd; color: #6a1a9a; }
.te-edge-dependson   { background: #fef3e8; color: #9a5c00; }
.te-edge-parentchild { background: #f0e8fd; color: #5c1a9a; }
.te-edge-related     { background: var(--rel-type-bg); color: var(--text-muted); }

/* ============================================================
   TOPIC EXPLORER — anchor verses
   ============================================================ */
.te-anchor-list { display: flex; flex-direction: column; gap: 0; }
.te-anchor-item {
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border-light);
}
.te-anchor-item:last-child { border-bottom: none; }
.te-anchor-ref {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 0.3rem;
    letter-spacing: 0.02em;
}
.te-anchor-ref:hover { text-decoration: underline; }
.te-anchor-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
}
/* primary action: expand context (Phase 1b) */
.te-anchor-expand {
    display: block;
    background: none;
    border: none;
    padding: 0;
    margin-top: 0.4rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    letter-spacing: 0.01em;
}
.te-anchor-expand:hover { text-decoration: underline; background: none; }
.te-anchor-expand:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}
.te-anchor-expand.te-expand--open { color: var(--text-muted); }

/* secondary utility row */
.te-anchor-utils {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
}
.te-anchor-context {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.12s;
}
.te-anchor-context:hover { color: var(--accent); }
.te-context-panel {
    margin-top: 0.6rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary, #f8f6f3);
    border-radius: 0 6px 6px 0;
    border-left: 3px solid var(--accent);
}
.te-context-panel * { background: transparent; }
[data-theme="dark"] .te-context-panel {
    background: var(--bg-secondary, #1e1c1a);
}
.te-context-verses {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.te-context-verse {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-muted);
}
.te-context-verse--center {
    color: var(--text-primary);
    font-weight: 600;
}
.te-context-ref {
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--accent);
    margin-right: 0.3rem;
}
.te-context-text { /* inherits from .te-context-verse */ }
.te-context-hint {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    opacity: 0.7;
}
.te-context-loading,
.te-context-error {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.te-anchor-hidden { display: none; }
.te-anchor-count {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
}
.te-anchor-count::before {
    content: "\00b7";
    margin: 0 0.45em;
}
.te-testament-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 1.25rem 0 0.5rem;
}
.te-testament-label:first-of-type { margin-top: 0; }
.te-show-all-btn {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.65rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--accent);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.te-show-all-btn:hover { border-color: var(--accent); background: var(--bg-hover); }

/* ============================================================
   TOPIC EXPLORER — Reading Path (thematic verse journey)
   ============================================================ */
.te-section--reading-path {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 1.5rem;
}
.te-rp-intro {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}
.te-rp-steps {
    display: flex;
    flex-direction: column;
}
.te-rp-step {
    display: flex;
    gap: 1rem;
    min-height: 0;
}
.te-rp-step-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 28px;
}
.te-rp-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.te-rp-step-line {
    width: 2px;
    flex: 1;
    background: var(--border-light);
    min-height: 20px;
}
.te-rp-step-body {
    padding-bottom: 1.5rem;
    flex: 1;
    min-width: 0;
}
.te-rp-step:last-child .te-rp-step-body { padding-bottom: 0; }
.te-rp-topic-name {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.te-rp-topic-name:hover { text-decoration: underline; }
.te-rp-verse-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--text-primary);
    font-style: italic;
    margin: 0.4rem 0 0.35rem;
}
.te-rp-verse-ref {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.12s;
}
.te-rp-verse-ref:hover { color: var(--accent); }

@media (max-width: 480px) {
    .te-section--reading-path { padding: 1.25rem 1rem; }
    .te-rp-step { gap: 0.75rem; }
}

/* ============================================================
   TOPIC EXPLORER — connections section
   ============================================================ */

.te-no-data {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.te-no-data a { color: var(--accent); text-decoration: none; }
.te-no-data a:hover { text-decoration: underline; }

/* ============================================================
   TOPIC EXPLORER — topic detail: new header layout
   ============================================================ */
.te-header {
    margin-bottom: 0.5rem;
}
.te-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 2.2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    line-height: 1.25;
}
.te-description {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    max-width: 600px;
}

/* Type badge color variants */
.te-type-doctrine   { background: rgba(100,120,200,0.1); color: #6478c8; }
.te-type-virtue     { background: rgba(80,160,100,0.1);  color: #4a9060; }
.te-type-practice   { background: rgba(180,130,60,0.12); color: var(--accent); }
.te-type-experience { background: rgba(160,80,160,0.1);  color: #a050a0; }
[data-theme="dark"] .te-type-doctrine   { background: rgba(100,120,200,0.15); color: #8898e0; }
[data-theme="dark"] .te-type-virtue     { background: rgba(80,160,100,0.15);  color: #5cb87a; }
[data-theme="dark"] .te-type-practice   { background: rgba(180,130,60,0.18);  color: #c89450; }
[data-theme="dark"] .te-type-experience { background: rgba(160,80,160,0.15);  color: #c068c0; }

/* ============================================================
   TOPIC EXPLORER — "Why this matters" block
   ============================================================ */
.te-why-block {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.75rem;
    max-width: 520px;
    line-height: 1.6;
}

/* ============================================================
   TOPIC EXPLORER — flow section intro + expand button
   ============================================================ */
.te-flow-intro {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.te-spine-expand-btn {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none !important;
    border: 1px dashed var(--border-light);
    border-radius: 4px;
    padding: 0.18rem 0.45rem;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
    flex-shrink: 0;
    line-height: 1;
}
.te-spine-expand-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    border-style: solid;
    background: transparent;
}
.te-spine-expand-btn:disabled {
    opacity: 0.5;
    cursor: default;
}
.te-spine-node--expanded {
    opacity: 0;
    animation: te-fade-in 0.2s ease forwards;
}
@keyframes te-fade-in {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   TOPIC EXPLORER — API pitch block
   ============================================================ */
.te-api-pitch {
    margin-top: 2rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-subtle);
}
.te-api-pitch-text {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}
.te-api-pitch-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.te-api-pitch-link:hover { text-decoration: underline; }

/* ============================================================
   TOPIC EXPLORER — relationship table (directed rows)
   ============================================================ */
.te-rel-table {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Override te-rel-row for the table layout */
.te-rel-table .te-rel-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    flex-wrap: nowrap;
    overflow: visible;
}

.te-rel-dir {
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
    padding-top: 0.05rem;
    width: 1rem;
    text-align: center;
}
.te-rel-out { color: var(--accent); }
.te-rel-in  { color: var(--text-muted); }

.te-rel-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 9rem;
    padding-top: 0.15rem;
}

.te-rel-nodes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex: 1;
}

/* Nodes inside the rel table: styled as chips */
.te-rel-table .te-rel-node {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 0.2rem 0.55rem;
    text-decoration: none;
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
    transition: color 0.12s, border-color 0.12s;
}
.te-rel-table .te-rel-node:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* ============================================================
   TOPIC EXPLORER — theological flow spine
   ============================================================ */
.te-spine-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.te-spine-chain {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.te-spine-arrow {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.te-spine-node {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--accent);
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 0.22rem 0.6rem;
    text-decoration: none;
    transition: all 0.12s;
}
.te-spine-node:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}
.te-spine-node--current {
    background: var(--brand-dark);
    color: #fff;
    border-color: var(--brand-dark);
    font-weight: 600;
}
[data-theme="dark"] .te-spine-node--current {
    background: var(--accent);
    border-color: var(--accent);
}
.te-spine-node--current:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    opacity: 0.9;
}

/* ============================================================
   TOPIC EXPLORER — flow path groups (before / consequence / redemption)
   ============================================================ */
.te-flow-group {
    margin-top: 1.1rem;
}
.te-flow-group + .te-flow-group {
    margin-top: 1.35rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border-light);
}
.te-flow-connecting {
    font-family: 'Lora', serif;
    font-size: 0.88rem;
    font-style: italic;
    color: var(--text-secondary);
    margin: 0.35rem 0 0;
    line-height: 1.55;
}
.te-flow-group-label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.55rem;
    color: var(--text-secondary);
}
.te-flow-group--before      .te-flow-group-label { color: var(--text-secondary); }
.te-flow-group--consequence .te-flow-group-label { color: var(--text-muted); }
.te-flow-group--redemption  .te-flow-group-label { color: var(--accent); }

/* All spine nodes slightly lighter so label reads first */
.te-flow-group .te-spine-node:not(.te-spine-node--current) {
    opacity: 0.82;
}

/* Consequence path — extra muted */
.te-flow-group--consequence .te-spine-node:not(.te-spine-node--current) {
    opacity: 0.65;
}

/* Redemption path — warmer/brighter, full opacity */
.te-flow-group--redemption .te-spine-node:not(.te-spine-node--current) {
    opacity: 1;
    border-color: color-mix(in srgb, var(--accent) 50%, var(--border-light));
    color: var(--accent);
}

/* ============================================================
   TOPIC EXPLORER — anchors (alias for anchor-list)
   ============================================================ */
.te-anchors {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ============================================================
   TOPIC EXPLORER — related chips
   ============================================================ */
.te-related-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.te-related-chip {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    text-decoration: none;
    transition: color 0.12s, border-color 0.12s;
}
.te-related-chip:hover { color: var(--accent); border-color: var(--accent); }

/* ============================================================
   TOPIC EXPLORER — entry / browse links
   ============================================================ */
.te-section--entry {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: flex-start;
}

.te-read-link {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.12s;
}
.te-read-link:hover { color: var(--accent-hover); text-decoration: underline; }
.te-read-link--muted { color: var(--text-muted); font-size: 0.8rem; }
.te-read-link--muted:hover { color: var(--text-secondary); }

/* ============================================================
   TOPIC EXPLORER — "Start Exploring" chains
   ============================================================ */
.te-start-section {
    margin-bottom: 3rem;
    padding: 1.5rem 1.75rem;
    background: var(--bg-subtle);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}
.te-start-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.te-start-framing {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.25rem;
}
.te-start-chains {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.te-start-chain {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    text-decoration: none;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.te-start-chain:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.te-chain-node {
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}
.te-chain-cta {
    margin-left: auto;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.12s;
}
.te-start-chain:hover .te-chain-cta { opacity: 1; }
.te-start-arrow {
    font-size: 0.75rem;
    color: var(--accent);
    opacity: 0.6;
}

/* Inline relation preview rows on browse list */
.te-row-rels {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-top: 0.3rem;
}
.te-row-rel {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ============================================================
   TOPIC EXPLORER — browse mode
   ============================================================ */
.te-browse-main {
    max-width: 820px;
    margin: 0 auto;
    padding: calc(var(--header-height) + 2.5rem) 1.5rem 5rem;
}
.te-browse-hero {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
}
.te-browse-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 2.2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}
.te-browse-sub {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 520px;
    margin: 0 auto;
    text-align: left;
}
.te-browse-group {
    margin-bottom: 2.5rem;
}
.te-browse-type {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0;
    border-bottom: none;
}

/* Start Exploring — hero-style entry cards */
.te-browse-group--explore {
    margin-bottom: 3rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-light);
}
.te-browse-group--explore .te-browse-type {
    font-size: 0.7rem;
    color: var(--accent);
    margin-bottom: 1rem;
}
.te-browse-group--explore .te-cluster-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
.te-browse-group--explore .te-cluster-card {
    padding: 1.6rem 1.5rem 1.2rem;
    border-left-width: 5px;
    border-left-color: var(--accent);
    background: var(--bg-subtle);
}
.te-browse-group--explore .te-cluster-title {
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}
.te-browse-group--explore .te-cluster-desc {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
}

/* cluster-name is used in topic-explorer browse cards */
.te-cluster-name {
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: auto;
    padding-bottom: 0.75rem;
}
/* Directional edge on browse cards — the "where does this lead?" line */
.te-cluster-direction {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.01em;
}

/* ============================================================
   TOPIC EXPLORER — responsive
   ============================================================ */
@media (max-width: 600px) {
    .te-main,
    .te-browse-main { padding-left: 1rem; padding-right: 1rem; }
    .te-cluster-grid { grid-template-columns: 1fr; }
    .te-topic-name { font-size: 1.6rem; }
    .te-hero-title { font-size: 1.6rem; }
    .te-title { font-size: 1.6rem; }
    .te-browse-title { font-size: 1.6rem; }
    .te-rel-label { min-width: 7rem; }

    /* Section title: stack copy button below on narrow screens */
    .te-section-title {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.4rem 0.75rem;
    }

    /* Touch-friendly action buttons */
    .te-anchor-expand {
        font-size: 0.78rem;
        padding: 0.45rem 0;
        -webkit-tap-highlight-color: transparent;
    }
    .te-anchor-utils {
        padding: 0.2rem 0;
    }
    .te-anchor-context,
    .te-anchor-xref {
        font-size: 0.7rem;
        padding: 0.35rem 0;
        -webkit-tap-highlight-color: transparent;
    }

    /* Context panel tighter on mobile */
    .te-context-panel { padding: 0.6rem 0.75rem; }
    .te-context-verse { font-size: 0.84rem; }
    .te-context-ref { font-size: 0.64rem; }

    /* Entry links — touch targets */
    .te-read-link {
        display: block;
        padding: 0.6rem 0;
    }

    /* Browse sub text */
    .te-browse-sub { font-size: 0.9rem; }

    /* Adjacency section */
    .te-adjacency-item { padding: 0.4rem 0; }
}

@media (max-width: 480px) {
    .reader-content { padding: 1.25rem 1rem 3rem; }
}

/* ============================================================
   THEME TOGGLE BUTTON
   ============================================================ */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    color: rgba(255,255,255,0.75) !important;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    padding: 0.3rem 0.5rem;
}
.theme-toggle:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.15); color: #fff !important; }
.theme-toggle:focus-visible { outline: 2px solid rgba(255,255,255,0.4); outline-offset: 2px; }

/* Show moon in light mode, sun in dark mode */
.theme-icon-sun  { display: none; }
.theme-icon-moon { display: block; }
[data-theme="dark"] .theme-icon-sun  { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }

/* ============================================================
   MOBILE BOTTOM NAV — shown below 640px (when header nav hides)
   ============================================================ */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    transition: background-color 0.2s ease, transform 0.22s ease, opacity 0.22s ease;
    padding: 0.45rem 0;
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px));
}
.mobile-bottom-nav.nav-hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}
.mobile-bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    max-width: 400px;
    margin: 0 auto;
}
.mobile-bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    transition: color 0.12s;
    -webkit-tap-highlight-color: transparent;
}
.mobile-bottom-nav-link svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
}
.mobile-bottom-nav-link.active {
    color: var(--accent);
}
.mobile-bottom-nav-link:active {
    color: var(--accent);
}

@media (max-width: 640px) {
    .mobile-bottom-nav { display: block; }
    /* Add bottom padding to pages so content isn't hidden behind bottom nav */
    .reader-index-page { padding-bottom: 70px; }
    .search-main { padding-bottom: 80px; }
    .plans-main { padding-bottom: calc(5rem + 60px); }
    .plan-page-main { padding-bottom: calc(5rem + 60px); }
}

/* ============================================================
   CLOUD SYNC
   ============================================================ */
.sync-header-btn {
    display: flex; align-items: center; justify-content: center;
    background: none; border: none;
    color: #a0a0a0 !important;
    cursor: pointer; padding: 6px; border-radius: 4px;
    transition: color 0.15s; flex-shrink: 0;
}
.sync-header-btn:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.08); }
.sync-header-btn.sync-active { color: var(--accent); }
/* Blanket reset — explicit backgrounds on child rules override as expected */
.sync-modal * { background: transparent; }
.sync-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 9998;
}
.sync-modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--bg-card); border-radius: 12px;
    width: 90%; max-width: 360px; z-index: 9999;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    color: var(--text-primary);
}
.sync-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; border-bottom: 1px solid var(--border-light);
    font-weight: 600; font-size: 0.95rem; color: var(--text-primary);
    background: transparent;
}
.sync-modal-close {
    background: none; border: none; font-size: 22px; cursor: pointer;
    color: var(--text-muted); line-height: 1;
}
.sync-modal-close:hover { background: rgba(255,255,255,0.08); }
.sync-modal-body { padding: 20px; background: transparent; }
.sync-hint {
    color: var(--text-secondary); font-size: 0.88rem;
    margin-bottom: 16px; line-height: 1.5;
}
.sync-status-label {
    color: var(--text-muted); font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px;
}
.sync-code-display {
    font-size: 1.7rem; font-weight: 700; letter-spacing: 0.08em;
    color: var(--accent); text-align: center; padding: 14px;
    background: var(--bg-subtle); border-radius: 8px; margin-bottom: 16px;
    font-family: 'Inter', monospace;
}
.sync-btn {
    display: block; width: 100%; padding: 10px; border: none; border-radius: 8px;
    font-size: 0.9rem; cursor: pointer; margin-bottom: 8px; font-weight: 500;
    font-family: 'Inter', sans-serif;
}
.sync-btn-primary { background: var(--accent); color: #fff; }
.sync-btn-primary:hover { opacity: 0.9; background: var(--accent); }
.sync-btn-secondary { background: var(--bg-subtle); color: var(--text-primary); }
.sync-btn-secondary:hover { background: var(--bg-subtle); }
.sync-btn-danger { background: none; color: var(--text-muted); font-size: 0.82rem; }
.sync-btn-danger:hover { background: rgba(255,255,255,0.08); }
.sync-divider {
    text-align: center; color: var(--text-muted); margin: 14px 0; font-size: 0.82rem;
    display: flex; align-items: center; gap: 12px;
}
.sync-divider::before, .sync-divider::after {
    content: ''; flex: 1; border-top: 1px solid var(--border-light);
}
.sync-code-input {
    display: block; width: 100%; padding: 10px 12px;
    border: 1px solid var(--border-light); border-radius: 8px;
    font-size: 1rem; text-align: center; letter-spacing: 0.1em;
    background: var(--bg-page); color: var(--text-primary);
    margin-bottom: 10px; text-transform: uppercase;
    font-family: 'Inter', monospace;
    box-sizing: border-box;
}
.sync-code-input:focus { outline: none; border-color: var(--accent); }
.sync-code-input.sync-input-error { border-color: #c0392b; }
.sync-error-msg { display: none; color: #c0392b; font-size: 0.78rem; line-height: 1.4; margin-top: 6px; }

/* ============================================================
   RATE LIMIT NOTICE
   ============================================================ */
.reader-limit-notice {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 380px;
    margin: 2rem auto;
}
.reader-limit-notice p:first-child {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}
.reader-limit-notice p:nth-child(2) {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}
.reader-limit-links {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
}
.reader-limit-links a {
    display: inline-block;
    padding: 0.4rem 1rem;
    font-size: 0.82rem;
    border: 1px solid var(--accent);
    color: var(--accent);
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.reader-limit-links a:hover {
    background: var(--accent);
    color: #fff;
}

/* ============================================================
   VERSE NOTES
   ============================================================ */
.verse-note-indicator {
    color: var(--accent);
    margin-left: 0.2rem;
    cursor: help;
    vertical-align: middle;
    display: inline-flex;
    opacity: 0.7;
}
.verse-note-indicator svg { display: block; }
.va-note-active { color: var(--accent) !important; }
.note-textarea {
    display: block; width: 100%; padding: 10px 12px;
    border: 1px solid var(--border-light); border-radius: 8px;
    font-size: 0.9rem; line-height: 1.5;
    background: var(--bg-page); color: var(--text-primary);
    margin-bottom: 12px; resize: vertical; min-height: 100px;
    font-family: 'Inter', sans-serif; box-sizing: border-box;
}
.note-textarea:focus { outline: none; border-color: var(--accent); }

/* ============================================================
   HIGHLIGHT & NOTES BROWSER
   ============================================================ */
.hl-browser-modal { max-height: 80vh; display: flex; flex-direction: column; }
.hl-browser-body { overflow-y: auto; max-height: 60vh; background: transparent; }
.hl-browser-book {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-muted);
    margin: 16px 0 6px; padding-top: 8px;
    border-top: 1px solid var(--border-light);
    background: transparent;
}
.hl-browser-book:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.hl-browser-item {
    display: flex; align-items: baseline; gap: 8px;
    padding: 6px 0; text-decoration: none; color: var(--text-primary);
    font-size: 0.88rem; line-height: 1.4;
    background: transparent;
}
.hl-browser-item:hover { color: var(--accent); }
.hl-browser-dot {
    width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0; display: inline-block;
}
.hl-browser-dot.verse-hl-yellow { background: #f5c842; }
.hl-browser-dot.verse-hl-green { background: #4caf50; }
.hl-browser-dot.verse-hl-blue { background: #42a5f5; }
.hl-browser-dot.verse-hl-pink { background: #ec407a; }
.hl-browser-ref { font-weight: 500; white-space: nowrap; }
.hl-browser-note {
    font-size: 0.8rem; color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}


/* ============================================================
   Plan page CSS migration — added 2026-04-13
   Source of truth: /var/www/html/plans/{index,plan,day}.php
   Migrated from inline <style> blocks that never reached reader.css
   during the v1.0.4 WP blocker fix. Discovered as unstyled plan
   pages on ziemercomply.com test install (non-holybible.dev origin).

   Scoping fix vs standalone: plan-day standalone used
   `body { padding-bottom: 90px }` to clear the fixed day-complete
   bar — rewritten to `.day-main { padding-bottom: 90px }` so the
   rule can't leak into the host WordPress theme.
   ============================================================ */

/* --- Plans listing (routes/plans.php) --- */
/* ---- Plans page layout ---- */
        .plans-main {
            max-width: 760px;
            margin: 0 auto;
            padding: calc(var(--header-height) + 2.5rem) 1.5rem 5rem;
        }
        .plans-hero {
            margin-bottom: 2.5rem;
        }
        .plans-hero h1 {
            font-family: 'Lora', Georgia, serif;
            font-size: 2rem;
            font-weight: 500;
            color: var(--text-primary);
            margin-bottom: 0.5rem;
        }
        .plans-hero p {
            font-family: 'Inter', sans-serif;
            font-size: 0.95rem;
            color: var(--text-secondary);
            line-height: 1.6;
        }

        /* ---- Plan cards ---- */
        .plans-grid {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }
        .plan-card {
            background: var(--bg-card);
            border: 1px solid var(--border-light);
            border-radius: 8px;
            padding: 1.4rem 1.5rem;
            display: grid;
            grid-template-columns: 48px 1fr auto;
            gap: 0 1.2rem;
            align-items: center;
            text-decoration: none;
            color: inherit;
            box-shadow: var(--shadow-card);
            transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
        }
        .plan-card:hover {
            border-color: var(--accent);
            box-shadow: var(--shadow-card-hover);
            transform: translateY(-1px);
        }
        .plan-card-icon {
            width: 48px;
            height: 48px;
            border-radius: 10px;
            background: var(--bg-subtle);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--accent);
            flex-shrink: 0;
        }
        .plan-card-body {
            min-width: 0;
        }
        .plan-card-top {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            margin-bottom: 0.25rem;
        }
        .plan-card-name {
            font-family: 'Inter', sans-serif;
            font-size: 1rem;
            font-weight: 600;
            color: var(--text-primary);
        }
        .plan-card-tag {
            font-family: 'Inter', sans-serif;
            font-size: 0.65rem;
            font-weight: 600;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--accent);
            background: var(--bg-subtle);
            padding: 0.15em 0.55em;
            border-radius: 3px;
            white-space: nowrap;
        }
        .plan-card-desc {
            font-family: 'Inter', sans-serif;
            font-size: 0.875rem;
            color: var(--text-secondary);
            line-height: 1.55;
        }
        .plan-card-meta {
            font-family: 'Inter', sans-serif;
            font-size: 0.8rem;
            color: var(--text-muted);
            white-space: nowrap;
            text-align: right;
            padding-left: 1rem;
        }
        .plan-card-days {
            font-size: 1.1rem;
            font-weight: 600;
            color: var(--text-primary);
            display: block;
        }

        /* ---- Progress indicator for active plans ---- */
        .plan-card-progress {
            margin-top: 0.7rem;
            display: none; /* shown by JS if plan is started */
        }
        .plan-card-progress-bar {
            height: 3px;
            background: var(--bg-subtle);
            border-radius: 2px;
            overflow: hidden;
        }
        .plan-card-progress-fill {
            height: 100%;
            background: var(--accent);
            border-radius: 2px;
            transition: width 0.3s;
        }
        .plan-card-progress-label {
            font-family: 'Inter', sans-serif;
            font-size: 0.72rem;
            color: var(--text-muted);
            margin-top: 0.3rem;
        }

        @media (max-width: 540px) {
            .plan-card {
                grid-template-columns: 40px 1fr;
                grid-template-rows: auto auto;
            }
            .plan-card-icon {
                width: 40px;
                height: 40px;
                grid-row: 1;
            }
            .plan-card-body {
                grid-column: 2;
                grid-row: 1;
            }
            .plan-card-meta {
                grid-column: 1 / -1;
                text-align: left;
                padding-left: 0;
                margin-top: 0.5rem;
                display: flex;
                align-items: center;
                gap: 0.5rem;
            }
            .plan-card-days {
                font-size: 0.9rem;
                display: inline;
            }
        }

/* --- Plan detail (routes/plan-detail.php) --- */
.plan-page-main {
            max-width: 860px;
            margin: 0 auto;
            padding: calc(var(--header-height) + 2rem) 1.5rem 5rem;
        }

        /* ---- Breadcrumb ---- */
        .plan-breadcrumb {
            font-family: 'Inter', sans-serif;
            font-size: 0.8rem;
            color: var(--text-muted);
            margin-bottom: 1.5rem;
        }
        .plan-breadcrumb a {
            color: var(--text-muted);
            text-decoration: none;
        }
        .plan-breadcrumb a:hover { color: var(--accent); }
        .plan-breadcrumb span { margin: 0 0.4rem; }

        /* ---- Plan header ---- */
        .plan-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 1.5rem;
            margin-bottom: 2rem;
        }
        .plan-header-left h1 {
            font-family: 'Lora', Georgia, serif;
            font-size: 1.75rem;
            font-weight: 500;
            color: var(--text-primary);
            margin-bottom: 0.35rem;
        }
        .plan-header-left p {
            font-family: 'Inter', sans-serif;
            font-size: 0.875rem;
            color: var(--text-secondary);
            line-height: 1.6;
            max-width: 520px;
        }
        .plan-header-right {
            flex-shrink: 0;
        }

        /* ---- Overall progress ---- */
        .plan-progress-row {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-bottom: 2rem;
            padding: 1rem 1.25rem;
            background: var(--bg-card);
            border: 1px solid var(--border-light);
            border-radius: 8px;
        }
        .plan-progress-row.hidden { display: none; }
        .plan-progress-bar-wrap {
            flex: 1;
        }
        .plan-progress-bar-bg {
            height: 6px;
            background: var(--bg-subtle);
            border-radius: 3px;
            overflow: hidden;
        }
        .plan-progress-bar-fill {
            height: 100%;
            background: var(--accent);
            border-radius: 3px;
            transition: width 0.4s ease;
            width: 0%;
        }
        .plan-progress-text {
            font-family: 'Inter', sans-serif;
            font-size: 0.78rem;
            color: var(--text-muted);
            margin-top: 0.35rem;
        }
        .plan-progress-pct {
            font-family: 'Inter', sans-serif;
            font-size: 1.1rem;
            font-weight: 600;
            color: var(--text-primary);
            white-space: nowrap;
        }
        .btn-continue {
            font-family: 'Inter', sans-serif;
            font-size: 0.85rem;
            font-weight: 600;
            background: var(--accent);
            color: #fff;
            border: none;
            border-radius: 6px;
            padding: 0.55rem 1.1rem;
            cursor: pointer;
            white-space: nowrap;
            text-decoration: none;
            display: inline-block;
        }
        .btn-continue:hover { background: var(--accent-hover); }

        /* ---- Start Plan CTA ---- */
        .plan-start-cta {
            background: var(--bg-card);
            border: 1px solid var(--border-light);
            border-radius: 8px;
            padding: 1.5rem;
            margin-bottom: 2rem;
            display: flex;
            align-items: center;
            gap: 1.5rem;
            flex-wrap: wrap;
        }
        .plan-start-cta.hidden { display: none; }
        .plan-start-cta p {
            font-family: 'Inter', sans-serif;
            font-size: 0.875rem;
            color: var(--text-secondary);
            flex: 1;
            min-width: 200px;
        }
        .plan-start-cta p strong {
            color: var(--text-primary);
        }
        .plan-start-actions {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            flex-wrap: wrap;
        }
        .start-date-label {
            font-family: 'Inter', sans-serif;
            font-size: 0.78rem;
            color: var(--text-muted);
            margin-right: 0.25rem;
        }
        input[type="date"].start-date-input {
            font-family: 'Inter', sans-serif;
            font-size: 0.85rem;
            background: var(--bg-subtle);
            border: 1px solid var(--border-light);
            border-radius: 5px;
            color: var(--text-primary);
            padding: 0.45rem 0.7rem;
            cursor: pointer;
        }
        input[type="date"].start-date-input:focus {
            outline: none;
            border-color: var(--accent);
        }
        .btn-start {
            font-family: 'Inter', sans-serif;
            font-size: 0.85rem;
            font-weight: 600;
            background: var(--accent);
            color: #fff;
            border: none;
            border-radius: 6px;
            padding: 0.55rem 1.2rem;
            cursor: pointer;
        }
        .btn-start:hover { background: var(--accent-hover); }
        .btn-reset {
            font-family: 'Inter', sans-serif;
            font-size: 0.78rem;
            color: var(--text-muted);
            background: none;
            border: none;
            cursor: pointer;
            padding: 0;
            text-decoration: underline;
            text-underline-offset: 2px;
        }
        .btn-reset:hover { color: var(--text-primary); background: none; }

        /* ---- Calendar ---- */
        .calendar-section {
            margin-top: 0.5rem;
        }
        .calendar-section-title {
            font-family: 'Inter', sans-serif;
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--text-muted);
            margin-bottom: 1rem;
        }

        /* Week-row grid (7 cols) */
        .calendar-week-header {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 4px;
            margin-bottom: 4px;
        }
        .calendar-week-header span {
            font-family: 'Inter', sans-serif;
            font-size: 0.65rem;
            font-weight: 600;
            color: var(--text-muted);
            text-align: center;
            padding: 0 0 2px;
        }
        .calendar-grid {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 4px;
        }

        /* Day cell */
        .cal-day {
            aspect-ratio: 1;
            border-radius: 5px;
            background: var(--bg-subtle);
            border: 1px solid transparent;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Inter', sans-serif;
            font-size: 0.72rem;
            font-weight: 500;
            color: var(--text-muted);
            cursor: pointer;
            text-decoration: none;
            transition: background 0.12s, border-color 0.12s, color 0.12s;
            position: relative;
            user-select: none;
        }
        .cal-day:hover {
            border-color: var(--accent);
            color: var(--accent);
            background: var(--bg-subtle);
        }

        /* States */
        .cal-day.completed {
            background: var(--accent);
            color: #fff;
            border-color: transparent;
        }
        .cal-day.completed:hover {
            background: var(--accent-hover);
            border-color: transparent;
            color: #fff;
        }
        .cal-day.today {
            border-color: var(--accent);
            color: var(--accent);
            font-weight: 700;
            background: var(--bg-hover);
        }
        .cal-day.today.completed {
            background: var(--accent);
            color: #fff;
        }
        .cal-day.future {
            opacity: 0.4;
            cursor: default;
        }
        .cal-day.future:hover {
            border-color: transparent;
            color: var(--text-muted);
        }
        /* Allow clicking future days anyway */
        .cal-day.future {
            cursor: pointer;
            opacity: 0.38;
        }
        .cal-day.future:hover {
            opacity: 0.65;
            border-color: var(--border-light);
        }

        /* "Today" ring pulse — only when not started */
        .cal-day.not-started-today {
            border-color: var(--accent);
            color: var(--accent);
            font-weight: 700;
        }

        /* Legend */
        .calendar-legend {
            display: flex;
            gap: 1.25rem;
            margin-top: 1rem;
            flex-wrap: wrap;
        }
        .legend-item {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            font-family: 'Inter', sans-serif;
            font-size: 0.75rem;
            color: var(--text-muted);
        }
        .legend-dot {
            width: 10px;
            height: 10px;
            border-radius: 2px;
            flex-shrink: 0;
        }
        .legend-dot.completed { background: var(--accent); }
        .legend-dot.today     { background: var(--bg-hover); border: 2px solid var(--accent); }
        .legend-dot.missed    { background: var(--bg-subtle); }
        .legend-dot.future    { background: var(--bg-subtle); opacity: 0.4; }

        @media (max-width: 540px) {
            .plan-header { flex-direction: column; }
            .plan-progress-row { flex-wrap: wrap; }
            .cal-day { font-size: 0.62rem; border-radius: 4px; }
            .calendar-grid { gap: 3px; }
        }

/* --- Plan day (routes/plan-day.php) --- */
/* Plan day — the same contained book-page as the reader: a centred .day-sheet
   floating on a full-width .day-main desk. (.day-main is NOT in the transparent
   hardening list, so unlike .reader-main it can paint its own surface directly.) */
.day-main {
    /* Header clearance is margin-top, matching .reader-layout's own
       margin-top: var(--header-height) on the plain reader page — not
       padding. .day-sheet supplies its own top padding below this, same
       as .reader-content does for the reader page, so this margin must
       be exactly the header height with no added buffer. (Previously this
       was padding-top: calc(header-height + 1.25rem), which both used the
       wrong box-model property AND double-counted extra clearance,
       leaving plan-day pages ~20px lower than the equivalent reader page.) */
    margin-top: var(--header-height);
    /* Horizontal padding lives on .day-sheet only, matching .reader-main
       (which has none — only .reader-content insets horizontally). Side
       padding here would stack with .day-sheet's own and make the plan
       page's readable column narrower than the reader page's for no
       reason (unlike the bottom, which deliberately stacks to clear the
       sticky bar + mobile nav — see the media query below). */
    padding: 0 0 90px;
    /* .reader-main avoids parent/child margin collapse because it's a flex
       item of .reader-layout (flex items get their own block-formatting
       context for free). .day-main has no such parent, so without this,
       .day-sheet's own margin-top collapses straight through it and gets
       silently absorbed into this margin instead of adding to it. */
    display: flow-root;
}
        @media (max-width: 640px) {
            /* 72px here + .day-sheet's own 48px trailing padding ≈ 120px total, matching
               the sticky bar (66px) + mobile nav (58px) combined footprint. These two
               paddings stack (parent+child, no margin-collapse), so this one must NOT
               double-count .day-sheet's share of the clearance. */
            .day-main { padding-bottom: 72px; }
        }
        /* No darker desk — .day-main stays the universal page colour (body #faf9f7);
           the .day-sheet floats via its own border + shadow, matching the reader. */
        .day-sheet {
            max-width: 680px;
            margin: 0 auto;
            padding: 2.5rem 2rem 4rem;
            background: var(--bg-page);
            transition: background-color 0.2s ease;
        }
        [data-theme="dark"] .day-sheet { background: #17171b; }
        @media (min-width: 768px) {
            /* margin matches .reader-content's desktop rule exactly — without it
               .day-sheet sits flush against the header instead of floating with
               the same top/bottom clearance as the plain reader page. */
            .day-sheet {
                margin: 1.25rem auto 3rem;
                border-radius: 14px;
                border: 1px solid var(--border-light);
                box-shadow: 0 1px 2px rgba(35, 28, 14, 0.045), 0 20px 44px -30px rgba(35, 28, 14, 0.28);
            }
            [data-theme="dark"] .day-sheet {
                border-color: rgba(255, 255, 255, 0.06);
                box-shadow: 0 22px 60px -30px rgba(0, 0, 0, 0.85);
            }
        }
        @media (max-width: 640px) {
            .day-sheet { padding: 1.5rem 1.25rem 3rem; }
        }

        /* ---- Breadcrumb / plan context ---- */
        .day-context {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 1.75rem;
            flex-wrap: wrap;
            gap: 0.5rem;
        }
        .day-breadcrumb {
            font-family: 'Inter', sans-serif;
            font-size: 0.8rem;
            color: var(--text-muted);
        }
        .day-breadcrumb a {
            color: var(--text-muted);
            text-decoration: none;
        }
        .day-breadcrumb a:hover { color: var(--accent); }
        .day-breadcrumb span   { margin: 0 0.35rem; }

        .day-nav-links {
            display: flex;
            gap: 0.5rem;
        }
        .day-nav-link {
            font-family: 'Inter', sans-serif;
            font-size: 0.8rem;
            color: var(--text-muted);
            text-decoration: none;
            padding: 0.3rem 0.65rem;
            border: 1px solid var(--border-light);
            border-radius: 5px;
            transition: border-color 0.12s, color 0.12s;
        }
        .day-nav-link:hover { border-color: var(--accent); color: var(--accent); }

        /* ---- Day header — a centred opener, like the reader's chapter opener ---- */
        .day-header {
            text-align: center;
            margin: 1.5rem 0 2.5rem;
        }
        .day-number-label {
            font-family: 'Inter', sans-serif;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: var(--accent);
            margin-bottom: 0.5rem;
        }
        .day-reading-label {
            font-family: 'Lora', Georgia, serif;
            font-size: 1.9rem;
            font-weight: 500;
            color: var(--text-primary);
            line-height: 1.2;
            letter-spacing: -0.01em;
        }
        .day-reading-time {
            font-family: 'Inter', sans-serif;
            font-size: 0.78rem;
            color: var(--text-muted);
            margin-top: 0.55rem;
        }

        /* ---- Plan rail — slim, meta; the reading itself is pure book+chapter ---- */
        .plan-daybar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
            flex-wrap: wrap;
            margin-bottom: 1.75rem;
        }
        .plan-daybar-bottom { margin-bottom: 0; margin-top: 2.5rem; }
        .plan-backlink {
            font-family: 'Inter', sans-serif;
            font-size: 0.8rem;
            color: var(--text-muted);
            text-decoration: none;
            transition: color 0.12s;
        }
        .plan-backlink:hover { color: var(--accent); }
        .plan-sr-title {
            position: absolute;
            width: 1px; height: 1px;
            padding: 0; margin: -1px;
            overflow: hidden; clip: rect(0, 0, 0, 0);
            white-space: nowrap; border: 0;
        }

        /* ---- Each passage = a reader chapter (book running head + gold numeral) ---- */
        .reading-section {
            margin-bottom: 2.5rem;
        }
        .reading-section:last-of-type { margin-bottom: 0; }
        .section-runhead { margin-bottom: 0.85rem; }
        .section-heading {
            font-family: 'Lora', Georgia, serif;
            font-size: 1.4rem;
            font-weight: 500;
            color: var(--text-primary);
            margin-bottom: 1.4rem;
            text-align: center;
            letter-spacing: -0.01em;
        }
        /* Chapter figure in the theme accent — matches the reader's gold opener numeral. */
        .section-chapter { color: var(--accent); font-weight: 400; }
        .reading-section.single-section .section-heading { display: none; }
        /* Verses inherit the reader's exact type + leading (1.15rem / 1.6) and the
           unified .vnum treatment (no per-plan override) so the two views match. */
        .plan-verse {
            font-family: 'Lora', Georgia, serif;
            font-size: var(--verse-font-size);
            line-height: var(--verse-line-height);
            color: var(--text-primary);
            margin-bottom: 0;
            padding: 0.3rem 0;
        }

        /* ---- Sticky complete bar ---- */
        .day-complete-bar {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            z-index: 210;
            background: var(--bg-card);
            border-top: 1px solid var(--border-light);
            padding: 0.9rem 1.5rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            box-shadow: 0 -4px 16px rgba(0,0,0,0.07);
            opacity: 0;
            transform: translateY(100%);
            transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
            pointer-events: none;
        }
        .day-complete-bar.shown {
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto;
        }
        /* Search overlay open or keyboard up — must beat .shown (same
           specificity, so this rule stays below it) */
        .day-complete-bar.nav-hidden {
            opacity: 0;
            transform: translateY(100%);
            pointer-events: none;
        }
        /* Progress fill — content-based reading progress along the bar's top edge.
           Same signal feeds the "min left" status, so the two never disagree. */
        .day-bar-fill {
            position: absolute;
            top: 0;
            left: 0;
            height: 3px;
            width: 0;
            background: var(--accent);
            transition: width 0.2s ease;
        }
        .day-bar-left { min-width: 0; }
        .day-bar-status {
            font-family: 'Inter', sans-serif;
            font-size: 0.85rem;
            font-weight: 500;
            color: var(--text-secondary);
            white-space: nowrap;
        }
        /* Completed: the day number becomes achievement feedback (accent), not chrome. */
        .day-complete-bar.is-complete .day-bar-status { color: var(--accent); font-weight: 600; }
        .day-complete-bar.just-completed .day-bar-fill { box-shadow: 0 0 10px var(--accent); }
        .day-bar-right {
            display: flex;
            align-items: center;
            gap: 0.65rem;
        }

        .btn-mark, .btn-day-next {
            font-family: 'Inter', sans-serif;
            font-size: 0.875rem;
            font-weight: 600;
            background: var(--accent);
            color: #fff;
            border: none;
            border-radius: 6px;
            padding: 0.6rem 1.3rem;
            cursor: pointer;
            text-decoration: none;
            white-space: nowrap;
        }
        .btn-mark:hover, .btn-day-next:hover { background: var(--accent-hover); }

        .btn-undo {
            font-family: 'Inter', sans-serif;
            font-size: 0.8rem;
            font-weight: 500;
            color: var(--text-muted);
            background: none;
            border: none;
            cursor: pointer;
            padding: 0.3rem 0.4rem;
            transition: color 0.12s;
        }
        .btn-undo:hover { color: var(--accent); }

        /* Clear the mobile bottom nav — must come after the base .day-complete-bar
           rule above so this offset actually wins the cascade (equal specificity,
           source order decides; this used to sit before the base rule and never applied). */
        @media (max-width: 640px) {
            .day-complete-bar { bottom: calc(52px + env(safe-area-inset-bottom, 0px)); }
        }

        @media (max-width: 480px) {
            .day-complete-bar { flex-wrap: wrap; }
            .day-bar-status { white-space: normal; }
            .btn-mark, .btn-day-next { padding: 0.6rem 1rem; }
        }


/* ============================================================
   xref panel — Direction 1 "Study Bible margin" refinement
   Applied 2026-04-13. Unifies the legacy reader panel and the
   new topic-page walker under one typographic treatment:
   - Serif headline (verse reference) + uppercase eyebrow label
   - Left accent border signals study companion, not popup
   - Pure white body, no internal dividers, spacing carries rhythm
   - Verse text (Lora serif) as the hero at 1rem
   All colors/fonts used here already exist in :root tokens.
   ============================================================ */

/* -- Shell: wider, pure white, left accent, stronger shadow -- */
.xref-panel {
    width: 380px;
    background: var(--bg-card);
    border-left: 3px solid var(--accent);
    box-shadow: -6px 0 28px rgba(26, 21, 18, 0.10);
}

/* -- Header: top-aligned. Bottom padding trimmed so header-to-body gap
   (0.6rem + body's 1.15rem top padding = 1.75rem) matches the panel's own
   item-to-item rhythm (.xref-item margin-bottom: 1.75rem) instead of running wider. -- */
.xref-panel-header {
    align-items: flex-start;
    padding: 1.15rem 1.1rem 0.6rem 1.25rem;
    border-bottom: none;
}

/* -- Verse reference: same voice as .xref-ref below it (Inter, uppercase,
   letter-spaced), a size/weight/color step down so it reads as this panel's
   header rather than another item in the list. -- */
.panel-verse-label {
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.25;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

/* -- Close button: larger glyph, no chrome -- */
.xref-close {
    font-size: 1.4rem;
}

/* -- Body: generous padding -- */
.xref-panel-body {
    padding: 1.15rem 1.25rem 2.5rem;
}

/* -- Hint & loading: more breathing room -- */
.xref-hint {
    font-size: 0.88rem;
    margin-top: 3rem;
}
.xref-loading {
    font-size: 0.85rem;
    margin-top: 4rem;
}

/* -- Themes row (legacy panel): dot-separated prose, no chip backgrounds -- */
.xref-themes {
    gap: 0;
    margin-bottom: 1.75rem;
    padding-bottom: 0;
    border-bottom: none;
    align-items: baseline;
    line-height: 1.7;
}
.xref-theme-chip {
    background: transparent;
    border: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--accent);
}
.xref-theme-chip:hover {
    background: transparent;
    border: none;
    text-decoration: underline;
}
.xref-theme-chip:not(:last-child)::after {
    content: ' · ';
    color: var(--text-muted);
    padding: 0 0.35rem;
    font-weight: 400;
    letter-spacing: normal;
    text-decoration: none;
    display: inline;
}

/* -- Xref items (legacy panel): no dividers, pure spacing -- */
.xref-item {
    margin-bottom: 1.75rem;
    padding-bottom: 0;
    border-bottom: none;
}
.xref-item:last-child {
    margin-bottom: 1.2rem;
    padding-bottom: 0;
    border-bottom: none;
}
/* NOTE: this overrides the earlier .xref-ref at ~line 1173 (same specificity,
   later wins). Two definitions of one class, 4,500 lines apart — the earlier one
   says inline-block and is dead. Worth collapsing. */
.xref-ref {
    display: block;
    /* The target must match the text. As a full-width block anchor, "Joshua 1:9"
       (85px of type) had a 350px hit area — 265px of invisible link. Tapping the
       empty space beside a reference silently navigated you to it. Identical bug
       to .search-result-ref, in a second place. */
    width: fit-content;
    max-width: 100%;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 0.55rem;
}
.xref-ref:hover { text-decoration: underline; }
.xref-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
}
.xref-explain {
    display: block;
    margin-top: 0.6rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-style: italic;
    line-height: 1.5;
    color: var(--text-muted);
}
.xref-explain-label { font-weight: 500; }
.xref-explain-topic {
    font-style: normal;
    color: var(--accent);
    font-weight: 600;
}

/* -- Mid-sized screens: narrower panel to keep reader breathable -- */
@media (min-width: 769px) and (max-width: 960px) {
    .xref-panel { width: 340px; }
}

/* ============================================================
   POWERED BY BADGE
   ============================================================ */
.bb-powered-by {
    text-align: center;
    padding: 1.5rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.bb-powered-by a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
}
.bb-powered-by a:hover { text-decoration: underline; }

/* -- Mobile bottom sheet: preserve drag-handle padding, accent on top edge -- */
@media (max-width: 768px) {
    .xref-panel {
        width: 100%;
        border-left: none;
        border-top: 3px solid var(--accent);
    }
    .xref-panel-header {
        padding: 2rem 1.1rem 0.9rem 1.25rem;
    }
}

/* ============================================================
   WHITE / LIGHT NAV THEME  (data-bb-nav-light on <html>)
   Dark mode always wins — light overrides are scoped out.
   ============================================================ */
[data-bb-nav-light]:not([data-theme="dark"]) {
    --bg-sidebar-hover: rgba(0,0,0,0.06);
    --bg-sidebar-active: var(--accent);
}

[data-bb-nav-light]:not([data-theme="dark"]) .reader-header {
    border-bottom-color: rgba(0,0,0,0.10);
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-logo {
    color: #1a1a1a !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-location {
    color: rgba(0,0,0,0.7);
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-api-cta {
    color: rgba(0,0,0,0.6);
    border-color: rgba(0,0,0,0.2);
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-api-cta:hover {
    color: #1a1a1a;
    border-color: rgba(0,0,0,0.4);
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-toggle span {
    background: rgba(0,0,0,0.6);
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-toggle:hover {
    background: rgba(0,0,0,0.06) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-toggle:hover span {
    background: #1a1a1a;
}
/* Gold cannot work on a light nav — it clears 3:1 only below a nav luminance
   of ~0.098, and White (0.921) and Parchment (0.814) are nowhere near it. Not
   a near miss: there is no light nav where gold works. Ink instead — 11.21:1
   on White, 10.00:1 on Parchment. */
[data-bb-nav-light]:not([data-theme="dark"]) { --bb-focus-ring: #2b2015; }

[data-bb-nav-light]:not([data-theme="dark"]) .reader-search-form {
    background: rgba(0,0,0,0.05) !important;
    border-color: rgba(0,0,0,0.12);
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-search-form:focus-within {
    /* was rgba(0,0,0,0.28) — 1.04:1 on Parchment, effectively no indicator */
    border-color: var(--bb-focus-ring);
    background: rgba(0,0,0,0.07) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-search-input {
    color: #1a1a1a !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-search-input::placeholder {
    color: rgba(0,0,0,0.38) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-search-btn {
    border-left-color: rgba(0,0,0,0.12) !important;
    color: rgba(0,0,0,0.45) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-search-btn:hover {
    color: #1a1a1a !important;
    background: rgba(0,0,0,0.06);
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-search-book {
    background-color: rgba(0,0,0,0.05) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='rgba(0,0,0,0.45)' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    border-left-color: rgba(0,0,0,0.12);
    color: rgba(0,0,0,0.7) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-search-book:hover {
    color: #1a1a1a !important;
    background-color: rgba(0,0,0,0.09) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-search-book option,
[data-bb-nav-light]:not([data-theme="dark"]) .reader-search-book optgroup {
    background: #fff;
    color: #1a1a1a;
}
[data-bb-nav-light]:not([data-theme="dark"]) .mobile-home-btn,
[data-bb-nav-light]:not([data-theme="dark"]) .mobile-search-toggle {
    color: #6e6e6e !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .mobile-home-btn:hover,
[data-bb-nav-light]:not([data-theme="dark"]) .mobile-search-toggle:hover {
    color: #1a1a1a !important;
    background: rgba(0,0,0,0.06);
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-header-nav-link {
    color: rgba(0,0,0,0.5) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-header-nav-link:hover {
    color: rgba(0,0,0,0.85) !important;
    background: rgba(0,0,0,0.06);
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-header-nav-link.active {
    color: rgba(0,0,0,0.85) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .version-btn {
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.15);
    color: rgba(0,0,0,0.75);
}
[data-bb-nav-light]:not([data-theme="dark"]) .version-btn:hover {
    background: rgba(0,0,0,0.10);
    border-color: rgba(0,0,0,0.2);
    color: #1a1a1a;
}
[data-bb-nav-light]:not([data-theme="dark"]) .font-btn {
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.15);
    color: rgba(0,0,0,0.7);
}
[data-bb-nav-light]:not([data-theme="dark"]) .font-btn:hover {
    background: rgba(0,0,0,0.10);
    border-color: rgba(0,0,0,0.2);
    color: #1a1a1a;
}
[data-bb-nav-light]:not([data-theme="dark"]) .theme-toggle {
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.15);
    color: rgba(0,0,0,0.7) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .theme-toggle:hover {
    background: rgba(0,0,0,0.10);
    border-color: rgba(0,0,0,0.2);
    color: #1a1a1a !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .theme-toggle:focus-visible {
    outline-color: rgba(0,0,0,0.35);
}
[data-bb-nav-light]:not([data-theme="dark"]) .parallel-toggle-btn {
    color: rgba(0,0,0,0.65);
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.15);
}
[data-bb-nav-light]:not([data-theme="dark"]) .parallel-toggle-btn:hover {
    background: rgba(0,0,0,0.10);
    border-color: rgba(0,0,0,0.2);
    color: #1a1a1a;
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-sidebar {
    scrollbar-color: rgba(0,0,0,0.15) transparent;
}
[data-bb-nav-light]:not([data-theme="dark"]) .reader-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-section {
    border-bottom-color: rgba(0,0,0,0.08);
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-testament-btn {
    color: rgba(0,0,0,0.45) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-testament-btn:hover {
    color: rgba(0,0,0,0.75) !important;
    background-color: rgba(0,0,0,0.06) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-testament-btn.open {
    color: rgba(0,0,0,0.65) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-testament-btn:focus-visible {
    outline-color: rgba(0,0,0,0.3);
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-book-btn {
    color: rgba(0,0,0,0.55);
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-book-btn:hover {
    color: #1a1a1a;
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-book-btn:focus-visible {
    outline-color: rgba(0,0,0,0.3);
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-chapter {
    color: rgba(0,0,0,0.45) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-chapter:hover {
    color: #1a1a1a !important;
}
/* Active chapter is a filled accent pill — needs white text, not the muted 45%-black
   above (which this block would otherwise apply to .active too, killing contrast on the
   light-nav themes: Parchment/White). White on the gold accent ≈ 5:1 (AA). */
[data-bb-nav-light]:not([data-theme="dark"]) .sidebar-chapter.active {
    color: #fff !important;
}

[data-bb-nav-light]:not([data-theme="dark"]) .sync-header-btn {
    color: #6e6e6e !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .sync-header-btn:hover {
    color: rgba(0,0,0,0.75) !important;
    background: rgba(0,0,0,0.06) !important;
}
[data-bb-nav-light]:not([data-theme="dark"]) .sync-header-btn.sync-active {
    color: var(--accent) !important;
}
@media (max-width: 640px) {
    [data-bb-nav-light]:not([data-theme="dark"]) .mobile-search-close {
        color: rgba(0,0,0,0.55);
    }
    [data-bb-nav-light]:not([data-theme="dark"]) .mobile-search-close:hover {
        color: #1a1a1a;
    }
}

/* Version label is print-only (shown inside @media print below) */
.print-version-label { display: none; }

/* -----------------------------------------------------------
   PRINT — native Ctrl+P / right-click Print. Strips the app
   chrome, forces a light page (even in dark mode), and prints
   just the chapter heading + verses as a clean document.
   ----------------------------------------------------------- */
@media print {
    /* Force a light palette regardless of the active theme */
    :root,
    html[data-theme="dark"] {
        --bg-page: #fff !important;
        --bg-card: #fff !important;
        --text-primary: #000 !important;
        --text-secondary: #222 !important;
        --text-muted: #555 !important;
        --border-light: #ccc !important;
        --border-divider: #bbb !important;
        --accent: #000 !important;
    }

    @page { margin: 1.9cm 2.2cm; }

    html, body {
        background: #fff !important;
        color: #000 !important;
    }

    /* No animations/transitions on paper (e.g. the verse-hint pulse) */
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }

    /* Hide app chrome, controls, panels — anything that is not scripture */
    #wpadminbar,
    .reader-header,
    .reader-sidebar,
    .reading-progress-bar,
    .chapter-nav,
    .verse-actions,
    .verse-hint-label,
    .verse-hint-tooltip,
    .xref-panel,
    .sidebar-overlay,
    .panel-backdrop,
    .mobile-bottom-nav,
    .verse-action-sheet,
    .vas-backdrop,
    .bk-panel,
    .bk-backdrop,
    .sync-modal,
    .sync-modal-backdrop,
    .day-complete-bar,
    .bb-powered-by,
    /* Interactive controls are useless on paper (and future-proofs new ones) */
    button,
    input,
    select,
    textarea,
    /* Reading-plan chrome: progress, start/reset controls, legend, day nav */
    .plan-progress-row,
    .plan-start-cta,
    #resetWrap,
    .calendar-legend,
    .day-nav-links,
    .day-breadcrumb,
    .plan-breadcrumb,
    .plan-card-progress-bar,
    .plan-card-progress-label,
    .reader-permission {
        display: none !important;
    }

    /* Let the reading pane fill the page */
    .reader-layout {
        display: block !important;
        margin: 0 !important;
        min-height: 0 !important;
    }
    .reader-main {
        margin: 0 !important;
        flex: none !important;
    }
    .reader-content,
    .plans-main,
    .plan-page-main,
    .day-main,
    .day-sheet {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    /* Premium book typography — a classic serif, like a fine printed Bible */
    .reader-content,
    .day-main,
    .verse,
    .chapter-heading,
    .day-header,
    .section-heading {
        font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif !important;
    }
    .chapter-heading,
    .day-header,
    .section-heading,
    .plan-header,
    .plans-hero {
        color: #000 !important;
    }
    .chapter-heading {
        font-size: 23pt !important;
        font-weight: 600 !important;
        text-align: center !important;
        letter-spacing: 0.01em !important;
        margin: 0 0 0.35em !important;
        /* Drop the full-width web divider; a short centred rule sits below the
           version label instead, framing heading + version as a title block. */
        border-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    /* Print: collapse the stacked opener back to a single inline "Book N" title */
    .chapter-heading .chapter-book {
        display: inline !important;
        font-variant: normal !important;
        letter-spacing: 0.01em !important;
        font-size: 23pt !important;
        font-weight: 600 !important;
        color: #000 !important;
        margin: 0 !important;
    }
    .chapter-heading .chapter-number {
        display: inline !important;
        font-size: 23pt !important;
        font-weight: 600 !important;
        color: #000 !important;
    }
    /* Version label: small-caps, centred, quiet — like a fine Bible's running head */
    .print-version-label {
        display: block !important;
        text-align: center !important;
        font-variant: small-caps !important;
        letter-spacing: 0.12em !important;
        font-size: 9pt !important;
        color: #9e7640 !important;
        margin: 0 auto 1.1em !important;
    }
    /* Short centred hairline under the title block. Uses a BORDER, not a
       background — browsers suppress background colours in print by default,
       which is why a background-based rule disappeared on a normal printout. */
    .print-version-label::after {
        content: "";
        display: block;
        width: 3.4em;
        height: 0;
        border-top: 1pt solid #9e7640;
        margin: 0.9em auto 0;
    }
    /* A comfortable book measure, centred — premium type is never edge-to-edge.
       (Single-column only; the parallel KJV/BSB grid needs the full width.) */
    .verses-block {
        max-width: 34em !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .verse,
    .plan-verse {
        font-size: 11.5pt !important;
        line-height: 1.65 !important;
        color: #000 !important;
        text-align: justify;
        -webkit-hyphens: auto;
        hyphens: auto;
        font-variant-numeric: oldstyle-nums;
        break-inside: avoid;
    }
    .verse .vnum,
    .verse sup,
    .plan-verse .vnum,
    .plan-verse sup {
        color: #9e7640 !important; /* warm brand gold, not generic web grey */
        font-variant-numeric: oldstyle-nums;
    }

    /* ---- Reading-plan DAY: match the chapter page's title block ---- */
    .day-header {
        display: flex !important;
        flex-direction: column-reverse !important; /* big reading title on top, label beneath */
        align-items: center !important;
        text-align: center !important;
        margin: 0 0 1.1em !important;
    }
    .day-reading-label {
        font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif !important;
        font-size: 23pt !important;
        font-weight: 600 !important;
        color: #000 !important;
        letter-spacing: 0.01em !important;
        margin: 0 0 0.35em !important;
    }
    .day-number-label {
        font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif !important;
        font-variant: small-caps !important;
        letter-spacing: 0.12em !important;
        font-size: 9pt !important;
        color: #9e7640 !important;
    }
    .day-number-label::after {
        content: "";
        display: block;
        width: 3.4em;
        height: 0;
        border-top: 1pt solid #9e7640;
        margin: 0.9em auto 0;
    }
    /* Section subhead: a modest centred chapter marker, not a competing title */
    .section-heading {
        text-align: center !important;
        font-size: 13pt !important;
        font-weight: 600 !important;
        color: #000 !important;
        margin: 1.4em 0 0.5em !important;
    }
    .section-heading span { color: #000 !important; }
    /* Single-chapter day: the day title already names it, so drop the duplicate */
    .reading-section.single-section .section-heading { display: none !important; }
    /* No screen-state decoration on paper (deep-link highlight, tap-selected) */
    .verse.verse-highlight,
    .verse.verse-selected,
    .verse.verse-hint-pulse {
        background: transparent !important;
        border-left: 0 !important;
        padding-left: 0.5rem !important; /* match base .verse so accented verses stay aligned */
    }
    /* Links read as plain text on paper (reader + plan pages) */
    a {
        color: #000 !important;
        text-decoration: none !important;
    }
    /* Parallel KJV/BSB: keep both columns */
    .parallel-grid { display: grid !important; }
    .parallel-header-row { color: #555 !important; }
}

/* ============================================================
