/* ==========================================================================
   Nepa Books — Interactive E-Reader & 3D Flipbook Engine (St.PageFlip)
   Developer: khanalsaroj083
   ========================================================================== */

@font-face {
    font-family: 'Noto Sans Devanagari';
    src: url('../fonts/noto-sans-devanagari.woff2') format('woff2'),
         url('https://fonts.gstatic.com/s/notosansdevanagari/v30/TuG7UUFzXI5FBtUq5a8bjKYTZjtRU6Sgv3NaV_SNmI0b8QQCQmHN5TV_5Kl4-GIB.woff2') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Mangal';
    src: url('../fonts/mangal.woff2') format('woff2'),
         url('https://fonts.gstatic.com/s/notosansdevanagari/v30/TuG7UUFzXI5FBtUq5a8bjKYTZjtRU6Sgv3NaV_SNmI0b8QQCQmHN5TV_5Kl4-GIB.woff2') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Siddhanta';
    src: url('../fonts/siddhanta.woff2') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

.nepa-siddhanta,
.nepa-font-siddhanta,
[data-font="siddhanta"],
.nepa-mundhum-block,
.nepa-mundhum-verse,
.nepa-verse {
    font-family: 'Siddhanta', 'Mangal', 'Noto Sans Devanagari', serif !important;
}

.nepa-mundhum-block,
.nepa-mundhum-verse {
    font-size: 13.2px;
    line-height: 1.58;
    margin: 8px 0;
    padding-left: 10px;
    border-left: 2.5px solid var(--accent);
    color: var(--text-main);
}

.nepa-mundhum-block div,
.nepa-mundhum-verse div {
    margin-bottom: 2px;
    text-align: left;
}

:root {
    /* Default: Warm Sepia Mode (प्राकृतिक बासमती/कागज रङ - पूरै सिस्टम वार्म, आँखालाई आराम दिने) */
    --book-font-family: 'Mangal', 'Siddhanta', 'Noto Sans Devanagari', 'Mukta', 'Kohinoor Devanagari', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --canvas-bg: #ece2cb;
    --page-bg: #fbf5e5;
    --text-main: #1c150c;
    --text-muted: #54432d;
    --text-heading: #120d07;
    --border-color: #d8c7a6;
    --spine-shadow: rgba(45, 32, 16, 0.22);
    --spine-crease-dark: rgba(45, 32, 16, 0.20);
    --spine-crease-mid: rgba(45, 32, 16, 0.07);
    --heading-shadow: rgba(60, 40, 16, 0.08);
    --page-shadow: 0 14px 36px rgba(85, 65, 35, 0.22);
    --accent: #8d4004;
    --accent-hover: #6d3102;
    --accent-light: rgba(141, 64, 4, 0.12);
    --toolbar-bg: #dfd3ba;
    --toolbar-border: #cfbe9a;
    --toolbar-text: #261a0c;
    --toolbar-muted: #6c563e;
    --btn-bg: rgba(50, 32, 12, 0.07);
    --btn-border: rgba(50, 32, 12, 0.16);
    --btn-hover: rgba(50, 32, 12, 0.14);
    --arrow-bg: rgba(60, 40, 16, 0.35);
    --arrow-color: #ffffff;
    --arrow-border: rgba(60, 40, 16, 0.25);
    --card-bg: #f5edd9;
    --card-border: #d4c29e;
    --font-scale: 16px;
    --line-scale: 1.76;
}

[data-theme="light"] {
    --canvas-bg: #eef1f5;
    --page-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-heading: #020617;
    --border-color: #e2e8f0;
    --spine-shadow: rgba(0, 0, 0, 0.1);
    --spine-crease-dark: rgba(0, 0, 0, 0.14);
    --spine-crease-mid: rgba(0, 0, 0, 0.04);
    --heading-shadow: rgba(0, 0, 0, 0.06);
    --page-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
    --accent: #0284c7;
    --accent-hover: #0369a1;
    --accent-light: rgba(2, 132, 199, 0.12);
    --toolbar-bg: #ffffff;
    --toolbar-border: #d8dee4;
    --toolbar-text: #0f172a;
    --toolbar-muted: #64748b;
    --btn-bg: rgba(15, 23, 42, 0.06);
    --btn-border: rgba(15, 23, 42, 0.14);
    --btn-hover: rgba(15, 23, 42, 0.12);
    --arrow-bg: rgba(15, 23, 42, 0.38);
    --arrow-color: #ffffff;
    --arrow-border: rgba(15, 23, 42, 0.2);
    --card-bg: #f8fafc;
    --card-border: #e2e8f0;
}

[data-theme="soft"] {
    /* Soft Grey Theme: शांत खैरो - आँखालाई शीतल, कुनै पनि डार्क छैन */
    --canvas-bg: #d6dce3;
    --page-bg: #f3f6f9;
    --text-main: #192028;
    --text-muted: #4b5768;
    --text-heading: #0f172a;
    --border-color: #c6cfda;
    --spine-shadow: rgba(26, 32, 44, 0.15);
    --spine-crease-dark: rgba(26, 32, 44, 0.16);
    --spine-crease-mid: rgba(26, 32, 44, 0.05);
    --heading-shadow: rgba(0, 0, 0, 0.06);
    --page-shadow: 0 14px 36px rgba(25, 35, 45, 0.18);
    --accent: #15803d;
    --accent-hover: #166534;
    --accent-light: rgba(21, 128, 61, 0.12);
    --toolbar-bg: #e1e6ec;
    --toolbar-border: #c6cfda;
    --toolbar-text: #192028;
    --toolbar-muted: #556373;
    --btn-bg: rgba(25, 32, 40, 0.07);
    --btn-border: rgba(25, 32, 40, 0.16);
    --btn-hover: rgba(25, 32, 40, 0.13);
    --arrow-bg: rgba(25, 35, 45, 0.35);
    --arrow-color: #ffffff;
    --arrow-border: rgba(25, 35, 45, 0.2);
    --card-bg: #ecf0f4;
    --card-border: #c6cfda;
}

[data-theme="dark"] {
    /* Dark Slate Mode: मात्र डार्क मोड छान्दा आउने पूर्ण डार्क थिम */
    --canvas-bg: #090d13;
    --page-bg: #151b23;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-heading: #ffffff;
    --border-color: #273142;
    --spine-shadow: rgba(0, 0, 0, 0.7);
    --spine-crease-dark: rgba(0, 0, 0, 0.55);
    --spine-crease-mid: rgba(0, 0, 0, 0.22);
    --heading-shadow: rgba(0, 0, 0, 0.5);
    --page-shadow: 0 16px 44px rgba(0, 0, 0, 0.85);
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-light: rgba(245, 158, 11, 0.18);
    --toolbar-bg: #121820;
    --toolbar-border: #222a36;
    --toolbar-text: #f1f5f9;
    --toolbar-muted: #94a3b8;
    --btn-bg: rgba(255, 255, 255, 0.08);
    --btn-border: rgba(255, 255, 255, 0.16);
    --btn-hover: rgba(255, 255, 255, 0.14);
    --arrow-bg: rgba(0, 0, 0, 0.65);
    --arrow-color: #ffffff;
    --arrow-border: rgba(255, 255, 255, 0.15);
    --card-bg: #1a222c;
    --card-border: #263140;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

/* Eliminate WordPress admin bar push-down in full-screen reader */
#wpadminbar {
    display: none !important;
}

html {
    margin-top: 0 !important;
}

body.admin-bar.nepa-reader-body {
    padding-top: 0 !important;
    margin-top: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
}

body, .nepa-reader-body {
    background-color: var(--canvas-bg);
    color: var(--text-main);
    font-family: var(--book-font-family);
    font-weight: 400; /* Regular normal weight */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    user-select: none;
    transition: background-color 0.25s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ==========================================================================
   Top Navigation Bar (Clean & Auto-Hide with Zero Content Clipping)
   ========================================================================== */
.nepa-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--toolbar-border);
    color: var(--toolbar-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(0);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
}

.nepa-navbar.is-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.nepa-nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.nepa-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nepa-book-title-heading {
    font-size: 15px;
    font-weight: 600;
    color: var(--toolbar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    padding: 0;
    max-width: 55vw;
}

.nepa-icon-btn {
    background: var(--btn-bg);
    color: var(--toolbar-text);
    border: 1px solid var(--btn-border);
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.18s ease;
    text-decoration: none !important;
}

.nepa-icon-btn.nepa-btn-home {
    color: var(--accent);
    border-color: var(--accent-light, #d97706);
}

.nepa-icon-btn.nepa-btn-home:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

.nepa-icon-btn:hover {
    background: var(--btn-hover);
    border-color: var(--toolbar-text);
}

.nepa-icon-btn.nepa-btn-accent {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.nepa-icon-btn.is-bookmarked,
#nepaBookmarkBtn.is-bookmarked {
    background: #16a34a !important; /* Green bookmark highlight */
    color: #ffffff !important;
    border-color: #15803d !important;
    box-shadow: 0 0 10px rgba(22, 163, 74, 0.45) !important;
}

.nepa-icon-btn.is-bookmarked:hover,
#nepaBookmarkBtn.is-bookmarked:hover {
    background: #15803d !important;
    border-color: #166534 !important;
}

.nepa-icon-btn.is-bookmarked .nepa-bookmark-icon,
#nepaBookmarkBtn.is-bookmarked .nepa-bookmark-icon {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

[data-theme="dark"] .nepa-icon-btn.is-bookmarked,
[data-theme="dark"] #nepaBookmarkBtn.is-bookmarked {
    background: #22c55e !important;
    color: #0f172a !important;
    border-color: #16a34a !important;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.55) !important;
}

.nepa-close-btn {
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--toolbar-text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.nepa-close-btn:hover {
    background: var(--btn-hover);
    border-color: var(--toolbar-text);
}

/* ==========================================================================
   Table of Contents (TOC) Drawer
   ========================================================================== */
.nepa-toc-drawer {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 320px;
    max-width: 85vw;
    background: var(--toolbar-bg);
    border-right: 1px solid var(--toolbar-border);
    color: var(--toolbar-text);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
}

.nepa-toc-drawer.is-open {
    transform: translateX(0);
}

.nepa-drawer-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--toolbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 15px;
}

/* Go To Page Quick Jump Bar */
.nepa-goto-page-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--toolbar-border);
    background: var(--card-bg);
}

