/* ===========================
   BIBLA ONLINE KJV — STYLES
   Kisha Biblike e Durrësit
   =========================== */

/* --- Splash Screen --- */
.app-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #2a1509;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.app-splash.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.app-splash-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}
.app-splash-logo {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: splashLogoPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.app-splash-title {
    color: #e8d48b;
    font-family: 'Playfair Display', 'Lora', serif;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0;
    animation: splashFadeUp 0.5s ease 0.4s both;
}
.app-splash-bar {
    width: 140px;
    height: 3px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    overflow: hidden;
    opacity: 0;
    animation: splashFadeUp 0.3s ease 0.6s both;
}
.app-splash-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c9a84c, #e8d48b);
    border-radius: 2px;
    animation: splashBarGrow 1.4s ease 0.7s both;
}
@keyframes splashLogoPop {
    from { opacity: 0; transform: scale(0.6); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes splashFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes splashBarGrow {
    from { width: 0%; }
    to   { width: 100%; }
}
.app-splash-est {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.35);
    margin-top: 10px;
    opacity: 0;
    animation: splashFadeUp 0.4s ease 1.2s both;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* ── Cognac & Vellum – premium reading palette ── */
    --navy:           #3b1f0e;   /* deep cognac/walnut */
    --navy-dark:      #2a1509;   /* darkest walnut */
    --gold:           #b5732a;   /* warm amber */
    --gold-light:     #d4a45a;   /* soft amber highlight */
    --parchment:      #faf7f0;   /* warm vellum white */
    --parchment-dark: #f0e9d8;   /* aged parchment */
    --text-dark:      #1e1206;   /* near-black warm ink */
    --text-mid:       #5c3d1e;   /* mid-tone cognac */
    --text-light:     #9a7550;   /* muted amber-tan */
    --border-light:   #e2d4bb;   /* parchment edge */
    --verse-hover:    rgba(181, 115, 42, 0.10);
    --verse-active:   rgba(181, 115, 42, 0.22);
    --highlight: rgba(255, 235, 59, 0.4);
    --sidebar-w: 280px;
    --header-h: 54px;
    --radius: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(180deg, #ece6d8 0%, #f1ede4 40%, #f5f1ea 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.bible-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
    color: #fff;
    height: var(--header-h);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border-bottom: 2px solid var(--gold);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    padding: 0 14px;
    gap: 8px;
}

.visitor-corner {
    width: 18px;
    height: 38px;
    flex-shrink: 0;
    min-width: 18px;
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: all;
    -webkit-tap-highlight-color: transparent;
}
.header-spacer-right {
    width: 18px;
    min-width: 18px;
    flex-shrink: 0;
    pointer-events: none;
}

.header-home {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}
.header-home:hover { opacity: 1; }
.header-logo-img { height: 38px; width: auto; border-radius: 4px; object-fit: contain; }
.header-brand {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.3px;
    color: #fff;
}
.header-version {
    font-size: 0.62rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: 0.6;
    text-align: center;
}

.header-actions { display: flex; gap: 4px; align-items: center; }
.lang-toggle {
    display: flex;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    overflow: hidden;
    height: 34px;
}
.lang-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.65);
    font-size: 0.7rem;
    font-weight: 700;
    font-family: inherit;
    padding: 0 9px;
    height: 34px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
}
.lang-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.lang-btn.active {
    background: var(--gold);
    color: #1e1206;
}
.header-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.13);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
}
.header-btn:hover { background: rgba(255,255,255,0.18); }
.header-btn svg { width: 18px; height: 18px; }

/* Search button with visible label */
.header-btn-search {
    width: auto;
    gap: 6px;
    padding: 0 12px;
    background: rgba(201,168,76,0.18);
    border-color: rgba(201,168,76,0.45);
    font-weight: 600;
    letter-spacing: 0.02em;
}
.header-btn-search:hover {
    background: rgba(201,168,76,0.32);
    border-color: rgba(201,168,76,0.7);
}
.header-btn-label {
    font-size: 0.82rem;
    font-family: inherit;
    white-space: nowrap;
}

/* --- Search Overlay --- */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: none;
    flex-direction: column;
    align-items: center;
    padding-top: 80px;
}
.search-overlay.active { display: flex; }

.search-overlay-inner {
    width: 100%;
    max-width: 640px;
    padding: 0 20px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    padding: 0 16px;
}
.search-bar-icon { width: 22px; height: 22px; opacity: 0.4; flex-shrink: 0; }
.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    padding: 16px 12px;
    font-family: inherit;
    background: transparent;
}
.search-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.search-close:hover { opacity: 1; }
.search-close svg { width: 20px; height: 20px; }

.search-hints {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 4px;
    flex-wrap: wrap;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
}
.hint-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}
.hint-btn:hover { background: rgba(255,255,255,0.3); }

.search-options-bar {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 8px 4px 4px;
    flex-wrap: wrap;
    row-gap: 6px;
}
.search-scope-bar,
.search-mode-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}
.search-scope-bar .scope-option,
.search-mode-bar .scope-option {
    color: rgba(255,255,255,0.85);
    font-size: 0.82rem;
}
.search-scope-bar .scope-option input[type="radio"],
.search-mode-bar .scope-option input[type="radio"] {
    accent-color: var(--gold);
}
.search-scope-bar,
.search-mode-bar {
    border-left: 1px solid rgba(255,255,255,0.2);
    padding-left: 14px;
}

/* Back-to-search button */
.back-to-search {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--navy);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 28px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 900;
    transition: background 0.2s, transform 0.2s;
}
.back-to-search:hover {
    background: var(--navy-light, #2a4a7f);
    transform: translateX(-50%) scale(1.04);
}

.search-results {
    margin-top: 12px;
    max-height: 50vh;
    overflow-y: auto;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: none;
}
.search-results.has-results { display: block; }

.search-result-item {
    padding: 14px 18px;
    border-bottom: 1px solid #f0ece3;
    cursor: pointer;
    transition: background 0.15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--verse-hover); }
.search-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.search-result-ref {
    font-weight: 600;
    color: var(--navy);
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.search-copy-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 5px 6px;
    cursor: pointer;
    color: var(--text-mid);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    line-height: 0;
}
.search-copy-btn:hover {
    color: var(--navy);
    border-color: var(--navy);
    background: rgba(26,54,93,0.06);
}
/* Bilingual copy button (SQ+EN) */
.search-copy-bilingual {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    line-height: 1;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: inherit;
    background: rgba(139,69,19,0.08);
    border-color: rgba(139,69,19,0.3);
    color: #7a4010;
    letter-spacing: 0.02em;
}
.search-copy-bilingual:hover {
    background: rgba(139,69,19,0.16);
    border-color: rgba(139,69,19,0.55);
    color: #7a4010;
}
body.dark-mode .search-copy-bilingual {
    background: rgba(201,168,76,0.1);
    border-color: rgba(201,168,76,0.3);
    color: #c9a84c;
}
body.dark-mode .search-copy-bilingual:hover {
    background: rgba(201,168,76,0.2);
}
/* Bilingual copy-all button */
.copy-all-btn-bilingual {
    background: rgba(139,69,19,0.08);
    border-color: rgba(139,69,19,0.3);
    color: #7a4010;
    font-weight: 700;
}
.copy-all-btn-bilingual:hover {
    background: rgba(139,69,19,0.16);
    border-color: rgba(139,69,19,0.55);
    color: #7a4010;
}
.search-result-text {
    font-size: 0.88rem;
    color: var(--text-mid);
    line-height: 1.5;
}
.search-result-text mark {
    background: var(--highlight);
    padding: 1px 2px;
    border-radius: 2px;
}

/* Cross-language translation line under a search result */
.result-cross-lang {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed rgba(0,0,0,0.08);
    line-height: 1.45;
}
.result-cross-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #1a7a1a;
    background: rgba(34,139,34,0.08);
    border: 1px solid rgba(34,139,34,0.25);
    border-radius: 3px;
    padding: 1px 5px;
    white-space: nowrap;
    flex-shrink: 0;
}
body.dark-mode .result-cross-lang { border-color: rgba(255,255,255,0.07); color: #8a8070; }
body.dark-mode .result-cross-label { color: #5dba5d; background: rgba(60,180,60,0.1); border-color: rgba(60,180,60,0.25); }

/* Cross-highlight toggle in copy bar */
.copy-cross-toggle {
    color: #1a7a1a;
}
body.dark-mode .copy-cross-toggle { color: #5dba5d; }

/* --- Compare / Parallel View --- */
.search-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.compare-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}
.compare-btn:hover {
    background: #244a7a;
    transform: translateY(-1px);
}
.compare-btn.compare-back {
    background: transparent;
    color: var(--navy);
    border: 1px solid var(--navy);
}
.compare-btn.compare-back:hover {
    background: rgba(26,54,93,0.08);
}
.compare-item {
    padding: 12px 16px;
}
.compare-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 8px;
}
.compare-col {
    background: rgba(250,246,237,0.5);
    border-radius: 6px;
    padding: 10px 12px;
    border-left: 3px solid var(--gold);
}
.compare-col-other {
    border-left-color: var(--navy);
    background: rgba(26,54,93,0.04);
}
.compare-lang-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gold);
    margin-bottom: 4px;
}
.compare-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.compare-col-header .search-copy-btn {
    padding: 3px 4px;
}
.compare-col-other .compare-lang-label {
    color: var(--navy);
}
.compare-text {
    font-size: 0.86rem;
    color: var(--text-mid);
    line-height: 1.55;
}
@media (max-width: 600px) {
    .compare-columns {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .search-summary-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .copy-all-bar {
        flex-wrap: wrap;
    }
}

/* --- Copy All Bar --- */
.copy-all-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #f5f1e8;
    border-bottom: 1px solid #e8e2d5;
    flex-wrap: wrap;
}
.copy-all-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-mid);
    margin-right: 4px;
}
.copy-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-mid);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.copy-all-btn:hover {
    background: rgba(26,54,93,0.06);
    border-color: var(--navy);
    color: var(--navy);
}

/* Highlight toggle in copy bar */
.copy-hl-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-mid);
    cursor: pointer;
    margin-left: 6px;
    font-family: monospace;
    user-select: none;
}
.copy-hl-toggle input[type="checkbox"] {
    cursor: pointer;
    accent-color: #b5732a;
    width: 14px;
    height: 14px;
}

/* Cross-language highlight mark (different colour from primary mark) */
mark.mark-cross {
    background: #b8e8b8;
    color: #1a4d1a;
    border-radius: 2px;
    padding: 0 1px;
}
body.dark-mode mark.mark-cross {
    background: #2a5c2a;
    color: #a0e0a0;
}

/* --- Layout --- */
.bible-layout {
    display: flex;
    margin-top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
}

/* --- Sidebar --- */
.bible-sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--border-light);
    height: calc(100vh - var(--header-h));
    position: sticky;
    top: var(--header-h);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 50;
    /* Subtle warm bottom glow */
    background-image: linear-gradient(to bottom, #fff 85%, rgba(201,168,76,0.06) 100%);
}

.sidebar-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 16px 0;
}

.sidebar-section { padding: 0 12px; margin-bottom: 20px; }
.sidebar-heading {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 10px;
}

/* Testament group — acts as a labeled section */
.testament-group { margin-bottom: 16px; }

.testament-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 0 0 6px 0;
    border: none;
    border-bottom: 2px solid var(--gold);
    background: none;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--navy);
    cursor: pointer;
    margin-bottom: 8px;
    transition: color 0.15s;
    font-family: inherit;
}
.testament-toggle:hover { color: var(--gold); }

.toggle-arrow {
    width: 13px;
    height: 13px;
    transition: transform 0.22s;
    flex-shrink: 0;
    margin-left: auto;
    opacity: 0.5;
}
.testament-toggle.active .toggle-arrow { transform: rotate(0deg); }
.testament-toggle:not(.active) .toggle-arrow { transform: rotate(-90deg); }

.testament-count {
    font-size: 0.68rem;
    color: var(--text-light);
    font-weight: 400;
    letter-spacing: 0;
    background: var(--parchment-dark);
    border-radius: 10px;
    padding: 1px 6px;
}

/* Book grid — 2-column compact grid */
.book-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
}
.book-list.collapsed { display: none; }

.book-item {
    padding: 6px 8px;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.78rem;
    color: var(--text-mid);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.12s, color 0.12s;
    font-family: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.book-item:hover { background: var(--parchment); color: var(--navy); }
.book-item.active {
    background: var(--navy);
    color: #fff;
    font-weight: 600;
}

/* --- Concordance Section --- */
.concordance-desc {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 10px;
    line-height: 1.4;
}

.concordance-input-wrap {
    display: flex;
    gap: 6px;
}
.concordance-input-wrap input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.concordance-input-wrap input:focus { border-color: var(--gold); }
.concordance-input-wrap button {
    padding: 8px 10px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}
.concordance-input-wrap button:hover { background: var(--navy-dark); }
.concordance-input-wrap button svg { width: 16px; height: 16px; }

.concordance-scope {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 12px;
}
.scope-option {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    color: var(--text-mid);
    cursor: pointer;
}
.scope-option input[type="radio"] { accent-color: var(--gold); cursor: pointer; }

.concordance-results {
    max-height: 300px;
    overflow-y: auto;
}
.concordance-header-info {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}
.concordance-item {
    padding: 8px 0;
    border-bottom: 1px solid #f5f0e5;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 3px;
    padding-left: 4px;
    padding-right: 4px;
}
.concordance-item:hover { background: var(--verse-hover); }
.concordance-item:last-child { border-bottom: none; }
.concordance-item-ref {
    font-weight: 600;
    color: var(--gold);
    margin-right: 6px;
}
.concordance-item-text {
    color: var(--text-mid);
    line-height: 1.4;
}
.concordance-item mark {
    background: var(--highlight);
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Progress */
.concordance-progress { margin-top: 12px; }
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}
.progress-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}
.progress-text { font-size: 0.78rem; color: var(--text-light); }
.progress-cancel {
    background: none;
    border: none;
    color: #c0392b;
    font-size: 0.78rem;
    cursor: pointer;
    margin-left: 8px;
    text-decoration: underline;
    font-family: inherit;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 49;
}
.sidebar-overlay.active { display: block; }

/* --- Main Content --- */
.bible-main {
    flex: 1;
    padding: 0 24px 24px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}

/* Chapter Controls */
.chapter-controls {
    margin-bottom: 20px;
}
.controls-inner {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.controls-inner select {
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-family: inherit;
    background: #fff;
    color: var(--text-dark);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 0;
}
.controls-inner select:focus { border-color: var(--gold); }
#chapterSelect { width: 100px; }
.go-btn {
    padding: 10px 24px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}
.go-btn:hover { background: var(--navy-dark); }

/* --- Book Picker (custom grid dropdown) --- */
.book-picker {
    position: relative;
    flex: 1;
    min-width: 140px;
}
.book-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-family: inherit;
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
}
.book-picker-trigger:hover,
.book-picker-trigger:focus { border-color: var(--gold); outline: none; }
.book-picker-trigger[aria-expanded="true"] {
    border-color: var(--gold);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.book-picker-trigger span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.book-picker-arrow {
    flex-shrink: 0;
    opacity: 0.45;
    transition: transform 0.2s;
}
.book-picker-trigger[aria-expanded="true"] .book-picker-arrow {
    transform: rotate(180deg);
}

/* Panel — positioned below trigger */
.book-picker-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 380px;
    max-height: 62vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--gold);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.14);
    z-index: 500;
    padding: 14px;
}
.book-picker-panel.open { display: block; }

.book-picker-section { margin-bottom: 14px; }
.book-picker-section:last-child { margin-bottom: 0; }

.book-picker-head {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--navy);
    padding-bottom: 5px;
    margin-bottom: 7px;
    border-bottom: 2px solid var(--gold);
}

/* Book tiles grid — fills as many columns as fit */
.book-picker-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* New book row layout */
.bp-book-row {
    border-bottom: 1px solid var(--border-light);
}
.bp-book-row:last-child { border-bottom: none; }

.bp-book-name {
    display: block;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
    transition: background 0.15s;
}
.bp-book-name:hover {
    background: rgba(26, 39, 68, 0.06);
}
.bp-book-row.expanded .bp-book-name {
    background: var(--navy);
    color: #fff;
}

.bp-chapters-inline {
    display: none;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px 12px 12px;
    background: rgba(26, 39, 68, 0.03);
}
.bp-book-row.expanded .bp-chapters-inline {
    display: flex;
}

.bp-chapter-btn {
    min-width: 36px;
    height: 30px;
    padding: 0 6px;
    background: var(--parchment);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
    transition: background 0.12s, transform 0.08s;
}
.bp-chapter-btn:hover {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.bp-chapter-btn:active {
    transform: scale(0.93);
}

/* Legacy tile style - keep for compatibility */
.bp-tile {
    padding: 6px 8px;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.78rem;
    font-family: inherit;
    color: var(--text-mid);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}
.bp-tile:hover { background: var(--parchment); color: var(--navy); }
.bp-tile.active {
    background: var(--navy);
    color: #fff;
    font-weight: 600;
}

@media (max-width: 768px) {
    .book-picker-panel {
        position: fixed;
        left: 0;
        right: 0;
        top: var(--header-h);
        bottom: 0;
        min-width: 0;
        max-height: none;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-top: 2px solid var(--gold);
        overflow-y: auto;
        z-index: 600;
    }
    .book-picker-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
    .bp-tile {
        white-space: normal;
        font-size: 0.82rem;
        padding: 8px 10px;
    }
}

/* --- Bible Page (printed book look) --- */
.bible-page-wrap {
    perspective: 1200px;
    overflow: hidden;
    padding-top: 20px;
}

.bible-page {
    background: var(--parchment);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    box-shadow:
        0 1px 4px rgba(0,0,0,0.06),
        0 4px 16px rgba(0,0,0,0.04),
        inset 0 0 60px rgba(139, 117, 85, 0.04);
    min-height: 400px;
    position: relative;
    overflow: hidden;
    /* Subtle parchment texture via repeating gradient */
    background-image:
        radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 80%, rgba(139,117,85,0.03) 0%, transparent 50%);
    background-color: var(--parchment);
}

