/* In-bio EPUB reader styles — v2 */

.bio-books-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.bio-books-empty {
    padding: 12px;
    font-size: 13px;
    opacity: 0.7;
    color: #fff;
}

.bio-book-card {
    display: flex;
    gap: 14px;
    align-items: stretch;
    padding: 12px;
    background: rgba(58, 65, 73, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.bio-book-card:hover {
    transform: translateY(-1px);
    background: rgba(58, 65, 73, 0.55);
    border-color: rgba(255, 255, 255, 0.18);
}
.bio-book-cover {
    width: 70px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.bio-book-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    color: #fff;
}
.bio-book-meta .bio-book-title { font-size: 16px; font-weight: 600; line-height: 1.2; }
.bio-book-meta .bio-book-author { font-size: 13px; opacity: 0.75; }
.bio-book-meta .bio-book-cta { margin-top: 6px; font-size: 12px; color: #ffd57a; }
.bio-book-meta .bio-book-cta i { margin-right: 4px; }

/* ---- Reader overlay ---- */
.epub-reader-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--er-bg, #f5efe2);
    color: var(--er-fg, #1d1d1f);
    display: none;
    flex-direction: column;
    font-family: var(--er-font, Georgia, "Times New Roman", serif);
}
.epub-reader-overlay.in-bio-panel {
    position: absolute;
    inset: 0;
    z-index: 5;
    border-radius: 15px 0 0 15px;
    overflow: hidden;
}
.epub-reader-overlay.is-open { display: flex; }
.epub-reader-overlay[data-theme="light"] { --er-bg: #ffffff; --er-fg: #1d1d1f; --er-toolbar-bg: rgba(245, 245, 245, 0.95); --er-border: rgba(0,0,0,0.08); }
.epub-reader-overlay[data-theme="sepia"] { --er-bg: #f5efe2; --er-fg: #3a2f1d; --er-toolbar-bg: rgba(244, 235, 215, 0.95); --er-border: rgba(0,0,0,0.08); }
.epub-reader-overlay[data-theme="dark"]  { --er-bg: #1a1a1a; --er-fg: #e8e8e8; --er-toolbar-bg: rgba(28, 28, 28, 0.95); --er-border: rgba(255,255,255,0.08); }

/* ---- Toolbar ---- */
.epub-reader-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: var(--er-toolbar-bg, rgba(0,0,0,0.05));
    border-bottom: 1px solid var(--er-border);
    flex-wrap: wrap;
}
.epub-reader-toolbar .er-title {
    font-weight: 600;
    margin-right: auto;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 35%;
    padding: 0 4px;
}
.epub-reader-toolbar button {
    background: transparent;
    border: 1px solid var(--er-border);
    color: inherit;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.15s ease;
    padding: 0;
}
.epub-reader-toolbar button:hover:not(:disabled) { background: rgba(127,127,127,0.15); }
.epub-reader-toolbar button:disabled { opacity: 0.45; cursor: not-allowed; }
.epub-reader-toolbar .er-aa .er-aa-label { font-weight: 600; font-family: Georgia, serif; }
.epub-reader-toolbar .er-aa-label::first-letter { font-size: 1.15em; }
.epub-reader-toolbar .er-search {
    flex: 0 1 200px;
    height: 32px;
    border: 1px solid var(--er-border);
    border-radius: 6px;
    padding: 0 10px;
    background: transparent;
    color: inherit;
    font-size: 13px;
    display: none;
}
.epub-reader-toolbar.searching .er-search { display: inline-block; }
.epub-reader-toolbar .er-play.is-playing {
    background: rgba(255, 213, 80, 0.25);
    border-color: rgba(255, 213, 80, 0.5);
    color: #b67900;
}

/* ---- Aa popover ---- */
.epub-reader-popover {
    position: absolute;
    z-index: 50;
    min-width: 260px;
    background: var(--er-bg);
    border: 1px solid var(--er-border);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    padding: 12px;
    color: var(--er-fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
}
.er-pop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    gap: 10px;
}
.er-pop-row label { font-weight: 600; opacity: 0.85; flex: 0 0 auto; }
.er-pop-controls { display: inline-flex; align-items: center; gap: 6px; }
.er-pop-controls button,
.er-seg button {
    background: transparent;
    border: 1px solid var(--er-border);
    color: inherit;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}
.er-seg { display: inline-flex; }
.er-seg button { border-radius: 0; border-right-width: 0; }
.er-seg button:first-child { border-radius: 6px 0 0 6px; }
.er-seg button:last-child  { border-radius: 0 6px 6px 0; border-right-width: 1px; }
.er-seg button.is-active,
.er-pop-controls button:hover,
.er-seg button:hover { background: rgba(127,127,127,0.15); }
.er-seg button.is-active { background: rgba(255, 213, 80, 0.25); border-color: rgba(255, 213, 80, 0.55); }
.er-pop-value { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.er-brightness { width: 100%; }

/* ---- Body / stage ---- */
.epub-reader-body {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
}
.epub-reader-toc {
    width: 280px;
    overflow-y: auto;
    border-right: 1px solid var(--er-border);
    padding: 12px;
    display: none;
    background: var(--er-toolbar-bg);
}
.epub-reader-toc.is-open { display: block; }
.epub-reader-toc .toc-item {
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.35;
}
.epub-reader-toc .toc-item:hover { background: rgba(127,127,127,0.15); }
.epub-reader-toc .toc-sub { margin-left: 12px; font-size: 12px; opacity: 0.85; }
.epub-reader-toc .toc-search-header {
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 12px;
}
.epub-reader-toc .toc-search-header small { opacity: 0.7; font-weight: 400; }
.epub-reader-toc .toc-search-status { padding: 6px 8px; opacity: 0.75; font-size: 12px; }
.epub-reader-toc .toc-search-hit { padding: 8px; border-bottom: 1px dashed var(--er-border); }
.epub-reader-toc .toc-search-chapter { font-size: 11px; opacity: 0.7; margin-bottom: 2px; }
.epub-reader-toc .toc-search-snippet { font-size: 12px; line-height: 1.4; }
.epub-reader-toc mark { background: rgba(255, 213, 80, 0.5); color: inherit; padding: 0 1px; border-radius: 2px; }

.epub-reader-stage {
    flex: 1;
    position: relative;
    min-width: 0;
}
.epub-reader-area {
    position: absolute;
    inset: 0;
    padding: 20px 60px;
}
.epub-reader-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 56px;
    background: rgba(127,127,127,0.15);
    border: none;
    color: inherit;
    cursor: pointer;
    border-radius: 6px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0.55;
    transition: opacity 0.15s ease;
}
.epub-reader-nav:hover { opacity: 1; }
.epub-reader-nav.prev { left: 4px; }
.epub-reader-nav.next { right: 4px; }

/* Brightness overlay */
.er-brightness-overlay {
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0;
    pointer-events: none;
    z-index: 8;
    transition: opacity 0.2s ease;
}

/* Sentence highlight overlay (click-through) */
.er-sentence-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 9;
}
.er-sentence-rect {
    position: absolute;
    background: rgba(255, 213, 80, 0.32);
    border-radius: 3px;
    transition: opacity 0.15s ease;
}

/* Current-word follow-along overlay (read-aloud karaoke highlight) */
.er-word-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}
.er-word-rect {
    position: absolute;
    background: rgba(212, 160, 88, 0.55);
    border-radius: 3px;
    transition: left 0.08s linear, top 0.08s linear, width 0.08s linear;
}

/* ── Selection action menu ("Tuscan dusk"): highlight colors + note/quote/copy.
   Positioned in stage coords; `transform` centers it over the selection and
   lifts it above the text. */
.er-selection-bar {
    position: absolute;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: linear-gradient(180deg, #2a221a, #1f1810);
    border: 1px solid rgba(212, 160, 88, 0.22);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
    transform: translate(-50%, -100%);
}
.er-selection-bar[hidden] { display: none; }
.er-sel-row { display: flex; align-items: center; gap: 4px; padding: 0 2px; }
.er-sel-divider {
    width: 1px; height: 18px;
    background: rgba(244, 239, 230, 0.16);
    margin: 0 2px;
}
.er-selection-bar .sel-color {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 1.5px solid rgba(244, 239, 230, 0.18);
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.er-selection-bar .sel-color:hover { transform: scale(1.12); border-color: rgba(244, 239, 230, 0.55); }
.er-selection-bar .sel-color-amber { background: linear-gradient(135deg, #f5c87e, #d4a058); }
.er-selection-bar .sel-color-rose  { background: linear-gradient(135deg, #e89a8a, #c8645c); }
.er-selection-bar .sel-color-teal  { background: linear-gradient(135deg, #6fb0a8, #3d8a87); }
.er-selection-bar .sel-color-sage  { background: linear-gradient(135deg, #b8c89a, #88a070); }
.er-selection-bar .sel-action {
    width: 32px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 0;
    color: rgba(244, 239, 230, 0.78);
    cursor: pointer;
    border-radius: 6px;
    font-size: 12px;
    transition: background 0.18s ease, color 0.18s ease;
}
.er-selection-bar .sel-action:hover { background: rgba(244, 239, 230, 0.08); color: #fbf3e2; }
/* "Ask the avatar" is the primary action — give it a warm accent so it reads
   as the headline option in the selection bar. */
.er-selection-bar .sel-action.er-hl-ask { color: #f5c87e; }
.er-selection-bar .sel-action.er-hl-ask:hover { background: rgba(212, 160, 88, 0.18); color: #ffe6b8; }
/* Hover tooltips on every menu button */
.er-selection-bar .sel-color,
.er-selection-bar .sel-action { position: relative; }
.er-selection-bar [data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%; transform: translateX(-50%);
    background: rgba(20, 16, 12, 0.96);
    color: #fbf3e2;
    padding: 4px 9px;
    border-radius: 5px;
    border: 1px solid rgba(212, 160, 88, 0.22);
    font-size: 10px; letter-spacing: 0.06em;
    white-space: nowrap;
    opacity: 0; pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 14;
}
.er-selection-bar [data-tip]:hover::after { opacity: 1; }
/* Downward arrow connecting the menu to the selection */
.er-sel-arrow {
    position: absolute;
    left: 50%; top: 100%;
    width: 10px; height: 10px;
    background: linear-gradient(135deg, transparent 50%, #1f1810 50%);
    transform: translate(-50%, -5px) rotate(45deg);
    border-right: 1px solid rgba(212, 160, 88, 0.22);
    border-bottom: 1px solid rgba(212, 160, 88, 0.22);
}

/* ── Inline note editor (anchored under a highlight) ── */
.er-note-popover {
    position: absolute;
    z-index: 16;
    width: 280px;
    max-width: 90%;
    padding: 12px;
    background: rgba(248, 240, 220, 0.98);
    border: 1px solid rgba(120, 80, 40, 0.20);
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(80, 50, 20, 0.20);
    transform: translateX(-50%);
}
.er-note-popover[hidden] { display: none; }
.er-note-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(120, 80, 40, 0.14);
    border-radius: 8px;
    padding: 8px 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-size: 13.5px; line-height: 1.5;
    color: #2a221a;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.er-note-input:focus { border-color: #8b3a1e; background: rgba(255, 255, 255, 0.9); }
.er-note-input::placeholder { color: rgba(80, 50, 20, 0.45); }
.er-note-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.er-note-cancel, .er-note-save {
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 11px; letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.er-note-cancel { background: transparent; border: 1px solid rgba(120, 80, 40, 0.22); color: rgba(80, 50, 20, 0.7); }
.er-note-cancel:hover { background: rgba(80, 50, 20, 0.08); color: #2a221a; }
.er-note-save { background: #8b3a1e; border: 1px solid #8b3a1e; color: #fbf3e2; }
.er-note-save:hover { background: #6e2d18; }

/* ── Copy / quote confirmation toast ── */
.er-reader-toast {
    position: absolute;
    z-index: 18;
    padding: 8px 16px;
    background: rgba(42, 34, 26, 0.95);
    color: #fbf3e2;
    border-radius: 999px;
    border: 1px solid rgba(212, 160, 88, 0.32);
    font-size: 12.5px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
    transition: opacity 0.25s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    display: none;
}
.er-reader-toast.is-visible {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.er-reader-toast em { color: #ffd57a; font-style: normal; }

/* Dictionary popover */
.er-dict-popover {
    position: absolute;
    z-index: 13;
    width: 280px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--er-bg);
    color: var(--er-fg);
    border: 1px solid var(--er-border);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    padding: 10px 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
}
.er-dict-word { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.er-dict-defs { margin: 0; padding-left: 18px; line-height: 1.45; }
.er-dict-defs li { margin-bottom: 4px; }
.er-dict-pos { font-style: italic; opacity: 0.7; margin-right: 4px; }
.er-dict-foot { margin-top: 8px; font-size: 11px; opacity: 0.7; text-align: right; }
.er-dict-foot a { color: inherit; }
.er-dict-loading, .er-dict-empty { font-size: 12px; opacity: 0.75; }

/* ---- Footer ---- */
.epub-reader-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    border-top: 1px solid var(--er-border);
    background: var(--er-toolbar-bg);
    font-size: 12px;
}
.epub-reader-footer .er-chapter {
    font-weight: 600;
    max-width: 30%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.epub-reader-footer .er-scrubber-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}
.epub-reader-footer .er-scrubber-tip {
    position: absolute;
    bottom: calc(100% + 6px);
    background: rgba(20,20,20,0.92);
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    transform: translateZ(0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    z-index: 5;
}
.epub-reader-footer .er-scrubber-tip::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(20,20,20,0.92);
}
.epub-reader-footer .er-scrubber-wrap .er-scrubber {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(127,127,127,0.25);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.epub-reader-footer .er-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #ffd57a;
    border: 1px solid rgba(0,0,0,0.2);
    cursor: pointer;
}
.epub-reader-footer .er-scrubber::-moz-range-thumb {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #ffd57a;
    border: 1px solid rgba(0,0,0,0.2);
    cursor: pointer;
}
.epub-reader-footer .er-time-left,
.epub-reader-footer .er-loc { white-space: nowrap; opacity: 0.85; }

/* ---- Loading / error ---- */
.epub-reader-loading,
.epub-reader-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    background: var(--er-bg);
    z-index: 10;
    font-size: 14px;
}
.epub-reader-error { color: #c0392b; padding: 0 30px; text-align: center; }

/* ---- Marks drawer (bookmarks + highlights) ---- */
.epub-reader-drawer {
    position: absolute;
    top: 50px;       /* below toolbar */
    right: 0;
    bottom: 36px;    /* above footer */
    width: 320px;
    max-width: 85%;
    background: var(--er-bg);
    color: var(--er-fg);
    border-left: 1px solid var(--er-border);
    box-shadow: -8px 0 20px rgba(0,0,0,0.2);
    z-index: 20;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.er-drawer-tabs {
    display: flex;
    border-bottom: 1px solid var(--er-border);
}
.er-drawer-tabs button {
    flex: 1;
    background: transparent;
    border: none;
    color: inherit;
    padding: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 2px solid transparent;
}
.er-drawer-tabs button.is-active { border-bottom-color: #ffd57a; }
.er-drawer-body { flex: 1; overflow-y: auto; padding: 8px; }
.er-mark-empty { padding: 20px; text-align: center; opacity: 0.7; font-size: 13px; }
.er-mark-item {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-bottom: 1px dashed var(--er-border);
    align-items: flex-start;
}
.er-mark-item:hover { background: rgba(127,127,127,0.08); }
.er-mark-main { flex: 1; cursor: pointer; min-width: 0; }
.er-mark-label { font-weight: 600; font-size: 13px; line-height: 1.3; word-wrap: break-word; }
.er-mark-label i { margin-right: 4px; opacity: 0.7; }
.er-mark-snippet,
.er-mark-note { font-size: 12px; opacity: 0.8; margin-top: 3px; line-height: 1.3; }
.er-mark-note { font-style: italic; opacity: 0.75; }
.er-mark-meta { font-size: 10px; opacity: 0.55; margin-top: 4px; }
.er-mark-swatch {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,0.15);
}
.er-mark-del {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.4;
    padding: 4px;
    font-size: 12px;
}
.er-mark-del:hover { opacity: 1; }

@media (max-width: 768px) {
    .epub-reader-area { padding: 12px 24px; }
    .epub-reader-toc { width: 78%; position: absolute; inset: 0 auto 0 0; z-index: 6; }
    .epub-reader-toolbar .er-title { max-width: 40%; font-size: 12px; }
    .epub-reader-toolbar .er-search { flex-basis: 130px; }
    .epub-reader-drawer { width: 90%; }
    .epub-reader-popover { min-width: 240px; right: 6px !important; }
}

/* ═══════════════════════════════════════════════════════════════
   EMBEDDED READER (Task #47) — engine mounted inside the pretty
   right-panel `.view-reader`. The pretty panel-head toolbar +
   footer drive the engine; the engine's own chrome is hidden.
   ═══════════════════════════════════════════════════════════════ */
/* Embedded overlay is a flex child of `.view-reader` (column) so the pretty
   footer below it stays visible. `order` keeps the engine above the footer
   regardless of DOM append order. */
.epub-reader-overlay.er-embedded {
    position: relative;
    inset: auto;
    flex: 1 1 auto;
    min-height: 0;
    order: 1;
    z-index: 1;
    border-radius: 0;
    overflow: hidden;
    background: var(--er-bg, #f5efe2);
}
.view-reader > .reader-foot { order: 2; }
/* When a real EPUB is active, hide the mockup page; the engine renders instead */
.right-panel[data-real-book="1"] .view-reader .reader-page { display: none; }
/* Theme surfaces for the embedded stage (engine themes: parchment/sepia/quiet/light/dark) */
/* Tokens MUST match the engine theme `body` colors in EpubReaderController
   (_applyPrefsToRendition), so the themed frame around the page is the same
   color as the page itself — no contrasting rectangle. */
.epub-reader-overlay.er-embedded[data-theme="parchment"] { --er-bg: #f5efe2; --er-fg: #3a2f1d; }
.epub-reader-overlay.er-embedded[data-theme="quiet"]     { --er-bg: #211b14; --er-fg: #cdbfa8; }
.epub-reader-overlay.er-embedded[data-theme="sepia"]     { --er-bg: #efe0c4; --er-fg: #4a3b28; }
.epub-reader-overlay.er-embedded[data-theme="light"]     { --er-bg: #ffffff; --er-fg: #1d1d1f; }
.epub-reader-overlay.er-embedded[data-theme="dark"]      { --er-bg: #1a1a1a; --er-fg: #e8e8e8; }

/* Hide the engine's own chrome — the pretty toolbar/footer/popovers replace it */
.er-embedded .epub-reader-toolbar,
.er-embedded .epub-reader-footer,
.er-embedded .epub-reader-popover,
.er-embedded .epub-reader-drawer,
.er-embedded .epub-reader-toc { display: none !important; }

/* Stage fills the embedded area; keep the engine's prev/next as edge taps */
.er-embedded .epub-reader-body { flex: 1; min-height: 0; }
.er-embedded .epub-reader-stage { border-radius: 0; }
/* Hide the engine's floating edge tap-zones in embedded mode — they sit on the
   panel's left edge directly over the resize handle (the "drag button right next
   to the page buttons" overlap). The pretty footer prev/next, arrow keys, and the
   progress scrubber handle navigation instead. */
.er-embedded .epub-reader-nav { display: none !important; }

/* Loading + error states restyled for the pretty panel */
.er-embedded .epub-reader-loading {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; color: var(--er-fg, #2e2718);
}
.er-embedded .epub-reader-error {
    display: flex; align-items: center; justify-content: center;
    padding: 24px; text-align: center; color: var(--er-fg, #2e2718);
}

/* ── Real search results dropdown (injected under #reader-search-bar) ── */
.reader-search-results {
    display: none;
    position: absolute;
    left: 12px;
    right: 12px;
    top: 100%;
    margin-top: 6px;
    max-height: 320px;
    overflow-y: auto;
    background: rgba(28, 22, 14, 0.97);
    border: 1px solid rgba(255, 213, 122, 0.22);
    border-radius: 10px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
    z-index: 40;
    padding: 6px;
}
.reader-search-results.is-open { display: block; }
.reader-search-results .rsr-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 11px;
    border: 0;
    background: transparent;
    color: #f3e9d4;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.12s ease;
}
.reader-search-results .rsr-item:hover { background: rgba(255, 213, 122, 0.12); }
.reader-search-results .rsr-chapter {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #ffd57a;
    margin-bottom: 3px;
    opacity: 0.85;
}
.reader-search-results .rsr-excerpt { font-size: 13px; line-height: 1.4; opacity: 0.92; }
.reader-search-results .rsr-empty { padding: 12px; font-size: 13px; opacity: 0.7; color: #f3e9d4; }

/* ── Bookmark popover: "Bookmark this page" action + empty/eyebrow ── */
.popover-eyebrow {
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #ffd57a;
    opacity: 0.85;
    padding: 4px 6px 8px;
}
.popover-bm-add {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 11px;
    margin-bottom: 6px;
    border: 1px solid rgba(255, 213, 122, 0.28);
    background: rgba(255, 213, 122, 0.10);
    color: #ffd57a;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.12s ease;
}
.popover-bm-add:hover { background: rgba(255, 213, 122, 0.18); }
.popover-bm-empty {
    padding: 10px;
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.7;
    color: #f3e9d4;
}
.popover-bm-list { display: flex; flex-direction: column; gap: 2px; }