.nepa-goto-label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--toolbar-muted);
    white-space: nowrap;
}

.nepa-goto-input {
    flex: 1;
    height: 32px;
    padding: 0 8px;
    background: var(--page-bg);
    border: 1px solid var(--btn-border);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 13.5px;
    font-weight: 600;
    text-align: center;
    outline: none;
}

.nepa-goto-input:focus {
    border-color: var(--accent);
}

.nepa-goto-btn {
    height: 32px;
    padding: 0 10px;
    background: var(--accent);
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.nepa-goto-btn:hover {
    background: var(--accent-hover);
}

.nepa-toc-scroll-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nepa-toc-row {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13.5px;
    font-weight: 700;
    border-bottom: 1px solid var(--btn-border);
    transition: background 0.15s;
    color: var(--toolbar-text);
}

.nepa-toc-row:hover, .nepa-toc-row.active {
    background: var(--accent-light);
    color: var(--accent);
}

.nepa-toc-page-badge {
    font-size: 11.5px;
    font-weight: 700;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--toolbar-text);
    white-space: nowrap;
}

/* Hierarchical TOC Chapter Accordion */
.nepa-toc-chapter-group {
    border-bottom: 1px solid var(--btn-border);
}

.nepa-toc-chapter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    font-weight: 600;
    color: var(--toolbar-text);
}