/* Page turn overlay sheet — peels away like a real book page */
.page-turn-sheet {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--parchment);
    background-image:
        radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 80%, rgba(139,117,85,0.03) 0%, transparent 50%);
    z-index: 5;
    backface-visibility: hidden;
    pointer-events: none;
}

.page-turn-sheet.turn-next {
    transform-origin: right center;
    animation: pagePeelNext 0.6s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}
.page-turn-sheet.turn-prev {
    transform-origin: left center;
    animation: pagePeelPrev 0.6s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

/* Fold crease shadow on the sheet */
.page-turn-sheet::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}
.page-turn-sheet.turn-next::after {
    left: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.1), transparent);
    animation: foldShadowIn 0.6s ease forwards;
}
.page-turn-sheet.turn-prev::after {
    right: 0;
    background: linear-gradient(to left, rgba(0,0,0,0.1), transparent);
    animation: foldShadowIn 0.6s ease forwards;
}

.bible-page.page-swipe-drag {
    transition: none !important;
}

@keyframes pagePeelNext {
    0% {
        transform: perspective(1200px) rotateY(0deg);
        box-shadow: -2px 0 8px rgba(0,0,0,0.06);
    }
    55% {
        transform: perspective(1200px) rotateY(-70deg);
        box-shadow: -15px 0 40px rgba(0,0,0,0.18);
    }
    100% {
        transform: perspective(1200px) rotateY(-90deg);
        box-shadow: 0 0 0 transparent;
    }
}

@keyframes pagePeelPrev {
    0% {
        transform: perspective(1200px) rotateY(0deg);
        box-shadow: 2px 0 8px rgba(0,0,0,0.06);
    }
    55% {
        transform: perspective(1200px) rotateY(70deg);
        box-shadow: 15px 0 40px rgba(0,0,0,0.18);
    }
    100% {
        transform: perspective(1200px) rotateY(90deg);
        box-shadow: 0 0 0 transparent;
    }
}

@keyframes foldShadowIn {
    0%   { opacity: 0; }
    30%  { opacity: 1; }
    100% { opacity: 0; }
}

body.dark-mode .page-turn-sheet {
    background: #221508;
    background-image: none;
}

/* Page edge shadow (left spine) */
.bible-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(to right, rgba(139,117,85,0.06), transparent);
    pointer-events: none;
    z-index: 1;
}

/* Page edge shadow (right) */
.bible-page::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 100%;
    background: linear-gradient(to left, rgba(139,117,85,0.04), transparent);
    pointer-events: none;
    z-index: 1;
}

/* Chapter header */
.chapter-header {
    text-align: center;
    padding: 40px 50px 20px;
}
.chapter-book {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.8rem;
    color: var(--navy);
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}
.chapter-number-display {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    color: var(--text-light);
    letter-spacing: 3px;
    text-transform: uppercase;
}
.chapter-ornament {
    color: var(--gold);
    font-size: 1rem;
    line-height: 1;
    margin: 6px 0;
    opacity: 0.7;
}

/* Decorative chapter divider between header and text */
.chapter-header::after {
    content: '';
    display: block;
    width: 80px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    margin: 16px auto 0;
    opacity: 0.5;
}

/* --- Bible Text --- */
.page-text {
    padding: 16px 50px 50px;
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: 1.08rem;
    line-height: 1.9;
    color: var(--text-dark);
    column-count: 1;
    column-gap: 0;
    column-rule: none;
    text-align: justify;
    hyphens: auto;
}

/* Each verse on its own row */
.verse {
    display: block;
    margin-bottom: 0.3em;
    padding-bottom: 0.1em;
}

/* Compact verse text: less space within, more between verses */
.verse {
    line-height: 1.4;
}
.page-text {
    line-height: 1.2;
}

/* Welcome screen */
.bible-welcome {
    column-span: all;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-mid);
}
.welcome-illustration {
    margin-bottom: 20px;
}
.welcome-svg {
    width: 160px;
    height: auto;
    opacity: 0.85;
}
.welcome-divider {
    display: flex;
    justify-content: center;
    margin: 18px 0 14px;
}
.welcome-divider svg {
    width: 120px;
    height: 12px;
}
.bible-welcome h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    color: var(--navy);
    margin-bottom: 12px;
}
.bible-welcome p {
    max-width: 420px;
    margin: 0 auto 12px;
    font-size: 0.95rem;
    line-height: 1.6;
}
.welcome-verse {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    color: var(--text-light);
    font-size: 0.9rem !important;
    margin-top: 20px !important;
}

/* Verses */
.verse {
    cursor: pointer;
    transition: background 0.15s;
    padding: 1px 3px;
    border-radius: 3px;
    position: relative;
}
.verse:hover { background: var(--verse-hover); }
.verse.selected { background: var(--verse-active); }
.verse.highlighted { background: var(--highlight); }

.verse-num {
    font-family: 'Inter', sans-serif;
    font-size: 0.6em;
    font-weight: 700;
    color: #8b4513;
    vertical-align: super;
    margin-right: 2px;
    user-select: none;
    letter-spacing: 0;
}

/* Drop cap on first verse */
.verse.first-verse .drop-cap {
    float: left;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 3.4em;
    line-height: 0.8;
    padding-right: 6px;
    padding-top: 6px;
    color: var(--navy);
    font-weight: 700;
}

