/* ═══════════════════════════════════════════
   THE 3D BOOK - CSS
   ═══════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,400&family=Lora:ital,wght@0,400;0,600;0,700;1,400&display=swap');

/* ═══════════════════════════════════════════
   3D BOOK COVER INTRO
   ═══════════════════════════════════════════ */
.book3d-intro {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 48px;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 50% 30%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(168, 85, 247, 0.05) 0%, transparent 50%);
    perspective: 1200px;
    overflow: hidden;
}

.book3d-scene {
    perspective: 1200px;
    width: 340px;
    height: 480px;
}

.book3d-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(5deg) rotateY(-25deg);
    transition: transform 0.4s ease;
    cursor: pointer;
}

/* Front Cover */
.book3d-cover-front {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 4px 16px 16px 4px;
    transform: translateZ(20px);
    backface-visibility: hidden;
    box-shadow:
        0 0 40px rgba(99, 102, 241, 0.15),
        inset 0 0 80px rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    overflow: hidden;
}

[data-theme="light"] .book3d-cover-front {
    background: linear-gradient(135deg, #2c3e6b 0%, #3b5998 50%, #4a6fa5 100%);
}

.book3d-cover-content {
    padding: 48px 32px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
}

.book3d-cover-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: rgba(165, 180, 252, 0.8);
    margin-bottom: 20px;
}

.book3d-cover-content h1 {
    font-family: 'Merriweather', serif;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #e0e7ff, #a5b4fc, #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.book3d-cover-line {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #a5b4fc, transparent);
    margin-bottom: 20px;
}

.book3d-cover-content p {
    font-family: 'Lora', serif;
    font-size: 0.85rem;
    line-height: 1.7;
    color: rgba(200, 210, 255, 0.7);
    margin-bottom: 24px;
}

.book3d-cover-stats {
    display: flex;
    gap: 16px;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(165, 180, 252, 0.6);
}

/* Spine */
.book3d-spine {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(180deg, #0f1629, #1a1a3e);
    transform: rotateY(-90deg) translateZ(0px) translateX(-20px);
    transform-origin: left center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px 0 0 4px;
}

[data-theme="light"] .book3d-spine {
    background: linear-gradient(180deg, #1e3a6e, #2c4a8a);
}

.book3d-spine span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-family: 'Merriweather', serif;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(165, 180, 252, 0.5);
    letter-spacing: 1px;
    white-space: nowrap;
}

/* Back Cover */
.book3d-cover-back {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0f1629, #1a1a2e);
    border-radius: 16px 4px 4px 16px;
    transform: translateZ(-20px);
}

[data-theme="light"] .book3d-cover-back {
    background: linear-gradient(135deg, #1e3a6e, #2c4a8a);
}

/* Page edges */
.book3d-pages-edge {
    position: absolute;
    top: 6px;
    right: -2px;
    width: 40px;
    height: calc(100% - 12px);
    background: repeating-linear-gradient(
        180deg,
        #e8e4dc 0px, #e8e4dc 1px,
        #d4cfc5 1px, #d4cfc5 2px
    );
    transform: rotateY(90deg) translateZ(318px) translateX(20px);
    transform-origin: right center;
    border-radius: 0 2px 2px 0;
}

[data-theme="dark"] .book3d-pages-edge {
    background: repeating-linear-gradient(
        180deg,
        #3a3a4a 0px, #3a3a4a 1px,
        #2a2a3a 1px, #2a2a3a 2px
    );
}

.book3d-pages-bottom {
    position: absolute;
    bottom: -2px;
    left: 20px;
    width: calc(100% - 40px);
    height: 40px;
    background: repeating-linear-gradient(
        90deg,
        #e8e4dc 0px, #e8e4dc 1px,
        #d4cfc5 1px, #d4cfc5 2px
    );
    transform: rotateX(90deg) translateZ(478px) translateY(20px);
    transform-origin: bottom center;
}

[data-theme="dark"] .book3d-pages-bottom {
    background: repeating-linear-gradient(
        90deg,
        #3a3a4a 0px, #3a3a4a 1px,
        #2a2a3a 1px, #2a2a3a 2px
    );
}

/* Open Button */
.book3d-open-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 36px;
    background: linear-gradient(135deg, var(--accent-primary), #a855f7);
    color: white;
    border: none;
    border-radius: 50px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.3);
}

.book3d-open-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
}