.nepa-toc-chapter-header:hover, .nepa-toc-chapter-header.active {
    background: var(--accent-light);
    color: var(--accent);
}

.nepa-toc-ch-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.nepa-toc-ch-name {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nepa-toc-ch-sub {
    font-size: 11.5px;
    color: var(--toolbar-muted);
}

.nepa-toc-meta-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nepa-toc-chevron {
    font-size: 11px;
    transition: transform 0.2s ease;
    color: var(--toolbar-muted);
    display: inline-block;
}

.nepa-toc-chapter-group.is-open .nepa-toc-chevron {
    transform: rotate(90deg);
}

.nepa-toc-sub-list {
    display: none;
    background: var(--card-bg);
    border-top: 1px solid var(--btn-border);
    padding: 2px 0;
}

.nepa-toc-chapter-group.is-open .nepa-toc-sub-list {
    display: block;
}

.nepa-toc-sub-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 8px 26px;
    font-size: 13px;
    color: var(--toolbar-text);
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px dashed var(--btn-border);
}

.nepa-toc-sub-item:last-child {
    border-bottom: none;
}

.nepa-toc-sub-item:hover, .nepa-toc-sub-item.active {
    background: var(--accent-light);
    color: var(--accent);
    padding-left: 30px;
}

.nepa-toc-sub-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

/* ==========================================================================
   Modal Backdrop & Dialogs (Search & Quick Menu)
   ========================================================================== */
.nepa-modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nepa-modal-backdrop.is-open {
    display: flex;
    opacity: 1;
}

/* Search Dialog */
.nepa-search-dialog {
    background: var(--toolbar-bg);
    border: 1px solid var(--toolbar-border);
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
}

.nepa-search-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 10px;
    border-bottom: 1px solid var(--toolbar-border);
    background: var(--card-bg);
}

.nepa-search-icon {
    font-size: 16px;
    opacity: 0.8;
}

.nepa-search-header input[type="search"] {
    flex: 1;
    background: none;
    border: none;
    color: var(--toolbar-text);
    font-size: 15px;
    outline: none;
    font-family: inherit;
}