/* Loading */
.page-loading {
    padding: 80px 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.95rem;
}
.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-light);
    border-top-color: var(--gold);
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Chapter Navigation --- */
.chapter-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding: 14px 0;
}
.nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.nav-btn:hover { background: var(--parchment); border-color: var(--gold); }
.nav-btn:disabled { opacity: 0.4; cursor: default; }
.nav-btn:disabled:hover { background: #fff; border-color: var(--border-light); }
.nav-btn svg { width: 16px; height: 16px; }
.nav-current {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.95rem;
    color: var(--text-mid);
    font-weight: 600;
}

/* --- Verse Popover --- */
.verse-popover {
    position: fixed;
    z-index: 150;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 14px 42px 14px 16px;
    max-width: 380px;
    display: none;
    animation: popoverIn 0.15s ease;
    overflow-y: auto;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.verse-popover.active { display: block; }

@keyframes popoverIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.popover-ref {
    font-weight: 700;
    color: var(--navy);
    font-size: 0.85rem;
    margin-bottom: 6px;
}
.popover-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.82rem;
    color: var(--text-mid);
    line-height: 1.5;
    margin-bottom: 10px;
    max-height: 80px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.popover-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.popover-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    color: var(--text-dark);
}
.popover-btn:hover { background: var(--parchment); border-color: var(--gold); }
.popover-btn svg { width: 15px; height: 15px; }
.popover-wa {
    background: #25D366;
    color: #fff;
    border-color: #25D366;
}
.popover-wa:hover { background: #1ebe57; border-color: #1ebe57; }
.popover-wa svg { width: 15px; height: 15px; }

.popover-translate {
    background: rgba(26,54,93,0.06);
    border-color: rgba(26,54,93,0.18);
    color: var(--navy);
    font-weight: 600;
}
.popover-translate.active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.popover-translate:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Translation panel inside popover */
.popover-translation {
    margin: 0 0 10px 0;
    border-left: 3px solid var(--navy);
    background: rgba(26,54,93,0.04);
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    animation: popoverIn 0.15s ease;
}
.popover-trans-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    gap: 6px;
}
.popover-trans-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--navy);
    opacity: 0.75;
}
.popover-trans-hint {
    font-size: 0.65rem;
    color: var(--text-light);
    font-style: italic;
}
.popover-trans-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.82rem;
    color: var(--text-mid);
    line-height: 1.55;
    margin-bottom: 7px;
    cursor: text;
    user-select: text;
}
.popover-trans-search {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 5px 11px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.popover-trans-search:hover { background: var(--navy-dark, #12284a); }

/* Note toggle button active state */
.popover-note-toggle.note-active {
    background: rgba(120,85,25,0.1);
    border-color: var(--gold);
    color: var(--gold-dark, #8a7230);
}

/* Note panel inside popover */
.popover-note-panel {
    margin: 0 0 10px 0;
    border-left: 3px solid var(--gold, #b5732a);
    background: rgba(181,115,42,0.05);
    border-radius: 0 6px 6px 0;
    padding: 8px 10px;
    animation: popoverIn 0.15s ease;
}
.popover-note-textarea {
    width: 100%;
    min-height: 72px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    padding: 7px 9px;
    font-family: inherit;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-dark);
    background: #fff;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}
.popover-note-textarea:focus { border-color: var(--gold); }
.popover-note-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}
.popover-note-save,
.popover-note-delete {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 5px;
    border: none;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.popover-note-save {
    background: var(--navy);
    color: #fff;
}
.popover-note-save:hover { background: var(--navy-dark, #12284a); }
.popover-note-save svg { width: 13px; height: 13px; }
.popover-note-delete {
    background: rgba(180,40,40,0.1);
    color: #b22020;
    border: 1px solid rgba(180,40,40,0.25);
}
.popover-note-delete:hover { background: #b22020; color: #fff; }
.popover-note-delete svg { width: 13px; height: 13px; }

/* Note indicator dot on verse */
.verse.has-note::after,
.verse-block.has-note .verse-num::after {
    content: '•';
    color: var(--gold, #b5732a);
    font-size: 0.55em;
    vertical-align: super;
    margin-left: 2px;
    font-weight: 700;
}

/* --- Multi-select mode --- */
.verse.multi-selected {
    background: var(--verse-active);
    border-radius: 3px;
}

/* Subtle left accent on multi-selected verse */
.verse.multi-selected::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 2px;
    bottom: 2px;
    width: 3px;
    background: var(--gold);
    border-radius: 2px;
}

/* Change cursor in multi-select mode */
.multiselect-active .verse {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Multi-select floating toolbar */
.multiselect-toolbar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--navy);
    color: #fff;
    padding: 10px 20px;
    border-radius: 14px;
    box-shadow: 0 6px 28px rgba(0,0,0,0.3);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    font-size: 0.88rem;
    font-family: inherit;
}
.multiselect-toolbar.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.multiselect-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    white-space: nowrap;
}
.multiselect-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--gold);
    color: var(--navy);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.82rem;
}

.multiselect-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.multiselect-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    color: #fff;
}
.multiselect-btn:hover {
    background: rgba(255,255,255,0.2);
}
.multiselect-btn svg { flex-shrink: 0; }

.multiselect-wa {
    background: #25D366;
    border-color: #25D366;
}
.multiselect-wa:hover { background: #1ebe57; }

.multiselect-cancel {
    border: none;
    background: rgba(255,255,255,0.08);
    padding: 7px 8px;
}
.multiselect-cancel:hover { background: rgba(255,77,77,0.3); }

@media (max-width: 768px) {
    .multiselect-toolbar {
        bottom: 16px;
        left: 12px;
        right: 12px;
        transform: translateX(0) translateY(100px);
        border-radius: 14px;
        padding: 10px 14px;
        gap: 10px;
    }
    .multiselect-toolbar.active {
        transform: translateX(0) translateY(0);
    }
    .multiselect-btn {
        padding: 7px 10px;
        font-size: 0.78rem;
    }
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--navy);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Verse of the Day Widget --- */
.votd-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 800;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.votd-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gold);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}
.votd-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}
.votd-fab svg { stroke: #fff; }

.votd-popup {
    display: none;
    position: absolute;
    bottom: 68px;
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    overflow: hidden;
    animation: votdSlideUp 0.25s ease;
}
.votd-popup.open { display: block; }
@keyframes votdSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.votd-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--navy);
    color: #fff;
}
.votd-popup-title {
    font-weight: 600;
    font-size: 0.95rem;
}
.votd-popup-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 4px;
    line-height: 0;
    transition: color 0.15s;
}
.votd-popup-close:hover { color: #fff; }
.votd-text {
    margin: 0;
    padding: 20px 18px 12px;
    font-family: 'Lora', serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-dark);
    border-left: 3px solid var(--gold);
    margin-left: 18px;
    margin-top: 16px;
    margin-bottom: 0;
    padding-left: 14px;
    padding-top: 0;
    padding-bottom: 0;
    font-style: italic;
}
.votd-ref {
    padding: 10px 18px 4px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--navy);
    text-align: right;
}
.votd-actions {
    display: flex;
    gap: 6px;
    padding: 10px 18px 16px;
    justify-content: flex-end;
}
.votd-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid #e0dcd3;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    color: var(--text-mid);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.votd-action-btn:hover {
    border-color: var(--navy);
    color: var(--navy);
    background: rgba(26,54,93,0.05);
}
.votd-share { color: #25D366; }
.votd-share:hover { border-color: #25D366; background: rgba(37,211,102,0.06); color: #1ebe57; }
.votd-read { color: var(--gold); }
.votd-read:hover { border-color: var(--gold); background: rgba(201,168,76,0.08); }

@media (max-width: 480px) {
    .votd-popup { width: calc(100vw - 32px); right: -8px; }
    .votd-widget { bottom: 16px; right: 16px; }
}

/* --- Font Size Controls --- */
.font-size-controls {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 6px;
    overflow: hidden;
    padding: 1px;
    height: 34px;
    box-sizing: border-box;
}

.font-btn {
    background: none;
    border: none;
    border-radius: 4px;
    color: rgba(255,255,255,0.75);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0 7px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    line-height: 1;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.font-btn:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* Font size body classes */
body.font-sm .page-text { font-size: 0.85rem; }
body.font-md .page-text { font-size: 1rem; }
body.font-lg .page-text { font-size: 1.15rem; }
body.font-xl .page-text { font-size: 1.32rem; }
body.font-sm .verse-num { font-size: 0.55em; }
body.font-lg .verse-num { font-size: 0.6em; }
body.font-xl .verse-num { font-size: 0.62em; }

/* --- Verse Highlight Colors --- */
.verse.hl-yellow { background: rgba(255, 245, 157, 0.45); border-radius: 2px; }
.verse.hl-green  { background: rgba(165, 214, 167, 0.4); border-radius: 2px; }
.verse.hl-blue   { background: rgba(144, 202, 249, 0.35); border-radius: 2px; }
.verse.hl-pink   { background: rgba(244, 143, 177, 0.3); border-radius: 2px; }

/* --- Highlight Picker (in popover) --- */
.popover-highlight-wrap {
    position: relative;
}
.popover-highlight-toggle svg,
.popover-bookmark svg {
    width: 18px;
    height: 18px;
}
.popover-bookmark.bookmarked svg {
    fill: var(--gold);
    stroke: var(--gold);
}
.highlight-picker {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #e0dcd3;
    border-radius: 8px;
    padding: 6px 8px;
    gap: 5px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.14);
    z-index: 1100;
    flex-direction: row;
    margin-bottom: 6px;
}
.highlight-picker.open { display: flex; }
.hl-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
    font-size: 0;
    line-height: 0;
}
.hl-color:hover {
    transform: scale(1.2);
    border-color: var(--navy);
}
.hl-clear {
    background: #f5f5f5 !important;
    font-size: 11px;
    line-height: 24px;
    color: var(--text-mid);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Bookmarks Panel (sidebar) --- */
.bookmarks-section {
    border-top: 1px solid var(--border-light);
}
.bookmarks-list {
    max-height: 260px;
    overflow-y: auto;
}
.bookmarks-empty {
    font-size: 0.8rem;
    color: var(--text-light);
    padding: 8px 0;
    line-height: 1.5;
}
.bookmark-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px 6px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    cursor: pointer;
    transition: background 0.12s;
    position: relative;
}
.bookmark-item:hover { background: var(--verse-hover); }
.bookmark-ref {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--navy);
    flex: 1;
}
.bookmark-preview {
    width: 100%;
    font-size: 0.76rem;
    color: var(--text-light);
    line-height: 1.4;
}
.bookmark-remove {
    position: absolute;
    top: 6px;
    right: 4px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.bookmark-item:hover .bookmark-remove { opacity: 1; }
.bookmark-remove:hover { color: #e53935; }
.bookmarks-clear-btn {
    display: block;
    width: 100%;
    background: none;
    border: 1px solid #e0dcd3;
    border-radius: 5px;
    padding: 6px;
    font-size: 0.76rem;
    color: var(--text-light);
    cursor: pointer;
    margin-top: 8px;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}
.bookmarks-clear-btn:hover {
    color: #e53935;
    border-color: #e53935;
}

/* ============================================================
   DARK MODE — Cognac & Vellum dark variant
   Espresso backgrounds, warm cream text, amber accents.
   ============================================================ */
body.dark-mode {
    background: #1a0f07;   /* deep espresso */
    color: #e8dfd0;
    --navy:           #e8c99a;   /* warm amber-cream for interactive elements */
    --navy-dark:      #d4a45a;
    --gold:           #d4a45a;   /* softened amber accent */
    --gold-light:     #e8c99a;
    --parchment:      #221508;   /* dark cognac page */
    --parchment-dark: #2d1c0d;
    --text-dark:      #f0e6d3;   /* warm near-white */
    --text-mid:       #c4a882;   /* mid amber-cream */
    --text-light:     #8a6d4e;   /* muted caramel */
    --border-light:   #3d2910;   /* dark cognac border */
    --verse-hover:    rgba(212, 164, 90, 0.10);
    --verse-active:   rgba(212, 164, 90, 0.20);
}
body.dark-mode .bible-header {
    background: linear-gradient(135deg, #0e0804, #1a0f07) !important;
    border-bottom-color: #b5732a;
}
body.dark-mode .bible-sidebar {
    background: #1e1108;
    border-color: #3d2910;
}
body.dark-mode .bible-page {
    background: #221508;
    box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
body.dark-mode .bible-page::before,
body.dark-mode .bible-page::after {
    display: none;
}
body.dark-mode .page-text {
    color: #e8dfd0;
}
body.dark-mode .chapter-header {
    color: #c4a882;
}
body.dark-mode .chapter-book { color: var(--gold-light); }
body.dark-mode .chapter-number-display { color: #8a6d4e; }
body.dark-mode .verse-num { color: #d4a45a; }
body.dark-mode .verse:hover {
    background: rgba(212, 164, 90, 0.10);
}
body.dark-mode .verse.selected {
    background: rgba(212, 164, 90, 0.20);
}
body.dark-mode .verse.hl-yellow { background: rgba(255, 245, 157, 0.15); }
body.dark-mode .verse.hl-green  { background: rgba(165, 214, 167, 0.13); }
body.dark-mode .verse.hl-blue   { background: rgba(144, 202, 249, 0.13); }
body.dark-mode .verse.hl-pink   { background: rgba(244, 143, 177, 0.13); }
body.dark-mode .chapter-controls {
    background: #1e1108;
    border-color: #3d2910;
}
body.dark-mode .chapter-controls select,
body.dark-mode .chapter-controls .go-btn {
    background: #2d1c0d;
    color: #e8dfd0;
    border-color: #4d3518;
}
body.dark-mode .book-picker-trigger {
    background: #2d1c0d;
    color: #e8dfd0;
    border-color: #4d3518;
}
body.dark-mode .book-picker-trigger:hover,
body.dark-mode .book-picker-trigger:focus,
body.dark-mode .book-picker-trigger[aria-expanded="true"] {
    border-color: #d4a45a;
}
body.dark-mode .book-picker-panel {
    background: #221508;
    border-color: #b5732a;
}
body.dark-mode .book-picker-head {
    color: #e8c99a;
    border-bottom-color: #b5732a;
}
body.dark-mode .bp-tile { color: #9a7d5a; }
body.dark-mode .bp-tile:hover { background: rgba(255,255,255,0.06); color: #e8dfd0; }
body.dark-mode .bp-tile.active { background: #b5732a; color: #f0e6d3; }
body.dark-mode .bp-book-row { border-color: #3d2910; }
body.dark-mode .bp-book-name { color: #e8dfd0; }
body.dark-mode .bp-book-name:hover { background: rgba(200, 168, 76, 0.1); }
body.dark-mode .bp-book-row.expanded .bp-book-name {
    background: #8a5420;
    color: #fff;
}
body.dark-mode .bp-chapters-inline { background: rgba(0, 0, 0, 0.2); }
body.dark-mode .bp-chapter-btn {
    background: #2d1c0d;
    border-color: #4d3518;
    color: #e8dfd0;
}
body.dark-mode .bp-chapter-btn:hover {
    background: #8a5420;
    border-color: #c9a84c;
    color: #fff;
}
body.dark-mode .chapter-nav {
    background: #1e1108;
    border-color: #3d2910;
}
body.dark-mode .nav-btn {
    color: #c4a882;
}
body.dark-mode .nav-btn:hover {
    background: rgba(255,255,255,0.05);
}
body.dark-mode .verse-popover {
    background: #2d1c0d;
    border-color: #4d3518;
    color: #e8dfd0;
}
body.dark-mode .popover-ref { color: var(--gold-light); }
body.dark-mode .popover-text { color: #c4a882; }
body.dark-mode .popover-btn {
    border-color: #4d3518;
    color: #c4a882;
}
body.dark-mode .popover-btn:hover {
    background: rgba(255,255,255,0.05);
    border-color: #7a5530;
}
body.dark-mode .popover-translate {
    background: rgba(181,115,42,0.08);
    border-color: rgba(181,115,42,0.25);
    color: var(--gold-light);
}
body.dark-mode .popover-translate.active,
body.dark-mode .popover-translate:hover {
    background: var(--gold);
    color: var(--navy);
    border-color: var(--gold);
}
body.dark-mode .popover-translation {
    background: rgba(181,115,42,0.07);
    border-left-color: var(--gold);
}
body.dark-mode .popover-trans-label { color: var(--gold-light); opacity: 1; }
body.dark-mode .popover-trans-text { color: #c4a882; }
body.dark-mode .popover-note-panel {
    background: rgba(181,115,42,0.07);
    border-left-color: var(--gold);
}
body.dark-mode .popover-note-textarea {
    background: #2d1c0d;
    color: #e8dfd0;
    border-color: #4d3518;
}
body.dark-mode .popover-note-textarea:focus { border-color: var(--gold); }
body.dark-mode .popover-note-toggle.note-active { background: rgba(181,115,42,0.15); }
body.dark-mode .search-overlay-inner {
    background: #221508;
}
body.dark-mode .search-results {
    background: #2d1c0d;
}
body.dark-mode .search-result-item {
    border-color: #3d2910;
}
body.dark-mode .search-result-item:hover {
    background: rgba(255,255,255,0.04);
}
body.dark-mode .search-result-ref { color: var(--gold-light); }
body.dark-mode .search-result-text { color: #c4a882; }
body.dark-mode #searchInput {
    background: #2d1c0d;
    color: #e8dfd0;
    border-color: #4d3518;
}
body.dark-mode .highlight-picker {
    background: #2d1c0d;
    border-color: #4d3518;
}
body.dark-mode .toast {
    background: #b5732a;
    color: #f0e6d3;
}
body.dark-mode .sidebar-heading { color: var(--gold-light); }
body.dark-mode .book-btn {
    color: #c4a882;
    border-color: #3d2910;
}
body.dark-mode .book-btn:hover,
body.dark-mode .book-btn.active {
    background: rgba(181,115,42,0.14);
    color: var(--gold-light);
}
body.dark-mode .testament-toggle {
    color: var(--gold-light);
    border-bottom-color: var(--gold);
}
body.dark-mode .testament-toggle:hover { color: #f0e6d3; }
body.dark-mode .testament-count {
    background: #2d1c0d;
    color: #8a6d4e;
}
body.dark-mode .book-item {
    color: #a07d55;
}
body.dark-mode .book-item:hover {
    background: rgba(255,255,255,0.05);
    color: #e8dfd0;
}
body.dark-mode .book-item.active {
    background: #b5732a;
    color: #f0e6d3;
}
body.dark-mode .concordance-input-wrap input {
    background: #2d1c0d;
    color: #e8dfd0;
    border-color: #4d3518;
}
body.dark-mode .concordance-input-wrap button {
    color: #c4a882;
}
body.dark-mode .bookmark-ref { color: var(--gold-light); }
body.dark-mode .bookmark-preview { color: #9a7550; }
body.dark-mode .bookmark-item { border-color: #3d2910; }
body.dark-mode .bookmarks-clear-btn {
    border-color: #4d3518;
    color: #9a7550;
}
body.dark-mode .bible-welcome {
    color: #c4a882;
}
body.dark-mode .welcome-verse { color: #8a6d4e; }
body.dark-mode .votd-popup {
    background: #2d1c0d;
}
body.dark-mode .votd-text { color: #e8dfd0; }
body.dark-mode .votd-ref { color: var(--gold-light); }
body.dark-mode .votd-action-btn {
    border-color: #4d3518;
    color: #c4a882;
}
body.dark-mode .multiselect-toolbar {
    background: #2d1c0d;
}
body.dark-mode .drop-cap { color: var(--gold); }
body.dark-mode .copy-all-bar {
    background: #221508;
    border-color: #3d2910;
}
body.dark-mode .copy-all-btn {
    background: #2d1c0d;
    border-color: #4d3518;
    color: #c4a882;
}
body.dark-mode .compare-col {
    background: rgba(181,115,42,0.07);
    border-left-color: var(--gold);
}
body.dark-mode .compare-col-other {
    background: rgba(58,35,14,0.4);
    border-left-color: #7a5530;
}
body.dark-mode .search-summary-bar {
    background: #221508 !important;
}

/* --- Study Place --- */

/* FAB button */
.study-fab {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 100;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.study-fab:hover {
    transform: scale(1.08);
    background: #244a7a;
}

/* Overlay */
.study-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: #f0ece4;
    display: none;
    flex-direction: column;
}
.study-overlay.open { display: flex; }
.study-overlay.fullscreen { z-index: 2500; }

/* Container: sidebar + main side-by-side */
.study-container {
    display: flex;
    flex-direction: row;
    flex: 1;
    overflow: hidden;
}
.study-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* Studies sidebar */
.study-sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #faf7f2;
    border-right: 1px solid var(--border-light);
    overflow: hidden;
}
.study-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.study-sidebar-label {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.study-sidebar-new-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.7rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.study-sidebar-new-btn:hover { background: #254a7a; }

/* Studies list */
.study-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}
.study-list-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}
.study-list-item:hover { background: #f0ece4; }
.study-list-item.active {
    background: #ede8df;
    border-left-color: var(--gold);
}
.study-list-title {
    font-size: 0.78rem;
    color: var(--text-dark);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.study-list-item.active .study-list-title { color: var(--navy); font-weight: 600; }
.study-list-title.untitled { color: var(--text-light); font-style: italic; }
.study-list-date {
    font-size: 0.67rem;
    color: var(--text-light);
    white-space: nowrap;
    flex-shrink: 0;
}
.study-list-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: none;
    border: none;
    border-radius: 4px;
    color: #aaa;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.study-list-item:hover .study-list-delete { opacity: 1; }
.study-list-delete:hover { color: #c0392b; background: #fdecea; }

/* Header */
.study-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    overflow-x: auto;
}
.study-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.study-title-label {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1rem;
    color: var(--navy);
    margin: 0;
    white-space: nowrap;
}
.study-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}
.study-header-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.study-header-btn:hover { background: var(--parchment); border-color: var(--gold); }
.study-export-btn { color: var(--navy); }
.study-new-btn { color: #b44; }

/* Toolbar */
.study-toolbar {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}
.study-tool-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    transition: background 0.12s;
}
.study-tool-btn:hover { background: #e8e4db; }
.study-tool-btn.active { background: #d5d0c6; border-color: var(--border-light); }
.study-toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border-light);
    margin: 0 4px;
}
.study-heading-select {
    padding: 4px 8px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    background: #fff;
    font-family: inherit;
    font-size: 0.78rem;
    color: var(--text-dark);
    cursor: pointer;
}

/* Font family selector */
.study-font-select {
    padding: 4px 6px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    background: #fff;
    font-size: 0.76rem;
    color: var(--text-dark);
    cursor: pointer;
    max-width: 140px;
    font-family: inherit;
}

/* Font size control group */
.study-fontsize-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    overflow: hidden;
    background: #fff;
}
.study-fontsize-btn {
    width: 22px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.12s;
}
.study-fontsize-btn:hover { background: #e8e4db; }
.study-fontsize-input {
    width: 38px;
    border: none;
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    text-align: center;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--text-dark);
    background: transparent;
    padding: 3px 2px;
    -moz-appearance: textfield;
}
.study-fontsize-input::-webkit-outer-spin-button,
.study-fontsize-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.study-fontsize-unit {
    font-size: 0.65rem;
    color: var(--text-light);
    padding: 0 4px 0 0;
}

/* Dark mode for font controls */
body.dark-mode .study-font-select { background: #2d1c0d; color: #e8dfd0; border-color: #4d3518; }
body.dark-mode .study-fontsize-wrap { background: #2d1c0d; border-color: #4d3518; }
body.dark-mode .study-fontsize-input { color: #e8dfd0; border-color: #4d3518; }
body.dark-mode .study-fontsize-btn { color: #c4a882; }
body.dark-mode .study-fontsize-btn:hover { background: #3d2910; }
body.dark-mode .study-fontsize-unit { color: #8a6d4e; }

/* ========== INLINE STUDY VERSE ========== */
.inline-study-verse {
    display: inline;
    font-style: italic;
    border: 1px solid var(--gold, #c9a84c);
    border-radius: 3px;
    padding: 1px 5px;
    margin: 0 2px;
    background: rgba(201, 168, 76, 0.07);
    line-height: inherit;
    font-size: inherit;
    /* Do not disrupt text flow */
    white-space: normal;
    word-break: break-word;
    cursor: default;
    user-select: text;
}
.inline-study-verse .isv-ref {
    font-size: 0.78em;
    font-weight: 700;
    color: var(--navy, #1a2744);
    font-style: normal;
    margin-right: 4px;
    letter-spacing: 0.01em;
}
.inline-study-verse .isv-body {
    color: inherit;
}
.inline-study-verse .isv-comment {
    font-size: 0.88em;
    color: var(--text-light, #888);
    margin-left: 5px;
    font-style: normal;
}

/* Dark mode inline verse */
body.dark-mode .inline-study-verse {
    border-color: #b5732a;
    background: rgba(181, 115, 42, 0.10);
}
body.dark-mode .inline-study-verse .isv-ref { color: #d4a45a; }

/* Body & Pages */
.study-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px 20px;
    display: flex;
    justify-content: center;
}
.study-pages {
    width: 100%;
    max-width: 816px; /* ~8.5in */
}
.study-page {
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
    padding: 60px 72px;
    min-height: 1056px; /* ~11in */
    margin-bottom: 24px;
    position: relative;
}
.study-title-input {
    width: 100%;
    border: none;
    outline: none;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
    padding: 0 0 12px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
    background: transparent;
}
.study-title-input::placeholder { color: #bbb; }
.study-editor {
    outline: none;
    font-family: 'Lora', Georgia, serif;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-dark);
    min-height: 400px;
    word-wrap: break-word;
}
.study-editor:empty::before {
    content: attr(data-placeholder);
    color: #bbb;
    pointer-events: none;
}
.study-editor h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    color: var(--navy);
    margin: 20px 0 10px;
}
.study-editor h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    color: var(--navy);
    margin: 16px 0 8px;
}
.study-editor h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 14px 0 6px;
}
.study-editor ul, .study-editor ol {
    margin: 8px 0;
    padding-left: 24px;
}

/* Verse block inserted from "Send to Study" */
.study-verse-block {
    background: var(--parchment);
    border-left: 3px solid var(--gold);
    padding: 12px 16px;
    margin: 14px 0;
    border-radius: 0 6px 6px 0;
    font-family: 'Lora', Georgia, serif;
}
.study-verse-ref {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--navy);
    margin-bottom: 4px;
}
.study-verse-text {
    font-style: italic;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-mid);
}
.study-verse-comment {
    margin-top: 8px;
    font-style: normal;
    font-size: 0.88rem;
    color: var(--text-dark);
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-top: 6px;
}

/* Status bar */
.study-status-bar {
    display: flex;
    justify-content: space-between;
    padding: 6px 16px;
    font-size: 0.72rem;
    color: var(--text-light);
    background: #fff;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

/* ========== STUDY INLINE SEARCH PANEL ========== */
.study-search-panel {
    display: none;
    flex-direction: column;
    background: var(--parchment);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    max-height: 320px;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.study-search-panel.open {
    display: flex;
}
.study-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    background: var(--parchment-dark, #f0e9d8);
}
/* Inner pill that holds icon + input */
.study-search-bar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    background: #fff;
    border: 1.5px solid var(--border-light);
    border-radius: 22px;
    padding: 6px 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.study-search-bar-inner:focus-within {
    border-color: var(--gold, #b5732a);
    box-shadow: 0 0 0 3px rgba(181,115,42,0.12);
}
.study-search-icon {
    width: 16px;
    height: 16px;
    color: var(--gold, #b5732a);
    flex-shrink: 0;
    opacity: 0.85;
}
.study-search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--navy, #3b1f0e);
    background: transparent;
    min-width: 0;
}
.study-search-bar input::placeholder {
    color: rgba(181,115,42,0.5);
    font-style: italic;
}
.study-search-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.study-srch-btn {
    padding: 3px 8px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 0.73rem;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.study-srch-btn:hover { background: var(--parchment); border-color: var(--gold); }
.study-srch-btn.active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.study-srch-scope {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 24px;
    padding: 0;
}
.study-srch-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    color: var(--text-light);
}
.study-search-results {
    overflow-y: auto;
    max-height: 250px;
    padding: 4px 0;
}
.study-srch-summary {
    padding: 4px 12px;
    font-size: 0.73rem;
    color: var(--text-light);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}
.study-srch-cmp-toggle {
    margin-left: auto;
    padding: 2px 8px;
    font-size: 0.68rem;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    background: #fff;
    color: var(--navy);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}
.study-srch-cmp-toggle:hover { background: var(--parchment); border-color: var(--gold); }
.study-srch-cmp-toggle.active { background: var(--gold); color: #fff; border-color: var(--gold); }
.study-srch-item--cmp { padding: 8px 10px; }
.study-srch-item--cmp .study-srch-cmp-cols { margin-top: 4px; }
.study-srch-item--cmp .study-srch-acts { margin-top: 4px; }
.study-srch-noresult {
    padding: 10px 14px;
    font-size: 0.82rem;
    color: var(--text-light);
}
.study-srch-item {
    padding: 8px 12px;
    border-bottom: 1px solid #f0ece3;
    cursor: default;
}
.study-srch-item:last-child { border-bottom: none; }
.study-srch-ref {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
}
.study-srch-lang {
    font-size: 0.65rem;
    background: var(--gold);
    color: #1e1206;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.study-srch-text {
    font-size: 0.8rem;
    color: var(--text-dark);
    line-height: 1.4;
    margin-bottom: 4px;
}
.study-srch-text mark {
    background: #fff3b0;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}
.study-srch-acts {
    display: flex;
    gap: 5px;
    margin-top: 3px;
}
.study-srch-act-btn {
    padding: 2px 8px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    background: #fff;
    color: var(--navy);
    cursor: pointer;
    font-size: 0.7rem;
    font-family: inherit;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}
.study-srch-act-btn:hover { background: var(--parchment); border-color: var(--gold); }

/* Dark mode for study search */
body.dark-mode .study-search-panel { background: #1e1108; border-bottom-color: #3d2910; }
body.dark-mode .study-search-bar { background: #2a1408; border-bottom-color: #3d2910; }
body.dark-mode .study-search-bar-inner { background: #1a0e06; border-color: #4d3518; }
body.dark-mode .study-search-bar-inner:focus-within { border-color: #b5732a; box-shadow: 0 0 0 3px rgba(181,115,42,0.15); }
body.dark-mode .study-search-bar input { color: #e8dfd0; }
body.dark-mode .study-search-bar input::placeholder { color: rgba(181,115,42,0.35); }
body.dark-mode .study-search-icon { color: #c8820a; }
body.dark-mode .study-srch-btn { background: #2d1c0d; color: #e8dfd0; border-color: #4d3518; }
body.dark-mode .study-srch-btn:hover { background: #3d2910; border-color: #7a5530; }
body.dark-mode .study-srch-btn.active { background: var(--gold); color: #1e1206; border-color: var(--gold); }
body.dark-mode .study-srch-item { border-bottom-color: #3d2910; }
body.dark-mode .study-srch-ref { color: #d4a45a; }
body.dark-mode .study-srch-text { color: #e8dfd0; }
body.dark-mode .study-srch-text mark { background: #5a3800; color: #f0e6d3; }
body.dark-mode .study-srch-act-btn { background: #2d1c0d; color: #c4a882; border-color: #4d3518; }
body.dark-mode .study-srch-act-btn:hover { background: #3d2910; border-color: #7a5530; }
body.dark-mode .study-srch-insert-btn { background: #b5732a; color: #1e1206; border-color: #d4a45a; }
body.dark-mode .study-srch-insert-btn:hover { background: #d4a45a; border-color: #e8c99a; color: #1e1206; }
body.dark-mode .study-srch-summary { color: #8a6d4e; border-bottom-color: #3d2910; }
body.dark-mode .study-srch-cmp-toggle { background: #2d1c0d; color: #c4a882; border-color: #4d3518; }
body.dark-mode .study-srch-cmp-toggle:hover { background: #3d2910; border-color: #7a5530; }
body.dark-mode .study-srch-cmp-toggle.active { background: var(--gold); color: #1e1206; border-color: var(--gold); }

/* Compare expansion inside study search */
.study-srch-compare {
    margin-top: 6px;
    border-top: 1px dashed var(--border-light);
    padding-top: 6px;
}
.study-srch-cmp-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.study-srch-cmp-col {
    background: var(--parchment);
    border-radius: 5px;
    padding: 6px 8px;
}
.study-srch-cmp-hd {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 4px;
}
.study-srch-cmp-add {
    padding: 2px 5px;
    margin-left: auto;
}
.study-srch-cmp-text {
    font-size: 0.78rem;
    color: var(--text-dark);
    line-height: 1.45;
}
.study-srch-cmp-text mark { background: #fff3b0; color: inherit; border-radius: 2px; padding: 0 1px; }
body.dark-mode .study-srch-compare { border-top-color: #3d2910; }
body.dark-mode .study-srch-cmp-col { background: #2d1c0d; }
body.dark-mode .study-srch-cmp-hd { color: #8a6d4e; }
body.dark-mode .study-srch-cmp-text { color: #e8dfd0; }
body.dark-mode .study-srch-cmp-text mark { background: #5a3800; color: #f0e6d3; }

/* ========== SEARCH FILTER ADDITIONS ========== */
.search-lang-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}
.search-lang-bar .scope-option {
    color: rgba(255,255,255,0.85);
    font-size: 0.82rem;
}
.search-lang-bar .scope-option input[type="radio"] { accent-color: var(--gold); }
.search-filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}
.search-lang-divider {
    padding: 6px 18px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--navy);
    background: #f5f1e8;
    border-bottom: 1px solid #e8e2d5;
}
body.dark-mode .search-lang-divider { background: #2d1c0d; color: #d4a45a; border-bottom-color: #3d2910; }

/* Send to Study dialog */
.study-send-dialog {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
}
.study-send-dialog.open { display: flex; }
.study-send-dialog-inner {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 460px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    animation: popoverIn 0.15s ease;
}
.study-send-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.study-send-dialog-header h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    color: var(--navy);
    margin: 0;
}
.study-send-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-mid);
    padding: 4px;
}
.study-send-verse {
    background: var(--parchment);
    border-left: 3px solid var(--gold);
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
    font-family: 'Lora', Georgia, serif;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-mid);
    margin-bottom: 14px;
}
.study-send-comment {
    width: 100%;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.study-send-comment:focus { border-color: var(--gold); }
.study-send-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}
.study-send-cancel {
    padding: 8px 18px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-mid);
    transition: background 0.15s;
}
.study-send-cancel:hover { background: #f5f5f5; }
.study-send-confirm {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    background: var(--navy);
    color: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.study-send-confirm:hover { background: #244a7a; }

/* Popover study button */
.popover-study {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.popover-study:hover { background: #244a7a; border-color: #244a7a; }
.popover-study svg { width: 15px; height: 15px; }

/* Search result study button */
.search-study-btn {
    background: rgba(34,139,34,0.1);
    border: 1px solid rgba(34,139,34,0.35);
    cursor: pointer;
    color: #1a7a1a;
    padding: 3px 8px;
    border-radius: 5px;
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.74rem;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
}
.search-study-btn::after {
    content: 'Studim';
    font-size: 0.74rem;
}
.search-study-btn:hover {
    background: rgba(34,139,34,0.2);
    border-color: rgba(34,139,34,0.6);
}
body.dark-mode .search-study-btn {
    background: rgba(60,180,60,0.12);
    border-color: rgba(60,180,60,0.3);
    color: #5dba5d;
}
body.dark-mode .search-study-btn:hover {
    background: rgba(60,180,60,0.22);
}

/* Dark mode study */
body.dark-mode .study-overlay { background: #1a0f07; }
body.dark-mode .study-header { background: #221508; border-bottom-color: #3d2910; }
body.dark-mode .study-title-label { color: #e8c99a; }
body.dark-mode .study-header-btn { background: #2d1c0d; color: #e8dfd0; border-color: #4d3518; }
body.dark-mode .study-header-btn:hover { background: #3d2910; border-color: #7a5530; }
body.dark-mode .study-tool-btn { color: #c4a882; }
body.dark-mode .study-tool-btn:hover { background: #3d2910; }
body.dark-mode .study-tool-btn.active { background: #4d3518; border-color: #7a5530; }
body.dark-mode .study-heading-select { background: #2d1c0d; color: #e8dfd0; border-color: #4d3518; }
body.dark-mode .study-sidebar { background: #1e1108; border-right-color: #3d2910; }
body.dark-mode .study-sidebar-head { border-bottom-color: #3d2910; }
body.dark-mode .study-sidebar-label { color: #e8c99a; }
body.dark-mode .study-sidebar-new-btn { background: #7a4515; }
body.dark-mode .study-sidebar-new-btn:hover { background: #9a5520; }
body.dark-mode .study-list-item:hover { background: #2d1c0d; }
body.dark-mode .study-list-item.active { background: #3d2910; border-left-color: var(--gold); }
body.dark-mode .study-list-title { color: #e8dfd0; }
body.dark-mode .study-list-item.active .study-list-title { color: #e8c99a; }
body.dark-mode .study-list-date { color: #8a6d4e; }
body.dark-mode .study-list-delete { color: #6a4d35; }
body.dark-mode .study-list-delete:hover { color: #e57373; background: rgba(229,115,115,0.12); }
body.dark-mode .study-page { background: #221508; border-color: #3d2910; box-shadow: 0 2px 16px rgba(0,0,0,0.5); }
body.dark-mode .study-title-input { color: #e8c99a; border-bottom-color: #4d3518; }
body.dark-mode .study-title-input::placeholder { color: #6a4d35; }
body.dark-mode .study-editor { color: #e8dfd0; }
body.dark-mode .study-editor:empty::before { color: #6a4d35; }
body.dark-mode .study-editor h1, body.dark-mode .study-editor h2 { color: #e8c99a; }
body.dark-mode .study-verse-block { background: #2d1c0d; border-left-color: #b5732a; }
body.dark-mode .study-verse-ref { color: #e8c99a; }
body.dark-mode .study-verse-text { color: #c4a882; }
body.dark-mode .study-verse-comment { color: #e8dfd0; border-top-color: #4d3518; }
body.dark-mode .study-status-bar { background: #221508; border-top-color: #3d2910; color: #8a6d4e; }
body.dark-mode .study-send-dialog-inner { background: #221508; }
body.dark-mode .study-send-dialog-header h3 { color: #e8c99a; }
body.dark-mode .study-send-verse { background: #2d1c0d; color: #c4a882; }
body.dark-mode .study-send-comment { background: #1a0f07; color: #e8dfd0; border-color: #4d3518; }
body.dark-mode .study-send-cancel { background: #2d1c0d; color: #c4a882; border-color: #4d3518; }
body.dark-mode .study-fab { background: #7a4515; }

/* --- Responsive --- */

/* Tablet */
@media (max-width: 1024px) {
    .page-text {
        column-count: 1;
        padding: 16px 36px 40px;
    }
    .chapter-header { padding: 30px 36px 16px; }
    .bible-main { padding: 0 16px 20px; }
    .chapter-controls { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
    .rp-minibar { margin-left: -16px; margin-right: -16px; }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --sidebar-w: 280px;
        --header-h: 50px;
    }

    .header-version { display: none; }
    .font-size-controls { gap: 1px; }
    .font-btn { font-size: 0.68rem; padding: 0 5px; }

    /* Sidebar slides in from left on mobile */
    .bible-sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0;
        height: calc(100vh - var(--header-h));
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
        z-index: 50;
    }
    .bible-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }

    .sidebar-toggle { display: flex !important; }

    .page-text {
        column-count: 1;
        padding: 16px 20px 36px;
        font-size: 1rem;
        line-height: 1.8;
    }
    .chapter-header { padding: 24px 20px 12px; }
    .chapter-book { font-size: 1.4rem; }
    .chapter-number-display { font-size: 0.9rem; }

    .bible-main { padding: 0 10px 16px; }

    .controls-inner { flex-wrap: wrap; }
    #bookSelect { flex: 1 1 100%; }
    #chapterSelect { flex: 1; }
    .go-btn { flex: 0 0 auto; }
    /* On mobile, reading mode btn label hidden to save space */
    .ctrl-reading-mode-btn #readingModeBtnLabel,
    .ctrl-reading-mode-btn span { display: none; }
    .ctrl-reading-mode-btn { padding: 8px 10px; margin-left: 0; }

    /* On mobile: hide desktop controls and eye btn, show only SVP trigger */
    .controls-inner .book-picker,
    .controls-inner #chapterSelect,
    .controls-inner .go-btn,
    .controls-inner .ctrl-reading-mode-btn { display: none; }
    .svp-trigger-btn { flex: 1; justify-content: center; font-size: 1rem; padding: 10px 16px; }

    /* Adjust sticky controls margins for mobile padding */
    .chapter-controls {
        margin-left: -10px;
        margin-right: -10px;
        padding-left: 10px;
        padding-right: 10px;
    }
    .rp-minibar { margin-left: -10px; margin-right: -10px; margin-bottom: 14px; }
    .bible-page-wrap { padding-top: 14px; }

    .chapter-nav { padding: 10px 0; }
    .nav-btn { padding: 8px 14px; font-size: 0.82rem; }

    /* Popover at bottom on mobile */
    .verse-popover {
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        max-width: none;
        border-radius: 14px 14px 0 0;
        padding: 18px 56px 24px 20px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
        max-height: 80vh;
        max-height: 80dvh;
    }
    .popover-close-btn { top: 14px; right: 20px; }
    .highlight-picker {
        bottom: auto;
        top: -40px;
    }

    /* Study place mobile */
    .study-sidebar {
        position: fixed;
        inset: 0;
        z-index: 2100;
        width: 80%;
        max-width: 280px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.18);
    }
    .study-sidebar.mobile-open { transform: translateX(0); }
    .study-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 2099;
        background: rgba(0,0,0,0.35);
    }
    .study-sidebar-backdrop.visible { display: block; }
    .study-list-toggle-btn { display: flex !important; }
    .study-header { flex-wrap: wrap; padding: 6px 10px; gap: 4px; }
    .study-toolbar { order: 3; width: 100%; justify-content: center; padding-top: 4px; border-top: 1px solid var(--border-light); }
    .study-page { padding: 30px 24px; min-height: auto; }
    .study-title-input { font-size: 1.2rem; }
    .study-header-btn { padding: 5px 7px; font-size: 0.7rem; }
    .study-export-btn span { display: none; }
    .study-fab { bottom: 75px; right: 14px; width: 44px; height: 44px; }
}

/* Desktop: hide study list toggle btn */
@media (min-width: 769px) {
    .sidebar-toggle { display: none !important; }
    .study-list-toggle-btn { display: none !important; }
}

/* Small phone */
@media (max-width: 400px) {
    .page-text { padding: 12px 16px 30px; font-size: 0.95rem; }
    .chapter-header { padding: 20px 16px 10px; }
    .chapter-book { font-size: 1.2rem; }
    .verse-num { font-size: 0.55em; }
}

/* Copyright footer */
.bible-copyright {
    text-align: center;
    padding: 16px 12px;
    font-size: 0.72rem;
    color: var(--text-light);
    letter-spacing: 0.3px;
    opacity: 0.6;
}
.bible-copyright p { margin: 0; }
body.dark-mode .bible-copyright { color: #7a7568; }


/* ============================================================
   POPOVER CLOSE BUTTON
   ============================================================ */
.popover-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(0,0,0,0.06);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-mid);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    z-index: 1;
}
.popover-close-btn:hover { background: rgba(0,0,0,0.12); color: var(--navy); }
body.dark-mode .popover-close-btn { background: rgba(255,255,255,0.08); color: #b0a898; }
body.dark-mode .popover-close-btn:hover { background: rgba(255,255,255,0.15); color: #e8dfd0; }

/* Tweak popover to have relative positioning for the close btn */
.verse-popover { position: fixed; }

/* ============================================================
   STICKY CHAPTER CONTROLS
   ============================================================ */
.chapter-controls {
    position: sticky;
    top: var(--header-h, 54px);
    z-index: 99;
    background: var(--parchment, #fdf8f0);
    border-bottom: 1px solid var(--border-light);
    padding: 10px 0 10px;
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    /* Negative margin to let it span full width despite bible-main padding */
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
}
body.dark-mode .chapter-controls {
    background: #1a0f07;
    border-bottom-color: #3d2910;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* ============================================================
   READING PLAN MINI BAR
   ============================================================ */
.rp-minibar {
    background: var(--parchment, #fdf8f0);
    border-bottom: 1px solid var(--border-light);
    border-top: 1px solid var(--border-light);
    padding: 0;
    overflow: hidden;
    margin-left: -24px;
    margin-right: -24px;
    margin-bottom: 20px;
}
.rp-minibar-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    max-width: 900px;
}
.rp-minibar-open {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(201,168,76,0.12);
    border: 1px solid rgba(201,168,76,0.4);
    border-radius: 20px;
    padding: 5px 12px;
    color: var(--gold, #c9a84c);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
}
.rp-minibar-open:hover { background: rgba(201,168,76,0.22); }
.rp-minibar-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.rp-minibar-bar-bg {
    flex: 1;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}
.rp-minibar-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold, #c9a84c), #e8c96a);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}
.rp-minibar-pct {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold, #c9a84c);
    white-space: nowrap;
    min-width: 32px;
    text-align: right;
}
.rp-minibar-today {
    font-size: 0.75rem;
    color: var(--text-mid, #7a6a55);
    white-space: nowrap;
    flex-shrink: 0;
}
.rp-minibar-today.done { color: #2e9e4f; }
@media (max-width: 480px) {
    .rp-minibar-today { display: none; }
}
body.dark-mode .rp-minibar {
    background: var(--surface-dark, #1a0f07);
    border-color: #3d2910;
}
body.dark-mode .rp-minibar-bar-bg { background: rgba(255,255,255,0.1); }
body.dark-mode .rp-minibar-today.done { color: #6ecf7e; }

/* ============================================================
   SVP TRIGGER BUTTON (Mobile only — shown via mobile media query)
   ============================================================ */
.svp-trigger-btn {
    display: none;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    background: var(--gold, #c9a84c);
    color: #fff;
    border: none;
    border-radius: var(--radius, 8px);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.svp-trigger-btn:hover { background: #b8952e; }
body.dark-mode .svp-trigger-btn { background: #b5732a; }
@media (max-width: 768px) {
    .svp-trigger-btn { display: flex; }
}
.svp-trigger-sep {
    opacity: 0.6;
    font-weight: 400;
    margin: 0 1px;
}
#svpTriggerChapter {
    font-weight: 700;
    font-size: 1.05em;
}

/* ============================================================
   SMART VERSE PICKER (SVP) SHEET
   ============================================================ */
.svp-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 3000;
    transition: opacity 0.2s;
}
.svp-overlay.open { display: block; }
.svp-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3001;
    background: #fff;
    border-radius: 18px 18px 0 0;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
}
.svp-sheet.open { transform: translateY(0); }
body.dark-mode .svp-sheet { background: #1a0f07; }

.svp-handle {
    width: 40px;
    height: 4px;
    background: rgba(0,0,0,0.12);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}
body.dark-mode .svp-handle { background: rgba(255,255,255,0.12); }

.svp-header {
    display: flex;
    align-items: center;
    padding: 12px 16px 8px;
    gap: 8px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
}
body.dark-mode .svp-header { border-color: #3d2910; }
.svp-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--navy);
    flex-shrink: 0;
}
body.dark-mode .svp-title { color: var(--gold-light, #e0c060); }
.svp-breadcrumb {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.svp-breadcrumb .svp-crumb {
    color: var(--gold-dark, #8a7230);
    cursor: pointer;
    font-weight: 600;
}
.svp-breadcrumb .svp-crumb:hover { text-decoration: underline; }
.svp-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-mid);
    flex-shrink: 0;
    transition: background 0.15s;
}
.svp-close:hover { background: rgba(0,0,0,0.12); }
body.dark-mode .svp-close { background: rgba(255,255,255,0.07); color: #b0a898; }

.svp-step {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px 8px;
    -webkit-overflow-scrolling: touch;
}
.svp-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-light);
    padding: 6px 2px 4px;
}
body.dark-mode .svp-section-label { color: #8a7a60; }

.svp-book-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 8px;
}
.svp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 6px;
}

.svp-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 6px;
    background: var(--parchment, #fdf8f0);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.12s, border-color 0.12s, transform 0.08s;
    overflow: hidden;
    min-height: 42px;
    line-height: 1.2;
}
.svp-item:active { transform: scale(0.93); }
.svp-item.active, .svp-item:hover {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.svp-item.holding {
    background: var(--navy);
    color: #fff;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px var(--gold);
}
/* Hold progress ring */
.svp-item-ring {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    pointer-events: none;
    overflow: hidden;
}
.svp-item-ring::after {
    content: '';
    position: absolute;
    inset: 0;
    background: conic-gradient(var(--gold) var(--progress, 0%), transparent 0%);
    opacity: 0.35;
    border-radius: 8px;
    transition: none;
}
body.dark-mode .svp-item {
    background: #2d1c0d;
    border-color: #4d3518;
    color: #e8dfd0;
}
body.dark-mode .svp-item.active, body.dark-mode .svp-item:hover {
    background: #8a5420;
    border-color: #c9a84c;
    color: #fff;
}

.svp-hint {
    text-align: center;
    font-size: 0.73rem;
    color: var(--text-light);
    padding: 6px 16px 10px;
    flex-shrink: 0;
    border-top: 1px solid var(--border-light);
}
body.dark-mode .svp-hint { border-color: #3d2910; color: #6a5840; }

/* New book-with-chapters list layout */
.svp-book-row {
    border-bottom: 1px solid var(--border-light);
}
.svp-book-row:last-child { border-bottom: none; }

.svp-book-name {
    display: block;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
    transition: background 0.15s;
}
.svp-book-name:hover {
    background: rgba(26, 39, 68, 0.06);
}
.svp-book-name:active {
    background: rgba(26, 39, 68, 0.12);
}
.svp-book-row.expanded .svp-book-name {
    background: var(--navy);
    color: #fff;
}

.svp-chapters-inline {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px 14px;
    background: rgba(26, 39, 68, 0.03);
}
.svp-book-row.expanded .svp-chapters-inline {
    display: flex;
}

.svp-chapter-btn {
    min-width: 38px;
    height: 34px;
    padding: 0 8px;
    background: var(--parchment);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
    transition: background 0.12s, transform 0.08s;
}
.svp-chapter-btn:hover {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}
.svp-chapter-btn:active {
    transform: scale(0.93);
}

/* Dark mode */
body.dark-mode .svp-book-row { border-color: #3d2910; }
body.dark-mode .svp-book-name { color: #e8dfd0; }
body.dark-mode .svp-book-name:hover { background: rgba(200, 168, 76, 0.1); }
body.dark-mode .svp-book-row.expanded .svp-book-name {
    background: #8a5420;
    color: #fff;
}
body.dark-mode .svp-chapters-inline { background: rgba(0, 0, 0, 0.2); }
body.dark-mode .svp-chapter-btn {
    background: #2d1c0d;
    border-color: #4d3518;
    color: #e8dfd0;
}
body.dark-mode .svp-chapter-btn:hover {
    background: #8a5420;
    border-color: #c9a84c;
    color: #fff;
}

/* ============================================================
   SIDEBAR READING PLAN - MORE VISIBLE
   ============================================================ */
.readingplan-section {
    border-top: none !important;
}
.readingplan-section .sidebar-heading {
    color: var(--navy);
}
.rp-sidebar-widget {
    background: linear-gradient(135deg, var(--navy) 0%, #2a3d6e 100%);
    border-radius: 10px;
    padding: 14px 14px 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: opacity 0.15s;
}
.rp-sidebar-widget:hover { opacity: 0.92; }
.rp-sidebar-widget-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.rp-sidebar-widget-title {
    color: #f0d882;
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.rp-sidebar-widget-pct {
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
    font-weight: 700;
}
.rp-sidebar-widget-bar-bg {
    height: 5px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.rp-sidebar-widget-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #c9a84c, #f0d882);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}
.rp-sidebar-widget-today {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.65);
}
.rp-sidebar-widget-today.done { color: #7ed87e; }
.rp-sidebar-new-plan-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 9px 14px;
    border: 2px dashed var(--gold, #c9a84c);
    background: transparent;
    color: var(--gold-dark, #8a7230);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.rp-sidebar-new-plan-btn:hover { background: rgba(201,168,76,0.1); }
body.dark-mode .rp-sidebar-new-plan-btn { color: var(--gold-light, #e0c060); border-color: rgba(201,168,76,0.4); }

/* --- Backup & Restore Section --- */
.backup-section, .readingplan-section {
    border-top: 1px solid var(--border-light);
}
.backup-desc {
    font-size: 0.78rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 10px;
}
.backup-actions, .backup-drive-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}
.backup-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border-light);
    background: var(--parchment);
    color: var(--navy);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.backup-btn:hover {
    background: var(--parchment-dark);
    border-color: var(--gold);
}
.backup-drive-btn {
    background: #e8f0fe;
    border-color: #c2d7f5;
}
.backup-drive-btn:hover {
    background: #d2e3fc;
    border-color: #4285f4;
}
.backup-drive-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Drive connection status */
.drive-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.02);
    border-radius: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.drive-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #bbb;
    flex-shrink: 0;
    transition: background 0.3s;
}
.drive-dot.connected {
    background: #34a853;
    box-shadow: 0 0 6px rgba(52, 168, 83, 0.5);
}
.drive-dot.syncing {
    background: #fbbc04;
    box-shadow: 0 0 6px rgba(251, 188, 4, 0.6);
    animation: drive-pulse 0.9s ease-in-out infinite alternate;
}
@keyframes drive-pulse {
    from { opacity: 1; }
    to   { opacity: 0.35; }
}
.drive-status-text {
    font-size: 0.78rem;
    color: var(--text-light);
    flex: 1;
    min-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.drive-login-btn, .drive-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.drive-login-btn {
    background: #4285f4;
    color: #fff;
    border-color: #3367d6;
}
.drive-login-btn:hover { background: #3367d6; }
.drive-logout-btn {
    background: var(--parchment);
    color: var(--text-light);
}
.drive-logout-btn:hover { background: var(--parchment-dark); }
body.dark-mode .backup-desc { color: #9a7550; }
body.dark-mode .backup-btn { background: #2d1c0d; border-color: #4d3518; color: #e8dfd0; }
body.dark-mode .backup-btn:hover { background: #3d2910; border-color: var(--gold); }
body.dark-mode .backup-drive-btn { background: #3b1f0e; border-color: #7a4515; }
body.dark-mode .backup-drive-btn:hover { background: #4d2a10; border-color: #b5732a; }
body.dark-mode .drive-status { background: rgba(255,255,255,0.04); }
body.dark-mode .drive-status-text { color: #9a7550; }
body.dark-mode .drive-logout-btn { background: #2d1c0d; color: #9a7550; border-color: #4d3518; }

/* ============================================================
   READING PLAN — Overlay & Layout
   ============================================================ */
.rp-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--parchment, #f0ece4);
    display: none;
    flex-direction: column;
}
.rp-overlay.open { display: flex; }
.rp-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ---- Header ---- */
.rp-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    min-height: 52px;
}
.rp-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.rp-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-wrap: wrap;
}

/* ---- Scrollable body ---- */
.rp-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px 24px;
    -webkit-overflow-scrolling: touch;
}

/* ============================================================
   GENERATOR FORM
   ============================================================ */
.rp-form {
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    border-radius: 14px;
    padding: 32px 28px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
}
.rp-form-row { margin-bottom: 22px; }
.rp-label {
    display: block;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--navy);
    margin-bottom: 8px;
}
.rp-label-inline {
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-light);
}
.rp-duration-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}
.rp-input {
    padding: 10px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--navy);
    background: var(--parchment);
    width: 80px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.rp-date-input { width: 100%; max-width: 220px; }
.rp-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(181,115,42,0.12);
}

/* Scope radio buttons — pill style */
.rp-scope-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.rp-radio {
    display: flex;
    align-items: center;
    gap: 0;
    cursor: pointer;
}
.rp-radio input[type="radio"] { display: none; }
.rp-radio-label {
    display: inline-block;
    padding: 8px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-mid, #6b7280);
    background: var(--parchment);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.rp-radio input[type="radio"]:checked + .rp-radio-label {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}
.rp-radio-label:hover { border-color: var(--navy); color: var(--navy); }

.rp-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: var(--navy);
    color: #fff;
    font-size: 0.97rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    margin-top: 6px;
    letter-spacing: 0.02em;
}
.rp-generate-btn:hover { background: #243b6a; }
.rp-generate-btn:active { transform: scale(0.98); }

/* ============================================================
   PLAN RESULT
   ============================================================ */
.rp-result {
    max-width: 760px;
    margin: 0 auto;
}
.rp-result-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.rp-result-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy);
    margin: 0;
    line-height: 1.3;
}
.rp-reset-btn {
    padding: 7px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: 20px;
    background: transparent;
    color: var(--text-mid, #6b7280);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.rp-reset-btn:hover { border-color: var(--navy); color: var(--navy); background: rgba(26,39,68,0.04); }

/* ---- Table ---- */
.rp-table-wrap {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    overflow: hidden; /* clip header radius */
}
.rp-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.875rem;
}
.rp-table thead th {
    background: var(--navy);
    color: rgba(255,255,255,0.9);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 11px 14px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
}
.rp-table thead th:first-child { border-radius: 0; }
.rp-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.055);
    color: var(--navy);
    vertical-align: middle;
}
.rp-table tbody tr:last-child td { border-bottom: none; }
.rp-table tbody tr { cursor: pointer; }
.rp-table tbody tr:nth-child(even) { background: #faf8f4; }
.rp-table tbody tr:hover { background: rgba(181,115,42,0.09); }
.rp-td-check { cursor: default; }

/* Today row highlight */
.rp-table tbody tr.rp-today { background: rgba(181,115,42,0.07); }
.rp-table tbody tr.rp-today td { border-left: 3px solid #b5732a; }
.rp-table tbody tr.rp-today td:not(:first-child) { border-left: none; }
.rp-table tbody tr.rp-today td:first-child { border-left: 3px solid #b5732a; padding-left: 11px; }

/* Column widths */
.rp-td-day { width: 44px; text-align: center; }
.rp-day-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--parchment, #f0ece4);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gold-dark, #8a7230);
}
tr.rp-today .rp-day-num {
    background: #b5732a;
    color: #fff;
}
.rp-td-date { width: 108px; white-space: nowrap; font-size: 0.82rem; color: var(--text-mid, #6b7280); }
.rp-td-reading { font-weight: 500; }
.rp-td-time { width: 58px; white-space: nowrap; font-size: 0.75rem; color: var(--text-light, #9ca3af); text-align: right; padding-right: 10px; }
tr.rp-done .rp-td-time { opacity: 0.4; }
.rp-date-time-sep { opacity: 0.4; }
.rp-inline-time { color: var(--text-light, #9ca3af); font-size: 0.7rem; }
.rp-td-readbtn { width: 44px; text-align: center; white-space: nowrap; }
.rp-td-readbtn:has(.rp-read-btn--today) { width: auto; }
.rp-td-check { width: 44px; text-align: center; }
.rp-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--gold);
    border-radius: 4px;
}
tr.rp-done td { opacity: 0.42; text-decoration: line-through; }
tr.rp-done .rp-td-check,
tr.rp-done .rp-td-readbtn { opacity: 1; text-decoration: none; }

/* ---- Dark mode ---- */
body.dark-mode .rp-overlay { background: #1a0f07; }
body.dark-mode .rp-header { background: #221508; border-color: #3d2910; }
body.dark-mode .rp-form { background: #221508; box-shadow: 0 2px 16px rgba(0,0,0,0.5); }
body.dark-mode .rp-label,
body.dark-mode .rp-result-title { color: var(--gold-light, #e8c99a); }
body.dark-mode .rp-input { background: #2d1c0d; border-color: #4d3518; color: #e8dfd0; }
body.dark-mode .rp-radio-label { background: #2d1c0d; border-color: #4d3518; color: #9a8060; }
body.dark-mode .rp-radio input[type="radio"]:checked + .rp-radio-label { background: #7a4515; border-color: #7a4515; color: #fff; }
body.dark-mode .rp-table { background: #221508; }
body.dark-mode .rp-table-wrap { box-shadow: 0 2px 12px rgba(0,0,0,0.5); }
body.dark-mode .rp-table thead th { background: #2e1608; color: #c8a878; }
body.dark-mode .rp-table tbody td { border-color: rgba(255,255,255,0.05); color: #e8dfd0; }
body.dark-mode .rp-table tbody tr:nth-child(even) { background: #2a1810; }
body.dark-mode .rp-table tbody tr:hover { background: rgba(181,115,42,0.1); }
body.dark-mode .rp-table tbody tr.rp-today { background: rgba(181,115,42,0.1); }
body.dark-mode .rp-td-date { color: #7a6a5a; }
body.dark-mode .rp-day-num { background: #2d1c0d; color: #c8a060; }
body.dark-mode tr.rp-today .rp-day-num { background: #b5732a; color: #fff; }
body.dark-mode .rp-reset-btn { border-color: #4d3518; color: #8a6d4e; }
body.dark-mode .rp-reset-btn:hover { border-color: #c8a060; color: #c8a060; background: rgba(181,115,42,0.08); }
body.dark-mode .rp-generate-btn { background: #7a4515; }
body.dark-mode .rp-generate-btn:hover { background: #8a5520; }

/* ============================================================
   MOBILE — card-style rows, more breathing room
   ============================================================ */
@media (max-width: 768px) {
    .rp-body { padding: 16px 12px; }
    .rp-form { padding: 24px 18px; border-radius: 12px; }
    .rp-header { padding: 8px 14px; min-height: 48px; }
    .rp-header-right { gap: 4px; }

    /* Hide table header — info is shown inline in each card */
    .rp-table thead { display: none; }

    /* Table/tbody/tr reset to allow grid layout */
    .rp-table { display: block; width: 100%; background: transparent; }
    .rp-table tbody { display: block; width: 100%; }

    /*
     * 3-column card grid:
     *   col1 = day circle (fixed 38px)
     *   col2 = reading title + date/time meta (fills remaining space)
     *   col3 = actions: read-btn stacked above checkbox (fixed width)
     *
     * Row 1: reading title | [read-btn]
     * Row 2: date · time   | [checkbox]
     */
    .rp-table tbody tr {
        display: grid;
        grid-template-columns: 38px 1fr 44px;
        grid-template-rows: auto auto;
        align-items: center;
        gap: 3px 10px;
        background: #fff;
        border-radius: 10px;
        margin-bottom: 10px;
        box-shadow: 0 1px 5px rgba(0,0,0,0.07);
        padding: 12px 14px;
        border-bottom: none !important;
        width: 100%;
        box-sizing: border-box;
    }
    .rp-table tbody tr.rp-today {
        box-shadow: 0 0 0 2px #b5732a, 0 2px 8px rgba(181,115,42,0.18);
        background: rgba(181,115,42,0.04);
    }
    /* Cancel desktop left-border accent — not needed in card mode */
    .rp-table tbody tr.rp-today td { border-left: none !important; padding-left: 0 !important; }

    /* ---- Cell placement ---- */
    .rp-td-day {
        grid-column: 1;
        grid-row: 1 / 3;
        padding: 0; border: none; width: auto;
        align-self: center;
        justify-self: center;
    }
    .rp-td-reading {
        grid-column: 2; grid-row: 1;
        padding: 0; border: none;
        font-size: 0.88rem; font-weight: 600;
        min-width: 0; /* allow text to shrink */
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* Date and time merged on row 2 col 2 — time hidden, folded into date cell */
    .rp-td-date {
        grid-column: 2; grid-row: 2;
        padding: 0; border: none;
        font-size: 0.73rem;
        color: var(--text-mid, #6b7280);
    }
    .rp-td-time {
        display: none; /* merged visually after date via JS or kept hidden to avoid layout breaks */
    }
    /* Read button: top half of actions column */
    .rp-td-readbtn {
        grid-column: 3; grid-row: 1;
        padding: 0; border: none;
        width: auto; text-align: center;
        align-self: center;
    }
    /* Checkbox: bottom half of actions column */
    .rp-td-check {
        grid-column: 3; grid-row: 2;
        padding: 0; border: none;
        width: auto; text-align: center;
        align-self: center;
    }

    /* Read button on mobile — icon only by default, label hidden */
    .rp-read-btn {
        white-space: normal;
        padding: 5px 6px;
        width: 32px;
        height: 32px;
        justify-content: center;
    }
    /* Hide "Read today" text label on mobile — button becomes amber icon pill */
    .rp-read-label { display: none; }
    .rp-read-btn--today {
        width: 32px;
        height: 32px;
        padding: 5px 6px;
        justify-content: center;
    }

    .rp-day-num { width: 32px; height: 32px; font-size: 0.75rem; }

    /* Strip alternating bg — each card has its own shadow */
    .rp-table tbody tr:nth-child(even) { background: #fff; }
    .rp-table tbody tr:hover { background: rgba(181,115,42,0.04); }

    .rp-result { max-width: 100%; }
    .rp-result-header { gap: 8px; }
    .rp-result-title { font-size: 1rem; }
    .rp-table-wrap { border-radius: 0; box-shadow: none; overflow: visible; background: transparent; }
    .rp-scope-options { gap: 8px; }
    .rp-radio-label { padding: 7px 14px; font-size: 0.82rem; }

    /* Dark mode cards */
    body.dark-mode .rp-table tbody tr { background: #221508; box-shadow: 0 1px 5px rgba(0,0,0,0.35); }
    body.dark-mode .rp-table tbody tr.rp-today { box-shadow: 0 0 0 2px #b5732a, 0 2px 8px rgba(181,115,42,0.25); background: rgba(181,115,42,0.08); }
    body.dark-mode .rp-table tbody tr:nth-child(even) { background: #221508; }
}

/* ---- Study sync indicator ---- */
.study-sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-light);
}
.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #aaa;
    flex-shrink: 0;
    transition: background 0.3s;
}
.sync-dot.synced { background: #27ae60; }
.sync-dot.syncing {
    background: #f39c12;
    animation: pulse-sync 1s infinite;
}
@keyframes pulse-sync {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
body.dark-mode .study-sync-indicator { color: #777; }

/* ---- PWA install button ---- */
.pwa-install-btn {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--gold);
    color: var(--navy);
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.pwa-install-btn:hover { opacity: 0.85; }
@media (max-width: 800px) {
    .pwa-install-label { display: none; }
    .pwa-install-btn { padding: 6px 8px; gap: 0; }
}
@media (max-width: 600px) {
    .header-brand { display: none; }
    .header-hide-mobile { display: none !important; }
}

/* Sidebar mobile quick actions */
.sidebar-mobile-actions {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-install-btn {
    flex: 1;
    justify-content: center;
}
@media (max-width: 600px) {
    .sidebar-mobile-actions { display: flex; }
}

/* ---- Visitor count popup ---- */
.visitor-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9200;
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
}
.visitor-popup.open { display: flex; }
.visitor-popup-inner {
    background: #fff;
    border-radius: 12px;
    padding: 24px 28px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    max-width: 420px;
    width: 94%;
    max-height: 90vh;
    overflow-y: auto;
}
.visitor-popup-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
}
.visitor-period-selector {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
}
.visitor-period-selector select {
    padding: 6px 10px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--parchment);
    color: var(--navy);
    font-size: 0.82rem;
    cursor: pointer;
}
.visitor-period-selector select:focus {
    outline: none;
    border-color: var(--gold);
}
body.dark-mode .visitor-period-selector select {
    background: #2d1c0d;
    border-color: #4d3518;
    color: #e8dfd0;
}
.visitor-popup-count {
    font-size: 3rem;
    font-weight: 700;
    color: var(--gold);
    line-height: 1.1;
    margin: 12px 0;
}
.visitor-popup-sub {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 0;
}
.visitor-popup-close {
    padding: 8px 24px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}
.visitor-locations {
    width: 100%;
    max-height: 260px;
    overflow-y: auto;
    margin: 4px 0 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.visitor-loc-loading {
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    padding: 8px 0;
}
.visitor-loc-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    color: var(--text-mid);
    min-height: 22px;
}
.visitor-loc-flag {
    font-size: 1.05rem;
    line-height: 1;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}
.visitor-loc-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-dark);
    font-size: 0.83rem;
}
.visitor-loc-bar {
    width: 60px;
    height: 5px;
    background: #e8e0d5;
    border-radius: 3px;
    flex-shrink: 0;
    overflow: hidden;
}
.visitor-loc-bar-fill {
    height: 100%;
    background: var(--navy);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.visitor-loc-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--navy);
    min-width: 24px;
    text-align: right;
    flex-shrink: 0;
}
body.dark-mode .visitor-popup-inner {
    background: #221508;
    color: #e8dfd0;
}
body.dark-mode .visitor-popup-title { color: var(--gold); }
body.dark-mode .visitor-loc-name { color: #e8dfd0; }
body.dark-mode .visitor-loc-bar { background: #3d2a14; }
body.dark-mode .visitor-loc-bar-fill { background: var(--gold); }
body.dark-mode .visitor-loc-count { color: var(--gold); }

/* Visitor popup — totals row */
.visitor-counts-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 20px;
}
.visitor-count-cell {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.visitor-count-divider {
    width: 1px;
    height: 56px;
    background: #e0d8ce;
    flex-shrink: 0;
    margin: 0 8px;
}
.visitor-unique-count {
    color: var(--navy) !important;
}

/* Visitor popup — section labels */
.visitor-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-light);
    text-align: left;
    margin: 14px 0 6px;
}

/* Visitor popup — stat bars (device / login) */
.visitor-stat-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.visitor-stat-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
}
.visitor-stat-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.visitor-stat-label {
    flex: 1;
    text-align: left;
    color: var(--text-dark);
    font-size: 0.83rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.visitor-stat-pct {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--navy);
    min-width: 34px;
    text-align: right;
    flex-shrink: 0;
}

body.dark-mode .visitor-count-divider { background: #3d2a14; }
body.dark-mode .visitor-unique-count { color: var(--gold) !important; }
body.dark-mode .visitor-section-label { color: #a08060; }
body.dark-mode .visitor-stat-label { color: #e8dfd0; }
body.dark-mode .visitor-stat-pct { color: var(--gold); }

/* Print styles */
@media print {
    .bible-header, .bible-sidebar, .chapter-controls, .chapter-nav,
    .verse-popover, .search-overlay, .toast, .study-fab,
    .study-header, .study-status-bar, .rp-overlay { display: none !important; }
    .bible-main { padding: 0; max-width: 100%; }
    .bible-page {
        box-shadow: none;
        border: none;
    }
    .page-text {
        column-count: 2;
        font-size: 10pt;
        line-height: 1.6;
    }
    /* Study print */
    .study-overlay.open {
        position: static;
        display: block !important;
        background: #fff;
    }
    .study-body { padding: 0; overflow: visible; }
    .study-page {
        box-shadow: none;
        border: none;
        padding: 0;
        min-height: auto;
        page-break-after: always;
    }
    .study-verse-block {
        break-inside: avoid;
    }
}

/* ============ DRIVE LOGOUT MODAL ============ */
.drive-logout-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9100;
    background: rgba(0,0,0,0.55);
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.drive-logout-modal.open { display: flex; }

.drive-logout-modal-inner {
    background: var(--parchment);
    border-radius: 12px;
    padding: 28px 24px 20px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    text-align: center;
}

.drive-logout-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.drive-logout-icon { color: var(--navy); opacity: 0.7; }
.drive-logout-modal-header h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy);
}
.drive-logout-msg {
    font-size: 0.88rem;
    color: var(--text-mid);
    line-height: 1.6;
    margin-bottom: 22px;
}
.drive-logout-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.drive-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    border: none;
}
.drive-logout-delete {
    background: #c0392b;
    color: #fff;
}
.drive-logout-delete:hover { background: #a93226; }
.drive-logout-only {
    background: var(--navy);
    color: #fff;
}
.drive-logout-only:hover { background: var(--navy-dark); }
.drive-logout-cancel {
    background: transparent;
    color: var(--text-mid);
    border: 1px solid var(--border-light) !important;
}
.drive-logout-cancel:hover { background: var(--parchment-dark); }

body.dark-mode .drive-logout-modal-inner {
    background: #221508;
}
body.dark-mode .drive-logout-modal-header h3 { color: #e8c99a; }
body.dark-mode .drive-logout-msg { color: #c4a882; }
body.dark-mode .drive-logout-cancel { color: #c4a882; border-color: #4d3518 !important; }

/* ── Drive Conflict Modal ── */
.drive-conflict-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9200;
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.drive-conflict-modal.open { display: flex; }
.drive-conflict-modal-inner {
    background: var(--parchment);
    border-radius: 12px;
    padding: 28px 24px 20px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
    text-align: center;
}
.drive-conflict-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.drive-conflict-modal-header h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy);
}
.drive-conflict-msg {
    font-size: 0.87rem;
    color: var(--text-mid);
    line-height: 1.6;
    margin-bottom: 20px;
}
.drive-conflict-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.drive-conflict-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    border: none;
}
.drive-conflict-copy    { background: var(--navy); color: #fff; }
.drive-conflict-copy:hover { background: var(--navy-dark); }
.drive-conflict-merge   { background: #2e7d32; color: #fff; }
.drive-conflict-merge:hover { background: #256427; }
.drive-conflict-overwrite { background: #c0392b; color: #fff; }
.drive-conflict-overwrite:hover { background: #a93226; }
.drive-conflict-cancel  { background: transparent; color: var(--text-mid); border: 1px solid var(--border-light) !important; }
.drive-conflict-cancel:hover { background: var(--parchment-dark); }
body.dark-mode .drive-conflict-modal-inner { background: #221508; }
body.dark-mode .drive-conflict-modal-header h3 { color: #e8c99a; }
body.dark-mode .drive-conflict-msg { color: #c4a882; }
body.dark-mode .drive-conflict-cancel { color: #c4a882; border-color: #4d3518 !important; }
body.dark-mode .drive-logout-cancel:hover { background: #2d1c0d; }

/* ============ DRIVE HISTORY MODAL ============ */
.drive-history-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 12000;
    background: rgba(20,12,4,0.6);
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.drive-history-modal.open { display: flex; }

.drive-history-modal-inner {
    background: var(--parchment);
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.drive-history-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.drive-history-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--navy);
}
.drive-history-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.drive-history-close-btn:hover { background: var(--parchment-dark); }

.drive-history-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Sidebar — list of snapshots */
.drive-history-sidebar {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.drive-history-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.drive-history-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.drive-history-new-btn:hover { background: var(--navy-dark); }

.drive-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}
.drive-history-loading {
    padding: 18px 14px;
    font-size: 0.82rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.5;
}
.drive-history-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 14px;
    cursor: pointer;
    border-radius: 0;
    transition: background 0.12s;
    border-left: 3px solid transparent;
}
.drive-history-item:hover { background: var(--parchment-dark); }
.drive-history-item.selected {
    background: rgba(33,72,128,0.08);
    border-left-color: var(--navy);
}
.drive-history-item-icon {
    color: var(--navy);
    opacity: 0.5;
    flex-shrink: 0;
    margin-top: 1px;
}
.drive-history-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.drive-history-item-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.drive-history-item-date {
    font-size: 0.72rem;
    color: var(--text-light);
}

/* Content — preview panel */
.drive-history-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.drive-history-preview {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
}
.drive-history-empty-preview {
    font-size: 0.85rem;
    color: var(--text-light);
    text-align: center;
    margin-top: 40px;
}
.drive-history-preview-header {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 14px;
}
.drive-history-preview-stats {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.drive-history-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--parchment-dark);
    border-radius: 8px;
    padding: 8px 16px;
    min-width: 60px;
}
.drive-history-stat-num {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
}
.drive-history-stat-lbl {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.drive-history-preview-section {
    margin-bottom: 14px;
}
.drive-history-preview-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.drive-history-study-item {
    background: var(--parchment-dark);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.drive-history-study-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 4px;
}
.drive-history-study-snippet {
    font-size: 0.78rem;
    color: var(--text-mid);
    line-height: 1.45;
    margin-bottom: 4px;
}
.drive-history-study-meta {
    font-size: 0.7rem;
    color: var(--text-light);
}

/* Actions bar */
.drive-history-actions {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}
.drive-history-restore-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.drive-history-restore-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.drive-history-restore-btn:not(:disabled):hover { background: var(--navy-dark); }

/* Responsive: stack on small screens */
@media (max-width: 540px) {
    .drive-history-body { flex-direction: column; }
    .drive-history-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        max-height: 160px;
    }
    .drive-history-modal-inner { max-height: 92vh; }
}

/* Dark mode */
body.dark-mode .drive-history-modal-inner { background: #221508; }
body.dark-mode .drive-history-modal-header { border-color: #3d2510; }
body.dark-mode .drive-history-modal-title { color: #e8c99a; }
body.dark-mode .drive-history-close-btn { color: #9a7550; }
body.dark-mode .drive-history-close-btn:hover { background: #2d1c0d; }
body.dark-mode .drive-history-sidebar { border-color: #3d2510; }
body.dark-mode .drive-history-sidebar-header { color: #9a7550; border-color: #3d2510; }
body.dark-mode .drive-history-item:hover { background: #2d1c0d; }
body.dark-mode .drive-history-item.selected { background: rgba(200,170,120,0.1); border-left-color: #c8aa78; }
body.dark-mode .drive-history-item-label { color: #e8c99a; }
body.dark-mode .drive-history-item-date { color: #9a7550; }
body.dark-mode .drive-history-loading { color: #9a7550; }
body.dark-mode .drive-history-preview-header { color: #9a7550; }
body.dark-mode .drive-history-empty-preview { color: #9a7550; }
body.dark-mode .drive-history-stat { background: #2d1c0d; }
body.dark-mode .drive-history-stat-num { color: #e8c99a; }
body.dark-mode .drive-history-stat-lbl { color: #9a7550; }
body.dark-mode .drive-history-preview-section-title { color: #9a7550; }
body.dark-mode .drive-history-study-item { background: #2d1c0d; }
body.dark-mode .drive-history-study-title { color: #e8c99a; }
body.dark-mode .drive-history-study-snippet { color: #c4a882; }
body.dark-mode .drive-history-study-meta { color: #9a7550; }
body.dark-mode .drive-history-actions { border-color: #3d2510; }
body.dark-mode .drive-history-new-btn { background: #c8aa78; color: #1a0e05; }
body.dark-mode .drive-history-new-btn:hover { background: #d4bb8a; }

/* ============ SETTINGS PANEL ============ */
.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10500;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(2px);
}
.settings-overlay.open { display: block; }

.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 10501;
    width: 340px;
    max-width: 96vw;
    background: var(--parchment);
    border-left: 1px solid var(--border-light);
    box-shadow: -4px 0 28px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    font-family: 'Inter', sans-serif;
}
.settings-panel.open { transform: translateX(0); }

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    background: #fff;
    flex-shrink: 0;
}
.settings-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1rem;
    color: var(--navy);
    letter-spacing: 0.01em;
}
.settings-close {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: transparent;
    border-radius: 6px; cursor: pointer;
    color: var(--text-mid);
    transition: background 0.15s;
}
.settings-close:hover { background: var(--parchment-dark); }

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.settings-section {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    overflow: hidden;
}
.settings-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    padding: 10px 14px 6px;
    background: var(--parchment);
    border-bottom: 1px solid var(--border-light);
}
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row--col {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.settings-label {
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-dark);
    flex-shrink: 0;
}

/* Theme buttons */
.settings-theme-btns { display: flex; gap: 8px; }
.settings-theme-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--parchment);
    color: var(--text-dark);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.settings-theme-btn:hover { background: var(--parchment-dark); }
.settings-theme-btn.active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

/* Font size controls */
.settings-fontsize-ctrl {
    display: flex; align-items: center; gap: 10px;
}
.settings-fs-btn {
    padding: 5px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--parchment);
    color: var(--text-dark);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.settings-fs-btn:hover { background: var(--parchment-dark); }
.settings-fs-label {
    font-size: 0.82rem;
    color: var(--text-mid);
    min-width: 52px;
    text-align: center;
}

/* Bible font selector */
.settings-font-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-light);
    border-radius: 7px;
    background: var(--parchment);
    font-size: 0.84rem;
    color: var(--text-dark);
    font-family: inherit;
    cursor: pointer;
}
.settings-font-select:focus { outline: none; border-color: var(--gold); }

/* Action buttons */
.settings-btn-group { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.settings-action-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px;
    border: 1px solid var(--border-light);
    border-radius: 7px;
    background: var(--parchment);
    color: var(--text-dark);
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.settings-action-btn:hover { background: var(--parchment-dark); border-color: var(--gold); }
.settings-drive-login-btn { color: #1a73e8; border-color: #c4d7f8; background: #f0f5ff; }
.settings-drive-login-btn:hover { background: #deeaff; }
.settings-drive-logout-btn { color: #c0392b; border-color: #f5c6c1; background: #fff5f4; }
.settings-drive-logout-btn:hover { background: #ffe8e6; }

/* Drive status */
.settings-drive-status {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.8rem; color: var(--text-mid);
}

/* Palette preview (single theme) */
.settings-palette-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 2px solid var(--gold);
    border-radius: 10px;
    background: var(--parchment-dark);
    width: 100%;
    box-sizing: border-box;
}
.season-swatch {
    flex-shrink: 0;
    width: 56px;
    height: 10px;
    border-radius: 5px;
    display: block;
}
.season-swatch--cognac { background: linear-gradient(90deg, #2a1509, #b5732a, #faf7f0); }
.settings-palette-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
}
.settings-palette-desc {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-left: auto;
}
body.dark-mode .settings-palette-preview {
    background: #2d1c0d;
    border-color: #b5732a;
}
body.dark-mode .settings-palette-name { color: #e8c99a; }
body.dark-mode .settings-palette-desc { color: #8a6d4e; }

/* Mode toggle (light/dark) */
.settings-mode-toggle {
    display: flex;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: hidden;
}
.settings-mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    background: var(--parchment);
    color: var(--text-mid);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.settings-mode-btn + .settings-mode-btn {
    border-left: 1px solid var(--border-light);
}
.settings-mode-btn.active {
    background: var(--navy);
    color: #fff;
}

/* Dark mode overrides for mode toggle UI */
body.dark-mode .settings-mode-toggle { border-color: #4d3518; }
body.dark-mode .settings-mode-btn { background: #2d1c0d; color: #c4a882; }
body.dark-mode .settings-mode-btn + .settings-mode-btn { border-color: #4d3518; }
body.dark-mode .settings-mode-btn.active { background: #b5732a; color: #f0e6d3; }

/* Dark mode overrides */
body.dark-mode .settings-panel {
    background: #1a0f07;
    border-color: #3d2910;
}
body.dark-mode .settings-header { background: #221508; border-color: #3d2910; }
body.dark-mode .settings-title { color: #e8c99a; }
body.dark-mode .settings-close { color: #c4a882; }
body.dark-mode .settings-close:hover { background: #2d1c0d; }
body.dark-mode .settings-section { background: #221508; border-color: #3d2910; }
body.dark-mode .settings-section-title { background: #150b03; color: #8a6d4e; border-color: #3d2910; }
body.dark-mode .settings-row { border-color: #3d2910; }
body.dark-mode .settings-label { color: #e8dfd0; }
body.dark-mode .settings-theme-btn { background: #2d1c0d; border-color: #4d3518; color: #e8dfd0; }
body.dark-mode .settings-theme-btn:hover { background: #3d2910; }
body.dark-mode .settings-theme-btn.active { background: #b5732a; color: #f0e6d3; border-color: #b5732a; }
body.dark-mode .settings-fs-btn { background: #2d1c0d; border-color: #4d3518; color: #e8dfd0; }
body.dark-mode .settings-fs-btn:hover { background: #3d2910; }
body.dark-mode .settings-fs-label { color: #c4a882; }
body.dark-mode .settings-font-select { background: #2d1c0d; border-color: #4d3518; color: #e8dfd0; }
body.dark-mode .settings-action-btn { background: #2d1c0d; border-color: #4d3518; color: #e8dfd0; }
body.dark-mode .settings-action-btn:hover { background: #3d2910; border-color: #b5732a; }
body.dark-mode .settings-drive-login-btn { background: #3b1f0e; color: #e8c99a; border-color: #7a4515; }
body.dark-mode .settings-drive-login-btn:hover { background: #4d2a10; }
body.dark-mode .settings-drive-logout-btn { background: #2e1a1a; color: #e07070; border-color: #5a2a2a; }
body.dark-mode .settings-drive-logout-btn:hover { background: #3a2020; }
body.dark-mode .settings-drive-status { color: #8a6d4e; }

/* Settings FAQ */
.settings-faq .faq-item {
    border-bottom: 1px solid var(--border-light);
    padding: 0;
}
.settings-faq .faq-item:last-child { border-bottom: none; }
.settings-faq .faq-question {
    display: block;
    padding: 10px 4px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--navy);
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.settings-faq .faq-question::-webkit-details-marker { display: none; }
.settings-faq .faq-question::before {
    content: '▸ ';
    color: var(--gold);
    font-size: 0.7rem;
}
details.faq-item[open] .faq-question::before { content: '▾ '; }
.settings-faq .faq-answer {
    padding: 0 4px 12px 14px;
    font-size: 0.78rem;
    color: var(--text-mid);
    line-height: 1.6;
}
.settings-faq .faq-answer p { margin: 0 0 6px; }
.settings-faq .faq-answer p:last-child { margin-bottom: 0; }
body.dark-mode .settings-faq .faq-item { border-color: #3d2910; }
body.dark-mode .settings-faq .faq-question { color: #e8c99a; }
body.dark-mode .settings-faq .faq-answer { color: #c4a882; }

/* Settings help/tour row */
.settings-help-row {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}
.settings-help-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    background: var(--parchment-dark);
    border: 1.5px solid var(--gold);
    border-radius: 8px;
    color: var(--navy);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.settings-help-btn:hover { background: var(--border-light); }
body.dark-mode .settings-help-row { border-color: #3d2910; }
body.dark-mode .settings-help-btn { background: #2d1c0d; border-color: #b5732a; color: #e8c99a; }
body.dark-mode .settings-help-btn:hover { background: #3d2910; }

/* Sidebar footer */
.sidebar-footer {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--border-light);
    background: #fff;
    flex-shrink: 0;
}
.sidebar-footer-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 6px;
    background: var(--parchment-dark);
    border: 1px solid var(--border-light);
    border-radius: 7px;
    color: var(--text-mid);
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.sidebar-footer-btn:hover { background: var(--border-light); color: var(--navy); }
body.dark-mode .sidebar-footer { background: #1a0e05; border-color: #3d2910; }
body.dark-mode .sidebar-footer-btn { background: #2d1c0d; border-color: #3d2910; color: #a08060; }
body.dark-mode .sidebar-footer-btn:hover { background: #3d2910; color: #e8c99a; }

/* Bible page font override */
.bible-font-override .page-text,
.bible-font-override .verse-text {
    font-family: var(--bible-font, inherit) !important;
}

/* ============ OFFLINE BANNER ============ */
.offline-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9000;
    background: #c0392b;
    color: #fff;
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    padding: 9px 16px;
    gap: 8px;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
}

/* ============================================================
   TUTORIAL TOUR
   ============================================================ */
.tour-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    z-index: 9000;
    pointer-events: all;
}
.tour-backdrop.active { display: block; }

/* Spotlight: a transparent "hole" punched through the backdrop */
.tour-spotlight {
    display: none;
    position: fixed;
    z-index: 9001;
    border-radius: 10px;
    box-shadow: 0 0 0 4px rgba(181,115,42,0.7), 0 0 0 9999px rgba(0,0,0,0.62);
    pointer-events: none;
    transition: top 0.35s cubic-bezier(0.4,0,0.2,1),
                left 0.35s cubic-bezier(0.4,0,0.2,1),
                width 0.35s cubic-bezier(0.4,0,0.2,1),
                height 0.35s cubic-bezier(0.4,0,0.2,1);
}
.tour-spotlight.active { display: block; }

/* Tour card */
.tour-card {
    display: none;
    position: fixed;
    z-index: 9002;
    background: var(--parchment, #faf7f0);
    border: 1.5px solid var(--gold, #b5732a);
    border-radius: 14px;
    padding: 20px 20px 16px;
    width: 300px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
    transition: top 0.35s cubic-bezier(0.4,0,0.2,1),
                left 0.35s cubic-bezier(0.4,0,0.2,1),
                opacity 0.2s;
}
.tour-card.active { display: block; }

/* Arrow pointer on the card */
.tour-card::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--parchment, #faf7f0);
    border-left: 1.5px solid var(--gold, #b5732a);
    border-top: 1.5px solid var(--gold, #b5732a);
    transform: rotate(45deg);
}
.tour-card.arrow-top::before    { top: -7px; left: var(--tour-arrow-left, 24px); }
.tour-card.arrow-bottom::before { bottom: -7px; left: var(--tour-arrow-left, 24px); transform: rotate(225deg); border-color: var(--gold, #b5732a); }
.tour-card.arrow-right::before  { top: 20px; right: -7px; transform: rotate(135deg); }
.tour-card.arrow-left::before   { top: 20px; left: -7px; transform: rotate(-45deg); border-left-color: transparent; border-top-color: transparent; border-right: 1.5px solid var(--gold,#b5732a); border-bottom: 1.5px solid var(--gold,#b5732a); }
.tour-card.arrow-none::before   { display: none; }

.tour-skip {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 0.72rem;
    color: var(--text-light, #9a7550);
    cursor: pointer;
    padding: 2px 4px;
    font-family: inherit;
    letter-spacing: 0.03em;
}
.tour-skip:hover { color: var(--text-dark, #1e1206); text-decoration: underline; }

.tour-icon {
    font-size: 1.8rem;
    line-height: 1;
    margin-bottom: 8px;
}
.tour-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--navy, #3b1f0e);
    margin-bottom: 6px;
    padding-right: 30px;
}
.tour-body {
    font-size: 0.82rem;
    color: var(--text-mid, #5c3d1e);
    line-height: 1.55;
    margin-bottom: 14px;
}
.tour-body strong { color: var(--navy, #3b1f0e); }

.tour-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tour-dots {
    display: flex;
    gap: 5px;
}
.tour-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border-light, #e2d4bb);
    transition: background 0.2s, transform 0.2s;
}
.tour-dot.active {
    background: var(--gold, #b5732a);
    transform: scale(1.25);
}
.tour-btns {
    display: flex;
    gap: 6px;
}
.tour-btn {
    padding: 5px 14px;
    border-radius: 7px;
    border: 1.5px solid var(--border-light, #e2d4bb);
    background: var(--parchment-dark, #f0e9d8);
    color: var(--navy, #3b1f0e);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.tour-btn:hover { background: var(--border-light, #e2d4bb); }
.tour-btn--prev { opacity: 0.6; }
.tour-btn--prev:disabled { opacity: 0.25; cursor: default; }
.tour-btn--next {
    background: var(--gold, #b5732a);
    border-color: var(--gold, #b5732a);
    color: #1e1206;
}
.tour-btn--next:hover { background: var(--gold-light, #d4a45a); border-color: var(--gold-light, #d4a45a); }

/* Dark mode */
body.dark-mode .tour-card {
    background: #221508;
    border-color: #b5732a;
}
body.dark-mode .tour-card::before { background: #221508; }
body.dark-mode .tour-title { color: #e8c99a; }
body.dark-mode .tour-body { color: #c4a882; }
body.dark-mode .tour-body strong { color: #e8dfd0; }
body.dark-mode .tour-skip { color: #8a6d4e; }
body.dark-mode .tour-skip:hover { color: #e8dfd0; }
body.dark-mode .tour-dot { background: #3d2910; }
body.dark-mode .tour-dot.active { background: #d4a45a; }
body.dark-mode .tour-btn { background: #2d1c0d; border-color: #4d3518; color: #e8dfd0; }
body.dark-mode .tour-btn:hover { background: #3d2910; }
body.dark-mode .tour-btn--next { background: #b5732a; border-color: #b5732a; color: #1e1206; }
body.dark-mode .tour-btn--next:hover { background: #d4a45a; border-color: #d4a45a; }

@media (max-width: 520px) {
    .tour-card {
        width: calc(100vw - 32px);
        left: 16px !important;
        right: 16px;
        box-sizing: border-box;
    }
}

/* ============ SYNC INFO BANNER ============ */
.sync-info-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    z-index: 19000;
    background: var(--navy);
    color: #fff;
    border-radius: 12px;
    padding: 12px 16px 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 420px;
    width: calc(100vw - 32px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.28);
    animation: syncBannerIn 0.35s cubic-bezier(.22,.68,0,1.2) both;
}
.sync-info-banner.hide {
    animation: syncBannerOut 0.3s ease forwards;
}
@keyframes syncBannerIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes syncBannerOut {
    to { opacity: 0; transform: translateX(-50%) translateY(16px); }
}
.sync-info-banner-icon {
    flex-shrink: 0;
    color: #7dd87a;
    margin-top: 1px;
}
.sync-info-banner-text {
    flex: 1;
    font-size: 0.83rem;
    line-height: 1.5;
    color: #e8e8e8;
}
.sync-info-banner-text strong { color: #fff; }
.sync-info-banner-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color 0.15s;
    margin-top: 1px;
}
.sync-info-banner-close:hover { color: #fff; }
body.dark-mode .sync-info-banner { background: #2d1c0d; box-shadow: 0 6px 24px rgba(0,0,0,0.5); }
body.dark-mode .sync-info-banner-text { color: #c4a882; }
body.dark-mode .sync-info-banner-text strong { color: #e8c99a; }

/* ============ RECONNECT BANNER ============ */
.reconnect-banner {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 10px 14px;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 32px);
    white-space: nowrap;
    animation: reconnect-slide-up 0.25s ease;
}
.reconnect-banner.open { display: flex; }
@keyframes reconnect-slide-up {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.reconnect-banner-text {
    font-size: 0.82rem;
    color: #5f6368;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reconnect-banner-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 0.15s, background 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.reconnect-banner-btn:hover { background: #f8f9fa; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.reconnect-banner-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.reconnect-banner-btn.loading { opacity: 0.7; pointer-events: none; }
.reconnect-banner-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    color: #9aa0a6;
    font-size: 0.9rem;
    padding: 2px 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.reconnect-banner-dismiss:hover { color: #5f6368; }
body.dark-mode .reconnect-banner {
    background: #2d1c0d;
    border-color: #4d3518;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
body.dark-mode .reconnect-banner-text { color: #c4a882; }
body.dark-mode .reconnect-banner-btn {
    background: #3d2510;
    color: #e8c99a;
    border-color: #6b4a20;
}
body.dark-mode .reconnect-banner-btn:hover { background: #4d2f14; }
body.dark-mode .reconnect-banner-dismiss { color: #7a5c3a; }
body.dark-mode .reconnect-banner-dismiss:hover { color: #c4a882; }

/* ============ LOGIN SCREEN ============ */
.login-screen {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--parchment);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 24px;
}
.login-screen.open { display: flex; }

body.dark-mode .login-screen { background: #140c04; }

.login-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 340px;
    width: 100%;
    text-align: center;
}
.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(26,39,68,0.18);
}
.login-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--navy);
    margin: 0;
    line-height: 1.1;
}
body.dark-mode .login-title { color: #e8c99a; }

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-mid);
    margin: 0;
    line-height: 1.5;
}
body.dark-mode .login-subtitle { color: #c4a882; }

.login-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 24px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 0.18s, background 0.18s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    margin-top: 8px;
    min-width: 220px;
    justify-content: center;
}
.login-btn:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.18); background: #f8f9fa; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.login-btn.loading { opacity: 0.7; pointer-events: none; }
body.dark-mode .login-btn { background: #2d1c0d; color: #e8c99a; border-color: #4d3518; }
body.dark-mode .login-btn:hover { background: #3d2510; }

.login-skip-btn {
    margin-top: 10px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px 8px;
}
.login-skip-btn:hover { color: var(--text-main); }
body.dark-mode .login-skip-btn { color: #a08060; }
body.dark-mode .login-skip-btn:hover { color: #e8c99a; }

.login-note {
    font-size: 0.75rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.5;
    max-width: 260px;
}
body.dark-mode .login-note { color: #9a7550; }

/* ============ PROFILE AVATAR (header) ============ */
.profile-avatar-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
/* Session-expired: pulse the border */
.profile-avatar-wrap.session-expired .profile-avatar {
    border-color: #ea4335;
    animation: avatar-pulse 2s ease-in-out infinite;
}
@keyframes avatar-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(234,67,53,0.5); }
    50%       { box-shadow: 0 0 0 4px rgba(234,67,53,0); }
}
/* Google badge bottom-right of avatar */
.profile-session-badge {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    z-index: 2;
    transition: transform 0.15s;
}
.profile-session-badge:hover { transform: scale(1.15); }
body.dark-mode .profile-session-badge { background: #2a1a0a; border-color: #5a3a1a; }

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--navy);
    overflow: hidden;
    cursor: pointer;
    background: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: opacity 0.15s, transform 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.profile-avatar:hover { opacity: 0.85; transform: scale(1.06); }
.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.profile-avatar-initials {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    user-select: none;
}
body.dark-mode .profile-avatar { border-color: #c8aa78; background: #c8aa78; }
body.dark-mode .profile-avatar-initials { color: #1a0e05; }

/* ============ STREAK BADGE ============ */
.streak-badge {
    display: none;
    align-items: center;
    gap: 2px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--navy);
    background: #fff3e0;
    border: 1.5px solid #e8a030;
    border-radius: 12px;
    padding: 2px 7px 2px 5px;
    line-height: 1;
    cursor: default;
    user-select: none;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.streak-badge.visible { display: flex; }
.streak-badge:hover { transform: scale(1.08); }
.streak-badge .streak-fire { font-size: 0.9rem; }
body.dark-mode .streak-badge { background: #2d1c0d; border-color: #c8820a; color: #f5c96a; }

/* ============ READING MODE BUTTON ============ */
.reading-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-light);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.reading-mode-btn:hover { background: var(--cream-dark); color: var(--navy); border-color: var(--navy); }
body.dark-mode .reading-mode-btn { border-color: #3d2910; color: #8a6d4e; }
body.dark-mode .reading-mode-btn:hover { background: #2d1c0d; color: #e8c99a; border-color: #c8820a; }

/* Reading mode button inside sticky controls bar */
.ctrl-reading-mode-btn {
    margin-left: auto; /* push to far right in controls-inner */
    padding: 8px 13px;
    border-color: var(--border-light);
}

/* ---- Compact Resume Strip (inside sticky chapter-controls) ---- */
.ctrl-resume-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px 2px;
    font-size: 0.8rem;
    color: var(--navy);
    border-top: 1px solid rgba(201,168,76,0.3);
    background: rgba(201,168,76,0.06);
    margin-top: 6px;
    border-radius: 0 0 4px 4px;
    animation: popoverIn 0.2s ease;
}
.ctrl-resume-icon { font-size: 0.95rem; flex-shrink: 0; }
.ctrl-resume-label {
    flex: 1;
    font-weight: 600;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--navy);
}
.ctrl-resume-play {
    flex-shrink: 0;
    background: var(--gold, #c9a84c);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 4px 11px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.ctrl-resume-play:hover { background: #b8952e; }
.ctrl-resume-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1;
    transition: background 0.15s;
}
.ctrl-resume-close:hover { background: rgba(0,0,0,0.07); color: var(--text-dark); }
body.dark-mode .ctrl-resume-strip {
    border-top-color: rgba(201,168,76,0.2);
    background: rgba(181,115,42,0.08);
    color: #e8dfd0;
}
body.dark-mode .ctrl-resume-label { color: #e8c99a; }
body.dark-mode .ctrl-resume-close:hover { background: rgba(255,255,255,0.08); }

/* ============ READING MODE OVERLAY ============ */
.rm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    /* Book-room background: dark walnut shelf colour */
    background: #2c1a0e;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.rm-overlay.active { display: flex; }
body.dark-mode .rm-overlay { background: #100800; }

.rm-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: rgba(30, 16, 6, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(180,140,80,0.2);
    flex-shrink: 0;
    gap: 10px;
    transition: opacity 0.4s;
}
.rm-topbar-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.rm-day-progress {
    font-size: 0.7rem;
    font-weight: 600;
    color: #8a6d30;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
body.dark-mode .rm-day-progress { color: #c8a040; }
.rm-overlay.rm-immersive .rm-topbar {
    opacity: 0;
    pointer-events: none;
}
.rm-overlay.rm-immersive:hover .rm-topbar,
.rm-overlay.rm-immersive .rm-topbar:hover {
    opacity: 1;
    pointer-events: auto;
}
body.dark-mode .rm-topbar { background: rgba(8,4,0,0.94); border-color: rgba(100,60,20,0.3); }

.rm-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e8c99a;
    letter-spacing: 0.04em;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.dark-mode .rm-title { color: #e8c99a; }

.rm-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Language toggle inside reading mode */
.rm-lang-toggle {
    display: flex;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    height: 30px;
    flex-shrink: 0;
}
.rm-lang-btn {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-light);
    font-size: 0.68rem;
    font-weight: 700;
    font-family: inherit;
    padding: 0 9px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    letter-spacing: 0.5px;
    line-height: 30px;
}
.rm-lang-btn:last-child { border-right: none; }
.rm-lang-btn:hover { background: var(--cream-dark); color: var(--navy); }
.rm-lang-btn--active {
    background: var(--navy);
    color: #fff;
}
.rm-lang-btn--active:hover { background: var(--navy); color: #fff; }

body.dark-mode .rm-lang-toggle { border-color: #3d2910; }
body.dark-mode .rm-lang-btn { border-color: #3d2910; color: #8a6d4e; }
body.dark-mode .rm-lang-btn:hover { background: #2d1c0d; color: #e8c99a; }
body.dark-mode .rm-lang-btn--active { background: #c8820a; color: #1a0e05; }
body.dark-mode .rm-lang-btn--active:hover { background: #c8820a; color: #1a0e05; }

/* ---- Font size controls inside reading mode ---- */
.rm-font-ctrl {
    display: flex;
    border: 1.5px solid rgba(180,140,80,0.35);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}
.rm-font-btn {
    background: transparent;
    border: none;
    border-right: 1px solid rgba(180,140,80,0.3);
    color: #c9a84c;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: Georgia, serif;
    padding: 0 10px;
    height: 30px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1;
}
.rm-font-btn:last-child { border-right: none; }
.rm-font-btn:hover { background: rgba(201,168,76,0.15); color: #e8c99a; }
body.dark-mode .rm-font-ctrl { border-color: rgba(180,140,80,0.2); }
body.dark-mode .rm-font-btn { border-color: rgba(180,140,80,0.2); }

.rm-action-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1.5px solid rgba(180,140,80,0.35);
    background: transparent;
    color: #c9a84c;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.rm-action-btn:hover { background: rgba(201,168,76,0.12); color: #e8c99a; }
.rm-exit-btn { border-color: rgba(200,60,60,0.5); color: #e07070; }
.rm-exit-btn:hover { background: rgba(200,60,60,0.18); color: #ff9090; }
body.dark-mode .rm-action-btn { border-color: rgba(180,140,80,0.25); color: #c9a84c; }
body.dark-mode .rm-action-btn:hover { background: rgba(201,168,76,0.1); color: #e8c99a; }
body.dark-mode .rm-exit-btn { border-color: rgba(200,60,60,0.4); color: #e07070; }
body.dark-mode .rm-exit-btn:hover { background: rgba(200,60,60,0.15); color: #ff9090; }

/* ----
   Reading mode: single column, scrollable on all screen sizes.
   ---- */
.rm-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    background: #1a0f07;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    min-height: 0;
}

/* Book page card — full width, natural height, scrolls with body */
.rm-text {
    width: 100%;
    max-width: 720px;
    height: auto;
    min-height: 100%;
    align-self: auto;
    /* parchment paper */
    background: #faf6ee;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    position: relative;
}
/* Single column container */
.rm-text-inner {
    width: 100%;
    height: auto;
    min-height: 100%;
    padding: 32px 28px 60px;
    box-sizing: border-box;
    font-size: 1rem;
    line-height: 1.55;
    color: #1a1208;
    font-family: 'EB Garamond', 'Lora', Georgia, serif;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    column-count: 1;
    transition: none;
}
/* No binding shadow in single column */
.rm-text::before { display: none; }
body.dark-mode .rm-text {
    background: #1c1006;
}
body.dark-mode .rm-text-inner {
    color: #d4c4a8;
}

/* Each verse is its own block — tight internal line-height, clear gap between verses */
.rm-text .verse-block {
    display: block;
    line-height: 1.55;
    margin-bottom: 0.45em;
}
.rm-text .verse-block::after {
    content: none;
}
.rm-text .verse-num {
    font-size: 0.58em;
    vertical-align: super;
    color: #a08040;
    font-weight: 700;
    margin-right: 3px;
    user-select: none;
    font-family: Georgia, serif;
}
body.dark-mode .rm-text .verse-num { color: #8a6d4e; }
.rm-text .verse-sq { color: #2e1c08; }
body.dark-mode .rm-text .verse-sq { color: #c4a882; }
.rm-text .verse-en { color: #1a1208; }
body.dark-mode .rm-text .verse-en { color: #d4c4a8; }
.rm-text .verse-en-only { color: #1a1208; }
body.dark-mode .rm-text .verse-en-only { color: #d4c4a8; }

.rm-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(30, 16, 6, 0.92);
    border-top: 1px solid rgba(180,140,80,0.2);
    flex-shrink: 0;
    gap: 12px;
}
body.dark-mode .rm-nav { background: rgba(8,4,0,0.94); border-color: rgba(100,60,20,0.3); }

.rm-nav-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1.5px solid rgba(180,140,80,0.35);
    background: transparent;
    color: #c9a84c;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    min-width: 90px;
}
.rm-nav-btn:hover { background: rgba(201,168,76,0.12); border-color: #c9a84c; color: #e8c99a; }
.rm-nav-btn:disabled { opacity: 0.3; cursor: default; }
body.dark-mode .rm-nav-btn { border-color: rgba(180,140,80,0.25); color: #c9a84c; }
body.dark-mode .rm-nav-btn:hover { background: rgba(201,168,76,0.1); border-color: #c8820a; }

.rm-nav-ref {
    font-size: 0.82rem;
    color: rgba(201,168,76,0.7);
    font-weight: 600;
    text-align: center;
    flex: 1;
    letter-spacing: 0.03em;
}
body.dark-mode .rm-nav-ref { color: rgba(201,168,76,0.6); }

/* Mobile: tighter padding, slightly larger font */
@media (max-width: 768px) {
    .rm-text {
        max-width: 100%;
    }
    .rm-text-inner {
        padding: 24px 20px 40px;
        font-size: 1.05rem;
        line-height: 1.85;
    }
    body.dark-mode .rm-text {
        background: #130c04;
    }
}

/* ============ READING MODE — CHAPTER PROGRESS + COMPLETE DAY ============ */
.rm-chapter-progress {
    height: 4px;
    background: rgba(180,140,80,0.15);
    flex-shrink: 0;
}
.rm-chapter-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #b5732a 0%, #e8a030 100%);
    width: 0%;
    transition: width 0.4s ease;
}
body.dark-mode .rm-chapter-progress { background: rgba(100,60,20,0.3); }

/* Calligraphic book title — spans all columns at the very top of each desktop page.
   Rendered once per page render, before the first chapter's verses. */
/* Book name — top-left corner of the page card, like a printed book running head */
.rm-page-book-title {
    position: absolute;
    top: 1.1vh;
    left: 3.5vw;
    font-family: 'EB Garamond', 'Lora', Georgia, serif;
    font-size: 0.78rem;
    font-weight: 400;
    font-style: italic;
    color: #8a7230;
    letter-spacing: 0.08em;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    z-index: 2;
}
body.dark-mode .rm-page-book-title { color: #a08838; }
/* Hide on mobile — book name already in the topbar title */
@media (max-width: 768px) {
    .rm-page-book-title { display: none; }
}

/* Chapter drop-numeral — floats at the start of verse 1, like a printed Bible */
.rm-chapter-drop {
    float: left;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 3.6em;
    font-weight: 700;
    color: #8a7230;
    line-height: 0.82;
    margin: 0.08em 0.12em 0 0;
    padding: 0;
}
body.dark-mode .rm-chapter-drop { color: #c8a040; }
.rm-chapter-num {
    display: inline-block;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 2em;
    font-weight: 700;
    color: #8a7230;
    line-height: 1;
    vertical-align: middle;
    margin: 0 0.25em 0 0.1em;
    position: relative;
    top: -0.05em;
}
.rm-chapter-name {
    display: inline;
    font-size: 0.68em;
    font-weight: 700;
    color: #a08040;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-right: 0.4em;
}
body.dark-mode .rm-chapter-num  { color: #c8a040; }
body.dark-mode .rm-chapter-name { color: #9a7a38; }

/* clear float after first verse block */
.rm-text .verse-block:first-child::after {
    content: '';
    display: table;
    clear: both;
}

.rm-complete-day-wrap {
    justify-content: center;
    padding: 32px 24px 16px;
}
.rm-complete-day-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #5a7e30 0%, #7b9e4a 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(90,126,48,0.3);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
}
.rm-complete-day-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(90,126,48,0.4); }
.rm-complete-day-btn:active { transform: translateY(0); }
body.dark-mode .rm-complete-day-btn { background: linear-gradient(135deg, #3d5e20 0%, #5a7e30 100%); box-shadow: 0 4px 16px rgba(0,0,0,0.4); }

/* Last-read verse bookmark marker inside reading mode */
#rmText .verse-block.rm-last-read {
    border-left: 3px solid var(--gold, #b5732a);
    padding-left: 8px;
    margin-left: -11px;
    background: rgba(181,115,42,0.08);
    border-radius: 0 4px 4px 0;
    transition: background 0.3s;
}
body.dark-mode #rmText .verse-block.rm-last-read {
    background: rgba(181,115,42,0.14);
}

/* Continue reading banner on main page */
.rm-resume-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--parchment, #fdf6e3);
    border: 1.5px solid var(--gold, #b5732a);
    border-radius: 10px;
    padding: 10px 14px;
    margin: 0 0 14px 0;
    font-size: 0.85rem;
    color: var(--text-dark);
    animation: popoverIn 0.2s ease;
}
.rm-resume-icon { font-size: 1.1rem; flex-shrink: 0; }
.rm-resume-label { flex: 1; font-weight: 500; min-width: 0; }
.rm-resume-btn {
    flex-shrink: 0;
    background: var(--gold, #b5732a);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 13px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.rm-resume-btn:hover { background: #9a5e1f; }
.rm-resume-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: background 0.15s;
}
.rm-resume-close:hover { background: rgba(0,0,0,0.07); color: var(--text-dark); }
body.dark-mode .rm-resume-banner {
    background: #2d1c0d;
    border-color: var(--gold);
    color: #e8dfd0;
}
body.dark-mode .rm-resume-close:hover { background: rgba(255,255,255,0.08); }

/* Next button pulse animation when near bottom of page */
@keyframes rm-pulse-border {
    0%   { box-shadow: 0 0 0 0 rgba(181,115,42,0.5); }
    70%  { box-shadow: 0 0 0 6px rgba(181,115,42,0); }
    100% { box-shadow: 0 0 0 0 rgba(181,115,42,0); }
}
.rm-nav-btn.rm-next-pulse {
    border-color: #b5732a;
    color: #b5732a;
    animation: rm-pulse-border 1.2s infinite;
}
body.dark-mode .rm-nav-btn.rm-next-pulse { border-color: #e8a030; color: #e8a030; }

/* Reading plan read button */
.rp-td-readbtn { width: 36px; text-align: center; white-space: nowrap; }
/* when today's label is visible the cell expands naturally */
.rp-td-readbtn:has(.rp-read-btn--today) { width: auto; }

.rp-read-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-light);
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.rp-read-btn:hover {
    background: var(--cream-dark);
    color: var(--navy);
    border-color: var(--navy);
}
/* today's undone row — amber pill with label */
.rp-read-btn--today {
    border-color: #b5732a;
    color: #8a5010;
    background: rgba(181,115,42,0.08);
    font-weight: 600;
}
.rp-read-btn--today:hover {
    background: #b5732a;
    border-color: #b5732a;
    color: #fff;
}
.rp-read-label { letter-spacing: 0.01em; }

body.dark-mode .rp-read-btn { border-color: #4d3518; color: #8a6d4e; }
body.dark-mode .rp-read-btn:hover { background: #2d1c0d; color: #e8c99a; border-color: #8a6d4e; }
body.dark-mode .rp-read-btn--today { border-color: #c8820a; color: #e8a030; background: rgba(200,130,10,0.1); }
body.dark-mode .rp-read-btn--today:hover { background: #b5732a; border-color: #b5732a; color: #fff; }
tr.rp-done .rp-read-btn { opacity: 0.4; }

/* ============ READING PLAN PROGRESS BAR ============ */
.rp-progress-wrap {
    background: #fff;
    border-radius: 10px;
    padding: 14px 18px;
    margin: 0 0 18px 0;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.rp-progress-bar-bg {
    height: 8px;
    border-radius: 4px;
    background: rgba(0,0,0,0.08);
    overflow: hidden;
}
body.dark-mode .rp-progress-bar-bg { background: rgba(255,255,255,0.1); }
.rp-progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #7b9e4a 0%, #5a7e30 100%);
    width: 0%;
    transition: width 0.5s ease;
}
.rp-progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-light);
}
body.dark-mode .rp-progress-stats { color: #7a6a5a; }
.rp-progress-pct { font-weight: 700; color: #5a7e30; font-size: 0.8rem; }
body.dark-mode .rp-progress-pct { color: #8bb85a; }
.rp-daily-goal {
    font-weight: 700;
    color: #5a7e30;
    font-size: 0.75rem;
}
.rp-daily-goal.goal-done { color: #2d7a2d; }
.rp-daily-goal.goal-done::before { content: '✓ '; }
body.dark-mode .rp-daily-goal { color: #8bb85a; }
body.dark-mode .rp-daily-goal.goal-done { color: #6abf6a; }
body.dark-mode .rp-progress-wrap {
    background: #221508;
    box-shadow: 0 1px 6px rgba(0,0,0,0.4);
}

/* ============ ACHIEVEMENT TOAST ============ */
.achievement-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 9999;
    background: #fff;
    border: 2px solid #e8a030;
    border-radius: 14px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s, transform 0.35s;
    min-width: 240px;
    max-width: 360px;
}
.achievement-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}
body.dark-mode .achievement-toast { background: #1a0e05; border-color: #c8820a; box-shadow: 0 8px 32px rgba(0,0,0,0.5); }

.achievement-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}
.achievement-body { flex: 1; }
.achievement-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 2px;
}
.achievement-desc {
    font-size: 0.75rem;
    color: var(--text-light);
    line-height: 1.4;
}
body.dark-mode .achievement-title { color: #e8c99a; }
body.dark-mode .achievement-desc { color: #8a6d4e; }

/* ============================================================
   BIBLICAL PLACE LINKS
   ============================================================ */
.place-link {
    color: var(--gold, #b5732a);
    border-bottom: 1px dotted rgba(181, 115, 42, 0.6);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    border-radius: 2px;
    padding: 0 1px;
}
.place-link:hover,
.place-link:focus {
    color: var(--navy, #1a2744);
    border-bottom-color: var(--navy, #1a2744);
    background: rgba(181, 115, 42, 0.08);
    outline: none;
}
body.dark-mode .place-link {
    color: #d4a45a;
    border-bottom-color: rgba(212, 164, 90, 0.45);
}
body.dark-mode .place-link:hover,
body.dark-mode .place-link:focus {
    color: #f0d89a;
    border-bottom-color: rgba(240, 216, 154, 0.7);
    background: rgba(212, 164, 90, 0.12);
}

/* ============================================================
   PLACE MAP MODAL
   ============================================================ */
.place-map-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9100;
    display: none;
    backdrop-filter: blur(2px);
}
.place-map-overlay.active { display: block; }

.place-map-modal {
    position: fixed;
    z-index: 9200;
    background: var(--parchment, #f5f0e8);
    border: 1px solid var(--border-light, rgba(0,0,0,0.12));
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.15);
    width: min(520px, 94vw);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: popoverIn 0.18s ease;
}
.place-map-modal.active { display: flex; }

.place-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    background: linear-gradient(135deg, #1a2744 0%, #2a3f6f 100%);
    flex-shrink: 0;
}
.place-map-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #e8d48b;
    letter-spacing: 0.02em;
}
.place-map-close {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.65);
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.place-map-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
}

.place-map-container {
    width: 100%;
    height: 340px;
    flex-shrink: 0;
}
@media (max-height: 600px) {
    .place-map-container { height: 200px; }
}
@media (max-width: 480px) {
    .place-map-container { height: 260px; }
}

.place-map-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border-light, rgba(0,0,0,0.1));
    font-size: 0.72rem;
    color: var(--text-light, #7a6a5a);
    font-style: italic;
    flex-shrink: 0;
}
.place-map-footer a {
    color: var(--gold, #b5732a);
    text-decoration: none;
}
.place-map-footer a:hover { text-decoration: underline; }

/* Dark mode */
body.dark-mode .place-map-modal {
    background: #1a110a;
    border-color: #3d2910;
}
body.dark-mode .place-map-footer {
    border-top-color: #3d2910;
    color: #7a6a5a;
}

/* Leaflet popup tweak inside our modal */
.place-map-container .leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.place-map-container .leaflet-popup-content {
    font-family: 'Lora', Georgia, serif;
    font-size: 0.9rem;
    color: #1a2744;
    margin: 8px 12px;
}

/* ============================================================
   iOS / Mobile — prevent auto-zoom on input focus
   iOS Safari zooms the viewport whenever an <input> or <select>
   has font-size < 16px. Override ALL interactive fields to 16px
   so the navbar never jumps up on tap.
   ============================================================ */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}