/* ═══════════════════════════════════════════
   BOOK READER (3D PAGE STYLE)
   ═══════════════════════════════════════════ */
.book-reader {
    min-height: 100vh;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

.book-reader-enter {
    animation: readerFadeIn 0.5s ease;
}

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

/* ─── Top Bar ─── */
.book-topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: 52px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center;
    padding: 0 24px;
    gap: 16px;
    backdrop-filter: blur(12px);
}

.book-topbar-logo {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--text-primary);
    font-weight: 700; font-size: 0.9rem;
    flex-shrink: 0;
}

.book-topbar-logo span:first-child { font-size: 1.1rem; }

.book-topbar-title {
    flex: 1;
    text-align: center;
    font-family: 'Merriweather', serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-topbar-chapter { color: var(--accent-primary); font-weight: 700; }

.book-topbar-controls { display: flex; gap: 8px; flex-shrink: 0; }

.book-topbar-btn {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.book-topbar-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ─── Reading Progress Bar ─── */
.book-progress {
    position: fixed; top: 52px; left: 0; right: 0;
    height: 3px; z-index: 99;
    background: var(--bg-card);
}

.book-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), #a855f7, #ec4899);
    width: 0%;
    transition: width 0.3s ease;
}

/* ─── TOC Sidebar ─── */
.book-toc {
    position: fixed;
    top: 55px; left: 0; bottom: 0;
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    padding: 24px 0 60px;
}

.book-toc.open { transform: translateX(0); }

[dir="rtl"] .book-toc { left: auto; right: 0; border-right: none; border-left: 1px solid var(--border-color); transform: translateX(100%); }
[dir="rtl"] .book-toc.open { transform: translateX(0); }

.book-toc-overlay {
    position: fixed;
    inset: 0; z-index: 49;
    background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
}

.book-toc-overlay.visible { opacity: 1; pointer-events: all; }

.book-toc-header {
    padding: 0 24px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.book-toc-header h2 {
    font-family: 'Merriweather', serif;
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.book-toc-header p { font-size: 0.8rem; color: var(--text-muted); }

.book-toc-chapter { padding: 0 12px; margin-bottom: 4px; }

.book-toc-chapter-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: none; border: none;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s;
    text-align: left;
}

[dir="rtl"] .book-toc-chapter-btn { text-align: right; }

.book-toc-chapter-btn:hover { background: var(--bg-card); color: var(--text-primary); }

.book-toc-chapter-btn.active { background: var(--tag-bg); color: var(--accent-primary); font-weight: 600; }

.book-toc-chapter-num {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-card);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    flex-shrink: 0;
    color: var(--text-muted);
}

.book-toc-chapter-btn.active .book-toc-chapter-num {
    background: var(--accent-primary);
    color: white;
}

/* ═══════════════════════════════════════════
   3D PAGE CONTAINER
   ═══════════════════════════════════════════ */
.book-page-wrap {
    flex: 1;
    padding-top: 55px;
    display: flex;
    justify-content: center;
}

.book3d-reader {
    display: flex;
    width: 100%;
    max-width: 960px;
    min-height: calc(100vh - 55px);
    position: relative;
}

/* Book gutter shadows — simulate open book spine */
.book3d-gutter {
    width: 32px;
    flex-shrink: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0,0,0,0.03) 40%,
        rgba(0,0,0,0.08) 80%,
        rgba(0,0,0,0.12) 100%
    );
    pointer-events: none;
}

.book3d-gutter-right {
    background: linear-gradient(-90deg,
        transparent 0%,
        rgba(0,0,0,0.03) 40%,
        rgba(0,0,0,0.08) 80%,
        rgba(0,0,0,0.12) 100%
    );
}

[data-theme="light"] .book3d-gutter {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0,0,0,0.01) 40%,
        rgba(0,0,0,0.04) 80%,
        rgba(0,0,0,0.07) 100%
    );
}

[data-theme="light"] .book3d-gutter-right {
    background: linear-gradient(-90deg,
        transparent 0%,
        rgba(0,0,0,0.01) 40%,
        rgba(0,0,0,0.04) 80%,
        rgba(0,0,0,0.07) 100%
    );
}

/* Page container for 3D flips */
.book3d-page-container {
    flex: 1;
    perspective: 1600px;
    transform-style: preserve-3d;
}

/* Page flip animations */
.book3d-flip-next {
    animation: flipOutNext 0.3s ease-in forwards;
}