.nepa-search-results {
    flex: 1;
    overflow-y: auto;
    max-height: 60vh;
    padding: 8px 0;
}

.nepa-search-empty-state {
    padding: 30px 20px;
    text-align: center;
    color: var(--toolbar-muted);
    font-size: 14px;
}

.nepa-search-item {
    padding: 12px 18px;
    border-bottom: 1px solid var(--btn-border);
    cursor: pointer;
    transition: background 0.15s;
}

.nepa-search-item:hover {
    background: var(--accent-light);
}

.nepa-search-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.nepa-search-snippet {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--toolbar-text);
    text-align: left;
}

.nepa-search-snippet mark, mark.nepa-search-match {
    background: #ffeb3b;
    color: #111111;
    font-weight: 700;
    padding: 0 2px;
    border-radius: 2px;
}

/* Quick Menu Dialog (Bottom Sheet on Mobile) */
.nepa-menu-dialog {
    background: var(--toolbar-bg);
    border: 1px solid var(--toolbar-border);
    border-radius: 14px;
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
}

.nepa-menu-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--toolbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nepa-menu-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--toolbar-text);
    margin: 0;
}

.nepa-menu-body {
    padding: 16px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nepa-settings-group {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.nepa-group-title {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px dashed var(--btn-border);
    padding-bottom: 6px;
    margin-bottom: 2px;
}

.nepa-setting-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nepa-setting-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--toolbar-muted);
    text-transform: uppercase;
}

.nepa-setting-hint {
    font-size: 11.5px;
    color: var(--toolbar-muted);
    margin-top: 2px;
}

/* Rich Theme Grid with Visual Mini-Previews */
.nepa-theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.nepa-theme-card {
    background: var(--btn-bg);
    border: 2px solid var(--btn-border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--toolbar-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.18s ease;
    text-align: left;
}

.nepa-theme-card.active {
    border-color: var(--accent) !important;
    background: var(--accent-light) !important;
    box-shadow: 0 0 0 1px var(--accent);
}

.nepa-theme-card:hover {
    border-color: var(--accent);
    background: var(--btn-hover);
}

/* Miniature preview icon for each theme */
.nepa-theme-preview-box {
    width: 32px;
    height: 38px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    padding: 3px;
    gap: 2px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.nepa-preview-line {
    height: 2.5px;
    border-radius: 2px;
    width: 80%;
}

.nepa-preview-line:nth-child(2) { width: 100%; }
.nepa-preview-line:nth-child(3) { width: 60%; }

.nepa-theme-card-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.nepa-theme-card-title {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.nepa-theme-card-sub {
    font-size: 11px;
    color: var(--toolbar-muted);
}

/* Mode Pills */
.nepa-mode-pills {
    display: flex;
    gap: 6px;
}

.nepa-mode-pill {
    flex: 1;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--toolbar-text);
    padding: 8px 6px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

.nepa-mode-pill.active, .nepa-mode-pill:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

/* Font Control Bar */
.nepa-font-control-bar {
    display: flex;
    align-items: center;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 8px;
    overflow: hidden;
}

.nepa-font-ctrl-btn {
    background: none;
    border: none;
    color: var(--toolbar-text);
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    flex: 1;
    text-align: center;
}

.nepa-font-ctrl-btn:hover {
    background: var(--btn-hover);
}

.nepa-font-value-badge {
    padding: 0 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    border-left: 1px solid var(--btn-border);
    border-right: 1px solid var(--btn-border);
}

.nepa-action-row-btn {
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--toolbar-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    transition: background 0.15s;
}

.nepa-action-row-btn:hover {
    background: var(--btn-hover);
}

.nepa-action-row-btn.nepa-btn-install {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

/* Bookmarks in Menu (High Contrast & Clear Readability) */
.nepa-bookmarks-list {
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid var(--btn-border);
    border-radius: 8px;
    background: var(--card-bg);
}

.nepa-no-bookmarks {
    padding: 14px;
    text-align: center;
    font-size: 12.5px;
    color: var(--toolbar-muted);
}

.nepa-bookmark-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--btn-border);
    font-size: 13px;
    color: var(--toolbar-text);
    cursor: pointer;
    background: var(--card-bg);
    transition: background 0.15s ease;
}

.nepa-bookmark-item:last-child {
    border-bottom: none;
}

.nepa-bookmark-item:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.nepa-bookmark-delete-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0.8;
}

.nepa-bookmark-delete-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.12);
}

/* ==========================================================================
   Main Reading Stage & 3D Flipbook Area
   ========================================================================== */
.nepa-stage-container {
    position: absolute;
    top: 48px;
    bottom: 44px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 8px 14px;
    perspective: 2500px;
    box-sizing: border-box;
}

