/* ── Library Modal ─────────────────────────────────────────── */

.library-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10200;
    display: none;
    align-items: center;
    justify-content: center;
}
.library-backdrop.visible { display: flex; }

.library-modal {
    width: 95vw;
    max-width: 62rem;   /* hug the reading column — whitespace lives outside the shell */
    height: 92vh;
    background: var(--background, #FAF9F6);
    /* corners: .modal-shell (css/modal-header.css) */
    box-shadow: 0 25px 50px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header bar: the one header bar (css/modal-header.css) — nothing of its own. */

/* ── Body ────────────────────────────────────────────────── */

.library-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Nav Rail (mirrors main Bible nav) ───────────────────── */

.library-nav-rail {
    width: var(--nav-rail-width, 110px);
    min-width: var(--nav-rail-width, 110px);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border, #e2e8f0);
    background: var(--background, #FAF9F6);
    overflow-y: auto;
    padding: 0.25rem 0;
}

/* The library rail speaks the shell's language (2026-09-01):
   quiet ghost buttons, sentence-case labels, purple active pill. */
.library-nav-rail .icon-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    padding: 0.5rem 0.25rem 0.45rem;
    margin: 1px 6px;
    width: calc(100% - 12px);
    border: none;
    border-radius: 9px;
    background: none;
    color: var(--text-secondary, #6B5D54);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
}
.library-nav-rail .icon-nav-btn:hover {
    background: rgba(var(--primary-rgb, 91, 75, 138), 0.09);
    color: var(--text-primary, #2C2416);
}
.library-nav-rail .icon-nav-btn.active {
    background: var(--primary, #5B4B8A);
    color: #fff;
}
.library-nav-rail .icon-nav-btn svg { width: 19px; height: 19px; }
.library-nav-rail .icon-nav-divider {
    width: 60%;
    height: 1px;
    background: var(--border, #e2e8f0);
    margin: 4px auto;
}

/* ── Content Area ────────────────────────────────────────── */

.library-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface, #fff);
}

/* Book-like chrome (owner-ruled 2026-09-09): the bar OVERLAYS the page,
   hidden off-canvas behind its own chevron tab. One transform moves it —
   the reading area never resizes, so pages never recalculate. */
.library-content-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 1rem;
    border-bottom: 1px solid var(--border, #e2e8f0);
    gap: 0.5rem;
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 30;
    background: var(--surface, #fff);
    transform: translateY(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 10px 26px rgba(44, 36, 22, 0.12);
    --lib-progress: 0%;
}
.library-content-nav.lcn-open { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .library-content-nav { transition: none; } }
.library-content { position: relative; }
/* the peeking tab: a child protruding below the bar, so the same
   transform that hides the bar leaves the tab at the page's top edge */
.library-nav-tab {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 58px;
    height: 19px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-top: none;
    border-radius: 0 0 10px 10px;
    color: var(--text-secondary, #6B5D54);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(44, 36, 22, 0.08);
}
.library-nav-tab svg { width: 14px; height: 14px; transition: transform 0.22s ease; }
.library-content-nav.lcn-open .library-nav-tab svg { transform: rotate(180deg); }

/* Gold progress thread — how far through the work you are */
.library-content-nav::after {
    content: '';
    position: absolute;
    left: 0; bottom: -1px;
    height: 2px;
    width: var(--lib-progress);
    background: var(--gold-text, #8a6d2f);
    transition: width 0.3s ease;
}

/* Ghost chevrons + unboxed serif reference — the Bible top bar's grammar */
.library-nav-btn {
    padding: 0.15rem 0.6rem;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--text-secondary, #6B5D54);
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
}
.library-nav-btn:hover { background: rgba(var(--primary-rgb, 91, 75, 138), 0.09); color: var(--text-primary); }
.library-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
/* The mode toggle reads literally: [page] / [scroll]. The active side
   stands in purple; the resting side waits, muted. Display only —
   pressing it is the same toggle as ever (owner-ruled 2026-09-09). */
.library-mode-btn { display: inline-flex; align-items: center; gap: 2px; }
.library-mode-btn svg { width: 15px; height: 15px; opacity: 0.4; transition: opacity 0.15s, color 0.15s; }
.library-mode-btn .lmb-sep {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1rem;
    color: var(--text-secondary, #6B5D54);
    line-height: 1;
}
.library-mode-btn.lm-paged .lmb-page,
.library-mode-btn.lm-scroll .lmb-scroll {
    opacity: 1;
    color: var(--primary, #5B4B8A);
}

.library-ref-display {
    display: inline-flex;
    align-items: baseline;
    padding: 0.3rem 0.45rem;
    border: none;
    border-radius: 8px;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.05rem;
}
#libraryRefWork { font-weight: 700; }
#libraryRefChapter { color: var(--gold-text, #8a6d2f); }
.library-ref-segment {
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}
.library-ref-segment:hover {
    color: var(--primary, #5B4B8A);
    background: rgba(91, 75, 138, 0.07);
}
.library-ref-dot {
    color: var(--text-secondary);
    padding: 0 0.15rem;
    font-size: 0.8rem;
}

/* ── Reading Area (paragraph cards go here) ──────────────── */

.library-reading-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.9rem 1.25rem 2rem;
}

/* Book-comfortable measure: every reading child sits in a centered
   column (~72 characters). Whitespace frames the text — no chrome. */
.library-reading-area > * {
    max-width: 44rem;
    margin-left: auto;
    margin-right: auto;
}

/* Reading Room chapter head (2026-09-01): small-caps eyebrow + serif title */
.library-chapter-head {
    text-align: center;
    margin: 0.5rem auto 1.75rem;
}
.lch-no {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold-text, #8a6d2f);
    font-weight: 700;
    margin-bottom: 0.4rem;
}
.library-chapter-title {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.55rem;
    line-height: 1.25;
    text-align: center;
    margin: 0;
    color: var(--text-primary, #2C2416);
}

/* Drop cap opens the chapter — the old books did it; so do we */
.library-dropcap::first-letter {
    initial-letter: 3;
    -webkit-initial-letter: 3;
    color: var(--primary, #5B4B8A);
    font-weight: 600;
    padding-right: 0.45rem;
}
@supports not (initial-letter: 3) {
    .library-dropcap::first-letter {
        float: left;
        font-size: 3.1em;
        line-height: 0.85;
        padding: 0.04em 0.12em 0 0;
        font-family: 'Crimson Text', Georgia, serif;
    }
}

/* ── Sidebar (opens from nav rail buttons) ───────────────── */

.library-sidebar {
    width: 0;
    overflow: hidden;
    border-left: none;
    background: var(--surface, #fff);
    transition: width 0.25s ease;
}
.library-sidebar.open {
    width: 380px;
    border-left: 1px solid var(--border, #e2e8f0);
    overflow-y: auto;
}

/* ── Chapter Picker Button (title-driven) ────── */

.lp-chapter-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 0.5rem 0.6rem;
    min-height: 52px;
}
.lp-ch-title {
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.lp-chapter-btn.current .lp-ch-title {
    color: rgba(255,255,255,0.9);
}

/* ── Paragraph Card ──────────────────────────────────────── */

.library-paragraph-card {
    display: flex;
    gap: 0.5rem;
    padding: 0.65rem 0;
}

.library-para-num {
    min-width: 28px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary, #6B5D54);
    text-align: right;
    padding-top: 0.3rem;
    user-select: none;
}

.library-para-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.library-para-content {
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--text-primary, #2C2416);
}

/* Clean page law: actions collapsed at rest; tap the paragraph (or hover
   on desktop) and the row slides in — the reveal grammar the Bible taught.
   Tap-reveal is also the mobile fix: touch had no :hover to lean on. */
.library-para-actions {
    display: flex;
    gap: 0.3rem;
    justify-content: flex-end;
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    transition: opacity 0.15s, max-height 0.18s ease, margin-top 0.18s ease;
}

.library-paragraph-card:hover .library-para-actions,
.library-paragraph-card.lp-open .library-para-actions {
    opacity: 1;
    max-height: 44px;
    margin-top: 0.35rem;
}

.library-paragraph-card.lp-open .library-para-content {
    background: rgba(var(--primary-rgb, 91, 75, 138), 0.06);
    border-radius: 6px;
    box-decoration-break: clone;
}

/* ── Empty State ─────────────────────────────────────────── */

.library-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}
.library-empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.library-empty-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-primary); }
.library-empty-text { font-size: 0.85rem; max-width: 300px; line-height: 1.5; }

/* ── Mobile ──────────────────────────────────────────────── */

@media (max-width: 768px) {
    .library-modal { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }

    /* Body stacks: content on top, nav at bottom */
    .library-body { flex-direction: column; }

    /* Nav rail → horizontal bottom bar */
    .library-nav-rail {
        width: 100%;
        min-width: unset;
        flex-direction: row;
        border-left: none;
        border-top: 1px solid var(--border, #e2e8f0);
        order: 2;
        flex-shrink: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 0;
    }
    /* Labeled tabs, like the app's mobile bar — no mystery icons */
    .library-nav-rail {
        justify-content: space-around;
    }
    .library-nav-rail .icon-nav-btn {
        min-width: 52px;
        min-height: 44px;
        padding: 0.35rem 0.5rem;
        margin: 2px;
        width: auto;
    }
    .library-nav-rail .icon-nav-divider {
        width: 1px;
        height: 60%;
        align-self: center;
        margin: 0 2px;
    }

    /* Content area fills above bottom bar */
    .library-content { order: 1; flex: 1; min-height: 0; }

    /* Compact top nav — single line, tappable */
    .library-content-nav {
        padding: 0.3rem 0.5rem;
        gap: 0.3rem;
    }
    /* the overlay bar on small screens: breadcrumb reads first, full
       width, wrapping freely; the ‹ mode › controls sit centered under it */
    .library-content-nav { flex-wrap: wrap; row-gap: 0.1rem; }
    .library-ref-display { order: 1; flex-basis: 100%; flex-wrap: wrap; justify-content: center; }
    .library-prev-btn { order: 2; }
    .library-mode-btn { order: 3; }
    .library-next-btn { order: 4; }

    .library-reading-area { padding: 0.75rem; }

    /* Sidebar → fixed slide-over with backdrop */
    .library-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        height: 100dvh;
        z-index: 10250;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        background: var(--background, #FAF9F6);
    }
    .library-sidebar.open {
        width: 85vw;
        max-width: 400px;
        transform: translateX(0);
        box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    }

    /* Backdrop behind sidebar */
    .library-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 10249;
    }
    .library-sidebar-backdrop.visible { display: block; }
}

/* ─── Library Tag Refs (sidebar tag panel) ─── */
.tag-library-ref {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--text-primary);
    transition: background 0.12s;
}
.tag-library-ref:hover {
    background: var(--highlight);
    color: var(--primary);
}
.tag-library-unassign {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    opacity: 0;
    padding: 0 2px;
    line-height: 1;
    margin-left: auto;
    flex-shrink: 0;
}
.tag-library-ref:hover .tag-library-unassign {
    opacity: 1;
}
.tag-library-unassign:hover {
    color: var(--danger);
}

/* Tag dots — mirrors .commentary-tag-dots / .commentary-tag-dot */
.library-tag-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}
.library-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Send-to-Study button flash feedback */
.library-para-send-study.library-feedback-flash {
    background: var(--success) !important;
    color: #fff !important;
    border-color: var(--success) !important;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

/* ── The Stacks — browse front (mock-approved 2026-09-01) ───────────── */
.library-reading-area > .lib-browse { max-width: 56rem; }
.lib-browse-head {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    margin-bottom: 1rem;
}
.lib-browse-search {
    flex: 1; min-width: 220px; max-width: 420px;
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--background, #FAF9F6);
    border: 1px solid var(--border, #E5E1DB);
    border-radius: 9px;
    padding: 0.45rem 0.75rem;
}
.lib-browse-search svg { width: 14px; height: 14px; color: var(--text-secondary); flex-shrink: 0; }
.lib-browse-search input {
    border: none; outline: none; background: none;
    font-size: 0.86rem; color: var(--text-primary); width: 100%; font-family: inherit;
}
.lib-browse-tabs { display: flex; gap: 0.2rem; }
.lib-browse-tab {
    border: none; background: none; cursor: pointer; font-family: inherit;
    font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
    padding: 0.45rem 0.9rem;
    border-bottom: 2px solid transparent;
}
.lib-browse-tab:hover { color: var(--text-primary); }
.lib-browse-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.lib-shelf-label {
    font-size: 0.7rem; letter-spacing: 0.18em; text-transform: uppercase;
    color: var(--gold-text, #8a6d2f); font-weight: 700;
    margin: 0.4rem 0 0.6rem;
}
.lib-continue {
    display: flex; gap: 0.75rem; align-items: center;
    width: 100%; text-align: left;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #E5E1DB);
    border-radius: 12px;
    padding: 0.7rem 0.85rem;
    margin-bottom: 1.2rem;
    cursor: pointer; font-family: inherit;
    transition: border-color 0.13s, transform 0.13s;
}
.lib-continue:hover { border-color: var(--primary); transform: translateY(-1px); }
.lib-continue-spine {
    width: 34px; height: 52px; border-radius: 3px 6px 6px 3px; flex-shrink: 0;
    box-shadow: inset 3px 0 0 rgba(255,255,255,0.18), 0 2px 6px rgba(0,0,0,0.25);
}
.lib-continue-info { flex: 1; min-width: 0; }
.lib-continue-info b { display: block; font-family: 'Crimson Text', Georgia, serif; font-size: 0.95rem; color: var(--text-primary); }
.lib-continue-info i { display: block; font-style: normal; font-size: 0.74rem; color: var(--text-secondary); margin-top: 0.15rem; }
.lib-continue-bar { display: block; height: 3px; border-radius: 99px; background: var(--border); margin-top: 0.45rem; overflow: hidden; }
.lib-continue-bar span { display: block; height: 100%; background: var(--gold-text, #8a6d2f); }

.lib-shelf {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #E5E1DB);
    border-radius: 12px;
    padding: 0.9rem 1rem 0;
    margin-bottom: 1rem;
    overflow: hidden;
}
.lib-shelf-head { display: flex; align-items: baseline; gap: 0.7rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.lib-shelf-head b { font-family: 'Crimson Text', Georgia, serif; font-size: 1.02rem; color: var(--text-primary); }
.lib-shelf-head span { font-size: 0.72rem; color: var(--text-secondary); }
.lib-shelf-books {
    display: flex; align-items: flex-end; gap: 3px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.lib-spine {
    flex: 0 0 auto;
    width: 42px;
    border: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 4px 0 0 rgba(255,255,255,0.14), inset -2px 0 0 rgba(0,0,0,0.2);
    transition: transform 0.15s ease, filter 0.15s;
    padding: 0;
}
.lib-spine:hover { transform: translateY(-6px); filter: brightness(1.12); z-index: 2; }
.lib-spine i {
    writing-mode: vertical-rl;
    font-style: normal;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: rgba(255, 250, 240, 0.92);
    max-height: calc(100% - 16px);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    pointer-events: none;
}
.lib-spine-soon { opacity: 0.35; cursor: default; }
.lib-spine-soon:hover { transform: none; filter: none; }
.lib-shelf-plank { height: 10px; background: linear-gradient(var(--border, #E5E1DB), transparent); margin: 0 -1rem; }
.lib-stacks-note { text-align: center; font-size: 0.74rem; color: var(--text-secondary); padding: 0.4rem 0 1rem; }

.lib-author-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 0.7rem;
}
.lib-author-card {
    display: flex; gap: 0.75rem; align-items: center; text-align: left;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #E5E1DB);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    cursor: pointer; font-family: inherit;
    transition: border-color 0.13s;
}
.lib-author-card:hover { border-color: var(--primary); }
.lib-author-medallion {
    width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Crimson Text', Georgia, serif;
    font-weight: 700; font-size: 1.05rem;
    color: #fdf9ee;
}
.lib-author-info b { display: block; font-family: 'Crimson Text', Georgia, serif; font-size: 0.94rem; color: var(--text-primary); }
.lib-author-info i { display: block; font-style: normal; font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.12rem; }

@media (max-width: 768px) {
    .lib-author-grid { grid-template-columns: 1fr 1fr; }
    .lib-spine { width: 38px; }
}

/* ── The Page-Turn Library (mock-approved 2026-09-09) ─────────────────
   Paged reading: the chapter flows into CSS columns; LibraryPager turns
   them one page at a time. Nothing scrolls. */
.library-reading-area.library-paged {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
/* the centered 44rem measure is a scroll-mode law; a page owns its width */
.library-paged > * { max-width: none; margin-left: 0; margin-right: 0; }
.lib-page-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
    min-height: 0;
}
.lib-page-track {
    box-sizing: border-box;
    column-fill: auto;
    padding: 1.7rem 26px 0.5rem;
    transition: transform 0.28s ease;
}
@media (prefers-reduced-motion: reduce) { .lib-page-track { transition: none; } }
.lib-page-foot {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 16px 9px;
    border-top: 1px solid var(--border, #e2e8f0);
}
.lib-page-rail {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--border, #e2e8f0);
    overflow: hidden;
}
.lib-page-rail > span {
    display: block;
    height: 100%;
    background: var(--gold, #D4A017);
    border-radius: 2px;
}
.lib-page-no {
    font-size: 0.72rem;
    color: var(--text-secondary, #6B5D54);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
/* THE PAGE LAW: a page never reflows, and a card can FRAGMENT across page
   columns — absolute children of a fragmented box anchor unreliably, so
   the revealed pill is hosted by the TRACK (which never fragments) and
   placed at the tap by LibraryModal._revealPagedTools. In-card display —
   hover included — stays dark in pages: click is the one reveal. */
.library-paged .library-para-actions,
.library-paged .library-paragraph-card:hover .library-para-actions {
    display: none;
    opacity: 1;
    max-height: none;
    margin: 0;
    transition: none;
}
.library-paged .lib-page-track > .library-para-actions {
    position: absolute;
    z-index: 6;
    display: flex;
    overflow: visible;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(44, 36, 22, 0.16);
    padding: 4px 6px;
}

/* ------------------------------------------------- FEAT-034 Library Search
   Rail Search panel: input + scope toggle + coverage-ranked results.
   Books that DWELL on the topic rank above books that mention it; each
   chapter row lands at its best paragraph via _openWork (both read modes). */
.lib-search-panel { padding: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; height: 100%; }
.lib-search-bar { display: flex; gap: 0.35rem; }
.lib-search-bar input {
    flex: 1; min-width: 0;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: var(--text-primary, #1a202c);
    font-size: 0.85rem;
}
.lib-search-bar input:focus { outline: 2px solid var(--primary, #7c5cbf); outline-offset: 1px; }
.lib-search-go {
    display: flex; align-items: center; justify-content: center;
    width: 36px; border: 1px solid var(--border, #e2e8f0); border-radius: 8px;
    background: var(--surface, #fff); color: var(--primary, #7c5cbf); cursor: pointer;
}
.lib-search-go:hover { background: var(--highlight, #f5f1ea); }
.lib-search-scope { display: flex; gap: 0.35rem; }
.lib-scope-btn {
    flex: 1; padding: 0.32rem 0.5rem;
    border: 1px solid var(--border, #e2e8f0); border-radius: 999px;
    background: none; color: var(--text-secondary, #6B5D54);
    font-size: 0.74rem; cursor: pointer;
}
.lib-scope-btn.active { background: var(--primary, #7c5cbf); border-color: var(--primary, #7c5cbf); color: #fff; }
.lib-scope-btn:disabled { opacity: 0.45; cursor: default; }
.lib-search-results { overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.lib-search-status { padding: 1rem 0.5rem; color: var(--text-secondary, #6B5D54); font-size: 0.83rem; text-align: center; }
.lib-search-work {
    border: 1px solid var(--border, #e2e8f0); border-radius: 10px;
    background: var(--surface, #fff); overflow: hidden;
}
.lsw-head { padding: 0.55rem 0.7rem 0.45rem; border-bottom: 1px solid var(--border, #e2e8f0); background: var(--highlight, #f5f1ea); }
.lsw-title { font-weight: 700; font-size: 0.85rem; color: var(--text-primary, #1a202c); font-family: 'Crimson Pro', Georgia, serif; }
.lsw-author { font-size: 0.72rem; color: var(--text-secondary, #6B5D54); margin-top: 0.1rem; }
.lib-search-chapter { padding: 0.5rem 0.7rem; cursor: pointer; border-bottom: 1px solid var(--border, #e2e8f0); }
.lib-search-chapter:last-of-type { border-bottom: none; }
.lib-search-chapter:hover { background: var(--highlight, #f5f1ea); }
.lsc-title { font-size: 0.78rem; font-weight: 600; color: var(--primary, #7c5cbf); line-height: 1.3; }
.lsc-cue { font-size: 0.7rem; color: var(--text-secondary, #6B5D54); margin: 0.12rem 0; }
.lsc-phrase { color: var(--gold-text, #9a7b2f); font-weight: 600; }
.lsc-snippet { font-size: 0.78rem; color: var(--text-primary, #1a202c); line-height: 1.42; opacity: 0.88; }
.lib-search-more { padding: 0.32rem 0.7rem 0.45rem; font-size: 0.7rem; color: var(--text-secondary, #6B5D54); font-style: italic; }
