/* =========================================================
   VORTEX READER v5 — هادئ، دقيق، ومخصص
   ========================================================= */

/* ---------- الثيمات ---------- */
body.reader-body {
    --bg: #07080b; --panel: #0d1015; --raised: #141a22; --text: #e9edf1; --mute: var(--ds-text-3b);
    --line: rgba(255, 255, 255, 0.08); --line-2: rgba(255, 255, 255, 0.15); --accent: var(--ds-accent); --accent-2: var(--ds-accent-hi); --on-accent: var(--ds-accent-ink);
    background: var(--bg); color: var(--text); overflow-x: hidden;
}
body.reader-body::before { display: none; }
body.reader-body[data-theme="night"] { --bg: #0a1322; --panel: #0e1a2e; --raised: #13223a; --text: #e6edf7; --mute: #8a9bb5; --line: rgba(180, 210, 255, 0.1); --line-2: rgba(180, 210, 255, 0.18); }
body.reader-body[data-theme="sepia"] { --bg: #2a2118; --panel: #33291e; --raised: #3d3224; --text: #ece1cc; --mute: #a89878; --line: rgba(236, 225, 204, 0.1); --line-2: rgba(236, 225, 204, 0.18); --accent: #d9a86a; --accent-2: #f0c98e; --on-accent: #2a1d0c; }
body.reader-body[data-theme="paper"] { --bg: #efebe2; --panel: #f7f4ee; --raised: var(--ds-text-white); --text: #1d222a; --mute: #6b6f76; --line: rgba(0, 0, 0, 0.09); --line-2: rgba(0, 0, 0, 0.16); --accent: #0e86ad; --accent-2: #0b6f8f; --on-accent: var(--ds-text-white); }

body.reader-body button, body.reader-body input { font: inherit; color: inherit; }
body.reader-body button { cursor: pointer; background: none; border: 0; }
body.reader-body a { color: inherit; text-decoration: none; }
body.reader-body :focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.hidden { display: none !important; }
.loading-spinner { width: 32px; height: 32px; margin: 0 auto 16px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: rspin 0.9s linear infinite; }
@keyframes rspin { to { transform: rotate(360deg); } }

/* ---------- الهيدر ---------- */
.reader-header {
    position: fixed; top: 0; inset-inline: 0; z-index: 800; height: 60px;
    background: color-mix(in srgb, var(--bg) 92%, transparent); border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: transform 240ms ease, opacity 240ms ease;
}
.reader-header-inner { height: 100%; display: flex; align-items: center; gap: 12px; padding: 0 14px; max-width: 1400px; margin: 0 auto; }
.reader-logo { display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0; }
.reader-logo img { width: 30px; height: 30px; }
.reader-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.reader-title small { color: var(--mute); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-title b { font-size: 14.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-header-actions { display: flex; align-items: center; gap: 4px; }
.header-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--line-2); }
.reader-icon-btn { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 2px; color: var(--text); transition: background 150ms, color 150ms; }
.reader-icon-btn:hover { background: var(--line); color: var(--accent-2); }
.reader-icon-btn.on { color: var(--accent-2); }
.reader-icon-btn .ico-compress { display: none; }
.reader-icon-btn.on .ico-expand { display: none; }
.reader-icon-btn.on .ico-compress { display: block; }
.reader-progress { position: absolute; inset-inline: 0; bottom: -1px; height: 2px; background: transparent; }
.reader-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 120ms linear; }
body.ui-hidden .reader-header { transform: translateY(-100%); opacity: 0; }

/* ---------- الهيكل ---------- */
.reader-main { max-width: 1400px; margin: 0 auto; padding: 84px 14px 150px; min-height: 100vh; overflow-x: clip; }
.reader-state { max-width: 460px; margin: 16vh auto 0; text-align: center; }
.reader-state h2 { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.reader-state p { margin: 0 0 18px; color: var(--mute); font-size: 14px; }
.reader-state-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.reader-state-icon { width: 58px; height: 58px; margin: 0 auto 16px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 2px; color: var(--accent-2); }

.reader-btn, .btn-ghost { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 2px; border: 1px solid var(--line-2); font-weight: 600; font-size: 14px; }
.reader-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- مقدمة الفصل ---------- */
.reader-chapter-info {
    position: relative; display: grid; grid-template-columns: 148px minmax(0, 1fr) auto; gap: 26px; align-items: end;
    max-width: 920px; margin: 0 auto 30px; padding: 24px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel);
}
.intro-cover { display: block; width: 148px; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 2px; background: var(--raised); outline: 1px solid var(--line-2); outline-offset: 4px; }
.intro-cover img { width: 100%; height: 100%; object-fit: cover; }
.intro-cover.hidden { display: none; }
.intro-text { min-width: 0; }
.intro-text .eyebrow { color: var(--accent-2); font-size: 13px; font-weight: 600; display: block; }
.intro-text h1 { margin: 6px 0 14px; font-size: clamp(24px, 3vw, 34px); font-weight: 800; line-height: 1.25; }
.reader-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--line-2); border-radius: 2px; color: var(--mute); font-size: 12.5px; font-family: var(--mono); }
.chip.views { color: var(--accent-2); }
.chip .icon { width: 14px; height: 14px; }
.reader-chapter-info > .btn { align-self: center; }
.reader-chapter-info .btn { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 2px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.reader-chapter-info .btn:hover { border-color: var(--accent); color: var(--accent-2); }

/* ---------- الصفحات ----------
   نموذج واحد للتكبير: العرض والارتفاع الفعليان يتغيّران بـ --zoom (بدون transform)،
   والحاوية وحدها تتمرر أفقياً عند التكبير، فلا يتمدد المستند ولا تتحرك الواجهة. */
.reader-pages {
    --gap: 0px; --maxw: 920px; --zoom: 1; --margin: 0px;
    --base-w: min(100%, var(--maxw));
    display: block; width: 100%; max-width: 100%;
    padding-inline: var(--margin);
    overflow-x: auto; overflow-y: visible; overscroll-behavior-x: contain;
    scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
    direction: rtl; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.reader-pages.ltr { direction: ltr; }
.reader-page { position: relative; width: calc(var(--base-w) * var(--zoom)); margin-inline: auto; }
.reader-page + .reader-page { margin-top: var(--gap); }
.reader-page img { display: block; width: 100%; height: auto; pointer-events: none; -webkit-user-drag: none; }
.reader-page:not(.loaded):not(.failed) { min-height: 62vh; border-radius: 2px; background: linear-gradient(100deg, var(--raised) 30%, var(--line-2) 50%, var(--raised) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.reader-page.failed { min-height: 220px; border: 1px dashed var(--line-2); border-radius: 2px; display: grid; place-items: center; }
.reader-page.failed::after { content: "تعذر تحميل الصفحة"; color: var(--mute); font-size: 14px; }
.reader-page.failed img { display: none; }

/* العرض: عرض الحاوية مع حد أقصى، والتكبير يضاعفه */
.reader-pages.fit-width .reader-page { width: calc(var(--base-w) * var(--zoom)); }
/* الارتفاع: الصورة بارتفاع الشاشة، والعرض تابع للنسبة */
.reader-pages.fit-height .reader-page { width: auto; max-width: none; }
.reader-pages.fit-height .reader-page img { width: auto; height: calc((100dvh - 170px) * var(--zoom)); max-width: none; }
/* الأصلي: عرض ثابت بالحد الأقصى يتضاعف بالتكبير */
.reader-pages.fit-original .reader-page { width: calc(var(--maxw) * var(--zoom)); }

/* صفحة واحدة / صفحتان */
.reader-pages.paged {
    display: flex; flex-direction: row; justify-content: safe center; align-items: center; gap: var(--gap);
    min-height: calc(100dvh - 170px);
}
.reader-pages.paged .reader-page { display: none; margin-inline: 0; }
.reader-pages.paged .reader-page.current { display: block; }
.reader-pages.paged .reader-page:not(.loaded):not(.failed) { min-height: calc(100dvh - 170px); width: min(92vw, 600px); }
.reader-pages.paged.fit-width .reader-page { width: calc(var(--base-w) * var(--zoom)); }
.reader-pages.paged.fit-height .reader-page { width: auto; max-width: none; }
.reader-pages.paged.fit-height .reader-page img { height: calc((100dvh - 170px) * var(--zoom)); width: auto; max-width: none; }
.reader-pages.paged.fit-original .reader-page { width: calc(var(--maxw) * var(--zoom)); }
.reader-pages.paged.mode-double .reader-page { width: calc(var(--base-w) / 2 * var(--zoom)); }
.reader-pages.paged.mode-double.fit-height .reader-page { width: auto; }

/* ---------- شريط التمرير الجانبي (Webtoon) ---------- */
.scrub { position: fixed; inset-inline-start: 6px; top: 80px; bottom: 150px; width: 26px; z-index: 700; opacity: 0; transition: opacity 200ms; pointer-events: none; }
body[data-mode="vertical"] .scrub { pointer-events: auto; }
body:not(.ui-hidden) .scrub, .scrub.active { opacity: 1; }
body[data-mode]:not([data-mode="vertical"]) .scrub { display: none; }
.scrub-track { position: relative; height: 100%; width: 100%; cursor: ns-resize; touch-action: none; }
.scrub-track::before { content: ""; position: absolute; inset-inline-start: 12px; top: 0; bottom: 0; width: 2px; background: var(--line-2); }
.scrub-thumb { position: absolute; inset-inline-start: 7px; width: 12px; height: 40px; border-radius: 2px; background: var(--accent); top: 0; }
.scrub-bubble { position: absolute; top: 50%; inset-inline-start: 22px; transform: translateY(-50%); padding: 3px 9px; border-radius: 2px; background: var(--raised); border: 1px solid var(--line-2); font-family: var(--mono); font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity 150ms; pointer-events: none; }
.scrub.active .scrub-bubble { opacity: 1; }
.scrub-thumb { pointer-events: none; }

/* ---------- الشريط السفلي ---------- */
.reader-bottom-bar { position: fixed; bottom: 18px; left: 50%; z-index: 780; transform: translateX(-50%); transition: transform 240ms ease, opacity 240ms ease; }
body.ui-hidden .reader-bottom-bar { transform: translate(-50%, 24px); opacity: 0; pointer-events: none; }
.reader-bottom-inner {
    display: flex; align-items: center; gap: 2px; padding: 6px; border: 1px solid var(--line-2); border-radius: 2px;
    background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); max-width: calc(100vw - 24px);
}
.reader-control { min-width: 40px; height: 40px; padding: 0 8px; display: grid; place-items: center; border-radius: 2px; color: var(--text); font-size: 13px; font-family: var(--mono); transition: background 150ms, color 150ms; }
.reader-control:hover { background: var(--line); color: var(--accent-2); }
.reader-control.auto-on { background: var(--accent); color: var(--on-accent); }
.reader-control.zoom-val { min-width: 58px; }
.reader-control-divider { width: 1px; height: 22px; margin: 0 4px; background: var(--line-2); }
.page-counter { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 84px; height: 40px; padding: 0 8px; direction: ltr; font-family: var(--mono); font-size: 13.5px; color: var(--mute); }
.page-counter strong { color: var(--text); font-weight: 500; }
body.no-counter .page-counter { display: none; }
.reader-control[hidden] { display: none; }
body[data-mode="vertical"] .only-vertical { display: grid; }
body[data-mode]:not([data-mode="vertical"]) .only-vertical { display: none; }

/* ---------- أدوات جانبية ---------- */
.reader-toast { position: fixed; top: 74px; left: 50%; z-index: 1100; transform: translate(-50%, -8px); padding: 9px 16px; border-radius: 2px; background: var(--raised); border: 1px solid var(--line-2); font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 200ms, transform 200ms; white-space: nowrap; }
.reader-toast.show { opacity: 1; transform: translate(-50%, 0); }

.next-pill {
    position: fixed; bottom: 90px; left: 50%; z-index: 790; transform: translate(-50%, 12px); display: inline-flex; align-items: center; gap: 10px;
    padding: 0 18px; min-height: 44px; border-radius: 2px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 14px;
    opacity: 0; pointer-events: none; transition: opacity 200ms, transform 200ms;
}
.next-pill.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
body.ui-hidden .next-pill.show { bottom: 26px; }

/* ---------- لوحة الإعدادات ---------- */
.reader-overlay { position: fixed; inset: 0; z-index: 850; background: rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none; transition: opacity 200ms; }
.reader-overlay.open { opacity: 1; pointer-events: auto; }

.reader-settings {
    position: fixed; top: 0; bottom: 0; right: 0; z-index: 900; width: min(400px, 100%); display: flex; flex-direction: column;
    background: var(--panel); border-inline-start: 1px solid var(--line-2); transform: translateX(102%); transition: transform 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reader-settings.open { transform: none; }
.rs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 22px 16px; border-bottom: 1px solid var(--line); }
.rs-head small { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em; color: var(--mute); }
.rs-head h2 { margin: 4px 0 0; font-size: 19px; font-weight: 800; }
.rs-close { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 2px; color: var(--text); }
.rs-close:hover { border-color: var(--accent); color: var(--accent-2); }
.rs-tabs { display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 22px; border-bottom: 1px solid var(--line); }
.rs-tab { position: relative; padding: 14px 0; color: var(--mute); font-size: 14px; font-weight: 600; }
.rs-tab.on { color: var(--text); }
.rs-tab.on::after { content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; background: var(--accent); }
.rs-body { flex: 1; overflow-y: auto; padding: 8px 22px 18px; }
.rs-group { padding: 16px 0; border-bottom: 1px solid var(--line); }
.rs-group h3 { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; color: var(--mute); }
.rs-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rs-row h3 { margin-bottom: 10px; }
.rs-out { font-family: var(--mono); font-size: 12.5px; color: var(--accent-2); font-weight: 500; direction: ltr; }

.seg2, .seg3 { display: grid; gap: 6px; }
.seg2 { grid-template-columns: repeat(2, 1fr); }
.seg3 { grid-template-columns: repeat(3, 1fr); }
.settings-option {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-height: 66px; padding: 10px 6px;
    border: 1px solid var(--line); border-radius: 2px; background: var(--raised); color: var(--mute); font-size: 13px; font-weight: 600; transition: border-color 150ms, color 150ms, background 150ms;
}
.seg2 .settings-option { flex-direction: row; min-height: 46px; }
.settings-option:hover { border-color: var(--line-2); color: var(--text); }
.settings-option.active { border-color: var(--accent); color: var(--accent-2); background: color-mix(in srgb, var(--accent) 12%, var(--raised)); }
.settings-option .icon { width: 20px; height: 20px; }
.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.settings-option.theme { min-height: 74px; }
.chip-sw { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-2); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.04); }
.settings-option.theme.active .chip-sw { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--accent); }