.nepa-flipbook-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    max-width: calc(100% - 120px); /* 60px clearance for desktop side arrows */
}

@media (max-width: 820px) {
    .nepa-flipbook-wrapper {
        max-width: 100%;
    }
}

/* Zero FOUC: Hide non-first pages before St.PageFlip wraps pages */
#nepaFlipbook:not(.stf__parent) {
    overflow: hidden !important;
    position: relative !important;
    width: 100% !important;
    max-width: 540px !important;
    height: 100% !important;
    max-height: 760px !important;
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#nepaFlipbook:not(.stf__parent) .nepa-book-page {
    display: none !important;
}

#nepaFlipbook:not(.stf__parent) .nepa-book-page:first-child {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
}

#nepaFlipbook {
    box-shadow: var(--page-shadow);
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease;
}

/* Front Cover & Back Cover: Centered single-page view with zero ghost shadow on opposite side */
#nepaFlipbook.nepa-on-cover {
    transform: translateX(calc(-1 * var(--single-page-width, 540px) / 2));
    box-shadow: none !important;
}

#nepaFlipbook.nepa-on-back-cover {
    transform: translateX(calc(var(--single-page-width, 540px) / 2));
    box-shadow: none !important;
}

#nepaFlipbook.nepa-on-cover .stf__item.--right,
#nepaFlipbook.nepa-on-back-cover .stf__item.--left {
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34), 0 4px 14px rgba(0, 0, 0, 0.16) !important;
    border-radius: 2px 8px 8px 2px;
}

.nepa-arrow-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 74px;
    background: var(--arrow-bg);
    color: var(--arrow-color);
    border: 1px solid var(--arrow-border);
    border-radius: 10px;
    font-size: 36px;
    cursor: pointer;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    line-height: 1;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.nepa-arrow-btn:hover {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.3);
}

.nepa-arrow-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.nepa-arrow-left { left: 16px; }
.nepa-arrow-right { right: 16px; }

/* ==========================================================================
   Book Page Layout & Typography (Guaranteed Contrast in ALL Modes)
   ========================================================================== */
.nepa-book-page {
    background-color: var(--page-bg);
    color: var(--text-main);
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.05);
    padding: 0 !important; /* Top header and bottom footer manage their own padding */
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    font-weight: 400; /* Regular normal font weight */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Authentic 3D Center Spine Crease: Exactly ONE clean center line */
.stf__item.--left:not(.--simple) .nepa-book-page:not(.--hard) {
    box-shadow: inset -14px 0 18px -6px var(--spine-shadow);
    border-right: 1px solid var(--border-color);
    border-left: none;
}

.stf__item.--left:not(.--simple) .nepa-book-page:not(.--hard)::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 22px;
    background: linear-gradient(to left, 
        var(--spine-crease-dark) 0%, 
        var(--spine-crease-mid) 45%, 
        transparent 100%
    );
    pointer-events: none;
    z-index: 10;
}

.stf__item.--right:not(.--simple) .nepa-book-page:not(.--hard) {
    box-shadow: inset 14px 0 18px -6px var(--spine-shadow);
    border-left: none !important; /* ONE center line only: carried by left page's border-right */
    border-right: none;
}

.stf__item.--right:not(.--simple) .nepa-book-page:not(.--hard)::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 22px;
    background: linear-gradient(to right, 
        var(--spine-crease-dark) 0%, 
        var(--spine-crease-mid) 45%, 
        transparent 100%
    );
    pointer-events: none;
    z-index: 10;
}

/* Hard Cover Page — Deep Slate Hardcover with Guaranteed Crisp Contrast */
.nepa-book-page.--hard {
    background: #0f141c !important;
    color: #f8fafc !important;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.85);
    border: 1px solid #2d3748;
    box-sizing: border-box;
}

.nepa-book-page.--hard h1, 
.nepa-book-page.--hard h2, 
.nepa-book-page.--hard h3 {
    color: #ffffff !important;
}

.nepa-book-page.--hard strong {
    color: #ffffff !important;
}

.nepa-book-page.--hard p, 
.nepa-book-page.--hard span, 
.nepa-book-page.--hard div {
    color: #e2e8f0;
}

.nepa-cover-inner {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px solid rgba(212, 175, 55, 0.6);
    border-radius: 6px;
    padding: 24px 20px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.12) 0%, rgba(15, 20, 28, 0.95) 100%);
    overflow: hidden;
    box-sizing: border-box;
}

.nepa-cover-gold {
    color: #d4af37 !important;
}

