/* Hide the Settings install hint when already running as an installed app */
@media (display-mode: standalone) {
    .install-app-group { display: none; }
}

/* iOS installed-app safe areas (viewport-fit=cover). env() is 0 everywhere
   else, so these are no-ops outside notched standalone displays.
   CRITICAL: the mobile bottom nav must sit ABOVE the home-indicator gesture
   zone — otherwise iOS steals horizontal swipes as app-switch gestures and
   the menu can't scroll. */
.app-body {
    padding-top: env(safe-area-inset-top);
}

@media (max-width: 768px) {
    .icon-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .sidebar {
        padding-top: calc(1.5rem + env(safe-area-inset-top));
    }
}

/* Root Variables */
:root {
    --primary: #5B4B8A;
    --primary-dark: #4A3B73;
    --primary-light: #7C6BA6;
    --secondary: #8B7355;
    --background: #FAF9F6;
    --surface: #FFFFFF;
    --text-primary: #2C2416;
    --text-secondary: #6B5D54;
    --border: #E5E1DB;
    --highlight: #FFF9E6;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);

    /* Semantic accents — the ONLY definitions of these concepts app-wide.
       Components must use these tokens, never raw hex (dark mode depends on it). */
    --danger: #e74c3c;                        /* destructive actions (delete note/tag) */
    --success: #38a169;                       /* positive accents (derivatives, confirmations) */
    --success-rgb: 56, 161, 105;

    /* Content-type accents (study cards, badges, inject buttons).
       Commentary uses --gold. One definition each, app-wide. */
    --accent-library: #7B68AE;
    --accent-intro: #8FA68E;
    --accent-isbe: #4A6FA5;
    --gold: #D4A017;                          /* notes/commentary accent (buttons, borders) */
    --gold-text: #8a6a00;                     /* amber labels/text */
    --gold-border: rgba(210, 170, 50, 0.35);  /* amber section borders */
    --gold-bg: rgba(255, 248, 220, 0.35);     /* amber section backgrounds */

    /* RGB variants for rgba() usage (glassmorphism, etc.) */
    --primary-rgb: 91, 75, 138;
    --bg-primary-rgb: 255, 255, 255;
    --bg-secondary-rgb: 248, 248, 248;
    --border-rgb: 229, 225, 219;

    /* Responsive sizing */
    --nav-rail-width: 110px;
    --sidebar-width: 450px;
    --touch-target-min: 44px;
    --content-padding: 1.5rem;
}

/* Dark Theme */
[data-theme="dark"] {
    --background: #1A1A1A;
    --surface: #2A2A2A;
    --text-primary: #E5E5E5;
    --text-secondary: #A0A0A0;
    --border: #404040;
    --highlight: #3A3A3A;

    /* Semantic accents — dark variants */
    --gold-text: #c8a430;
    --gold-border: rgba(180, 140, 0, 0.35);
    --gold-bg: rgba(80, 60, 0, 0.25);
    --accent-isbe: #7C9FD6;  /* light-theme #4A6FA5 is ~3.4:1 on #1A1A1A — too dim for linked words */

    --primary-rgb: 91, 75, 138;
    --bg-primary-rgb: 26, 26, 26;
    --bg-secondary-rgb: 42, 42, 42;
    --border-rgb: 64, 64, 64;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Themed form-element defaults — the base every input inherits.
   Any textarea/input with no color rules of its own is automatically
   correct in BOTH themes. Component classes may still override. */
textarea,
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"] {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    caret-color: var(--text-primary);
}
textarea::placeholder,
input::placeholder {
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Base */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden; /* app-body handles all scrolling */
}

/* ── Clean Header (shared across all modals/popups) ─────────────────────
   F4 spec (approved 2026-08-24): surface bar, 2px primary top hairline,
   1px border bottom, icon+tick before title, boxed buttons (see
   .frosted-header-btn / .frosted-close-btn). Class name kept for compat. */
.frosted-header {
    background: var(--surface);
    border-top: 2px solid var(--primary);
    border-bottom: 1px solid var(--border);
    position: relative;
}
/* DEAD 2026-09-17 — flagged for deletion (one notes dialog, docs/NOTES_DIALOG_ONE_CLASS_DESIGN.md). Uncomment to revert; delete after a few weeks if all is well.
   Why: the app-logo tick before a title has no wearers left — every window and the notes dialog wear their launcher icon in .modal-mark.
.notes-dialog-title::before,
.cnote-dialog-title::before,
.lnote-dialog-title::before,
.isbe-note-dialog-title::before {
    content: '';
    display: inline-block;
    flex: 0 0 auto;
    width: 39px;
    height: 28px;
    background:
        url('../icons/icon-192.png') left center / 28px 28px no-repeat,
        linear-gradient(var(--primary), var(--primary)) right center / 3px 18px no-repeat;
    vertical-align: middle;
    margin-right: 0.5rem;
}
*/
/* F4 nav mark (FEAT-031 rule 1): a modal header wears its feature's
   own nav-rail icon — the EXACT svg from its nav button in app.html.
   One feature, one icon; replaces the app-logo ::before as slices ship. */
.frosted-header .f4-nav-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--primary);
    flex-shrink: 0;
}
.frosted-header .f4-nav-mark svg { width: 15px; height: 15px; }
.frosted-header,
.frosted-header h2,
.frosted-header h3,
.frosted-header span {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-family: 'Crimson Text', serif;
    font-weight: 700;
}
/* Spans inside header BUTTONS take the button's typography, never the
   title's — the broad span rule above is for title text only. */
.frosted-header button span {
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
}
.frosted-header button {
    cursor: pointer;
    color: var(--text-primary);
}
/* DEAD 2026-09-17 — flagged for deletion (one header bar, docs/MODAL_HEADER_DESIGN.md). Nothing wears this any more. Uncomment to revert; delete after a few weeks if all is well.
   Why: its three wearers (Lexicon Send, Account Sign Out, Practice A-/A+/🔤) wear .modal-ctl now.
.frosted-header-btn {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.13s, border-color 0.13s;
}
.frosted-header-btn:hover {
    background: var(--highlight);
    border-color: var(--primary);
}
.frosted-header-btn:active {
    transform: scale(0.97);
}
*/
.frosted-close-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.13s;
}
.frosted-close-btn:hover {
    background: var(--highlight);
    color: var(--text-primary);
}

/* App body: rail + content side by side, fills full viewport.
   --app-height is JS-maintained (inline snippet in app.html head):
   Chrome on iOS freezes 100dvh at the landing-viewport size on external
   -link opens and never recomputes until an app switch — the shell
   landed ~30% short with a white band under the tab bar. The variable
   tracks window.innerHeight (keyboard-safe on iOS) on every viewport
   event; dvh remains the no-JS fallback. */
.app-body {
    display: flex;
    flex-direction: row;
    height: 100vh;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    overflow: hidden;
}

/* Bible nav — pinned at top of bible-content, verses scroll beneath */
.bible-nav {
    position: relative;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding: 0.4rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px 12px 0 0;
}

/* ── Reader-bar toggles (Strong's + ISBE links) ──────────────────────────
   State is body.strongs-hidden / body.isbe-links-hidden — appearance
   derives from it here; no JS sync in either direction. */
.strongs-toggle-btn .strongs-toggle-glyph {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
}
.strongs-toggle-btn { color: var(--primary); }
body.strongs-hidden .strongs-toggle-btn {
    color: var(--text-secondary);
    opacity: 0.45;
}
.layout-toggle-btn { color: var(--text-secondary); opacity: 0.45; }
.layout-toggle-btn .layout-toggle-glyph { font-family: 'Crimson Text', serif; font-weight: 700; font-size: 1.05rem; }
body.layout-paragraph .layout-toggle-btn { color: var(--gold-text); opacity: 1; }
.isbe-toggle-btn { color: var(--accent-isbe); }
body.isbe-links-hidden .isbe-toggle-btn {
    color: var(--text-secondary);
    opacity: 0.45;
}
/* Menu checkmarks mirror the same body-class state */
body:not(.strongs-hidden) .nav-overflow-item[data-target="strongsToggleBtn"]::after,
body:not(.isbe-links-hidden) .nav-overflow-item[data-target="isbeToggleBtn"]::after {
    content: '\2713';
    margin-left: auto;
    color: var(--success);
    font-weight: 700;
}

/* ── ISBE inline word links (FEAT-014) ───────────────────────────────────
   Words in Bible text matching ISBE article titles. Toggle is CSS-only:
   body.isbe-links-hidden renders them as plain text — no re-render. */
.isbe-word-link {
    color: var(--accent-isbe);
    cursor: pointer;
}
/* No underline ever — the color IS the tell (user call 2026-08-26).
   Hover just deepens the blue slightly (brightens in dark — "deepen"
   is perceptual, not arithmetic). */
.isbe-word-link:hover {
    filter: brightness(0.8);
}
[data-theme="dark"] .isbe-word-link:hover {
    filter: brightness(1.25);
}
body.isbe-links-hidden .isbe-word-link {
    color: inherit;
    cursor: inherit;
    pointer-events: none;
}
/* Color = encyclopedia in the user's mind: nav label matches the links */
#isbeBtn .icon-nav-label { color: var(--accent-isbe); }

/* Disambiguation popover for words with 2+ ISBE articles.
   z-index above the verse-trail popup (20000) — the menu can be summoned
   from inside it and must float on top. */
.isbe-link-menu {
    position: fixed;
    z-index: 20050;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 2px solid var(--accent-isbe);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-width: min(320px, calc(100vw - 24px));
    max-height: 320px;
    overflow-y: auto;
    padding: 0.25rem;
}
.isbe-link-menu-header {
    position: sticky;
    top: 0;
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-isbe);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    text-transform: capitalize;
}
.isbe-link-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.6rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
}
.isbe-link-menu-item:hover {
    background: var(--background);
    color: var(--accent-isbe);
}


.bible-nav .nav-container {
    gap: 0.5rem;
}

/* Right-side nav mode */
body[data-nav-side="right"] .app-body {
    flex-direction: row-reverse;
}

