:root {
    color-scheme: light;
    --paper: #f2f1ed;
    --ink: #152e58;
    --red: #bd171e;
    --blue: #172e70;
    --muted: #747b85;
    --line: #d5d6d4;
    font-family: Tahoma, "Noto Naskh Arabic", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid #d99b43; outline-offset: 3px; }
.catalog { width: min(100%, 1160px); margin: auto; padding: 22px 28px 60px; }
.index-screen {
    position: relative; isolation: isolate; min-height: min(840px, calc(100dvh - 44px)); overflow: hidden;
    border: 1px solid rgba(27, 43, 69, .17); background: #f5f5f2; box-shadow: 0 16px 45px rgba(37, 47, 60, .13);
}
.screen-backdrop { position: absolute; z-index: -2; inset: 0; background: url("../images/catalog-background.webp") center / cover no-repeat; opacity: .32; }
.index-screen::after { position: absolute; z-index: -1; content: ""; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,.35), rgba(255,255,255,.66) 48%, rgba(255,255,255,.35)); }
.screen-content { width: min(100%, 900px); min-height: min(840px, calc(100dvh - 44px)); margin: auto; display: grid; grid-template-rows: 106px 1fr 75px; padding: 0 35px; }
.screen-head { position: relative; display: flex; align-items: center; justify-content: center; }
.brand-mark { position: absolute; inset-inline-start: 2px; top: 9px; width: 54px; height: 74px; object-fit: contain; }
.top-instruction { margin: 0; padding: 12px 25px; color: #981b24; background: rgba(255,255,255,.72); font-size: clamp(13px, 1.7vw, 18px); font-weight: 700; text-align: center; }
.music-toggle { position: absolute; inset-inline-end: 0; top: 28px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid rgba(31,48,74,.22); color: var(--blue); background: rgba(255,255,255,.84); cursor: pointer; font-size: 11px; }
.music-toggle:hover, .music-toggle[aria-pressed="true"] { color: white; border-color: var(--red); background: var(--red); }
.music-icon { font-size: 16px; }
.category-map { position: relative; width: min(100%, 650px); margin: auto; height: 100%; min-height: 560px; }
.spine { position: absolute; top: 2%; bottom: 2%; inset-inline-start: 50%; width: 3px; transform: translateX(50%); background: var(--red); }
.spine i { position: absolute; inset-inline-start: 50%; width: 14px; height: 14px; border: 2px solid #fff; border-radius: 50%; background: var(--red); box-shadow: 0 1px 4px rgba(0,0,0,.25); transform: translate(50%, -50%); }
.spine i:nth-child(1) { top: 4%; } .spine i:nth-child(2) { top: 15.5%; } .spine i:nth-child(3) { top: 27%; }
.spine i:nth-child(4) { top: 38.5%; } .spine i:nth-child(5) { top: 50%; } .spine i:nth-child(6) { top: 61.5%; }
.spine i:nth-child(7) { top: 73%; } .spine i:nth-child(8) { top: 84.5%; } .spine i:nth-child(9) { top: 96%; }
.category-list { position: absolute; inset: 0; }
.category-tab {
    position: absolute; width: 41%; height: 43px; display: flex; align-items: center; padding: 0 19px;
    color: #fff; background: linear-gradient(100deg, var(--red), #a90f18); text-decoration: none;
    font-size: clamp(12px, 1.55vw, 16px); font-weight: 700; box-shadow: 0 5px 10px rgba(45,35,40,.22);
    transition: transform .18s ease, filter .18s ease;
}
.category-tab.left { inset-inline-start: 0; justify-content: flex-end; clip-path: polygon(0 0, 87% 0, 100% 50%, 87% 100%, 0 100%); }
.category-tab.right { inset-inline-end: 0; justify-content: flex-start; background: linear-gradient(100deg, #182d70, #101e55); clip-path: polygon(13% 0, 100% 0, 100% 100%, 13% 100%, 0 50%); }
.category-tab:hover { filter: brightness(1.14); transform: translateY(-2px); }
.tab-1 { top: 1%; } .tab-2 { top: 12.5%; } .tab-3 { top: 24%; } .tab-4 { top: 35.5%; }
.tab-5 { top: 47%; } .tab-6 { top: 58.5%; } .tab-7 { top: 70%; } .tab-8 { top: 81.5%; } .tab-9 { top: 93%; }
.screen-foot { position: relative; display: flex; align-items: center; justify-content: center; border-top: 1px solid rgba(29,42,61,.15); }
.screen-foot p { margin: 0; color: #98202a; font-size: clamp(14px, 2vw, 20px); font-weight: 700; }
.hand-cursor { padding-inline-start: 8px; color: #182e6b; font-size: 23px; }
.footer-mark { position: absolute; inset-inline-start: 0; width: 48px; height: 59px; object-fit: contain; }
.screen-count { position: absolute; inset-inline-end: 0; color: #687283; font-size: 11px; }
.reader-section { padding: 56px 0 0; scroll-margin-top: 18px; }
.reader-heading { margin-bottom: 17px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-kicker { color: var(--red); font-size: 11px; font-weight: 700; }
.reader-heading h1 { margin: 6px 0 0; color: var(--blue); font-size: clamp(20px, 3vw, 30px); }
.reader-heading p, .reader-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.reader { overflow: hidden; color: #f6f4ef; background: #182849; box-shadow: 0 12px 35px rgba(22,37,62,.2); }
.reader-bar { min-height: 48px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.15); }
.page-counter { font-size: 12px; }
.tools { display: flex; align-items: center; gap: 3px; direction: ltr; }
.tool-button { width: 34px; height: 34px; border: 0; color: #fff; background: transparent; cursor: pointer; font-size: 22px; }
.tool-button:hover:not(:disabled) { background: rgba(255,255,255,.13); }
.tool-button:disabled { opacity: .4; cursor: default; }
#zoom-level { min-width: 47px; text-align: center; color: #ced5df; font-size: 11px; }
.page-stage { min-height: 540px; padding: 22px; display: flex; justify-content: center; align-items: center; overflow: auto; background: #14223c; touch-action: pan-y; }
.catalog-page { display: block; max-width: 100%; max-height: 74vh; width: auto; height: auto; transform-origin: center; transition: transform .2s ease; box-shadow: 0 10px 28px rgba(0,0,0,.28); user-select: none; backface-visibility: hidden; }
.catalog-page.is-zoomed { max-width: none; max-height: none; }
.catalog-page.turn-forward { animation: page-turn-forward .42s ease-out; }
.catalog-page.turn-back { animation: page-turn-back .42s ease-out; }
@keyframes page-turn-forward {
    0% { clip-path: inset(0 0 0 100%); filter: brightness(.78); }
    100% { clip-path: inset(0 0 0 0); filter: brightness(1); }
}
@keyframes page-turn-back {
    0% { clip-path: inset(0 100% 0 0); filter: brightness(.78); }
    100% { clip-path: inset(0 0 0 0); filter: brightness(1); }
}
.reader-controls { min-height: 55px; padding: 8px 14px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid rgba(255,255,255,.14); }
.page-nav { min-width: 100px; padding: 8px 13px; border: 1px solid rgba(255,255,255,.27); color: white; background: rgba(255,255,255,.06); cursor: pointer; font-size: 11px; }
.page-nav:hover:not(:disabled) { background: rgba(255,255,255,.17); }
.page-nav:disabled { opacity: .35; cursor: default; }
.page-jump { display: flex; align-items: center; gap: 7px; color: #ccd3df; font-size: 11px; }
.page-jump input { width: 48px; height: 30px; border: 1px solid rgba(255,255,255,.28); color: white; background: rgba(255,255,255,.08); text-align: center; direction: ltr; }
.thumbnail-strip { display: flex; gap: 10px; padding: 16px 2px 12px; overflow-x: auto; scrollbar-color: #9cabb8 transparent; }
.thumbnail { flex: 0 0 82px; padding: 5px; border: 1px solid #d3d4d1; color: #394d69; background: #fafaf8; cursor: pointer; }
.thumbnail:hover { border-color: #798ba3; }
.thumbnail.is-active { border: 2px solid var(--red); padding: 4px; }
.thumbnail img { display: block; width: 100%; aspect-ratio: .71; object-fit: cover; background: #e0e1de; }
.thumbnail span { display: block; padding-top: 5px; font-size: 10px; }
.reader-note { padding-top: 4px; }
.reader:fullscreen, .reader.is-fullscreen { position: fixed; z-index: 20; inset: 0; width: 100vw; height: 100dvh; }
.reader:fullscreen .page-stage, .reader.is-fullscreen .page-stage { min-height: 0; flex: 1; }
.reader:fullscreen .catalog-page, .reader.is-fullscreen .catalog-page { max-height: calc(100dvh - 120px); }
body.is-fullscreen { overflow: hidden; }
@media (max-width: 700px) {
    .catalog { padding: 10px 10px 38px; }
    .index-screen { min-height: min(750px, calc(100dvh - 20px)); }
    .screen-content { min-height: min(750px, calc(100dvh - 20px)); grid-template-rows: 95px 1fr 65px; padding: 0 13px; }
    .brand-mark { width: 42px; height: 60px; top: 7px; }
    .top-instruction { margin-inline: 34px; padding: 10px 7px; font-size: 12px; line-height: 1.8; }
    .music-toggle { top: auto; bottom: 2px; inset-inline-end: 0; padding: 5px 8px; font-size: 9px; }
    .category-map { min-height: 480px; width: 100%; }
    .category-tab { width: 44%; height: 38px; padding-inline: 13px; font-size: 11px; }
    .spine { width: 2px; }
    .spine i { width: 12px; height: 12px; }
    .screen-foot { justify-content: center; }
    .screen-foot p { margin-inline: 40px; text-align: center; font-size: 14px; }
    .footer-mark { width: 38px; height: 48px; }
    .screen-count { display: none; }
    .reader-section { padding-top: 38px; }
    .reader-heading { align-items: start; flex-direction: column; gap: 5px; }
    .reader-heading p { font-size: 10px; }
    .page-stage { min-height: min(112vw, 590px); padding: 10px; }
    .catalog-page { max-height: 68vh; }
    .reader-bar { padding-inline: 9px; }
    .page-nav { min-width: 77px; padding: 8px 5px; font-size: 10px; }
    .thumbnail { flex-basis: 67px; }
}
@media (max-width: 390px) {
    .screen-content { padding-inline: 8px; }
    .category-tab { width: 45%; padding-inline: 9px; font-size: 10px; }
    .top-instruction { font-size: 10px; }
    .reader-controls { padding-inline: 6px; }
    .page-nav { min-width: 67px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