.book3d-flip-prev {
    animation: flipOutPrev 0.3s ease-in forwards;
}

.book3d-flip-in {
    animation: flipIn 0.35s ease-out forwards;
}

@keyframes flipOutNext {
    0% { transform: perspective(1600px) rotateY(0deg); opacity: 1; }
    100% { transform: perspective(1600px) rotateY(-15deg) translateX(-30px); opacity: 0; }
}

@keyframes flipOutPrev {
    0% { transform: perspective(1600px) rotateY(0deg); opacity: 1; }
    100% { transform: perspective(1600px) rotateY(15deg) translateX(30px); opacity: 0; }
}

@keyframes flipIn {
    0% { transform: perspective(1600px) rotateY(10deg) translateX(20px); opacity: 0; }
    100% { transform: perspective(1600px) rotateY(0deg) translateX(0); opacity: 1; }
}

/* ═══════════════════════════════════════════
   BOOK PAGE CONTENT
   ═══════════════════════════════════════════ */
.book-page {
    width: 100%;
    padding: 60px 56px 120px;
    min-height: calc(100vh - 55px);
    position: relative;
    background: var(--bg-primary);
    /* Paper texture feel */
    box-shadow:
        inset 1px 0 0 rgba(0,0,0,0.04),
        inset -1px 0 0 rgba(0,0,0,0.04);
}

[data-theme="light"] .book-page {
    background: #fffef8;
    box-shadow:
        0 0 40px rgba(0,0,0,0.04),
        inset 1px 0 0 rgba(0,0,0,0.03),
        inset -1px 0 0 rgba(0,0,0,0.03);
}

/* ═══════════════════════════════════════════
   BOOK TYPOGRAPHY
   ═══════════════════════════════════════════ */
.book-page h1 {
    font-family: 'Merriweather', serif;
    font-size: 2.4rem;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.book-page h2 {
    font-family: 'Merriweather', serif;
    font-size: 1.55rem;
    font-weight: 700;
    margin: 48px 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
}

.book-page h3 {
    font-family: 'Merriweather', serif;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 32px 0 12px;
    color: var(--text-primary);
}

.book-page h4 {
    font-family: 'Lora', serif;
    font-size: 1rem;
    font-weight: 600;
    margin: 24px 0 8px;
    color: var(--accent-primary);
}

.book-page p {
    font-family: 'Lora', serif;
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.book-page p strong { color: var(--text-primary); font-weight: 700; }

.book-page p code, .book-page li code, .book-page td code {
    background: var(--code-bg);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.88em;
    color: var(--accent-primary);
}

.book-page ul, .book-page ol {
    font-family: 'Lora', serif;
    font-size: 1.02rem;
    line-height: 1.85;
    color: var(--text-secondary);
    margin-bottom: 20px;
    padding-left: 28px;
}

[dir="rtl"] .book-page ul, [dir="rtl"] .book-page ol { padding-left: 0; padding-right: 28px; }

.book-page li { margin-bottom: 6px; }

.book-page kbd {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.82em;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ═══════════════════════════════════════════
   BK- CLASSES (from book-chapters.js)
   ═══════════════════════════════════════════ */

/* Cover */
.bk-cover {
    text-align: center;
    padding: 80px 0 40px;
}

.bk-cover-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: var(--accent-primary);
    margin-bottom: 16px;
}

.bk-cover h1 {
    font-family: 'Merriweather', serif;
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bk-cover-sub {
    font-family: 'Lora', serif;
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto 32px;
    font-style: italic;
}

.bk-cover-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.bk-cover-stats div {
    text-align: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    min-width: 100px;
}

.bk-cover-stats strong {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-primary);
    font-family: var(--font-mono);
}

.bk-cover-stats span {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Chapter Label & Sub */
.bk-ch-label {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 2px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 8px;
}

.bk-ch-sub {
    font-family: 'Lora', serif;
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 40px;
    line-height: 1.6;
}

/* Separator */
.bk-sep {
    text-align: center;
    margin: 48px 0;
    color: var(--text-muted);
    font-size: 1.2rem;
    letter-spacing: 12px;
}

.bk-sep::before { content: '• • •'; }

/* Code Blocks */
.bk-code {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin: 20px 0;
}

.bk-code-h {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.78rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.bk-code pre {
    padding: 20px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.bk-code .code-comment { color: var(--text-muted); font-style: italic; }

/* Cards Grid */
.bk-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin: 20px 0;
}

.bk-cards-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.bk-card {
    padding: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s;
}

.bk-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }

.bk-card-i { font-size: 1.4rem; margin-bottom: 8px; display: block; }

.bk-card h4 {
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--text-primary);
}

.bk-card p {
    font-size: 0.82rem;
    line-height: 1.55;
    margin: 0;
    color: var(--text-muted);
}

/* Tool References */
.bk-tool {
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 14px 0;
    border-left: 4px solid var(--accent-primary);
    transition: all 0.2s;
}

[dir="rtl"] .bk-tool { border-left: 1px solid var(--border-color); border-right: 4px solid var(--accent-primary); }

.bk-tool:hover { border-color: var(--border-hover); border-left-color: var(--accent-primary); }

.bk-tool h4 {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--accent-primary);
    margin: 0 0 6px;
}

.bk-tool p {
    font-size: 0.88rem;
    margin: 0 0 10px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.bk-params {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bk-params span {
    padding: 3px 10px;
    background: var(--tag-bg);
    border-radius: 6px;
    font-size: 0.73rem;
    font-family: var(--font-mono);
    color: var(--tag-text);
}

/* Tables */
.bk-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9rem;
}

.bk-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

[dir="rtl"] .bk-table th { text-align: right; }

.bk-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    line-height: 1.6;
}

.bk-table code {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.83rem;
}

/* Notes */
.bk-note {
    display: flex;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 12px;
    margin: 24px 0;
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.bk-note p { font-size: 0.9rem; margin: 0; line-height: 1.7; }
.bk-note strong { display: block; margin-bottom: 4px; font-family: 'Inter', sans-serif; font-size: 0.85rem; color: var(--accent-primary); }

.bk-warn { background: rgba(245, 158, 11, 0.06); border-color: rgba(245, 158, 11, 0.2); }
.bk-warn strong { color: var(--warning); }

/* Feature Flags */
.bk-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.bk-flag {
    padding: 4px 12px;
    background: var(--tag-bg);
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--tag-text);
}

/* Species list */
.bk-species {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
    font-family: 'Lora', serif;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 2;
}

.bk-species span {
    padding: 4px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
}

/* Command lists */
.bk-cmd-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 20px;
}