.nepa-cover-img-wrap {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0;
    margin: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.nepa-cover-full-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

/* Page Top Running Header — STRICTLY PINNED AT THE TOP */
.nepa-page-top-header {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 32px !important;
    display: flex !important;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding: 0 22px;
    margin: 0;
    font-family: var(--book-font-family);
    background-color: var(--page-bg);
    z-index: 10;
    box-sizing: border-box;
    user-select: none;
    width: 100% !important;
}

.nepa-header-even {
    justify-content: flex-start !important;
    text-align: left !important;
    padding-left: 34px !important;
    padding-right: 26px !important;
}

.nepa-header-odd {
    justify-content: flex-end !important;
    text-align: right !important;
    padding-left: 26px !important;
    padding-right: 34px !important;
}

.nepa-header-chapter {
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-muted);
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

/* Page Bottom Running Footer — STRICTLY PINNED AT THE BOTTOM (पुछारमै) */
.nepa-page-bottom-footer {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 28px !important;
    display: flex !important;
    align-items: center;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background-color: var(--page-bg);
    padding: 4px 22px;
    margin: 0 !important;
    font-family: var(--book-font-family);
    z-index: 10;
    box-sizing: border-box;
    user-select: none;
    width: 100% !important;
}

.nepa-footer-even {
    justify-content: flex-start !important;
    text-align: left !important;
    padding-left: 34px !important;
    padding-right: 26px !important;
}

.nepa-footer-odd {
    justify-content: flex-end !important;
    text-align: right !important;
    padding-left: 26px !important;
    padding-right: 34px !important;
}

.nepa-footer-content {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    line-height: 1.35;
    font-family: var(--book-font-family);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nepa-footer-left {
    margin-right: auto;
}

.nepa-footer-right {
    margin-left: auto;
}

.nepa-footer-center {
    margin: 0 auto;
    text-align: center;
}

.nepa-footer-num {
    font-weight: 700;
    color: var(--accent);
}

.nepa-footer-sep {
    opacity: 0.6;
    margin: 0 1px;
}

.nepa-footer-author {
    font-weight: 600;
    color: var(--text-color);
}

.nepa-footer-web {
    color: var(--accent);
    text-decoration: none;
    font-size: 11px;
    letter-spacing: 0.2px;
}

.nepa-footer-web:hover {
    text-decoration: underline;
}

.nepa-footer-title {
    font-weight: 500;
    color: var(--text-color);
}

.nepa-footer-sub {
    font-family: var(--book-font-family);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 90%;
    text-align: center;
}

/* Blank Pages (Inside Cover & Section Transitions) */
.nepa-page-blank {
    background-color: var(--paper-bg, #fbf7ee) !important;
}

.nepa-blank-paper {
    width: 100%;
    height: 100%;
    background-color: var(--paper-bg, #fbf7ee) !important;
}

/* Scrollable Page Content Body — Fits cleanly between pinned header & footer */
.nepa-page-body {
    position: absolute !important;
    top: 36px !important;
    bottom: 30px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    z-index: 5 !important;
    padding: 22px 30px 24px 30px !important;
    box-sizing: border-box !important;
    font-family: var(--book-font-family) !important;
    font-size: var(--font-scale);
    line-height: 1.85 !important;
    color: var(--text-main);
    font-weight: 400;
    text-align: justify;
    text-justify: inter-word;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none !important;
    -webkit-hyphens: none !important;
}

/* Authentic Book Margins: Left (Verso) Page vs Right (Recto) Page */
.stf__item.--left .nepa-page-body {
    padding-left: 34px !important;
    padding-right: 26px !important;
}

.stf__item.--right .nepa-page-body {
    padding-left: 26px !important;
    padding-right: 34px !important;
}

/* Top margin protection: Devanagari vowels (इकार, रेफ, ऐकार, चन्द्रबिन्दु) never clip against header */
.nepa-page-body > *:first-child {
    margin-top: 0 !important;
    padding-top: 2px !important;
}

/* Subtle sleek scrollbar for page content */
.nepa-page-body::-webkit-scrollbar {
    width: 4px;
}
.nepa-page-body::-webkit-scrollbar-track {
    background: transparent;
}
.nepa-page-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}
[data-theme="dark"] .nepa-page-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.nepa-page-body p {
    font-weight: 400;
    margin-top: 0 !important;
    margin-bottom: 12px !important;
    text-indent: 0 !important;
    color: var(--text-main);
    line-height: 1.85 !important;
}

/* Reset indent for first paragraph and following headings for authentic book alignment */
.nepa-heading-chapter + p,
.nepa-heading-section + p,
.nepa-page-body > p:first-of-type,
.nepa-book-paragraph {
    text-indent: 0 !important;
}

/* In-Page Interactive Table of Contents with Dotted Leaders */
.nepa-toc-jump {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 3px 6px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    text-decoration: none;
    color: var(--text-main);
}

.nepa-toc-jump:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.nepa-toc-jump .nepa-toc-title {
    flex-shrink: 0;
    font-weight: 700;
}

.nepa-toc-jump:hover .nepa-toc-title {
    text-decoration: underline;
}

.nepa-toc-jump .nepa-toc-dots {
    flex: 1;
    border-bottom: 1px dotted var(--border-color);
    margin: 0 8px;
    height: 1px;
    opacity: 0.65;
}

.nepa-toc-jump .nepa-toc-page-num {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 11.5px;
    color: var(--accent);
}

/* Text utility classes */
.nepa-text-muted { color: var(--text-muted) !important; }
.nepa-text-accent { color: var(--accent) !important; font-weight: 600; }
.nepa-text-heading { color: var(--text-heading) !important; }

/* Headings — Scalable Book-Embossed Typography (Scales with User Font Setting) */
.nepa-heading-chapter {
    font-size: 1.25em !important;
    font-weight: 700;
    color: var(--text-heading);
    margin: 6px 0 14px 0 !important;
    padding-top: 2px !important;
    text-align: center;
    position: relative;
    padding-bottom: 7px;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 1px var(--heading-shadow);
    line-height: 1.5 !important;
}

.nepa-heading-chapter::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 64px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}

.nepa-heading-section {
    font-size: 1.05em !important;
    font-weight: 600;
    color: var(--text-heading);
    margin: 12px 0 8px 0 !important;
    padding-top: 2px !important;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.5 !important;
}

.nepa-heading-section::before {
    content: '❖';
    color: var(--accent);
    font-size: 11px;
}

/* Compact, Inline Video QR Code Box (Book Standard) */
.nepa-qr-inline-box, .bdqr-inline-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 6px 10px;
    margin: 8px 0 !important;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    user-select: none;
    box-sizing: border-box;
}

.nepa-qr-inline-box:hover, .bdqr-inline-box:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Alignment / Float for Text Wrap */
.nepa-qr-inline-box.bdqr-align-right, .bdqr-inline-box.bdqr-align-right {
    float: right !important;
    max-width: 195px;
    margin: 4px 0 14px 16px !important;
    clear: right;
}

.nepa-qr-inline-box.bdqr-align-left, .bdqr-inline-box.bdqr-align-left {
    float: left !important;
    max-width: 195px;
    margin: 4px 16px 14px 0 !important;
    clear: left;
}

.nepa-qr-inline-box.bdqr-align-center, .bdqr-inline-box.bdqr-align-center {
    float: none !important;
    max-width: 280px;
    margin: 14px auto !important;
    clear: both;
}

/* Sizing Options */
.bdqr-size-compact .nepa-qr-mini-thumb, .bdqr-size-compact .bdqr-mini-thumb {
    width: 60px;
    height: 60px;
}

.bdqr-size-compact .nepa-qr-mini-title, .bdqr-size-compact .bdqr-mini-title {
    font-size: 12px;
    line-height: 1.3;
}

.bdqr-size-small .nepa-qr-mini-thumb, .bdqr-size-small .bdqr-mini-thumb {
    width: 48px;
    height: 48px;
}

.bdqr-size-small .nepa-qr-mini-title, .bdqr-size-small .bdqr-mini-title {
    font-size: 11px;
    line-height: 1.25;
}

.bdqr-size-standard .nepa-qr-mini-thumb, .bdqr-size-standard .bdqr-mini-thumb {
    width: 76px;
    height: 76px;
}

.nepa-qr-mini-thumb, .bdqr-mini-thumb {
    width: 58px;
    height: 58px;
    background: #ffffff;
    border-radius: 6px;
    padding: 2px;
    flex-shrink: 0;
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nepa-qr-mini-thumb img, .bdqr-mini-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.nepa-qr-mini-info, .bdqr-mini-info {
    flex: 1;
    min-width: 0;
}

.nepa-qr-mini-title, .bdqr-mini-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.3;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bdqr-mini-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.bdqr-badge {
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--toolbar-text);
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    display: inline-block;
}

.nepa-qr-play-icon, .bdqr-play-icon {
    font-size: 10px;
    margin-right: 3px;
    color: #e11d48;
}

.nepa-qr-mini-sub, .bdqr-mini-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================================================
   Bottom Footer Bar & Progress
   ========================================================================== */
.nepa-footer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 44px;
    background: var(--toolbar-bg);
    border-top: 1px solid var(--toolbar-border);
    color: var(--toolbar-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    font-size: 12px;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.nepa-footer-bar.is-hidden {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.nepa-nav-footer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--toolbar-text);
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.nepa-nav-footer-btn:hover {
    background: var(--btn-hover);
    border-color: var(--toolbar-text);
}

.nepa-nav-footer-btn:active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    transform: scale(0.96);
}

.nepa-nav-footer-btn.disabled,
.nepa-nav-footer-btn:disabled {
    opacity: 0.35;
    pointer-events: none;
}

.nepa-nav-footer-btn .nepa-nav-icon {
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
}

.nepa-footer-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 0 10px;
}

