/* ============================================================
   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: #9e7640;
    --accent-hover: #7e5c2e;
    --text-primary: #1a1a1a;
    --text-secondary: #555;
    --text-muted: #888;
    --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.9;
    /* surface vars — swap for dark mode */
    --bg-card: #ffffff;
    --bg-subtle: #f5f3ef;
    --bg-hover: rgba(158,118,64,0.07);
    --highlight-bg: #fef8e4;
    --highlight-border: #c49226;
    --search-em-bg: #fef3c7;
    --search-em-color: #1a1a1a;
    --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:      #62594f;
    --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:    #2a2310;
    --search-em-color: #e8d89a;
    --badge-bg:        #292520;
    --badge-color:     #66605a;
    --rel-type-bg:     #252118;
}

/* 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; }
body { font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif; background: var(--bg-page); 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);
}

.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;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    opacity: 0.9;
}
.reader-logo:hover { opacity: 1; }

.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;
    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 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); color: #fff; }

.version-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 180px;
    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.5rem;
    padding: 0.5rem 0.85rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: background 0.1s;
}
.version-option:hover { background: var(--bg-subtle); }
.version-option.active { background: var(--bg-subtle); font-weight: 600; }
.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: 2px; }

.font-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.75);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}
.font-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.font-btn sup { font-size: 0.6em; }

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

/* ============================================================
   SIDEBAR
   ============================================================ */
.reader-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - 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; }

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

/* Sidebar footer nav — Plans / Topics links */
.sidebar-footer-nav {
    padding: 0.75rem 0 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
}
.sidebar-footer-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}
.sidebar-footer-link:hover {
    color: rgba(255,255,255,0.85);
    background: var(--bg-sidebar-hover);
}
.sidebar-footer-link svg { flex-shrink: 0; opacity: 0.7; }

/* 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);
    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); background: rgba(255,255,255,0.07); }
.reader-header-nav-link.active { color: rgba(255,255,255,0.9); }

@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;
    border: none;
    color: rgba(255,255,255,0.5);
    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); }
.sidebar-testament-btn.open { color: rgba(255,255,255,0.7); }
.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; }

.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;
    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);
    text-decoration: none;
    transition: all 0.1s;
}
.sidebar-chapter:hover { background: var(--bg-sidebar-hover); color: #fff; }
.sidebar-chapter.active { background: var(--accent); color: #fff; 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;
}
.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;
    transition: background 0.1s;
}
.chapter-nav-btn:hover { background: var(--bg-hover); }
.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; }

/* ============================================================
   CHAPTER HEADING
   ============================================================ */
.chapter-heading {
    font-family: 'Lora', Georgia, serif;
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    margin: 1.5rem 0 0;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-light);
    letter-spacing: -0.01em;
}
.chapter-number { font-weight: 400; }

/* ============================================================
   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;
}
.verse:hover { background: rgba(160,105,46,0.06); }
.verse.verse-selected { background: rgba(160,105,46,0.10); }
.verse.verse-hl-yellow:hover, .verse.verse-hl-yellow.verse-selected { background: rgba(250, 204, 21, 0.18); }
.verse.verse-hl-green:hover,  .verse.verse-hl-green.verse-selected  { background: rgba(34, 197, 94, 0.15); }
.verse.verse-hl-blue:hover,   .verse.verse-hl-blue.verse-selected   { background: rgba(59, 130, 246, 0.15); }
.verse.verse-hl-pink:hover,   .verse.verse-hl-pink.verse-selected   { background: rgba(236, 72, 153, 0.15); }
.verse.verse-highlight { background: var(--highlight-bg); border-left: 3px solid var(--highlight-border); padding-left: 0.7rem; }

.vnum {
    font-family: 'Inter', sans-serif;
    font-size: 0.65em;
    font-weight: 600;
    color: var(--accent);
    vertical-align: super;
    margin-right: 0.25em;
    user-select: none;
    line-height: 0;
}

/* ============================================================
   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;
    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); }
.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
   ============================================================ */
@keyframes bb-pulse {
    0%, 100% { background: transparent; }
    60%       { background: 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 {
    animation: bb-pulse 2.4s ease-in-out infinite;
}
.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; }

.verse-action-sheet {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    border-radius: 14px 14px 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;
}
.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;
}

.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)
   ============================================================ */
.xref-panel {
    position: fixed;
    right: 0;
    top: var(--header-height);
    width: 320px;
    height: calc(100vh - 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;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
}

/* 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;
}
.panel-tab {
    flex: 1;
    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); }

/* 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); }
.xref-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.xref-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}
.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.18); border-radius: 2px; }
.verse-hl-green  { background: rgba(34, 197, 94, 0.15); border-radius: 2px; }
.verse-hl-blue   { background: rgba(59, 130, 246, 0.15); border-radius: 2px; }
.verse-hl-pink   { background: rgba(236, 72, 153, 0.15); border-radius: 2px; }

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

.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); }
.xref-explain-weak .xref-explain-label { font-style: italic; }
.xref-explain-weak .xref-explain-topic { font-weight: 500; }

/* ============================================================
   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); }

.xref-panel-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}
.xref-api-link {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.1s;
}
.xref-api-link:hover { color: var(--accent); }

/* ============================================================
   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 {
    position: fixed;
    right: 0;
    top: var(--header-height);
    width: 320px;
    height: calc(100vh - 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); }
.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; }
.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; }

/* Header bookmark button */
.bk-header-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background 0.1s, color 0.1s;
}
.bk-header-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.bk-header-btn.has-bookmarks { color: var(--accent); }