/* Icon nav rail */
.icon-nav {
    width: var(--nav-rail-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

body[data-nav-side="right"] .icon-nav {
    border-right: none;
    border-left: 1px solid var(--border);
}

.icon-nav-top,
.icon-nav-bottom {
    display: flex;
    flex-direction: column;
}

/* One quiet surface — the tools live ON the rail, not in boxes.
   (Shell modernization, mock-approved 2026-09-01.) */
.icon-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.28rem;
    padding: 0.5rem 0.25rem 0.45rem;
    margin: 1px 6px;
    width: calc(100% - 12px);
    border: none;
    border-radius: 9px;
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.13s, color 0.13s;
    position: relative;
}

body[data-nav-side="right"] .icon-nav-btn {
    /* no side-specific overrides needed */
}

.icon-nav-btn:hover {
    background: rgba(var(--primary-rgb), 0.09);
    color: var(--text-primary);
}

.icon-nav-btn.active {
    background: var(--primary);
    color: #fff;
}

/* Encyclopedia label keeps its blue at rest, never on the purple pill */
#isbeBtn.active .icon-nav-label { color: #fff; }

body[data-nav-side="right"] .icon-nav-btn.active {
    /* same style both sides */
}

.icon-nav-btn-saved {
    color: #fff !important;
    background: linear-gradient(135deg, #43a047, #66bb6a) !important;
    box-shadow: 0 2px 12px rgba(67, 160, 71, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.icon-nav-btn-clean {
    color: #fff !important;
    background: linear-gradient(135deg, #1565c0, #42a5f5) !important;
    box-shadow: 0 2px 12px rgba(21, 101, 192, 0.35), inset 0 1px 0 rgba(255,255,255,0.15);
    transition: all 0.4s ease;
}

.icon-nav-btn-dirty {
    color: #fff !important;
    background: linear-gradient(135deg, #c62828, #ef5350) !important;
    box-shadow: 0 2px 16px rgba(198, 40, 40, 0.45), inset 0 1px 0 rgba(255,255,255,0.15);
    animation: dirtyGlow 2s ease-in-out infinite;
}

@keyframes dirtyGlow {
    0%, 100% { box-shadow: 0 2px 12px rgba(198, 40, 40, 0.4); }
    50% { box-shadow: 0 2px 28px rgba(198, 40, 40, 0.75); }
}

.icon-nav-btn svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.icon-nav-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.15;
    text-align: center;
}

.icon-nav-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-nav-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: var(--primary);
    color: white;
    font-size: 0.58rem;
    font-weight: 700;
    min-width: 15px;
    height: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

.icon-nav-badge:empty {
    display: none;
}

.icon-nav-side-toggle {
    opacity: 0.5;
    font-size: 0.6rem;
}

.icon-nav-side-toggle:hover {
    opacity: 1;
}

/* ── Mobile tab bar + More sheet — desktop: hidden ──────────────────────── */
.mobile-tabbar, .mobile-more-sheet, .mobile-sheet-scrim { display: none; }

/* DEAD 2026-09-18 (FEAT-045): the group eyebrows left app.html; frames
   below carry the group names now.
.icon-nav-group { ... }
body.nav-custom-order .icon-nav-group { display: none; } */

/* ── Toolbar groups (FEAT-045, docs/TOOLBAR_GROUPS_DESIGN.md) ──────────
   One quiet frame per group, its name set into the top edge. Built by
   NavLayoutManager; the real buttons live inside. */
.nav-frame {
    position: relative;
    margin: 0.55rem 5px 0.15rem;
    padding: 0.55rem 0 0.2rem;
    border: 1px solid var(--border);
    border-radius: 11px;
}
.nav-frame-label {
    position: absolute;
    top: -0.42rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0 0.35rem;
    background: var(--surface);
    font-size: 0.54rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-text);
    font-weight: 700;
    white-space: nowrap;
    user-select: none;
}
.nav-frame.nav-frame-empty { display: none; }
.icon-nav-btn.nav-tool-hidden { display: none; }

/* The Mode frame: pinned first, never hidden */
.nav-frame.nav-mode { border-color: rgba(var(--primary-rgb), 0.45); }

/* The dock: Tracking on top, Study attached beneath, one dashed seam —
   while both show (is-pair). Otherwise each frame stands on its own. */
.nav-dock.is-pair { margin: 0.55rem 5px 0.15rem; }
.nav-dock.is-pair .nav-frame { margin: 0; }
.nav-dock.is-pair .dock-top { border-radius: 11px 11px 0 0; padding-bottom: 0.45rem; }
.nav-dock.is-pair .dock-bottom {
    border-radius: 0 0 11px 11px;
    border-top: 1px dashed var(--border);
    padding-top: 0.6rem;
}
.nav-dock.is-pair .dock-bottom .nav-frame-label { top: -0.4rem; }

/* Emoji icons in nav (e.g. verse trail 👣) */
.icon-nav-emoji {
    font-size: 1.4rem;
    line-height: 1;
    display: block;
}

/* Nav drag-and-drop reordering */
.icon-nav-btn[draggable="true"] {
    cursor: grab;
}
.icon-nav-btn.nav-dragging {
    opacity: 0.35;
    cursor: grabbing;
}
.icon-nav-btn.nav-drag-over {
    border-top: 2px solid var(--primary);
}

/* Navigation */
.nav-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ── Nav Reference Display (replaces book/chapter selects) ─────────────── */

.nav-ref-display {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    padding: 0.3rem 0.45rem;
    border: none;
    border-radius: 8px;
    background: none;
    font-family: 'Crimson Text', 'Georgia', serif;
    font-size: 1.18rem;
    color: var(--text-primary);
    line-height: 1;
    user-select: none;
}
.nav-ref-display .nav-ref-chapter { color: var(--gold-text); }

.nav-ref-segment {
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
    font-weight: 600;
}

.nav-ref-segment:hover {
    color: var(--primary);
    background: rgba(91, 75, 138, 0.07);
}

.nav-ref-dot,
.nav-ref-colon {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0 0.05rem;
}

/* ── Nav Picker Panel ──────────────────────────────────────────────────── */

.nav-picker-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 10010;
    animation: np-fade-in 0.15s ease;
}

.nav-picker-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(480px, 92vw);
    max-height: 70vh;
    background: var(--surface);
    border-radius: 0;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10011;
    animation: np-slide-in 0.18s ease;
}

@keyframes np-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes np-slide-in {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.nav-picker-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem 0.85rem 0.75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.np-back-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
    line-height: 1;
}

.np-back-btn:hover {
    color: var(--primary);
    background: rgba(91, 75, 138, 0.07);
}

.np-back-btn[hidden] {
    visibility: hidden;
    pointer-events: none;
}

.nav-picker-crumb {
    flex: 1;
    font-family: 'Crimson Text', 'Georgia', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.np-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: color 0.15s ease;
    line-height: 1;
}

.np-close-btn:hover {
    color: var(--text-primary);
}

.nav-picker-body {
    overflow-y: auto;
    flex: 1;
    padding: 0.5rem 0;
}

.np-group-header {
    grid-column: 1 / -1;
    padding: 0.5rem 0.75rem 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.np-book-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}

.np-book-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: 'Crimson Text', 'Georgia', serif;
    font-size: 0.92rem;
    color: var(--text-primary);
    transition: background 0.12s ease, color 0.12s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.np-book-item:hover {
    background: rgba(91, 75, 138, 0.06);
    color: var(--primary);
}

.np-book-item.current {
    color: var(--primary);
    font-weight: 700;
}

.np-number-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.35rem;
    padding: 0.75rem 1rem;
}

.np-num-btn {
    aspect-ratio: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.np-num-btn:hover {
    background: rgba(91, 75, 138, 0.07);
    border-color: var(--primary-light);
    color: var(--primary);
}

.np-num-btn.current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ── Nav Picker — mobile overrides ─────────────────────────────────────── */

@media (max-width: 480px) {
    .nav-picker-panel {
        width: 96vw;
        max-height: 80vh;
    }

    .np-book-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .np-number-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .nav-ref-display {
        font-size: 0.95rem;
        padding: 0.25rem 0.5rem;
    }
}

/* ── Verse focused state (IntersectionObserver tracks scroll position) ─── */

/* Reading position: the thin inset line retired 2026-08-30 — the
   Inked Number (purple chip on the numeral) carries this state now. */
.verse-container.verse-focused {
    background: transparent;
    transition: background 0.3s ease;
}

/* Translation nav button — text pill instead of SVG icon */
.translation-btn-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1;
    padding: 4px 6px;
    border: 1.5px solid currentColor;
    border-radius: 6px;
    color: var(--primary);
}
.icon-nav-btn:hover .translation-btn-label,
.icon-nav-btn.active .translation-btn-label { color: inherit; }

/* Translation picker flyout panel */
.translation-panel {
    position: fixed;
    z-index: 10001;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 0.5rem;
    animation: translation-panel-in 0.15s ease-out;
}

@keyframes translation-panel-in {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.translation-panel-pills {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.translation-lang-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem 0;
    margin-top: 0.15rem;
}

.translation-lang-label:first-child {
    margin-top: 0;
}

.translation-lang-row {
    display: flex;
    gap: 0.3rem;
}

.translation-pill {
    display: block;
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    white-space: nowrap;
}

.translation-pill:hover {
    background: var(--highlight);
    border-color: var(--primary-light);
}

.translation-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.translation-pill.active:hover {
    background: var(--primary-dark, var(--primary));
}

/* chapter-display hidden — book + chapter selectors already show this info */
.chapter-display {
    display: none;
}

/* Ghost buttons — the bar is one quiet strip; state colors (Strong's
   purple, encyclopedia blue, ¶ gold) come from the toggle rules above. */
.nav-btn {
    padding: 0.3rem 0.55rem;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    min-height: 32px;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(var(--primary-rgb), 0.09);
    color: var(--text-primary);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Chapter chevrons — quiet serif marks flanking the book title */
.nav-chevron {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.15rem 0.6rem;
    line-height: 1;
}

/* Main Layout — flex child of .app-body, scrolls independently */
.main-container {
    flex: 1;
    height: 100vh;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    overflow: hidden;
    padding: 0.5rem var(--content-padding) var(--content-padding);
    display: flex;
    gap: 2rem;
}

/* Bible Content — flex column so nav is pinned, verses scroll */
.bible-content {
    flex: 1;
    min-height: 0;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Verses area scrolls independently */
#content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.25rem 1.25rem;
}

.chapter-container {
    font-family: 'Crimson Text', serif;
    font-size: 1.25rem;
    line-height: 1.8;
}

.verse-container {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    transition: background 0.3s ease;
    position: relative;
}

.verse-container:hover {
    background: var(--highlight);
}

.verse-container.highlight {
    background: rgba(70, 130, 200, 0.15);
    animation: fadeHighlight 3s ease-out;
}

@keyframes fadeHighlight {
    0% { background: rgba(70, 130, 200, 0.2); }
    100% { background: transparent; }
}

/* Share-link arrival (?v=): the verse wears the commentary cream and
   lets it go over 3 seconds, so the visitor knows exactly which verse
   they were sent to. Welcome splash + mobile drawer step aside for
   these arrivals. Internal navigation keeps .highlight above. */
.verse-container.share-flash {
    animation: shareFlashFade 5s ease-out forwards;
}
@keyframes shareFlashFade {
    0%   { background: var(--highlight); }
    35%  { background: var(--highlight); }
    100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
    /* No fade — a steady wash that simply leaves when the class does. */
    .verse-container.share-flash { animation: none; background: var(--highlight); }
}

/* Bible reference links — appear in note text and study text read mode */
.bible-ref-link {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-style: dotted;
    cursor: pointer;
    font-weight: 500;
    border-radius: 2px;
    padding: 0 1px;
    transition: background 0.15s;
}
.bible-ref-link:hover {
    background: rgba(91, 75, 138, 0.1);
    text-decoration-style: solid;
}

.search-word-highlight {
    background: rgba(70, 130, 200, 0.3);
    border-radius: 2px;
    padding: 0 1px;
    animation: fadeWordHighlight 5s ease-out forwards;
}

@keyframes fadeWordHighlight {
    0%, 60% { background: rgba(70, 130, 200, 0.3); }
    100% { background: transparent; }
}

/* ── Bible Text Highlights ────────────────────────────────────────────── */
mark.hl-yellow  { background: rgba(255, 235, 59, 0.35); border-radius: 2px; }
mark.hl-green   { background: rgba(76, 175, 80, 0.30); border-radius: 2px; }
mark.hl-blue    { background: rgba(66, 165, 245, 0.30); border-radius: 2px; }
mark.hl-red     { background: rgba(211, 47, 47, 0.25); border-radius: 2px; }
mark.hl-orange  { background: rgba(255, 152, 0, 0.35); border-radius: 2px; }
mark.hl-purple  { background: rgba(171, 71, 188, 0.30); border-radius: 2px; }

/* Highlight right-click context menu */
/* Highlight context menu — glassmorphism style */
.highlight-menu {
    position: fixed;
    /* FEAT-008: the ONE selection pill serves every surface — must clear
       every host it can appear over (library 10200, ISBE panels 10310,
       intro overlay, study console 10000-10400, trail popup 20000). */
    z-index: 26000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: hlMenuIn 0.12s ease-out;
}
@keyframes hlMenuIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}
.highlight-menu-colors {
    display: flex;
    gap: 8px;
    padding: 2px;
}
.hl-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    outline: none;
}
.hl-swatch:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.hl-swatch-active {
    transform: scale(1.15);
    box-shadow: 0 0 0 2.5px var(--primary);
    border-color: var(--primary);
}
/* Actions row under the swatches — Send to Study + Remove
   (SelectionActionMenu, docs/SELECTION_ACTIONS_DESIGN.md) */
.highlight-menu-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    padding-top: 8px;
}
.highlight-menu-send {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid var(--primary);
    background: none;
    color: var(--primary);
    border-radius: 999px;
    font-family: Inter, -apple-system, sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}