.nepa-footer-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--toolbar-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 25vw;
}

.nepa-progress-slider {
    flex: 1;
    max-width: 320px;
    height: 6px;
    background: var(--btn-border);
    border-radius: 4px;
    margin: 0 8px;
    overflow: hidden;
}

.nepa-progress-bar-fill {
    width: 8%;
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.25s ease;
}

.nepa-footer-page-wrap {
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    color: var(--toolbar-text);
    flex-shrink: 0;
}

/* ==========================================================================
   Video Modal Popup
   ========================================================================== */
.nepa-video-modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.nepa-video-modal-backdrop.is-open {
    display: flex;
}

.nepa-video-dialog {
    background: #14171a;
    border: 1px solid #2d333b;
    border-radius: 12px;
    width: 100%;
    max-width: 720px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

.nepa-dialog-header {
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1a1e24;
    border-bottom: 1px solid #2d333b;
    color: #f0f6fc;
    font-weight: 600;
    font-size: 14px;
}

.nepa-dialog-close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 18px;
    cursor: pointer;
}

.nepa-dialog-close:hover {
    color: #ffffff;
}

.nepa-dialog-video {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: #000000;
}

.nepa-dialog-video iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%; border: 0;
}

/* ==========================================================================
   Floating Toast Notification
   ========================================================================== */
