:root {
    --ink: #153d37;
    --ink-deep: #0c2b27;
    --ink-soft: #39645a;
    --gold: #bb8f4d;
    --gold-light: #e2c38d;
    --cream: #f5f0e6;
    --paper: #fcfaf5;
    --line: rgba(21, 61, 55, 0.16);
    --muted: #6f7d75;
    --shadow: 0 20px 55px rgba(20, 46, 39, 0.13);
}
* {
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
}
body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background: var(--cream);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    -webkit-font-smoothing: antialiased;
}
button,
input {
    font: inherit;
}
button {
    cursor: pointer;
}
button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}
[x-cloak] {
    display: none !important;
}
.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}
.icon {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    flex: 0 0 auto;
}
.app-shell {
    min-height: 100vh;
    background:
        radial-gradient(
            circle at 8% 2%,
            rgba(226, 195, 141, 0.2),
            transparent 28rem
        ),
        radial-gradient(
            circle at 94% 22%,
            rgba(179, 213, 192, 0.2),
            transparent 26rem
        ),
        var(--cream);
}
.site-header,
main,
.site-footer {
    width: min(1160px, calc(100% - 48px));
    margin-inline: auto;
}
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 25px 0 21px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
}
.brand-emblem {
    display: grid;
    place-items: center;
    width: 39px;
    height: 39px;
    border: 1px solid var(--gold);
    border-radius: 12px 3px 12px 3px;
    color: var(--gold);
    font-size: 1.4rem;
}
.brand strong,
.brand small {
    display: block;
    letter-spacing: 0.15em;
}
.brand strong {
    font-size: 0.78rem;
    font-weight: 800;
}
.brand small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.54rem;
    letter-spacing: 0.12em;
}
.header-actions,
.heading-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.header-button,
.bookmark-button,
.mobile-meal-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 14px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.32);
    transition: 0.2s ease;
}
.header-button:hover,
.bookmark-button:hover,
.mobile-meal-button:hover {
    border-color: var(--gold);
    background: var(--paper);
    transform: translateY(-1px);
}
.header-button-label {
    font-size: 0.76rem;
    font-weight: 700;
}
.count-badge {
    display: grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    color: var(--paper);
    background: var(--ink);
    font-size: 0.66rem;
}
.reader-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    padding: 29px 0 20px;
    border-bottom: 1px solid var(--line);
}
.eyebrow {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 10px;
    color: var(--gold);
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.eyebrow-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 4px rgba(187, 143, 77, 0.14);
}
h1,
h2,
h3,
p {
    margin-top: 0;
}
h1,
h2,
h3 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    letter-spacing: -0.045em;
}
h1 {
    margin: 0;
    color: var(--ink-deep);
    font-size: 1.85rem;
    line-height: 1;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.reader-title-line {
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.compact-page-number {
    color: var(--muted);
    font-family: Georgia, serif;
    font-size: 0.8rem;
}
.compact-page-number strong {
    color: var(--gold);
    font-size: 1.05rem;
    font-weight: 400;
}
.compact-page-number span {
    margin-left: 3px;
    color: var(--muted);
    font-size: 0.7rem;
}
.page-context {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}
.nav-pill,
.meta-tag,
.sajdah-tag {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
}
.nav-pill {
    max-width: 260px;
    border: 0;
    color: var(--paper);
    background: var(--ink);
}
.nav-pill > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-pill strong {
    margin-left: 4px;
}
.menu-caret {
    margin-left: 8px;
    font-size: 0.9rem;
    line-height: 0.5;
}
.meta-tag {
    color: var(--ink-soft);
    background: rgba(21, 61, 55, 0.09);
}
.meta-tag strong {
    margin-left: 4px;
    color: var(--ink);
}
.page-meta span {
    margin-left: 3px;
    color: var(--muted);
    font-weight: 400;
}
.sajdah-tag {
    color: #7a5723;
    background: rgba(187, 143, 77, 0.2);
}
.menu-wrap {
    position: relative;
}
.jump-menu {
    position: absolute;
    z-index: 12;
    top: calc(100% + 9px);
    left: 0;
    width: 290px;
    padding: 13px;
    border: 1px solid rgba(187, 143, 77, 0.42);
    border-radius: 4px 18px 4px 18px;
    background: var(--paper);
    box-shadow: 0 18px 45px rgba(20, 46, 39, 0.22);
}
.juz-menu {
    width: 220px;
}
.jump-menu-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 5px 11px;
    border-bottom: 1px solid var(--line);
}
.jump-menu-heading strong {
    font-family: Georgia, serif;
    font-size: 1.05rem;
    font-weight: 400;
}
.jump-menu-heading span {
    color: var(--muted);
    font-size: 0.62rem;
}
.jump-menu-list {
    max-height: 355px;
    padding-top: 6px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.jump-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 5px;
    border: 0;
    border-radius: 3px 10px 3px 10px;
    color: var(--ink);
    background: transparent;
    text-align: left;
}
.jump-row:hover {
    background: rgba(226, 195, 141, 0.18);
}
.jump-number {
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    color: var(--gold);
    background: rgba(187, 143, 77, 0.13);
    font-family: Georgia, serif;
    font-size: 0.62rem;
}
.jump-row strong,
.jump-row small {
    display: block;
}
.jump-row strong {
    font-size: 0.76rem;
    font-weight: 700;
}
.jump-row small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.6rem;
}
.reading-progress {
    height: 3px;
    border-radius: 10px;
    background: rgba(21, 61, 55, 0.1);
    overflow: hidden;
}
.reading-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    transition: width 0.35s ease;
}
.page-jump {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
}
.page-jump label {
    color: var(--muted);
    font-size: 0.68rem;
}
.page-jump input {
    width: 47px;
    padding: 6px 2px;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
    text-align: center;
    font-weight: 700;
}
.page-jump input::-webkit-inner-spin-button,
.page-jump input::-webkit-outer-spin-button {
    appearance: none;
    margin: 0;
}
.page-jump button {
    padding: 7px 12px;
    border: 0;
    border-radius: 999px;
    color: var(--paper);
    background: var(--ink);
    font-size: 0.68rem;
    font-weight: 750;
}
.bookmark-button,
.mobile-meal-button {
    padding: 12px 15px;
    font-size: 0.74rem;
    font-weight: 750;
}
.bookmark-button.is-saved {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(226, 195, 141, 0.18);
}
.bookmark-button.is-saved .icon {
    fill: currentColor;
}
.mobile-meal-button {
    display: none;
}
.reading-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
    align-items: start;
    gap: 28px;
    padding: 30px 0 75px;
}
.page-panel,
.meal-panel {
    min-width: 0;
}
.page-panel-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 3px 11px;
}
.panel-label {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.page-number {
    color: var(--gold);
    font-family: Georgia, serif;
    font-size: 0.86rem;
}
.reader-frame {
    position: relative;
    padding: 21px;
    border: 1px solid rgba(187, 143, 77, 0.52);
    border-radius: 4px 36px 4px 36px;
    background: #e6ddca;
    box-shadow:
        0 22px 55px rgba(31, 58, 49, 0.16),
        inset 0 0 0 5px rgba(255, 255, 255, 0.2);
}
.reader-frame::before {
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(21, 61, 55, 0.17);
    border-radius: 1px 28px 1px 28px;
    pointer-events: none;
    content: "";
}
.frame-corner {
    position: absolute;
    z-index: 2;
    width: 20px;
    height: 20px;
    border-color: var(--gold);
    opacity: 0.82;
}
.frame-corner-tl {
    top: 14px;
    left: 14px;
    border-top: 2px solid;
    border-left: 2px solid;
}
.frame-corner-tr {
    top: 14px;
    right: 14px;
    border-top: 2px solid;
    border-right: 2px solid;
}
.frame-corner-bl {
    bottom: 14px;
    left: 14px;
    border-bottom: 2px solid;
    border-left: 2px solid;
}
.frame-corner-br {
    right: 14px;
    bottom: 14px;
    border-right: 2px solid;
    border-bottom: 2px solid;
}
.page-canvas {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 340px;
    border-radius: 2px 18px 2px 18px;
    background: var(--paper);
    box-shadow: 0 8px 20px rgba(21, 61, 55, 0.13);
    overflow: hidden;
}
.quran-page {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: calc(100vh - 190px);
    object-fit: contain;
    background: var(--paper);
}
.image-loader {
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.75rem;
}
.image-loader span,
.spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(187, 143, 77, 0.3);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.reader-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 15px;
    margin-top: 17px;
}
.page-control {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    width: max-content;
    padding: 8px 0;
    border: 0;
    color: var(--ink);
    background: transparent;
    text-align: left;
}
.page-control.next {
    justify-self: end;
    text-align: right;
}
.page-control.next .icon {
    order: 2;
}
.page-control small,
.page-control strong {
    display: block;
}
.page-control small {
    color: var(--gold);
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}
.page-control strong {
    margin-top: 3px;
    font-size: 0.76rem;
    font-weight: 700;
}
.page-counter {
    color: var(--muted);
    font-family: Georgia, serif;
    text-align: center;
    white-space: nowrap;
}
.page-counter strong {
    color: var(--ink);
    font-size: 1.3rem;
    font-weight: 400;
}
.page-counter span {
    margin-left: 5px;
    color: var(--gold);
    font-size: 0.75rem;
}
.meal-panel {
    position: sticky;
    top: 16px;
    height: min(745px, calc(100vh - 32px));
    padding: 24px 25px 20px;
    border: 1px solid rgba(187, 143, 77, 0.45);
    border-radius: 4px 30px 4px 30px;
    background: rgba(255, 255, 255, 0.48);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.meal-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    padding-bottom: 17px;
    border-bottom: 1px solid var(--line);
}
.meal-heading h2 {
    margin: 0;
    font-size: 2.35rem;
    line-height: 0.9;
}
.meal-heading .eyebrow {
    margin-bottom: 10px;
}
.drawer-close {
    display: none;
}
.meal-scroll {
    height: calc(100% - 75px);
    padding: 19px 5px 8px 0;
    overflow-y: auto;
    scrollbar-color: rgba(187, 143, 77, 0.55) transparent;
    scrollbar-width: thin;
}
.meal-loading,
.meal-error,
.meal-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 150px;
    color: var(--muted);
    font-size: 0.76rem;
    text-align: center;
}
.meal-error {
    flex-direction: column;
}
.meal-error strong {
    color: var(--ink);
}
.meal-error button {
    border: 0;
    color: var(--gold);
    background: transparent;
    font-size: 0.72rem;
    font-weight: 750;
    text-decoration: underline;
}
.surah-meal + .surah-meal {
    margin-top: 27px;
    padding-top: 25px;
    border-top: 1px solid var(--line);
}
.surah-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}
.surah-heading h3 {
    margin: 0;
    font-size: 1.6rem;
    line-height: 1;
}
.surah-heading span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.61rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.surah-number {
    color: var(--gold) !important;
    font-family: Georgia, serif;
    font-size: 0.85rem !important;
}
.verse-list {
    display: grid;
}
.verse-row {
    display: grid;
    grid-template-columns: 29px minmax(0, 1fr);
    gap: 11px;
    padding: 15px 7px;
    border-top: 1px solid rgba(21, 61, 55, 0.09);
}
.verse-number {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border: 1px solid rgba(187, 143, 77, 0.52);
    border-radius: 50%;
    color: var(--gold);
    font-family: Georgia, serif;
    font-size: 0.7rem;
}
.verse-copy p {
    margin: 1px 0 0;
    color: var(--ink-soft);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.98rem;
    line-height: 1.6;
}
.sajdah-verse {
    margin-inline: -7px;
    border-radius: 3px 13px 3px 13px;
    background: rgba(187, 143, 77, 0.12);
}
.sajdah-verse .verse-number {
    color: var(--paper);
    background: var(--gold);
}
.sajdah-label {
    display: inline-block;
    margin-top: 8px;
    color: #8a6329;
    font-size: 0.61rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.footnote {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.5;
}
.footnote summary {
    cursor: pointer;
    color: var(--gold);
    font-weight: 700;
}
.footnote p {
    margin: 8px 0 0;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.71rem;
    line-height: 1.6;
    white-space: pre-line;
}
.reader-hint {
    margin: 0 0 38px;
    color: var(--muted);
    font-size: 0.7rem;
    text-align: center;
}
kbd {
    padding: 2px 5px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 4px;
    font-size: 0.64rem;
}
.site-footer {
    display: flex;
    justify-content: space-between;
    padding: 0 0 25px;
    color: var(--muted);
    font-size: 0.54rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.drawer-scrim,
.modal-backdrop {
    position: fixed;
    z-index: 20;
    inset: 0;
    background: rgba(7, 30, 26, 0.55);
    backdrop-filter: blur(8px);
}
.drawer-scrim {
    display: none;
}
.modal-backdrop {
    display: grid;
    place-items: center;
    padding: 24px;
}
.bookmarks-modal {
    width: min(540px, 100%);
    max-height: min(680px, 90vh);
    padding: 28px;
    border-radius: 4px 28px 4px 28px;
    background: var(--paper);
    box-shadow: 0 25px 90px rgba(0, 0, 0, 0.3);
    overflow: auto;
}
.modal-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 21px;
    border-bottom: 1px solid var(--line);
}
.modal-heading h2 {
    margin: 0;
    font-size: 2.1rem;
    line-height: 1;
}
.icon-button {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--ink);
    background: transparent;
}
.icon-button:hover {
    border-color: var(--gold);
    color: var(--gold);
}
.empty-state {
    padding: 52px 14px 35px;
    color: var(--muted);
    text-align: center;
}
.empty-symbol {
    display: block;
    margin-bottom: 11px;
    color: var(--gold);
    font-size: 2rem;
}
.empty-state p {
    margin-bottom: 7px;
    color: var(--ink);
    font-family: Georgia, serif;
    font-size: 1.05rem;
}
.empty-state small {
    display: block;
    font-size: 0.74rem;
    line-height: 1.6;
}
.bookmark-list {
    display: grid;
    gap: 8px;
    padding-top: 17px;
}
.bookmark-row {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 3px 14px 3px 14px;
    color: var(--ink);
    background: rgba(21, 61, 55, 0.045);
    text-align: left;
    transition: 0.2s ease;
}
.bookmark-row:hover {
    border-color: rgba(187, 143, 77, 0.5);
    background: rgba(226, 195, 141, 0.14);
}
.bookmark-page-number {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: var(--gold);
    background: rgba(187, 143, 77, 0.13);
    font-family: Georgia, serif;
    font-size: 0.8rem;
}
.bookmark-page-copy {
    flex: 1;
}
.bookmark-page-copy strong,
.bookmark-page-copy small {
    display: block;
}
.bookmark-page-copy strong {
    font-size: 0.82rem;
}
.bookmark-page-copy small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.68rem;
}
.bookmark-row > .icon {
    color: var(--gold);
}
.toast {
    position: fixed;
    z-index: 30;
    right: 22px;
    bottom: 22px;
    max-width: calc(100% - 44px);
    padding: 12px 17px;
    border-radius: 4px 14px 4px 14px;
    color: var(--paper);
    background: var(--ink-deep);
    box-shadow: var(--shadow);
    font-size: 0.76rem;
}
@media (max-width: 880px) {
    .site-header,
    main,
    .site-footer {
        width: calc(100% - 12px);
    }
    .site-header {
        padding-top: 18px;
    }
    .header-button {
        padding: 9px;
    }
    .header-button-label {
        display: none;
    }
    .reader-heading {
        display: block;
        padding-top: 28px;
    }
    .heading-actions {
        display: grid;
        grid-template-columns: 1fr auto auto;
        margin-top: 17px;
    }
    .page-jump {
        justify-content: space-between;
    }
    .mobile-meal-button {
        display: inline-flex;
        justify-content: center;
    }
    .reading-grid {
        display: block;
        padding-top: 18px;
    }
    .meal-panel {
        position: fixed;
        z-index: 25;
        inset: auto 0 0;
        width: 100%;
        height: min(86vh, 720px);
        padding: 20px 12px 16px;
        border-radius: 28px 28px 0 0;
        background: var(--paper);
        box-shadow: 0 -20px 60px rgba(7, 30, 26, 0.25);
        transform: translateY(105%);
        transition: transform 0.28s ease;
    }
    .meal-panel.is-open {
        transform: translateY(0);
    }
    .drawer-close {
        display: grid;
    }
    .drawer-scrim {
        display: block;
        z-index: 24;
    }
    .reader-frame {
        padding: 8px;
        border-radius: 3px 25px 3px 25px;
    }
    .reader-frame::before {
        inset: 5px;
        border-radius: 1px 20px 1px 20px;
    }
    .quran-page {
        width: 100%;
        max-height: none;
    }
    .page-canvas {
        min-height: 190px;
    }
    .reader-hint {
        margin-top: 25px;
    }
    .jump-menu {
        position: fixed;
        top: 125px;
        left: 6px;
        width: calc(100vw - 12px);
    }
    .juz-menu {
        width: calc(100vw - 12px);
    }
}
@media (max-width: 500px) {
    .brand small {
        font-size: 0.48rem;
    }
    .heading-actions {
        grid-template-columns: 1fr auto;
    }
    .mobile-meal-button {
        grid-column: 1 / -1;
        width: 100%;
    }
    .page-context {
        gap: 5px;
    }
    .nav-pill,
    .meta-tag,
    .sajdah-tag {
        padding-inline: 8px;
    }
    .reader-controls {
        gap: 3px;
    }
    .page-control {
        gap: 4px;
    }
    .page-control strong {
        max-width: 67px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.68rem;
    }
    .page-control small {
        font-size: 0.47rem;
    }
    .bookmarks-modal {
        padding: 24px 18px;
    }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Keyboard guidance is unnecessary when touch is the primary input method. */
@media (hover: none) and (pointer: coarse) {
    .reader-hint {
        display: none;
    }
}

/* Final reader refinements */
.brand-logo {
    width: 39px;
    height: 39px;
    color: var(--gold);
    fill: currentColor;
}
.menu-caret {
    width: 13px;
    height: 13px;
    margin-left: 8px;
    stroke-width: 2.2;
}
.surah-filter {
    display: block;
    width: 100%;
    margin: 10px 0 6px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    outline: 0;
    color: var(--ink);
    background: rgba(21, 61, 55, 0.045);
    font-size: 0.72rem;
}
.surah-filter:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(187, 143, 77, 0.12);
}
.reader-frame {
    padding: 26px;
    border-radius: 2px 11px 2px 11px;
}
.reader-frame {
    padding: 0;
    border: 0;
    border-radius: 2px 10px 2px 10px;
    background: transparent;
    box-shadow: none;
}
.reader-frame::before {
    display: none;
}
.page-canvas {
    padding: 1rem;
    border-radius: 2px 8px 2px 8px;
}
.reader-controls {
    margin-top: 27px;
    direction: rtl;
}
.page-control {
    direction: ltr;
}
.page-control.next {
    justify-self: start;
    text-align: left;
}
.page-control.next .icon {
    order: initial;
}
.page-counter {
    direction: ltr;
}
.meal-panel {
    border-radius: 3px 17px 3px 17px;
}
.nav-pill,
.meta-tag,
.sajdah-tag {
    border-radius: 8px;
}
.nav-pill {
    min-height: 34px;
    padding: 8px 12px;
}
.page-canvas {
    height: clamp(520px, calc(100dvh - 185px), 900px);
    min-height: 0;
}
.quran-page {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.reader-controls {
    width: 100%;
    direction: ltr;
    grid-template-areas: "next counter previous";
}
.reader-controls .page-control.next {
    grid-area: next;
    justify-self: start;
}
.reader-controls .page-counter {
    grid-area: counter;
    justify-self: center;
}
.reader-controls .page-control:not(.next) {
    grid-area: previous;
    justify-self: end;
}

@media (max-width: 880px) {
    .site-header,
    main {
        width: calc(100% - 20px);
    }
    .reader-heading {
        padding-top: 40px;
    }
    .reading-grid {
        padding-top: 29px;
    }
    .reader-frame {
        padding: 0;
        border-radius: 2px 9px 2px 9px;
    }
    .page-canvas {
        border-radius: 2px 7px 2px 7px;
    }
    .meal-panel {
        border-radius: 14px 14px 0 0;
    }
    .jump-menu {
        top: 142px;
        left: 10px;
        width: calc(100vw - 20px);
    }
    .juz-menu {
        width: calc(100vw - 20px);
    }
    .page-canvas {
        height: max(420px, calc(100svh - 285px));
    }
}

/* Let every Quran page determine its own height so no viewport width can crop it. */
.page-canvas {
    height: auto;
    min-height: 0;
    overflow: visible;
}

.quran-page {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: calc(100dvh - 185px);
    object-fit: contain;
}

@media (max-width: 880px) {
    .page-canvas {
        height: auto;
        overflow: visible;
    }

    .quran-page {
        max-height: none;
    }
}

/* Dark reading theme. Quran PNGs are transparent, so inversion preserves the page layout. */
[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e1ebe5;
    --ink-deep: #f4f7f2;
    --ink-soft: #b8cbc1;
    --gold: #d5aa67;
    --gold-light: #e2c38d;
    --cream: #172622;
    --paper: #24352f;
    --line: rgba(225, 235, 229, 0.17);
    --muted: #9bada3;
    --shadow: 0 20px 55px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .app-shell {
    background:
        radial-gradient(circle at 8% 2%, rgba(187, 143, 77, 0.13), transparent 28rem),
        radial-gradient(circle at 94% 22%, rgba(67, 117, 100, 0.16), transparent 26rem),
        var(--cream);
}

[data-theme="dark"] .header-button,
[data-theme="dark"] .page-jump {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .header-button:hover,
[data-theme="dark"] .bookmark-button:hover,
[data-theme="dark"] .mobile-meal-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .surah-filter {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .reader-frame {
    background: transparent;
}

[data-theme="dark"] .page-canvas {
    background: var(--paper);
}

[data-theme="dark"] .quran-page {
    background: transparent;
    filter: invert(1);
}

[data-theme="dark"] .meal-panel,
[data-theme="dark"] .meal-panel.is-open {
    background: rgba(36, 53, 47, 0.96);
}

[data-theme="dark"] .bookmark-row {
    background: rgba(255, 255, 255, 0.055);
}

[data-theme="dark"] .bookmark-row:hover {
    background: rgba(226, 195, 141, 0.12);
}

[data-theme="dark"] .sajdah-label,
[data-theme="dark"] .sajdah-tag {
    color: #e1be80;
}