/* Bookmarked verse: subtle left accent */
.verse.verse-bookmarked {
    border-left: 2px solid var(--accent);
    padding-left: calc(0.5rem - 2px);
}

/* 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);
    color: #fff;
}
.parallel-toggle-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.parallel-toggle-btn.active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
@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-muted);
}
.parallel-col-sublabel {
    font-weight: 400;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

/* 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);
    color: var(--text-secondary);
    border-left: 1px solid var(--border-divider);
    padding-left: 1rem;
}

/* 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;
}

/* 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; }
}

/* 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); }
.testament-count {
    font-weight: 400;
    opacity: 0.6;
    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;
}
.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: 0 2px 12px rgba(0,0,0,0.06);
}
.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;
    text-decoration: none;
    transition: all 0.15s;
}
.plan-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    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)
   ============================================================ */
.reader-search-form {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    overflow: hidden;
    overflow: hidden;
    transition: border-color 0.15s, background 0.15s;
    width: 100%;
    max-width: 420px;
}
.reader-search-form:focus-within {
    border-color: rgba(255,255,255,0.28);
    background: rgba(255,255,255,0.1);
}
.reader-search-input {
    background: none;
    border: none;
    outline: none;
    color: #fff;
    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); }
.reader-search-btn {
    background: none;
    border: none;
    border-left: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.5);
    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; background: rgba(255,255,255,0.08); }
.reader-search-book {
    -webkit-appearance: none;
    appearance: none;
    background-color: rgba(255,255,255,0.07);
    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);
    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; background-color: rgba(255,255,255,0.12); }

/* 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-results-main {
    max-width: 720px;
    margin: 0 auto;
    padding: calc(var(--header-height) + 2rem) 1.5rem 4rem;
}
.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: 0.9rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-card);
    margin-bottom: 0.6rem;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.search-result-item:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.search-result-ref {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 0.3rem;
}
.search-result-ref:hover { text-decoration: underline; }
.search-result-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-primary);
}
.search-result-text em {
    background: var(--search-em-bg);
    color: var(--search-em-color);
    font-style: normal;
    border-radius: 2px;
    padding: 0 1px;
}
.search-empty {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 3rem 1rem;
}
.search-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}
.search-suggestions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}
.search-suggestions-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}
.search-suggestion-chip {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    color: var(--accent);
    text-decoration: none;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 20px;
    background: var(--bg-card);
    transition: border-color 0.12s, background 0.12s;
}
.search-suggestion-chip:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}
.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; }
.search-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.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;
    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%); }
    .sidebar-overlay.open { display: block; }

    .reader-main { margin-left: 0 !important; }
    .reader-layout.sidebar-closed .reader-main { margin-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; }

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

@media (max-width: 600px) {
    .reader-logo { display: none; }
    .parallel-toggle-btn { display: none; }
    .reader-header-center { padding: 0 0.4rem; }
}

@media (max-width: 480px) {
    .font-controls { display: none; }
}

/* ============================================================
   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;
}

/* 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);
}
.te-anchor-context {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-top: 0.3rem;
    transition: color 0.12s;
}
.te-anchor-context:hover { color: var(--accent); }
.te-anchor-hidden { display: none; }
.te-anchor-count {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 0.5rem;
}
.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;
    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;
}
.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;
}
.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-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-rel-label { min-width: 7rem; }
}

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

/* ============================================================
   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);
    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); color: #fff; }
.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);
    padding: 0.45rem 0;
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px));
}
.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-results-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: rgba(255,255,255,0.5);
    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); }
.sync-header-btn.sync-active { color: var(--accent); }
.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, #fff); border-radius: 12px;
    width: 90%; max-width: 360px; z-index: 9999;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.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);
}
.sync-modal-close {
    background: none; border: none; font-size: 22px; cursor: pointer;
    color: var(--text-muted); line-height: 1;
}
.sync-modal-body { padding: 20px; }
.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; }
.sync-btn-secondary { background: var(--bg-subtle); color: var(--text-primary); }
.sync-btn-danger { background: none; color: var(--text-muted); font-size: 0.82rem; }
.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; }

/* ============================================================
   RATE LIMIT NOTICE
   ============================================================ */
.reader-limit-notice {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    max-width: 420px;
    margin: 2rem auto;
}
.reader-limit-notice p:first-child {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* ============================================================
   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; }
.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);
}
.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;
}
.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;
}