.nepa-toast {
    position: fixed;
    bottom: 54px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(18, 22, 28, 0.95);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 600;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
}

.nepa-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* ==========================================================================
   Mobile-First Responsive Rules (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .nepa-navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 48px;
        padding: 0 10px;
        z-index: 100;
        border-bottom: 1px solid var(--toolbar-border);
    }

    .nepa-btn-label {
        display: none;
    }

    .nepa-book-title-heading {
        font-size: 13.5px;
        max-width: calc(100vw - 165px);
    }

    .nepa-icon-btn {
        height: 34px;
        padding: 0 8px;
        font-size: 13px;
    }

    .nepa-stage-container {
        position: absolute;
        top: 48px;
        bottom: 44px;
        left: 0;
        right: 0;
        padding: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .nepa-book-page {
        padding: 0 !important;
    }

    .nepa-page-top-header {
        height: 34px !important;
        padding: 0 16px !important;
        font-size: 11px;
        line-height: 1.4;
    }

    .nepa-page-body {
        top: 36px !important;
        bottom: 30px !important;
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
        font-family: var(--book-font-family) !important;
        font-size: var(--font-scale-mobile, 15px);
        line-height: 1.85 !important;
        padding: 16px 18px 20px 18px !important;
        box-sizing: border-box !important;
    }

    .stf__item.--left .nepa-page-body,
    .stf__item.--right .nepa-page-body {
        padding: 16px 18px 20px 18px !important;
    }

    .nepa-page-bottom-footer {
        height: 28px !important;
        padding: 2px 16px !important;
        font-size: 11px;
        line-height: 1.35;
    }

    .nepa-arrow-btn {
        display: none !important;
    }

    .nepa-footer-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 48px;
        padding: 0 8px;
        gap: 6px;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
        z-index: 100;
        border-top: 1px solid var(--toolbar-border);
        transform: translateY(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .nepa-footer-bar.is-hidden {
        transform: translateY(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .nepa-footer-title {
        display: none !important;
    }

    .nepa-footer-center {
        gap: 6px;
        padding: 0 4px;
    }

    .nepa-nav-footer-btn {
        padding: 0 10px;
        height: 32px;
        gap: 4px;
        font-size: 12px;
    }

    .nepa-nav-footer-btn .nepa-nav-icon {
        font-size: 17px;
    }

    .nepa-progress-slider {
        margin: 0 4px;
        max-width: none;
        flex: 1;
        min-width: 40px;
    }

    .nepa-footer-page-wrap {
        font-size: 11px;
        flex-shrink: 0;
    }

    .nepa-modal-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .nepa-menu-dialog, .nepa-search-dialog {
        border-radius: 18px 18px 0 0;
        max-height: 85vh;
        width: 100%;
        max-width: 100vw;
    }
}