.highlight-menu-send:hover { background: var(--primary); color: #fff; }
.highlight-menu-send svg { width: 15px; height: 15px; flex-shrink: 0; }
/* Remove shares the actions row with Send — undo its solo block sizing */
.highlight-menu-actions .highlight-menu-remove { width: auto; flex-shrink: 0; }
.hl-swatch-yellow  { background: #FFE066; }
.hl-swatch-green   { background: #81C784; }
.hl-swatch-blue    { background: #64B5F6; }
.hl-swatch-red     { background: #D32F2F; }
.hl-swatch-orange  { background: #FFB74D; }
.hl-swatch-purple  { background: #BA68C8; }

.highlight-menu-remove {
    display: block;
    width: 100%;
    padding: 6px 0;
    margin-top: 2px;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: none;
    color: #999;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-align: center;
    transition: color 0.15s;
}
.highlight-menu-remove:hover {
    color: var(--danger);
}

/* Dark mode overrides */
[data-theme="dark"] .highlight-menu,
.dark .highlight-menu {
    background: rgba(40, 40, 45, 0.88);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .hl-swatch,
.dark .hl-swatch {
    border-color: rgba(40, 40, 45, 0.8);
}
[data-theme="dark"] .highlight-menu-remove,
.dark .highlight-menu-remove {
    border-top-color: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}
[data-theme="dark"] .highlight-menu-remove:hover,
.dark .highlight-menu-remove:hover {
    color: var(--danger);
}

.verse-number {
    font-weight: 600;
    color: var(--secondary);
    margin-right: 0.5rem;
    font-size: 0.875em;
    vertical-align: super;
}

.verse-text {
    display: inline;
}

/* ── FEAT-026: THE CLEAN CARD ──────────────────────────────────────
   Nothing on the card but what is from the Bible itself. Tools and tag
   dots are GONE until the reader asks: click the verse on desktop,
   swipe right-to-left on touch. The full familiar bar then arrives as
   a floating capsule at the verse's bottom-right (user pick 2026-08-29:
   "B but with the style of A") — absolute-positioned, zero layout
   shift, one verse revealed at a time. State classes (VerseCard owns):
   .vc-revealed = tools out;  .vc-marked = Inked Number chip (verse
   carries tags / notes — bookmarks excluded until FEAT-028). */
.verse-action-bar {
    display: none;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}
.verse-container .verse-dots-stack { display: none; }
.verse-container:not(.vc-revealed) { cursor: pointer; }

/* The revealed card outranks its neighbors — hover/focus paints on
   adjacent verses must never cover the capsule. */
.verse-container.vc-revealed { z-index: 45; }
.verse-container.vc-revealed .verse-dots-stack { display: inline-grid; }
.verse-container.vc-revealed .verse-action-bar {
    display: flex;
    position: absolute;
    right: 0.3rem;
    top: calc(100% - 0.6rem);
    z-index: 30;
    margin-top: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.45rem 0.65rem;
    box-shadow: 0 8px 26px rgba(0,0,0,0.13);
    animation: vcCapsuleIn 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
    /* Gentle motion (user call 2026-09-01): glide when re-pinned below an
       opening commentary/xref panel; fade rather than blink when closing. */
    transition: top 0.18s ease, opacity 0.15s ease, transform 0.15s ease;
}
/* Closing beat — .vc-closing holds the revealed state while the capsule
   and wash fade; VerseCard strips all classes ~170ms later. */
.verse-container.vc-closing .verse-action-bar {
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
    animation: none;
}
.chapter-paragraph .verse-container { transition: background 0.22s ease; }
.chapter-paragraph .verse-container.vc-revealed.vc-closing,
.chapter-paragraph .verse-container.vc-revealed.vc-closing:hover {
    background: transparent;
}
@media (prefers-reduced-motion: reduce) {
    .verse-container.vc-revealed .verse-action-bar { transition: none; animation: none; }
    .verse-container.vc-revealed.vc-reveal-up .verse-action-bar { animation: none; }
    .chapter-paragraph .verse-container { transition: none; }
}
/* A true SLIDE (user call): the capsule slides OUT of the revealed
   verse over the neighbor — its own height of travel, not a fade-nudge. */
@keyframes vcCapsuleIn {
    from { opacity: 0.25; transform: translateY(-90%); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Space-aware flip (user call): the capsule slides over whichever side
   has more room — above or below — so the words the reader is most
   likely to tap next (Strong's, encyclopedia links) stay reachable. */
.verse-container.vc-revealed.vc-reveal-up .verse-action-bar {
    top: auto;
    bottom: calc(100% - 0.6rem);
    animation: vcCapsuleInUp 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes vcCapsuleInUp {
    from { opacity: 0.25; transform: translateY(90%); }
    to   { opacity: 1; transform: translateY(0); }
}

/* The whisper — "the Inked Number" (chosen 2026-08-30, replaces the
   margin tick AND the reading-position inset line): the verse numeral
   itself fills solid. Green chip = marked (tags/notes), purple chip =
   reading position (.verse-focused), split chip = both. A revealed
   verse keeps its wash + ring; the numeral is not part of that state.
   The chip is an absolutely-positioned overlay painted BEHIND the
   numeral, so its presence never changes the shape of the text —
   glyph metrics are identical in every state (user's law). */
.verse-number {
    position: relative;
    z-index: 0; /* own stacking context so the chip (z -1) stays inside */
}
.verse-number::before {
    content: "";
    position: absolute;
    inset: -0.1em -0.28em -0.05em;
    border-radius: 4px;
    z-index: -1;
    background: transparent;
}
.verse-container.vc-marked .verse-number { color: #fff; }
.verse-container.vc-marked .verse-number::before {
    background: var(--success);
    opacity: 0.9;
}
.verse-container.verse-focused .verse-number { color: #fff; }
.verse-container.verse-focused .verse-number::before {
    background: var(--primary);
    opacity: 0.9;
}
/* Calm tracker: soft hand-offs, and while the page is moving the purple
   chip rests — it alights when the reader stops. Green marks are static
   facts and never blink; a marked+focused verse simply shows green while
   moving. */
.verse-number, .verse-number::before { transition: color 0.2s ease, background-color 0.2s ease; }
.verse-container.vc-marked.verse-focused .verse-number::before {
    background: linear-gradient(135deg, var(--success) 50%, var(--primary) 50%);
}

/* Share — the one gold pill in the bar (reading tool, never gated) */
.verse-action-btn.share-verse-btn { color: var(--gold-text); border-color: var(--gold-border); opacity: 0.85; }
.verse-action-btn.share-verse-btn:hover { background: rgba(212, 160, 23, 0.1); color: var(--gold-text); border-color: var(--gold); }

/* Share feedback toast (VerseCard._toast) */
#vcShareToast {
    position: fixed;
    left: 50%;
    bottom: 2rem;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-primary);
    color: var(--background);
    font-size: 0.85rem;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
    z-index: 30000;
    max-width: 92vw;
    overflow-wrap: anywhere;
}
#vcShareToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Verse action button */
.verse-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    width: 38px;
    height: 26px;
    padding: 0;
    background: var(--surface);
    border: 1px solid rgba(var(--border-rgb), 0.4);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: all 0.15s ease;
    opacity: 0.6;
}
.verse-action-btn svg { width: 13px; height: 13px; }
.verse-action-btn .action-badge { font-size: 0.65rem; font-weight: 700; }
.verse-action-btn .action-badge:empty { display: none; }
.verse-action-btn:hover { opacity: 1; border-color: rgba(var(--primary-rgb),0.3); color: var(--primary); }
.verse-action-btn.has-count { opacity: 1; border-color: rgba(var(--primary-rgb),0.25); color: var(--primary); background: rgba(var(--primary-rgb),0.04); }
.verse-action-btn.has-count:hover { background: var(--primary); color: white; }
.verse-action-btn.bookmarked { opacity: 1; border-color: rgba(var(--primary-rgb),0.3); color: var(--primary); background: rgba(var(--primary-rgb),0.05); }

/* (hover / has-count visibility scheme retired by FEAT-026 —
   the clean card reveals on click/swipe, owned by VerseCard) */

/* Strong's Numbers */
.word[data-strongs] {
    color: var(--primary);
    cursor: pointer;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.word[data-strongs]:hover {
    background: var(--primary);
    color: white;
}

.word[data-strongs].word-selected {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 2px rgba(91, 75, 138, 0.3);
}

.word[data-strongs].strongs-hidden {
    color: inherit;
    cursor: text;
}

.word[data-strongs].strongs-hidden:hover {
    background: transparent;
    color: inherit;
}

sup.strongs.strongs-hidden {
    display: none;
}

/* Body-level class — persists strongs visibility across all renders, including newly loaded chapters */
body.strongs-hidden .word[data-strongs] {
    color: inherit;
    cursor: text;
}
body.strongs-hidden .word[data-strongs]:hover {
    background: transparent;
    color: inherit;
}
body.strongs-hidden sup.strongs {
    display: none;
}

/* FEAT-026: in the CLEAN card the original-language layer sleeps too —
   no Strong's sups, no word purple, no encyclopedia blue. The verse
   reads as plain Scripture; reveal the card and the words wake (global
   toggles still rule the revealed state). Placed AFTER the global rules
   so the clean state wins specificity ties. */
.verse-container:not(.vc-revealed) sup.strongs { display: none; }
.verse-container:not(.vc-revealed) .word[data-strongs] { color: inherit; cursor: pointer; }
.verse-container:not(.vc-revealed) .word[data-strongs]:hover { background: transparent; color: inherit; }
.verse-container:not(.vc-revealed) .isbe-word-link { color: inherit; cursor: pointer; }
.verse-container:not(.vc-revealed) .isbe-word-link:hover { filter: none; }

/* Sidebar — scrolls independently, fills its flex cell */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-clear-all-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.sidebar-clear-all-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(229, 115, 115, 0.08);
}

/* Strong's Numbers in Text */
sup.strongs {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    margin: 0 0.125rem;
    background: var(--highlight);
    border: 1px solid var(--primary);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    line-height: 1;
    position: relative;
    top: -0.25rem;
    /* Paragraph layout sets text-indent on .chapter-paragraph; an
       inline-block inherits it and indents its OWN first line, padding
       every pill with 1.4em of dead space. Zero it here. */
    text-indent: 0;
}

sup.strongs:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

sup.strongs.word-selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 2px rgba(91, 75, 138, 0.3);
}

/* Strong's Display */
/* Sidebar inner surface — the quiet app ground, so every sidebar view
   (welcome, words, bookmarks, tags…) sits in the same world as the shell.
   Cards inside carry their own surface. */
.strongs-display {
    padding: 1rem;
    background: var(--background);
    border-radius: 8px;
    border: none;
    overflow-x: hidden;
}

.strongs-number {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.strongs-lemma {
    font-size: 1.75rem;
    font-family: 'Times New Roman', Georgia, serif;
    font-weight: 400;
}

.strongs-definition {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.strongs-kjv {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* Tabs */
.tab-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2.5px solid transparent;
    border-radius: 0;
    cursor: pointer;
    font-weight: 600;
    transition: color 0.2s, border-color 0.2s;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

.tab-content {
    padding: 1rem 0;
}

/* Letter Analysis */
.letter-analysis-item {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--background);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.hebrew-letter {
    font-size: 2rem;
    color: var(--primary);
    font-weight: bold;
}

.letter-name {
    font-weight: 600;
    color: var(--text-primary);
}

.letter-details {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.letter-meaning {
    color: var(--text-primary);
    line-height: 1.5;
    margin-top: 0.5rem;
}

.prefix-badge {
    background: #FFD700;
    color: #000;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.gematria-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border);
    font-weight: bold;
}

/* Anagrams */
.anagrams-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.anagram-summary {
    background: var(--highlight);
    border-radius: 8px;
    padding: 0.75rem;
}
.anagram-summary .anagram-summary-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.anagram-group {
    margin-bottom: 0.5rem;
}
.anagram-group-header {
    background: linear-gradient(90deg, var(--primary), transparent);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.anagram-category {
    margin-bottom: 1rem;
}
.anagram-category-label {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}
.anagram-category-label.words { color: var(--primary); }
.anagram-category-label.names { color: #8B4513; }
.anagram-category-label.places { color: #2E8B57; }

.anagram-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

.anagram-card {
    padding: 0.75rem;
    background: var(--background);
    border-radius: 8px;
    border: 1px solid var(--primary);
    cursor: pointer;
    transition: all 0.2s;
}
.anagram-card:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}
.anagram-card.name {
    background: #FFF5EE;
    border-color: #8B4513;
}
.anagram-card.place {
    background: #F0FFF0;
    border-color: #2E8B57;
}
.anagram-card.root {
    background: #FFF8DC;
    border-color: #DAA520;
}

.anagram-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}
.anagram-root-badge {
    font-size: 0.75rem;
    color: #DAA520;
}

.anagram-number {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--primary);
}

.anagram-lemma {
    font-size: 1.25rem;
    font-family: 'Crimson Text', serif;
    margin-bottom: 0.25rem;
}

.anagram-translit {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

.anagram-def {
    font-size: 0.75rem;
    color: var(--text-primary);
    margin-top: 0.25rem;
    line-height: 1.3;
}

.anagram-footer {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #FFF8DC;
    border: 2px solid #FFD700;
    border-radius: 8px;
}
.anagram-footer p {
    font-size: 0.75rem;
    color: #856404;
    margin: 0.5rem 0 0 0;
}

/* Bookmarks */
.bookmark-item {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--highlight);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bookmark-item:hover {
    background: var(--primary);
    color: white;
}

.remove-bookmark-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.remove-bookmark-btn:hover {
    opacity: 1;
    color: var(--text-primary);
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface);
    /* corners: .modal-shell (css/modal-header.css) */
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    width: 92%;
    max-width: 860px;
    height: min(620px, 86vh);
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

/* Header bar: the one header bar (css/modal-header.css). Only the drag
   cursor and stacking are this window's own. */
.settings-header {
    z-index: 1;
    cursor: grab;
}
.settings-header:active { cursor: grabbing; }

.settings-content {
    background: var(--surface);
    border-radius: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

/* ── Settings 2026-08-31 rebuild: rail + sections + switches ──────────── */
/* Signed-out honesty note (signed-out.css owns visibility) — content has no
   padding in the new shell, so the note carries its own */
.settings-content .sg-settings-note { margin: 0.6rem 0.9rem 0; }

.stg-top {
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.stg-search {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.34rem 0.65rem;
    max-width: 320px;
    margin-left: auto;
}
.stg-search svg { width: 13px; height: 13px; color: var(--text-secondary); flex-shrink: 0; }
.stg-search input {
    border: none; outline: none; background: none;
    font-size: 0.83rem; color: var(--text-primary); width: 100%;
    font-family: inherit;
}
.stg-search input::placeholder { color: var(--text-secondary); }

.stg-body { display: flex; flex: 1; min-height: 0; }
.stg-rail {
    width: 176px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    padding: 0.8rem 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--background);
    overflow-y: auto;
}
.stg-rail-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border: none;
    background: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.13s, color 0.13s;
}
.stg-rail-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.stg-rail-btn:hover { color: var(--text-primary); background: var(--highlight); }
.stg-rail-btn.on { background: var(--primary); color: #fff; }
.stg-rail-spacer { flex: 1; }
.stg-rail-note {
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 0.6rem 0.7rem 0;
    border-top: 1px solid var(--border);
}

.stg-pane { flex: 1; overflow-y: auto; padding: 1.15rem 1.4rem 1.4rem; }
.stg-sect { display: none; }
.stg-sect.on { display: block; animation: stgSectIn 0.18s ease-out; }
@keyframes stgSectIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.stg-sect-title {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold-text);
    font-weight: 700;
    margin-bottom: 0.8rem;
}
.stg-row {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding: 0.72rem 0.2rem;
    border-bottom: 1px solid var(--highlight);
}
.stg-sect .stg-row:last-child { border-bottom: none; }
.stg-lbl { flex: 1; min-width: 0; }
.stg-lbl b { display: block; font-size: 0.87rem; font-weight: 600; color: var(--text-primary); }
.stg-lbl span { display: block; font-size: 0.76rem; color: var(--text-secondary); line-height: 1.45; margin-top: 0.14rem; }
.stg-lbl-sub b { font-weight: 500; color: var(--text-secondary); padding-left: 0.4rem; }
.stg-row.hit { background: var(--highlight); border-radius: 8px; padding-left: 0.6rem; padding-right: 0.6rem; }
.stg-row.hidden { display: none; }

/* Switch */
.stg-sw {
    position: relative;
    width: 40px; height: 23px;
    border-radius: 999px;
    border: none;
    background: var(--border);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.18s ease;
}
.stg-sw::after {
    content: '';
    position: absolute;
    top: 2.5px; left: 2.5px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.18s ease;
}
.stg-sw[aria-checked="true"] { background: var(--primary); }
.stg-sw[aria-checked="true"]::after { transform: translateX(17px); }
.stg-sw:focus-visible, .stg-seg button:focus-visible, .stg-rail-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Segmented control */
.stg-seg {
    display: inline-flex;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2.5px;
    flex-shrink: 0;
    gap: 2px;
}
.stg-seg button {
    border: none;
    background: none;
    padding: 0.3rem 0.75rem;
    font-size: 0.79rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.13s, color 0.13s;
}
.stg-seg button:hover { color: var(--text-primary); }
.stg-seg button.on { background: var(--primary); color: #fff; font-weight: 600; }

/* Auto-close seconds chips */
.stg-chips { display: inline-flex; gap: 0.35rem; }
.stg-chips button {
    width: 30px; height: 26px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
}
.stg-chips button.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* Text size slider */
.stg-sliderbox { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.stg-sliderbox input[type=range] { width: 130px; accent-color: var(--primary); }
.stg-val {
    font-size: 0.74rem;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.18rem 0.2rem;
    background: var(--background);
    font-variant-numeric: tabular-nums;
}
.stg-mini {
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 0.72rem;
    padding: 0.24rem 0.5rem;
    cursor: pointer;
    font-family: inherit;
}
.stg-mini:hover { color: var(--text-primary); border-color: var(--primary); }

/* Action rows (chevron) */
.stg-action { cursor: pointer; border-radius: 8px; transition: background 0.13s; }
.stg-action:hover { background: var(--highlight); padding-left: 0.6rem; padding-right: 0.6rem; }
.stg-chev { color: var(--text-secondary); font-size: 1.05rem; flex-shrink: 0; }

/* Live preview */
.stg-preview {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
    padding: 0.95rem 1.15rem;
    margin-bottom: 0.9rem;
}
.stg-pv-tag {
    font-size: 0.64rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-text);
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.stg-pv {
    font-family: 'Crimson Text', Georgia, serif;
    color: var(--text-primary);
    font-size: 1.05rem;      /* rem — follows the Text size setting live */
    line-height: 1.8;
}
.stg-pv .vn { color: var(--primary); font-weight: 700; font-size: 0.68em; vertical-align: super; margin-right: 0.3em; }
.stg-pv sup.st { color: var(--primary); font-size: 0.6em; font-weight: 700; margin-left: 0.12em; }
.stg-pv.para { text-indent: 1.4em; }
.stg-pv.para .stg-pv-v { display: inline; }
.stg-pv.para .stg-pv-v + .stg-pv-v { margin-left: 0.35em; }
.stg-pv.verse { text-indent: 0; }
.stg-pv.verse .stg-pv-v { display: block; margin-bottom: 0.4em; }
.stg-pv.hide-st sup.st { display: none; }

/* Danger zone */
.stg-danger {
    margin-top: 1.2rem;
    border: 1px solid var(--danger);
    border-radius: 10px;
    padding: 0.15rem 0.85rem;
    background: rgba(211, 47, 47, 0.06);
}
.stg-danger .stg-lbl b { color: var(--danger); }
.stg-btn-danger {
    border: 1px solid var(--danger);
    color: var(--danger);
    background: none;
    border-radius: 7px;
    font-size: 0.78rem;
    padding: 0.32rem 0.8rem;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
}
.stg-btn-danger:hover { background: var(--danger); color: #fff; }

/* Footer */
.stg-foot {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 1.1rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 0.74rem;
    color: var(--text-secondary);
    background: var(--background);
}
.stg-saved {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.stg-saved.show { opacity: 1; }
.stg-saved[hidden] { display: none; }
.stg-dot { width: 7px; height: 7px; border-radius: 50%; background: #4a9d5f; }

/* ── Settings › Toolbar (FEAT-045, docs/TOOLBAR_GROUPS_DESIGN.md) ─────── */
.stg-tb-row { display: block; }
.stg-tb-lede { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; margin: 0 0 0.9rem; max-width: 60ch; }
.stg-tb-lede b { color: var(--text-primary); }

.stg-tb-list { display: flex; flex-direction: column; gap: 0.6rem; }
.stg-tb-grp {
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    overflow: hidden;
}
.stg-tb-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.6rem 0.5rem 0.7rem;
    background: var(--background);
    border-bottom: 1px solid var(--border);
}
.stg-tb-grp.is-off .stg-tb-head,
.stg-tb-grp.is-locked .stg-tb-head { border-bottom-color: transparent; }
.stg-tb-name { flex: 1; min-width: 0; font-size: 0.86rem; font-weight: 600; color: var(--text-primary); cursor: pointer; }
.stg-tb-name small { display: block; font-size: 0.7rem; font-weight: 400; color: var(--text-secondary); margin-top: 0.08rem; }
.stg-tb-grp.is-off .stg-tb-name { color: var(--text-secondary); }
.stg-tb-items { display: flex; flex-direction: column; }
.stg-tb-grp.is-off .stg-tb-items,
.stg-tb-grp.is-sleeping .stg-tb-items { display: none; }
.stg-tb-grp.is-sleeping .stg-tb-head { opacity: 0.55; }

.stg-tb-chk { width: 18px; height: 18px; flex-shrink: 0; margin: 0; accent-color: var(--primary); cursor: pointer; }
.stg-tb-chk:disabled { cursor: default; }

.stg-tb-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.38rem 0.6rem 0.38rem 1.2rem;
    border-bottom: 1px solid var(--highlight);
}
.stg-tb-item:last-child { border-bottom: none; }
.stg-tb-item.is-off .stg-tb-label,
.stg-tb-item.is-off .stg-tb-icon { opacity: 0.45; }
.stg-tb-icon {
    width: 30px; height: 30px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--primary);
}
.stg-tb-icon svg { width: 17px; height: 17px; }
.stg-tb-icon .icon-nav-emoji { font-size: 1.05rem; }
.stg-tb-icon .translation-btn-label { font-size: 0.72rem; height: auto; }
.stg-tb-label { flex: 1; min-width: 0; font-size: 0.83rem; font-weight: 500; cursor: pointer; }
.stg-tb-label small { display: block; font-size: 0.68rem; color: var(--text-secondary); font-weight: 400; }

.stg-tb-nudge { display: inline-flex; gap: 2px; flex-shrink: 0; }
.stg-tb-nudge button {
    width: 26px; height: 26px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.stg-tb-nudge button:hover:not(:disabled) { color: var(--text-primary); border-color: var(--primary); }
.stg-tb-nudge button:disabled { opacity: 0.3; cursor: default; }
.stg-tb-nudge svg { width: 11px; height: 11px; }

.stg-tb-pill { font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700; border-radius: 999px; padding: 0.14rem 0.5rem; flex-shrink: 0; }
.stg-tb-pill.is-hidden { background: var(--highlight); color: var(--text-secondary); }
.stg-tb-pill.is-some { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.stg-tb-pill.is-pinned { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.stg-tb-pill.is-mode { background: var(--highlight); color: var(--gold-text); }

/* The docked pair in the list: one card on another, a seam between */
.stg-tb-pair { display: flex; flex-direction: column; }
.stg-tb-pair .stg-tb-grp.is-host { border-radius: 11px 11px 0 0; }
.stg-tb-pair .stg-tb-grp.is-docked { border-radius: 0 0 11px 11px; border-top: none; }
.stg-tb-seam {
    display: flex; align-items: center; gap: 0.45rem;
    padding: 0.3rem 0.75rem;
    border-left: 1px solid var(--border); border-right: 1px solid var(--border);
    border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border);
    background: var(--surface);
    font-size: 0.7rem; color: var(--text-secondary);
}
.stg-tb-seam svg { width: 13px; height: 13px; color: var(--primary); flex-shrink: 0; }
.stg-tb-seam.is-sleeping svg { color: var(--text-secondary); }

.stg-tb-reset { margin-top: 0.9rem; display: flex; align-items: center; gap: 1.1rem; padding: 0.72rem 0.2rem 0; }

/* The phone preview */
.stg-phone { width: 100%; max-width: 340px; margin: 0 auto; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); overflow: hidden; box-shadow: 0 6px 22px rgba(0,0,0,0.08); }
.stg-phone-screen { height: 84px; display: flex; align-items: flex-end; justify-content: center; padding: 0 1rem 0.6rem; background: var(--background); }
.stg-phone-hint { font-family: 'Crimson Text', Georgia, serif; font-style: italic; font-size: 0.82rem; color: var(--text-secondary); text-align: center; }
.stg-phone-bar { display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--border); padding: 0.3rem 0.3rem 0.5rem; }
.stg-phone-tab { display: flex; flex-direction: column; align-items: center; gap: 0.18rem; color: var(--text-secondary); padding: 0.32rem 0.4rem; min-width: 54px; }
.stg-phone-tab svg { width: 21px; height: 21px; flex-shrink: 0; }
.stg-phone-tab .icon-nav-emoji { font-size: 1.25rem; }
.stg-phone-tab .translation-btn-label { height: 21px; font-size: 0.86rem; }
.stg-phone-tab > span:last-child { font-size: 0.62rem; font-weight: 600; }
.stg-phone-tab.is-study { color: var(--primary); }
.stg-phone-note { font-size: 0.74rem; color: var(--text-secondary); line-height: 1.5; margin: 0.8rem auto 0; max-width: 56ch; text-align: center; }

/* Footer: Save / Discard for the Toolbar section only */
.stg-tb-foot { margin-left: auto; display: inline-flex; align-items: center; gap: 0.5rem; }
.stg-tb-foot[hidden] { display: none; }
.stg-tb-foot ~ .stg-saved, .stg-saved ~ .stg-tb-foot { margin-left: 0.6rem; }
.stg-tb-state { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.74rem; color: var(--text-secondary); }
.stg-tb-state.is-dirty .stg-dot { background: var(--gold-text); }
.stg-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); border-radius: 8px; padding: 0.36rem 0.8rem; font-size: 0.78rem; font-weight: 500; cursor: pointer; font-family: inherit; }
.stg-btn:hover:not(:disabled) { background: var(--highlight); }
.stg-btn:disabled { opacity: 0.45; cursor: default; }
.stg-btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.stg-btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

/* Mobile: the panel becomes a bottom sheet (togglePanel clears the inline
   centering styles at this width so these rules own the position) */
@media (max-width: 760px) {
    .settings-panel {
        top: auto;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100%;
        max-width: none;
        height: 88dvh;
        border-radius: 18px 18px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }
    .settings-panel::before {
        content: '';
        display: block;
        width: 40px; height: 4px;
        border-radius: 999px;
        background: var(--border);
        margin: 0.5rem auto 0;
        flex-shrink: 0;
    }
    .stg-search { max-width: none; }
    .stg-body { flex-direction: column; }
    .stg-rail {
        flex-direction: row;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.45rem 0.6rem;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .stg-rail::-webkit-scrollbar { display: none; }
    .stg-rail-btn { flex-shrink: 0; padding: 0.5rem 0.85rem; border-radius: 999px; }
    .stg-rail-note, .stg-rail-spacer { display: none; }
    .stg-pane { padding: 1rem 1rem 1.3rem; }
    .stg-row { gap: 0.8rem; padding: 0.8rem 0.2rem; }
    .stg-row-seg { flex-wrap: wrap; }
    .stg-row-seg .stg-lbl { flex-basis: 100%; }
    .stg-row-seg .stg-seg { margin-left: auto; }
    .stg-row-slider { flex-wrap: wrap; }
    .stg-row-slider .stg-sliderbox { flex-basis: 100%; justify-content: flex-end; }
    .stg-row-slider .stg-sliderbox input[type=range] { flex: 1; width: auto; }
    .stg-sw { width: 46px; height: 27px; }
    .stg-sw::after { width: 22px; height: 22px; }
    .stg-sw[aria-checked="true"]::after { transform: translateX(19px); }
    .stg-foot { padding-bottom: calc(0.5rem + env(safe-area-inset-bottom)); flex-wrap: wrap; }
    .stg-foot-hint { display: none; }
    .stg-saved { margin-left: 0; }
    .stg-tb-foot { margin-left: auto; }
    .stg-tb-item { padding-left: 0.7rem; }
}

.attribution-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.attribution-list li {
    padding: 0.3rem 0;
}
.attribution-list strong {
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: background 0.3s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading-spinner {
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Reading Modes */
.reading-mode-focus .verse-container:not(:hover) {
    opacity: 0.7;
}

.reading-mode-focus .verse-container:hover {
    opacity: 1;
    transform: scale(1.02);
}

/* Responsive Design */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 320px;
        --content-padding: 1rem;
    }
}

@media (max-width: 768px) {
    /* Nav rail → horizontal bottom bar */
    .app-body {
        flex-direction: column;
    }

    body[data-nav-side="right"] .app-body {
        flex-direction: column;
    }

    /* The rail retires on phones — five labeled tabs + a More sheet take
       over. Tabs proxy the real rail buttons, which stay in the (hidden)
       DOM as the one source of behavior, badges, and gating. */
    .icon-nav {
        display: none;
    }

    .mobile-tabbar {
        display: flex;
        order: 2;
        flex-shrink: 0;
        justify-content: space-around;
        background: var(--surface);
        border-top: 1px solid var(--border);
        padding: 0.3rem 0.4rem calc(0.4rem + env(safe-area-inset-bottom));
        /* The tab bar is app chrome — it must stay tappable ABOVE the
           slide-over sidebar drawer (z 9000) and its backdrop (8999).
           The welcome drawer auto-opens on boot and was covering the
           tabs: real taps hit the drawer, nothing opened. Below the
           sheet scrim (9500) so an open More sheet still owns the screen. */
        position: relative;
        z-index: 9100;
    }
    .mtb-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.18rem;
        border: none;
        background: none;
        cursor: pointer;
        color: var(--text-secondary);
        font-family: inherit;
        padding: 0.32rem 0.6rem;
        border-radius: 10px;
        min-width: 56px;
        min-height: var(--touch-target-min);
    }
    .mtb-item svg { width: 21px; height: 21px; flex-shrink: 0; }
    .mtb-item .icon-nav-icon-wrap svg { width: 21px; height: 21px; }
    .mtb-item > span:last-child { font-size: 0.62rem; font-weight: 600; }
    .mtb-item:active { color: var(--primary); background: rgba(var(--primary-rgb), 0.09); }

    .mobile-sheet-scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 9500;
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s;
    }
    .mobile-sheet-scrim.open { opacity: 1; pointer-events: auto; }

    /* The same bottom-sheet language Settings taught */
    .mobile-more-sheet {
        display: block;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 9600;
        background: var(--surface);
        border-radius: 18px 18px 0 0;
        border-top: 1px solid var(--border);
        box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.25);
        transform: translateY(105%);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0.15, 1);
        padding: 0 1.1rem calc(1rem + env(safe-area-inset-bottom));
        max-height: 78dvh;
        overflow-y: auto;
    }
    .mobile-more-sheet.open { transform: translateY(0); }
    .mobile-more-sheet::before {
        content: '';
        display: block;
        width: 40px; height: 4px;
        border-radius: 999px;
        background: var(--border);
        margin: 0.55rem auto 0.3rem;
    }
    .mts-group {
        font-size: 0.64rem;
        letter-spacing: 0.18em;
        text-transform: uppercase;
        color: var(--gold-text);
        font-weight: 700;
        margin: 0.9rem 0 0.5rem;
    }
    .mts-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.4rem;
    }
    .mts-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
        border: none;
        background: var(--background);
        cursor: pointer;
        border-radius: 12px;
        padding: 0.7rem 0.2rem 0.6rem;
        color: var(--text-secondary);
        font-family: inherit;
        min-height: var(--touch-target-min);
    }
    .mts-item svg { width: 20px; height: 20px; }
    .mts-item span:last-child { font-size: 0.62rem; font-weight: 600; }
    .mts-item:active { background: rgba(var(--primary-rgb), 0.12); color: var(--primary); }
    .mts-item .translation-btn-label { font-size: 0.7rem; padding: 3px 5px; }
    .mts-item .icon-nav-badge { top: -4px; right: -7px; }

    .main-container {
        order: 1;
        flex: 1;
        min-height: 0;
    }

    .bible-content {
        padding: 1rem;
    }

    .chapter-container {
        font-size: 1.125rem;
    }

    /* Sidebar → slide-over drawer */
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 85vw;
        max-width: 400px;
        height: 100%;
        height: 100dvh;
        height: var(--app-height, 100dvh);
        z-index: 9000;
        border-radius: 0;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        box-shadow: -4px 0 20px rgba(0,0,0,0.15);
        /* Clear the tab bar (which now paints over the drawer's bottom
           strip) so the drawer's own content is never hidden behind it. */
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 8999;
    }

    .sidebar-backdrop.visible {
        display: block;
    }
}

@media (max-width: 480px) {
    :root {
        --content-padding: 0.5rem;
    }

    .nav-container {
        flex-wrap: nowrap;
        gap: 0.35rem;
        /* Fill the bar and pin ←/→ to its extremes so the row's outer
           edges (← left, ▼ right) line up with the verse-card edges. */
        flex: 1;
        justify-content: space-between;
    }

    .bible-nav {
        /* Symmetric 0.4rem matches #content's card inset on both sides.
           The chevron (.bible-nav-right) is in-flow at this width (see
           intro-overlay.css), so no reserved footprint is needed. */
        padding: 0.3rem 0.4rem;
        align-items: center;
    }

    .nav-container .nav-btn {
        padding: 0.3rem 0.5rem;
    }

    .chapter-display {
        min-width: auto;
        font-size: 0.8rem;
    }

    /* Reclaim horizontal space on phones: the outer shells slim down so
       verse cards and the nav bar get nearly the full screen width. */
    .bible-content {
        padding: 0.5rem 0.35rem 0.35rem;
    }

    #content {
        padding: 0.75rem 0.4rem 1rem;
    }

    .verse-container {
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.75rem;
    }

    .chapter-title {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }

    .chapter-container {
        font-size: 1rem;
    }

    /* Touch targets — 44px minimum */
    .nav-btn {
        min-width: var(--touch-target-min);
        min-height: var(--touch-target-min);
    }

    .nav-ref-display {
        min-height: var(--touch-target-min);
        font-size: 0.9rem;
        /* Never wrap the reference — "2 Corinthians" was breaking to two
           lines and doubling the bar height on phones. */
        white-space: nowrap;
    }

    .tab-btn {
        min-height: var(--touch-target-min);
        padding: 0.5rem 0.75rem;
    }

    /* Translation picker — reposition above bottom nav on mobile */
    .translation-panel {
        bottom: 60px;
        top: auto !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%);
    }

    /* iOS auto-zoom prevention — Safari zooms on inputs < 16px */
    input, textarea, select {
        font-size: 16px !important;
    }
}

/* Reading focus mode — disable transform on touch devices */
@media (hover: none) {
    .reading-mode-focus .verse-container:not(:hover) {
        opacity: 1;
    }

    .reading-mode-focus .verse-container:hover {
        transform: none;
    }
}

/* Strong's Numbers Styling */
.strongs {
    color: var(--primary);
    font-size: 0.75em;
    vertical-align: super;
    cursor: pointer;
    margin: 0 0.125rem;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.strongs:hover {
    background: var(--highlight);
    color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Hebrew Practice Modal Styles */
.hebrew-practice-modal {
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.hebrew-modal-content {
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.hebrew-verse-block:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hebrew-verse-block[data-highlighted="true"] {
    animation: highlightPulse 1s ease;
}

@keyframes highlightPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* DEAD 2026-09-17 — flagged for deletion (one header bar, docs/MODAL_HEADER_DESIGN.md). Nothing wears this any more. Uncomment to revert; delete after a few weeks if all is well.
   Why: .modal-btn left the Language Practice bar today; .modal-close-btn was never on its close button.
.modal-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: scale(1.05);
}

.modal-close-btn:hover {
    transform: scale(1.2) rotate(90deg);
    transition: transform 0.3s ease;
}
*/

/* Hebrew text styling */
.hebrew-row {
    font-feature-settings: "kern" 1;
    letter-spacing: 0.05em;
}

/* Pronunciation row (Language Practice modal) */
.pronunciation-row {
    font-size: 1.2em;
    color: #B8860B;
    margin-bottom: 0.75rem;
    line-height: 1.6;
    font-weight: 500;
}

/* Word-level hover tokens */
.lang-word {
    display: inline;
    border-radius: 3px;
    padding: 0 1px;
    transition: background 0.15s;
    cursor: default;
}

.lang-word.word-hover {
    background: rgba(74, 144, 226, 0.2);
}

/* Responsive modal */
@media (max-width: 768px) {
    .hebrew-modal-content {
        width: 98%;
        margin: 0.5% auto;
    }

    .hebrew-modal-header {
        padding: 0.5rem 0.75rem !important;
    }

/* DEAD 2026-09-17 — flagged for deletion (one header bar, docs/MODAL_HEADER_DESIGN.md). Nothing wears this any more. Uncomment to revert; delete after a few weeks if all is well.
   Why: Language Practice phone rules for classes the bar no longer has (.modal-controls/.modal-btn gone today; .modal-close-btn never worn).
    .modal-controls {
        flex-direction: row !important;
        gap: 0.35rem !important;
    }

    .modal-btn {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.85rem !important;
    }

    .modal-close-btn {
        font-size: 1.5rem !important;
    }
*/

    .hebrew-modal-body {
        padding: 0.75rem;
        max-height: 82vh;
    }

    .hebrew-verse-block {
        padding: 0.75rem !important;
    }
}

/* Print styles for Hebrew practice */
@media print {
    .hebrew-practice-modal {
        position: static;
        background: white;
    }
    
    .hebrew-modal-content {
        box-shadow: none;
        width: 100%;
        margin: 0;
    }
    
    .hebrew-modal-header .modal-ctls,
    .hebrew-modal-footer {
        display: none;
    }
    
    .hebrew-verse-block {
        page-break-inside: avoid;
        border: 1px solid var(--border);
    }
}


/* ── THE OPEN PAGE (owner-approved 2026-08-30, replaces Beautiful
   Verse Styling): Scripture flows as a typeset page — no boxes, no
   borders, small gold numerals. A verse only becomes a "card" the
   moment it is touched: a soft wash and hairline ring materialize,
   the capsule slides in, and on close the page is seamless again.
   This block is the cascade WINNER for verse dressing — the mobile
   compaction below adjusts it; nothing else should. ── */
/* The printed page head — "the Classic Spread" (chosen 2026-08-30):
   book name left in small caps, chapter right in gold, one hairline —
   exactly how a printed spread labels itself. Lives IN the flow and
   scrolls away with the text, like the top of an e-reader page. */
.chapter-spread-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding: 0 0.6rem 0.45rem;  /* horizontal matches .verse-container */
    margin: 0.2rem 0 1.1rem;
}
.csh-book {
    font-family: 'Crimson Text', serif;
    font-variant: small-caps;
    letter-spacing: 0.18em;
    font-size: 1.05rem;
    color: var(--text-secondary);
}
.csh-chapter {
    font-family: Inter, -apple-system, sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--gold-text);
    font-variant-numeric: tabular-nums;
}

.verse-container {
    margin-bottom: 0.15rem;
    padding: 0.3rem 0.6rem;
    background: transparent;
    border-radius: 6px;
    border-left: none;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

/* ── READING LAYOUT (FEAT-029): verses flow into printed paragraphs.
   The SAME .verse-container elements — every tool, chip, and handler —
   simply lay inline inside <p> blocks grouped by data/paragraphs.json.
   Toggled by body.layout-paragraph via the ¶ button / Settings. ── */
.chapter-paragraph {
    position: relative;             /* capsule anchors here (JS-measured) */
    font-family: 'Crimson Text', serif;
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    margin: 0 0 1rem;
    padding: 0 0.6rem;
    text-indent: 1.4em;             /* first line indented, like print */
}
.chapter-paragraph .verse-container {
    display: inline;
    position: static;   /* capsule anchors to the paragraph, not the inline box */
    padding: 0;
    margin: 0;
    border-radius: 3px;
    /* the wash must follow the words across line breaks */
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
.chapter-paragraph .verse-container:hover {
    background: rgba(var(--primary-rgb), 0.05);
    box-shadow: none;
}
.chapter-paragraph .verse-container.vc-revealed,
.chapter-paragraph .verse-container.vc-revealed:hover {
    background: rgba(var(--primary-rgb), 0.09);
    box-shadow: none;               /* no ring on inline — the wash is the tell */
}
.chapter-paragraph .verse-text { display: inline; font: inherit; }
/* the capsule floats over the following text at its JS-measured spot */
.chapter-paragraph .verse-action-bar { z-index: 40; }
/* Block tools opened from an inline verse read as inset blocks. Their
   own show/hide machinery is untouched — never force display here (a
   visible block inside an inline verse splits the paragraph). */
.chapter-paragraph .verse-commentary-panel,
.chapter-paragraph .xref-panel {
    text-indent: 0;
    font-family: Inter, -apple-system, sans-serif;
    margin: 0.5rem 0;
}
/* The floating capsule holds its place at the verse's last line — open
   panels clear it with top room so their first row (the commentary tabs,
   the xref list) is never trapped underneath the tools that opened it.
   (user bug 2026-09-01: "the TOOLS COVER the options") */
.chapter-paragraph .verse-container.vc-revealed .verse-commentary-panel.open,
.chapter-paragraph .verse-container.vc-revealed .xref-panel {
    margin-top: 3.4rem;
}

.verse-container:hover {
    transform: none;
    background: rgba(var(--primary-rgb), 0.035);
    box-shadow: none;
}

.verse-container.vc-revealed,
.verse-container.vc-revealed:hover {
    background: rgba(var(--primary-rgb), 0.05);
    box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.14);
}

.verse-number {
    display: inline;
    font-weight: 700;
    color: var(--gold-text);
    font-size: 0.62rem;
    margin-right: 0.45rem;
    padding: 0;
    background: none;
    border-radius: 0;
    min-width: 0;
    text-align: left;
    box-shadow: none;
    letter-spacing: 0.02em;
    vertical-align: super;
    font-family: Inter, -apple-system, sans-serif;
}

.verse-text {
    font-family: 'Crimson Text', serif;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

/* Chapter Title */
.chapter-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.25rem;
    text-align: center;
    font-family: 'Crimson Text', serif;
    text-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* ── Mobile verse compaction (must come AFTER Beautiful Verse Styling) ── */
@media (max-width: 480px) {
    #content {
        padding: 0.5rem 0.4rem 0.75rem;
    }

    .verse-container {
        padding: 0.25rem 0.45rem;
        margin-bottom: 0.1rem;
    }

    .verse-number {
        margin-right: 0.4rem;
    }

    .chapter-spread-head {
        padding: 0 0.45rem 0.35rem;  /* matches compacted verse padding */
        margin: 0.1rem 0 0.8rem;
    }
    .csh-book { font-size: 0.95rem; }

    .chapter-paragraph {
        font-size: 1.05rem;
        line-height: 1.75;
        padding: 0 0.45rem;
        margin-bottom: 0.85rem;
    }

    .verse-text {
        font-size: 1.05rem;
        line-height: 1.75;
    }

    .chapter-title {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
}

@media (hover: none) {
    .verse-container:hover {
        transform: none;
    }
}

/* (Old .verse-note-actions / .note-count-btn removed — unified into .verse-action-btn) */

/* Note List Items (sidebar) */
.note-list-item:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* DEAD 2026-09-17 — flagged for deletion (one notes dialog, docs/NOTES_DIALOG_ONE_CLASS_DESIGN.md). Uncomment to revert; delete after a few weeks if all is well.
   Why: the fade-in moved into css/notes-shared.css (notesDialogIn); the grab cursor and the white arrow hover were leftovers from the old gradient header.
.notes-dialog {
    animation: dialogFadeIn 0.2s ease;
}

@keyframes dialogFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.notes-dialog-header:active {
    cursor: grabbing;
}

.notes-nav-btn:hover {
    background: rgba(255, 255, 255, 0.35) !important;
}
*/

.note-dialog-item {
    transition: all 0.2s ease;
}

.note-dialog-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.note-edit-btn:hover {
    text-decoration: underline;
}

.note-delete-btn:hover {
    text-decoration: underline;
}

.note-add-submit-btn:hover {
    filter: brightness(1.1);
}

/* Lexicon History Items */
.lexicon-history-item:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.lexicon-verse-link:hover {
    text-decoration: underline;
    color: var(--primary) !important;
}

.remove-lexicon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.remove-lexicon-btn:hover {
    opacity: 1;
    color: var(--text-primary);
}

/* ====================== Search UI ====================== */

.search-ui {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-input-container {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 0.5rem 3.5rem 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(91, 75, 138, 0.15);
}

.search-clear-btn {
    position: absolute;
    right: 2rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s;
}

.search-input:not(:placeholder-shown) ~ .search-clear-btn {
    opacity: 0.5;
}

.search-clear-btn:hover {
    opacity: 1;
    color: var(--text-primary);
}

.search-go-btn {
    position: absolute;
    right: 0.3rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.3rem 0.4rem;
    border-radius: 6px;
    line-height: 1;
    transition: color 0.2s, background 0.2s, box-shadow 0.2s;
    opacity: 0.6;
}

.search-go-btn:hover {
    color: var(--primary);
    background: rgba(91, 75, 138, 0.08);
    opacity: 1;
}

.search-input:focus ~ .search-go-btn {
    color: var(--primary);
    opacity: 0.8;
}

.search-language-select {
    padding: 0.5rem 0.25rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
}

/* Virtual Keyboard */
.vk-container {
    padding: 0.375rem 0;
}

.vk-row {
    display: flex;
    justify-content: center;
    gap: 3px;
    margin-bottom: 3px;
}

.vk-key {
    min-width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text-primary);
    font-family: 'Crimson Text', serif;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
    user-select: none;
}

.vk-key:hover {
    background: var(--highlight);
}

.vk-key:active {
    transform: scale(0.95);
    background: var(--primary-light);
    color: white;
}

.vk-utils {
    margin-top: 2px;
}

.vk-backspace,
.vk-space,
.vk-clear {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    min-width: 3rem;
    padding: 0 0.5rem;
}

.vk-space {
    flex: 1;
    max-width: 6rem;
}

/* Search Results */
.search-result-item {
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--surface);
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.search-result-item:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.search-result-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-result-strongs {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85rem;
}

.search-result-lemma {
    font-family: 'Crimson Text', serif;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.search-result-translit {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.search-result-count {
    font-size: 0.7rem;
    color: var(--surface);
    background: var(--secondary);
    padding: 0.05rem 0.4rem;
    border-radius: 9px;
    font-weight: 600;
    margin-left: auto;
}

.search-result-def {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.search-result-verses {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.4rem;
}

.search-verse-link {
    font-size: 0.7rem;
    color: var(--primary);
    background: var(--highlight);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-verse-link:hover {
    background: var(--primary);
    color: white;
}

.search-verse-more {
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding: 0.1rem 0.35rem;
    font-style: italic;
}

.search-verse-expand,
.search-verse-collapse {
    cursor: pointer;
    color: var(--primary);
    font-style: italic;
    transition: color 0.15s;
}

.search-verse-expand:hover,
.search-verse-collapse:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.remove-search-result-btn {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0.15rem;
    line-height: 1;
}

.search-result-item:hover .remove-search-result-btn {
    opacity: 0.6;
}

.remove-search-result-btn:hover {
    opacity: 1 !important;
    color: var(--text-primary);
}

/* Search overlay (shown while searching) */
.search-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* No results state */
.search-no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.search-no-results-icon {
    font-size: 2.5rem;
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

.search-no-results-text {
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}

.search-no-results-hint {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ============================================================
   Cross-Reference Dropdown Panel (verse cards, main Bible reader)
   ============================================================ */

.xref-toggle {
    background: none;
    border: none;
    padding: 0.15rem 0.35rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s, color 0.15s;
    border-radius: 4px;
    margin-right: auto;  /* pushes xref left, keeps other action buttons grouped on the right */
}

.xref-toggle:hover,
.xref-toggle.open {
    opacity: 1;
    color: var(--primary, #5B4B8A);
}

.xref-arrow {
    margin-left: 0.3rem;
    font-size: 0.65rem;
    vertical-align: middle;
}

.xref-panel {
    display: none;
    padding: 0.5rem 0.6rem 0.6rem;
    background: var(--highlight);
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    line-height: 1.7;
}

.xref-refs {
    columns: 2;
    column-gap: 1.5rem;
}

.xref-book-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
    margin-top: 0.3rem;
    margin-bottom: 0.25rem;
    width: 100%;
}

/* Pill-style bible-ref-link — used in xref panels AND all verse reference grids */
.xref-panel .bible-ref-link,
.verse-ref-grid .bible-ref-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
    padding: 0.05rem 0.25rem;
    border-radius: 3px;
    font-size: 0.78rem;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: background 0.15s;
}

.xref-panel .bible-ref-link:hover,
.verse-ref-grid .bible-ref-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 2-column grid for verse reference lists */
.verse-ref-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 0.5rem;
}

.xref-empty {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.78rem;
}

/* ─── Commentary panel (inline below verse) ────────────────────────────── */
/* .commentary-verse-btn base styling handled by .verse-action-btn */

.verse-commentary-panel {
    display: none;
    padding: 0.75rem;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    background: var(--highlight);
    border-left: 3px solid var(--gold);
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
}
.verse-commentary-panel.open {
    display: block;
}
.commentary-source-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.commentary-text {
    font-style: italic;
}
.commentary-empty {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.78rem;
}

/* Commentary tab bar — source abbreviation tabs */
.commentary-tab-bar {
    display: flex;
    gap: 2px;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
    flex-wrap: wrap;
}
.commentary-tab {
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 0.02em;
}
.commentary-tab:hover {
    color: var(--gold);
}
.commentary-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

/* Commentary panes — only active one visible */
.commentary-pane { display: none; }
.commentary-pane.active { display: block; }

/* Commentary entry inside pane */
.commentary-entry-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.3rem;
}
.commentary-tag-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}
.commentary-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
/* Commentary panel tag/note buttons use .verse-action-btn */
.commentary-tag-btn { margin-left: auto; }

/* Commentary cross-reference links */
.commentary-ref {
    color: var(--accent-color, #4a90d9);
    cursor: pointer;
    text-decoration: underline dotted;
    text-decoration-color: var(--accent-color, #4a90d9);
}
.commentary-ref:hover {
    text-decoration: underline solid;
}

/* Commentary "Pin to Study" button — matches .bookmarked style */
.commentary-add-to-study.in-study {
    opacity: 1;
    border-color: rgba(var(--primary-rgb),0.3);
    color: var(--primary);
    background: rgba(var(--primary-rgb),0.05);
}

/* Commentary "Send to Study" context menu */
.commentary-send-menu {
    position: fixed;
    z-index: 10000;
    background: var(--surface);
    border: 1px solid var(--border-color, #ccc);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0.25rem;
}
.commentary-send-menu button {
    display: block;
    width: 100%;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    border-radius: 4px;
    white-space: nowrap;
}
.commentary-send-menu button:hover {
    background: var(--accent-color, #4a90d9);
    color: white;
}

/* Commentary tag picker layer badge color */
.tag-picker-layer.commentary {
    background: var(--gold);
    color: white;
}

/* ─── References pagination nav ──────────────────────────────────────────── */
.refs-nav-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--highlight);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

/* Concordance layout (approved 2026-09-01; repacked 2026-09-03): quiet
   count eyebrow; book named once; bare chapter:verse chips. Groups now
   STACK full-width — chips wrap to the container, so the same renderer
   fills the 450px sidebar and the wide Lexicon panel alike (the old
   150px self-balancing columns encoded the sidebar's width and left
   wide hosts two skinny columns and dead space). Biblical order law
   unchanged. */
.refs-count-line {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-text);
    margin-bottom: 0.8rem;
}
.refs-conc {
    display: block;
}
.refs-conc-group {
    margin-bottom: 0.85rem;
}
.refs-conc-book {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}
.refs-conc-book span {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.7rem;
}
.refs-conc-verses {
    display: flex;
    flex-wrap: wrap;
    gap: 0.28rem;
    font-variant-numeric: tabular-nums;
}

.verse-ref-grid + .refs-nav-bar {
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.refs-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface, #fff);
    color: var(--primary);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    line-height: 1;
}

.refs-nav-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.refs-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.refs-book-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 0.5rem;
    justify-content: center;
}

.refs-book-pill {
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.6rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.refs-book-pill:hover {
    background: var(--hover);
    color: var(--text);
}

.refs-book-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* BibleRefPopup Strong's styles moved to css/bible-ref-popup.css */

/* ────────────────────────────────────────────────────────────────────────────
   TOUCH DEVICES — show hover-only action buttons at reduced opacity
   ──────────────────────────────────────────────────────────────────────────── */
@media (hover: none) {
    .remove-search-result-btn { opacity: 0.5; }
}

/* ────────────────────────────────────────────────────────────────────────────
   FEAT-020: Sidebar Welcome — the panel's resting state.
   All colors from tokens: dark mode inherits automatically.
   Sizing chain: .sidebar becomes a flex column ONLY while the welcome is
   present (:has guard — other sidebar views keep today's layout), so the
   Discover area can measure its space and paginate to fit.
   ──────────────────────────────────────────────────────────────────────────── */
.sidebar:has(.welcome-root) { display: flex; flex-direction: column; }

.welcome-root {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.welcome-header { display: flex; align-items: center; gap: 0.6rem; flex: none; }
.welcome-logo {
    width: 40px; height: 40px; border-radius: 9px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.welcome-title { font-weight: 700; font-size: 1.15rem; color: var(--primary); }

.welcome-eyebrow {
    text-transform: uppercase; letter-spacing: 0.13em;
    font-size: 0.68rem; font-weight: 700; color: var(--gold);
    margin-bottom: 0.45rem;
}

.welcome-verse-section {
    flex: none;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface);
    padding: 0.75rem;
}
.welcome-verse-refline {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 0.4rem; font-size: 0.85rem; color: var(--text-secondary);
}
.welcome-verse-next {
    background: none; border: 1px solid var(--border); border-radius: 6px;
    color: var(--gold); cursor: pointer; padding: 0.1rem 0.45rem;
    font-size: 0.9rem; line-height: 1.3;
}
.welcome-verse-next:hover { border-color: var(--gold); }

.welcome-discover { flex: 1; min-height: 190px; display: flex; flex-direction: column; }
.welcome-panels {
    flex: 1; min-height: 150px;
    display: flex; flex-direction: column; gap: 0.6rem;
    overflow: hidden;
}
.welcome-panel {
    flex: 1; min-height: 0;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface);
    padding: 0.65rem 0.75rem;
    display: flex; flex-direction: column; gap: 0.4rem;
    overflow-y: auto;
}
.welcome-panel-head {
    display: flex; align-items: center; gap: 0.5rem;
    font-weight: 700; font-size: 0.92rem; color: var(--text-primary);
}
.welcome-panel-icon {
    display: inline-flex; align-items: center; gap: 0.25rem;
    color: var(--primary); flex: none;
}
.welcome-panel-icon svg { width: 18px; height: 18px; display: block; }
.welcome-panel-icon .strongs-toggle-glyph { font-size: 1rem; }
.welcome-panel-blurb { margin: 0; font-size: 0.82rem; color: var(--text-secondary); }
.welcome-panel-hint { font-size: 0.8rem; font-weight: 700; color: var(--gold); }
.welcome-panel-open {
    align-self: flex-start;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-primary); border-radius: 8px;
    padding: 0.35rem 0.7rem; font-size: 0.8rem; font-weight: 600;
    cursor: pointer;
}
.welcome-panel-open:hover { border-color: var(--gold); }

.welcome-pager {
    flex: none;
    display: flex; align-items: center; justify-content: center; gap: 0.6rem;
    padding-top: 0.5rem;
}
.welcome-pager-arrow {
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-secondary); border-radius: 7px;
    width: 28px; height: 24px; cursor: pointer; line-height: 1;
}
.welcome-pager-arrow:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.welcome-pager-dots { display: inline-flex; gap: 0.4rem; }
.welcome-pager-dot {
    width: 8px; height: 8px; border-radius: 50%;
    border: none; background: var(--border); cursor: pointer; padding: 0;
}
.welcome-pager-dot.on { background: var(--gold); }

/* Touch devices: swipe changes pages — the arrows retire; dots remain
   as the position indicator (larger for legibility, still tappable). */
@media (pointer: coarse) {
    .welcome-pager-arrow { display: none; }
    .welcome-pager-dots { gap: 0.5rem; }
    .welcome-pager-dot { width: 10px; height: 10px; }
}

/* Drawer lesson — only where the drawer + touch gestures exist */
.welcome-drawer-hint { display: none; }
@media (max-width: 768px) and (pointer: coarse) {
    .welcome-drawer-hint {
        display: block; flex: none;
        text-align: center; font-size: 0.72rem; font-style: italic;
        color: var(--text-secondary);
        padding-top: 0.35rem;
    }
}

.welcome-swatches { display: inline-flex; gap: 3px; }
.welcome-swatches span { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.welcome-panel-mission .welcome-mission-text {
    font-size: 0.8rem; color: var(--text-primary); margin: 0.2rem 0;
}
.welcome-mission-logo { width: 20px; height: 20px; border-radius: 5px; display: block; }
.welcome-scripture-refs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }
.welcome-scripture-ref {
    border: 1px solid var(--border); background: var(--surface);
    color: var(--accent-isbe); border-radius: 999px;
    padding: 0.15rem 0.55rem; font-size: 0.72rem; font-weight: 600;
    cursor: pointer;
}
.welcome-scripture-ref:hover { border-color: var(--accent-isbe); }

/* FEAT-020: welcome verse — clean devotional line + 👣 go-to */
.welcome-verse-text {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.65;
    text-align: center;
    color: var(--text-primary);
}
.welcome-verse-actions { display: inline-flex; align-items: center; gap: 0.35rem; }

/* FEAT-020 P3: shared sidebar view header — [←] Title (count) [actions] */
.sidebar-view-header {
    display: flex; align-items: center; gap: 0.55rem;
    margin-bottom: 0.75rem;
}
.sidebar-back-btn {
    flex: none;
    border: none; background: none;
    color: var(--text-secondary); border-radius: 8px;
    width: 30px; height: 28px; cursor: pointer;
    font-size: 1.05rem; line-height: 1;
    transition: background 0.13s, color 0.13s;
}
.sidebar-back-btn:hover { background: rgba(var(--primary-rgb), 0.09); color: var(--text-primary); }
.sidebar-view-title {
    flex: 1;
    display: flex; align-items: center; gap: 0.5rem;
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 700; font-size: 1.08rem; color: var(--text-primary);
}
.sidebar-view-title::before {
    content: '';
    width: 3px; height: 16px; border-radius: 2px;
    background: var(--primary);
    flex: none;
}
.sidebar-view-actions { flex: none; }
#sidebarViewHeader:empty { display: none; }

/* FEAT-020 v4: whole panel paginates — votd page + one full feature page each */
.welcome-pages {
    flex: 1; min-height: 180px;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.welcome-votd-page {
    flex: 1; min-height: 0;
    /* top-justified THROUGHOUT (owner call 2026-08-30) — no dead-space
       centering on tall screens */
    display: flex; flex-direction: column; justify-content: flex-start;
    gap: 0.9rem;
    border: 1px solid var(--border); border-radius: 10px;
    padding: 1rem;
    overflow-y: auto;
}
.welcome-votd-page .welcome-eyebrow { text-align: center; margin-bottom: 0; }
.welcome-votd-page .welcome-verse-text { font-size: 1.05rem; }
.welcome-feature-page {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column; gap: 0.45rem;
}
.welcome-panel-full { flex: 1; min-height: 0; }

/* FEAT-020 v6: votd greeting, screenshot slots, darker pager */
.welcome-votd-greeting {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    line-height: 1.55;
    text-align: center;
    color: var(--text-secondary);
}
.welcome-shot-wrap { flex: none; }
.welcome-shot {
    width: 100%; display: block;
    border: 1px solid var(--border); border-radius: 8px;
}
.welcome-shot-placeholder {
    border: 1.5px dashed var(--gold); border-radius: 8px;
    padding: 0.6rem 0.7rem;
    font-size: 0.75rem; line-height: 1.5;
    color: var(--text-secondary);
}
.welcome-shot-placeholder code { font-size: 0.72rem; color: var(--primary); }
/* Pager: darker + bigger so it reads as the way through */
.welcome-pager-dot {
    width: 9px; height: 9px;
    background: var(--text-secondary); opacity: 0.45;
}
.welcome-pager-dot:hover { opacity: 0.75; }
.welcome-pager-dot.on { background: var(--gold); opacity: 1; }
.welcome-pager-arrow {
    color: var(--text-primary);
    border-color: var(--text-secondary);
    font-weight: 700;
}

/* FEAT-020: votd scripture chip row — centered beneath the greeting */
.welcome-votd-refs { justify-content: center; }

/* FEAT-020: framed votd card — clearer sections on the front page */
.welcome-votd-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    display: flex; flex-direction: column; gap: 0.7rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* FEAT-020: current page reads at a glance — active dot stretches to a gold pill */
.welcome-pager-dot { transition: width 0.15s ease, opacity 0.15s ease; }
.welcome-pager-dot.on {
    width: 22px;
    border-radius: 999px;
    background: var(--gold);
    opacity: 1;
}
@media (prefers-reduced-motion: reduce) { .welcome-pager-dot { transition: none; } }

/* FEAT-020: launcher buttons centered in their page */
.welcome-panel-open { align-self: center; }

/* FEAT-020: CTA cluster centered on every page — hint label + ref chips + buttons */
.welcome-panel .welcome-panel-hint { text-align: center; }
.welcome-panel .welcome-scripture-refs { justify-content: center; }

/* FEAT-020: "on the workbench" tease line — quiet, distinct from body copy */
.welcome-panel-tease {
    margin: 0;
    font-size: 0.8rem;
    font-style: italic;
    color: var(--text-secondary);
    border-left: 3px solid var(--gold);
    padding-left: 0.6rem;
}

/* FEAT-020: the ref pill — verse reference + feet, ONE control.
   Chip language: feet = walks you there; plain chip = peeks in the trail. */
.welcome-verse-refline { display: flex; justify-content: center; }
.welcome-ref-pill {
    display: inline-flex; align-items: center; gap: 0.45rem;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--accent-isbe); border-radius: 999px;
    padding: 0.28rem 0.85rem; font-size: 0.85rem; font-weight: 700;
    cursor: pointer;
}
.welcome-ref-pill:hover { border-color: var(--accent-isbe); }
.welcome-ref-feet { font-size: 0.9rem; line-height: 1; }

/* FEAT-020: compact header — logo beside Welcome + Discover stack, centered */
.welcome-header { justify-content: center; }
.welcome-header-text { display: flex; flex-direction: column; align-items: flex-start; }
.welcome-header-eyebrow { margin-bottom: 0; }

/* FEAT-020: icon-led bullets — the icon fronts the paragraph it explains */
.welcome-icon-para { display: flex; gap: 0.6rem; align-items: flex-start; }
.welcome-icon-para-icon { flex: none; color: var(--primary); padding-top: 0.1rem; }
.welcome-icon-para-icon svg { width: 18px; height: 18px; display: block; }

/* FEAT-020: launcher buttons wear their feature's icon */
.welcome-panel-open { display: inline-flex; align-items: center; gap: 0.45rem; }
.welcome-btn-icon { display: inline-flex; align-items: center; color: var(--primary); }
.welcome-btn-icon svg { width: 15px; height: 15px; display: block; }
.welcome-btn-icon:empty { display: none; }

/* FEAT-020: free-account nudge — quiet footer line, signed-out only, taps to signup */
.welcome-account-note {
    margin-top: auto;
    padding: 0.5rem 0 0;
    border: none; border-top: 1px dashed var(--border);
    background: none; cursor: pointer;
    font-size: 0.75rem; line-height: 1.5;
    color: var(--text-secondary);
    text-align: center; width: 100%;
}
.welcome-account-note:hover { color: var(--primary); }