input.range { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; padding: 0; background: transparent; border: 0; min-height: 0; direction: ltr; }
input.range::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--line-2) var(--fill, 50%)); }
input.range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 0; background: var(--accent-2); border: 0; transform: rotate(45deg); }
input.range::-moz-range-track { height: 2px; background: var(--line-2); }
input.range::-moz-range-progress { height: 2px; background: var(--accent); }
input.range::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 0; background: var(--accent-2); transform: rotate(45deg); }

.rs-toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.rs-toggle span:first-child { display: flex; flex-direction: column; gap: 2px; }
.rs-toggle strong { font-size: 14px; font-weight: 600; }
.rs-toggle small { color: var(--mute); font-size: 12px; line-height: 1.6; }
.rs-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.rs-toggle .sw { position: relative; flex-shrink: 0; width: 40px; height: 22px; border-radius: 2px; border: 1px solid var(--line-2); background: var(--raised); transition: background 150ms, border-color 150ms; }
.rs-toggle .sw::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 14px; height: 14px; border-radius: 1px; background: var(--mute); transition: transform 180ms, background 150ms; }
.rs-toggle input:checked + .sw { background: var(--accent); border-color: var(--accent); }
.rs-toggle input:checked + .sw::after { transform: translateX(-18px); background: var(--on-accent); }
.rs-toggle input:focus-visible + .sw { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.keys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; font-size: 12.5px; color: var(--mute); }
.keys-grid span { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 2px; background: var(--raised); color: var(--text); font-family: var(--mono); font-size: 11px; }
.rs-link { display: block; width: 100%; padding: 12px; color: var(--accent-2); font-size: 13.5px; font-weight: 600; text-align: center; border: 1px dashed var(--line-2); border-radius: 2px; margin-top: 14px; }
.rs-link:hover { border-color: var(--accent); }
.rs-foot { padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.rs-foot .rs-link { margin-top: 0; border-style: solid; }

/* ---------- قائمة الفصول ---------- */
.chapters-modal { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 16px; opacity: 0; pointer-events: none; transition: opacity 200ms; }
.chapters-modal.open { opacity: 1; pointer-events: auto; }
.chapters-panel { width: min(560px, 100%); max-height: min(82vh, 760px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-2); border-radius: 2px; overflow: hidden; }
.chapters-panel .rs-head { padding: 18px 20px 14px; }
.modal-search { position: relative; display: flex; align-items: center; margin: 14px 20px 6px; }
.modal-search .icon { position: absolute; inset-inline-start: 12px; color: var(--mute); pointer-events: none; width: 18px; height: 18px; }
.modal-search input { width: 100%; height: 44px; padding: 0 40px 0 14px; border: 1px solid var(--line-2); border-radius: 2px; background: var(--raised); color: var(--text); outline: none; }
.modal-search input:focus { border-color: var(--accent); }
.modal-search input::placeholder { color: var(--mute); }
.chapters-list { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.chapter-vol { display: flex; align-items: center; gap: 8px; margin: 14px 8px 6px; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; color: var(--mute); }
.chapter-vol .icon { width: 14px; height: 14px; }
.chapter-item { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 2px; color: var(--text); transition: background 120ms; }
.chapter-item:hover { background: var(--raised); }
.chapter-item.current { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.chapter-num { display: grid; place-items: center; width: 50px; height: 40px; border: 1px solid var(--line-2); border-radius: 2px; font-family: var(--mono); font-size: 15px; font-weight: 500; direction: ltr; }
.chapter-item.current .chapter-num { border-color: var(--accent); color: var(--accent-2); }
.chapter-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.chapter-done { color: var(--accent-2); }
.chapter-done .icon { width: 15px; height: 15px; }
.chapter-views { display: inline-flex; align-items: center; gap: 4px; color: var(--mute); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.chapter-views .icon { width: 13px; height: 13px; }

/* ---------- نهاية الفصل ---------- */
.reader-end { max-width: 620px; margin: 56px auto 0; padding: 36px 26px 30px; text-align: center; border-top: 1px solid var(--line); }
.reader-end-badge { width: 52px; height: 52px; margin: 0 auto 14px; display: grid; place-items: center; border: 1px solid var(--accent); border-radius: 2px; color: var(--accent-2); }
.reader-end h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.reader-end > p { margin: 0 0 22px; color: var(--mute); font-size: 14.5px; }
.next-card { display: flex; align-items: center; gap: 16px; text-align: start; padding: 16px 18px; border: 1px solid var(--line-2); border-radius: 2px; background: var(--panel); transition: border-color 150ms; }
.next-card:hover { border-color: var(--accent); }
.next-card.hidden { display: none; }
.next-card-main { flex: 1; min-width: 0; }
.next-card-main small { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--accent-2); letter-spacing: 0.06em; }
.next-card-main b { display: block; margin-top: 3px; font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-card-go { width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center; border-radius: 2px; background: var(--accent); color: var(--on-accent); }
.reader-navigation { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.reader-navigation .btn { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 2px; font-size: 13.5px; font-weight: 600; }
.reader-navigation .btn:hover { border-color: var(--accent); color: var(--accent-2); }
.reader-navigation .btn.hidden { display: none; }
#end-fav.on { border-color: #ff7a93; color: var(--ds-danger-soft); }

/* ---------- الطباعة والحماية ---------- */
@media print { body.reader-body * { display: none !important; } body.reader-body::after { content: "المحتوى غير متاح للطباعة"; display: block !important; text-align: center; padding: 40vh 0; } }
.reader-pages, .reader-pages * { -webkit-user-select: none; user-select: none; }

/* ---------- الجوال ---------- */
@media (max-width: 900px) {
    .reader-chapter-info { grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 18px; }
    .intro-cover { width: 96px; }
    .reader-chapter-info > .btn { grid-column: 1 / -1; justify-self: stretch; justify-content: center; }
    .reader-control.zoom-val { display: none; }
}
@media (max-width: 720px) {
    .hide-sm { display: none !important; }
    .reader-main { padding: 74px 0 130px; }
    .reader-chapter-info { margin: 0 12px 22px; }
    .reader-pages:not(.paged) { padding-inline: 0; }
    .reader-bottom-inner { gap: 0; padding: 4px; }
    .reader-control { min-width: 36px; height: 38px; padding: 0 5px; }
    .reader-control-divider { margin: 0 2px; }
    .page-counter { min-width: 70px; font-size: 12.5px; }
    .reader-settings { width: 100%; }
    .chapters-modal { place-items: end center; padding: 0; }
    .chapters-panel { width: 100%; max-height: 84vh; border-radius: 2px 2px 0 0; border-width: 1px 0 0; }
    .chapter-item { grid-template-columns: 46px minmax(0, 1fr) auto; }
    .chapter-views { display: none; }
    .reader-end { margin-top: 40px; padding: 30px 18px 26px; }
}
@media (max-width: 380px) {
    .reader-title b { font-size: 13px; }
    .reader-icon-btn { width: 34px; }
}