.bk-cmd-list code {
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent-primary);
    transition: all 0.15s;
}

.bk-cmd-list code:hover {
    border-color: var(--accent-primary);
    background: var(--tag-bg);
}

/* ═══════════════════════════════════════════
   PAGE NAVIGATION
   ═══════════════════════════════════════════ */
.book-page-nav {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 60px;
    padding-top: 32px;
    border-top: 2px solid var(--border-color);
}

.book-nav-btn {
    display: flex; flex-direction: column; gap: 4px;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 160px;
    font-family: inherit;
    color: inherit;
}

.book-nav-btn:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
}

.book-nav-next { text-align: right; margin-left: auto; }
[dir="rtl"] .book-nav-next { text-align: left; margin-left: 0; margin-right: auto; }

.book-nav-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.book-nav-title {
    font-family: 'Merriweather', serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Page Number */
.book-page-num {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 48px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    letter-spacing: 2px;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
    .book3d-scene { width: 260px; height: 370px; }
    .book3d-cover-content h1 { font-size: 1.5rem; }
    .book3d-cover-content { padding: 32px 20px; }
    .book-page { padding: 40px 28px 100px; }
    .book-page h1 { font-size: 1.8rem; }
    .book-page h2 { font-size: 1.3rem; }
    .bk-cover h1 { font-size: 2rem; }
    .book-toc { width: 280px; }
    .book-page-nav { flex-direction: column; }
    .book-nav-next { text-align: left; margin-left: 0; }
    .book3d-gutter { display: none; }
}

@media (max-width: 600px) {
    .book3d-scene { width: 220px; height: 310px; }
    .book3d-cover-content h1 { font-size: 1.3rem; }
    .book3d-cover-badge { font-size: 0.6rem; }
    .book-page { padding: 24px 18px 80px; }
    .book-topbar-title { display: none; }
    .book-page p { font-size: 0.95rem; }
    .bk-cards { grid-template-columns: 1fr; }
    .bk-cover-stats { flex-direction: column; align-items: center; }
    .bk-cover-stats div { min-width: 140px; }
}
