/* Kitab — design system (see docs/DESIGN.md). Local fonts only; no frameworks. */

@font-face { font-family: "Hafs"; src: url("../fonts/hafs.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "QuranWBW"; src: url("../fonts/quranwbw.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "SolaimanLipi"; src: url("../fonts/solaimanlipi.woff") format("woff"); font-display: swap; }

/* ---------- Tokens ---------- */
:root {
    --paper: #f2f4f7;
    --leaf: #ffffff;
    --ink: #18202f;
    --faint: #5b6579;
    --lapis: #1e4c8a;
    --lapis-ink: #ffffff;
    --lapis-wash: #e3ebf6;
    --gilt: #b3812a;
    --gilt-wash: #f6ecd9;
    --rule: #dae0e8;
    --mark: #fde9a8;
    --danger: #b3261e;
    --ok: #1f6b3d;
    --scrim: rgb(13 20 36 / .45);
    --lift: 0 1px 2px rgb(24 32 47 / .06), 0 8px 24px rgb(24 32 47 / .08);

    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Bitstream Charter", Georgia, serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    --bn: "SolaimanLipi", "Noto Sans Bengali", "Noto Serif Bengali", sans-serif;
    --ar: "Hafs", "KFGQPC Uthmanic Script HAFS", "Amiri Quran", "Scheherazade New", "Noto Naskh Arabic", serif;

    /* Classical scale */
    --t-xs: .8125rem;  /* 13 */
    --t-sm: .9375rem;  /* 15 */
    --t-md: 1.0625rem; /* 17 */
    --t-lg: 1.25rem;   /* 20 */
    --t-xl: 1.5rem;    /* 24 */
    --t-2xl: 1.875rem; /* 30 */
    --t-3xl: 2.5rem;   /* 40 */

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 18px;
    --bar-h: 56px;
    --tab-h: 64px;
    --measure: 68ch;
    --reader-scale: 1;
    --reader-leading: 1;
    color-scheme: light;
}

:root[data-theme="sepia"] {
    --paper: #f1e6cf;
    --leaf: #f8efdb;
    --ink: #3b2f1f;
    --faint: #6e604b;
    --lapis: #6a4a1c;
    --lapis-ink: #fff8ea;
    --lapis-wash: #e8d8b6;
    --gilt: #9b6b1e;
    --gilt-wash: #ead7b0;
    --rule: #decdaa;
    --mark: #f3d58a;
    --lift: 0 1px 2px rgb(59 47 31 / .08), 0 8px 24px rgb(59 47 31 / .1);
}

:root[data-theme="dark"] {
    --paper: #0d1424;
    --leaf: #141d31;
    --ink: #e4e8f0;
    --faint: #97a3ba;
    --lapis: #86aeea;
    --lapis-ink: #0d1424;
    --lapis-wash: #1c2b48;
    --gilt: #d8ae5e;
    --gilt-wash: #2e2a20;
    --rule: #26314a;
    --mark: #5d4c1a;
    --danger: #ff8a80;
    --ok: #82d49e;
    --scrim: rgb(0 0 0 / .6);
    --lift: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="sepia"]) {
        --paper: #0d1424;
        --leaf: #141d31;
        --ink: #e4e8f0;
        --faint: #97a3ba;
        --lapis: #86aeea;
        --lapis-ink: #0d1424;
        --lapis-wash: #1c2b48;
        --gilt: #d8ae5e;
        --gilt-wash: #2e2a20;
        --rule: #26314a;
        --mark: #5d4c1a;
        --danger: #ff8a80;
        --ok: #82d49e;
        --scrim: rgb(0 0 0 / .6);
        --lift: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .35);
        color-scheme: dark;
    }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 56px); }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    color: var(--ink);
    font: 400 var(--t-md)/1.6 var(--sans);
    -webkit-font-smoothing: antialiased;
}
main { flex: 1; outline: none; padding-bottom: 56px; }
img { max-width: 100%; height: auto; }
a { color: var(--lapis); text-underline-offset: .18em; text-decoration-thickness: 1px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(var(--t-xl), 1.2rem + 2vw, var(--t-3xl)); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
p { margin: 0 0 1em; }
:lang(bn) { font-family: var(--bn); letter-spacing: 0; }
:lang(ar) { font-family: var(--ar); letter-spacing: 0; }
h1:lang(bn), h2:lang(bn), h3:lang(bn) { font-family: var(--bn); font-weight: 700; }
:focus-visible { outline: 2px solid var(--lapis); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
::selection { background: var(--lapis-wash); }

.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; }
.skip-link { position: absolute; left: 12px; top: -80px; z-index: 200; padding: 10px 16px; background: var(--lapis); color: var(--lapis-ink); border-radius: var(--r-sm); }
.skip-link:focus { top: 12px; }
.muted { color: var(--faint); }
.small { font-size: var(--t-sm); }
.center { text-align: center; }
.spaced { margin-top: 32px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 28px; } }
.container--narrow { max-width: 520px; }
.container--wide { max-width: 1280px; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5em;
    min-height: 44px; padding: 0 20px; border: 1px solid var(--lapis); border-radius: var(--r-md);
    background: var(--lapis); color: var(--lapis-ink);
    font: 600 var(--t-sm)/1 var(--sans); text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: transparent; color: var(--lapis); border-color: var(--rule); }
.btn--ghost:hover { background: var(--lapis-wash); filter: none; }
.btn--sm { min-height: 36px; padding: 0 14px; }
.btn--block { width: 100%; }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--lapis); font: inherit; text-decoration: underline; cursor: pointer; }
.iconbtn {
    display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
    border: 0; border-radius: 50%; background: transparent; color: inherit;
    font: 600 var(--t-sm)/1 var(--sans); text-decoration: none; cursor: pointer;
}
.iconbtn:hover { background: var(--lapis-wash); }
.iconbtn.is-disabled { opacity: .3; pointer-events: none; }
.iconbtn--sm { width: 36px; height: 36px; color: var(--faint); }

/* ---------- Top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--paper) 90%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--rule);
}
.topbar__inner { display: flex; align-items: center; gap: 12px; height: var(--bar-h); max-width: 1280px; margin: 0 auto; padding: 0 8px 0 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 600 var(--t-lg)/1 var(--serif); }
.brand__mark { width: 26px; height: 26px; color: var(--gilt); }
.mainnav { display: none; margin-left: 20px; gap: 2px; }
.mainnav a { padding: 8px 12px; color: var(--faint); text-decoration: none; font-size: var(--t-sm); font-weight: 500; }
.mainnav a:hover { color: var(--ink); }
.mainnav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--lapis); }
.topbar__end { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.topbar__end form { margin: 0; }
.topbar__login { display: none; }
@media (min-width: 900px) {
    .mainnav { display: flex; }
    .topbar__login { display: inline-flex; }
}

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 220px; padding: 6px;
    background: var(--leaf); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: var(--lift);
}
.menu__panel a, .menu__panel button { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: inherit; font-size: var(--t-sm); text-align: left; text-decoration: none; cursor: pointer; }
.menu__panel a:hover, .menu__panel button:hover { background: var(--lapis-wash); }
.menu__who { margin: 6px 12px 8px; font-weight: 600; }
.menu__panel hr { border: 0; border-top: 1px solid var(--rule); margin: 6px 0; }

/* Bottom tab bar (phones) */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--leaf); border-top: 1px solid var(--rule);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 11.5px; font-weight: 600; text-decoration: none; }
.tabbar a .icon { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--lapis); }
body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
    .tabbar { display: none; }
    body { padding-bottom: 0; }
}

.subnav { display: flex; gap: 4px; max-width: 1280px; margin: 0 auto; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; }
.subnav a, .tabs a { padding: 6px 12px; border-radius: var(--r-sm); color: var(--faint); font-size: var(--t-sm); text-decoration: none; white-space: nowrap; }
.subnav a[aria-current], .tabs a[aria-current] { background: var(--lapis-wash); color: var(--lapis); font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 20px; }

.footer { padding: 28px 16px 32px; color: var(--faint); font-size: var(--t-sm); text-align: center; }
.footer p { margin: 0; }
.footer a { color: inherit; }

/* ---------- Flash & toast ---------- */
.flashes { display: grid; gap: 8px; margin-top: 16px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 8px 12px 16px; border-radius: var(--r-md); background: var(--leaf); border: 1px solid var(--rule); box-shadow: inset 3px 0 0 var(--lapis); }
.flash > * { min-width: 0; overflow-wrap: anywhere; }
.flash > span { flex: 1; }
.flash--success { box-shadow: inset 3px 0 0 var(--ok); }
.flash--error { box-shadow: inset 3px 0 0 var(--danger); }
.flash__close { padding: 6px; border: 0; border-radius: var(--r-sm); background: none; color: var(--faint); cursor: pointer; }
.toast {
    position: fixed; left: 50%; bottom: calc(var(--tab-h) + 88px); z-index: 120; transform: translateX(-50%);
    padding: 10px 18px; border-radius: var(--r-md); background: var(--ink); color: var(--paper);
    font-size: var(--t-sm); box-shadow: var(--lift); animation: toast-rise .2s ease-out;
}
@media (min-width: 900px) { .toast { bottom: 96px; } }

/* ---------- Forms ---------- */
.stack { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: var(--t-sm); font-weight: 600; }
input, select, textarea {
    width: 100%; min-height: 46px; padding: 10px 14px;
    border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--leaf); color: inherit; font: inherit;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lapis); outline-offset: -1px; border-color: transparent; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--lapis); }
input[type="range"] { padding: 0; min-height: 28px; border: 0; background: none; accent-color: var(--lapis); }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; }
fieldset { display: grid; gap: 6px; margin: 0; padding: 12px 16px; border: 1px solid var(--rule); border-radius: var(--r-md); }
legend { padding: 0 6px; font-weight: 600; font-size: var(--t-sm); }
.form-grid { grid-template-columns: 1fr; }
@media (min-width: 720px) { .form-grid { grid-template-columns: 1fr 1fr; } .field--wide { grid-column: 1 / -1; } }
.form-msg { min-height: 1.5em; margin: 0; color: var(--faint); }
.form-msg.is-error { color: var(--danger); }
.inline-form { display: flex; align-items: center; gap: 8px; margin: 0; }
.inline-form--wrap { flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 16px; }
.field--inline { min-width: 200px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.field-search { position: relative; display: flex; align-items: center; }
.field-search > .icon { position: absolute; left: 14px; color: var(--faint); pointer-events: none; }
.field-search input { padding-left: 44px; }
.segmented { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--rule); }
.segmented button { min-height: 38px; padding: 0 14px; border: 0; border-radius: 7px; background: none; color: var(--faint); font: 600 var(--t-sm)/1 var(--sans); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--leaf); color: var(--ink); box-shadow: var(--lift); }

/* ---------- Medallion: the one gilded element ---------- */
.mark {
    position: relative; display: inline-grid; place-items: center; width: 2.15em; height: 2.15em;
    margin-inline-end: .35em; padding: 0; border: 0; background: none; color: var(--gilt);
    font: 600 .7em/1 var(--sans); vertical-align: -.6em; cursor: pointer;
}
.mark svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mark__n { position: relative; color: var(--ink); font-variant-numeric: tabular-nums; }
.vcell--ara .mark { font-family: var(--ar); font-size: .5em; vertical-align: -.5em; }
.vcell--ara .mark__n { font-size: 1.25em; }
.vcell--bn .mark { font-family: var(--bn); }
.vcell--bn .mark__n { font-size: 1.1em; }
.mark:hover, .mark:focus-visible { color: var(--lapis); }
.verse.is-bookmarked .mark { color: var(--lapis); }
.verse.is-bookmarked .mark::after { content: ""; position: absolute; top: 0; right: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--lapis); box-shadow: 0 0 0 2px var(--paper); }

/* ---------- Library ---------- */
.lib-head { padding: 28px 0 0; }
.lib-head h1 { margin-bottom: 6px; }
.lib-head p { max-width: 52ch; color: var(--faint); }
.lib-search { max-width: 560px; margin-top: 16px; }
.lib-search input { min-height: 52px; }

.resume { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin-top: 20px; padding: 14px 18px 14px 14px; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--leaf); color: var(--ink); text-decoration: none; }
.resume:hover { border-color: var(--lapis); }
.resume__mark { width: 42px; height: 42px; color: var(--gilt); }
.resume__title { display: block; font: 600 var(--t-lg)/1.3 var(--serif); }
.resume__meta { display: block; color: var(--faint); font-size: var(--t-sm); }
.resume__go { color: var(--lapis); font-size: var(--t-sm); font-weight: 600; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.chip { min-height: 36px; padding: 0 14px; border: 1px solid var(--rule); border-radius: 999px; background: var(--leaf); color: var(--ink); font: 500 var(--t-sm)/1 var(--sans); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.shelf { margin-top: 32px; }
.shelf__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.shelf__head h3 { margin: 0; font-size: var(--t-xl); }
.shelf__count { color: var(--faint); font-size: var(--t-sm); }

.books { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.book { position: relative; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 14px; padding: 8px 4px; border-radius: var(--r-md); }
.book:hover { background: var(--leaf); }
.book__cover { display: block; width: 48px; aspect-ratio: 5 / 7; overflow: hidden; border-radius: 3px; background: var(--rule); box-shadow: 0 1px 3px rgb(0 0 0 / .2); }
.book__cover img { width: 100%; height: 100%; object-fit: cover; }
.book__link { min-width: 0; color: var(--ink); text-decoration: none; }
.book__link::after { content: ""; position: absolute; inset: 0; }
.book__name { display: block; font-weight: 600; line-height: 1.35; }
.book__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 2px; color: var(--faint); font-size: var(--t-xs); }
.book__meta .icon { width: 1.1em; height: 1.1em; }
.pick { position: relative; z-index: 1; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--faint); cursor: pointer; }
.pick:hover { background: var(--lapis-wash); color: var(--lapis); }
.pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pick .when-on { display: none; }
.pick:has(input:checked) { color: var(--lapis); }
.pick:has(input:checked) .when-on { display: block; }
.pick:has(input:checked) .when-off { display: none; }
.pick:has(input:focus-visible) { outline: 2px solid var(--lapis); }
.book.is-picked .book__cover { outline: 3px solid var(--lapis); outline-offset: 2px; }
@media (min-width: 720px) {
    .books { grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); gap: 28px 22px; }
    .book { grid-template-columns: 1fr auto; align-items: start; gap: 12px 0; padding: 0; }
    .book:hover { background: none; }
    .book__cover { grid-column: 1 / -1; width: 100%; border-radius: var(--r-sm); box-shadow: 0 2px 4px rgb(0 0 0 / .12), 0 14px 26px -10px rgb(0 0 0 / .35); transition: transform .2s ease; }
    .book:hover .book__cover { transform: translateY(-4px); }
    .pick { margin: -8px -10px 0 0; }
    .book.is-picked .book__cover { outline-offset: 4px; }
}

.selectionbar { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px); z-index: 45; display: flex; justify-content: center; padding: 0 12px; animation: rise .2s ease-out; }
@media (min-width: 900px) { .selectionbar { bottom: 20px; } }
.selectionbar__inner { display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 8px 8px 18px; border-radius: var(--r-lg); background: var(--ink); color: var(--paper); box-shadow: var(--lift); }
.selectionbar__inner .btn { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.selectionbar__inner .btn--ghost { background: transparent; color: var(--paper); border-color: transparent; }
.selectionbar__text { font-size: var(--t-sm); white-space: nowrap; }

/* ---------- Book page ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 14px; color: var(--faint); font-size: var(--t-sm); }
.crumbs a { color: var(--faint); }
.bookhead { display: grid; grid-template-columns: 84px 1fr; gap: 20px; align-items: start; margin-bottom: 16px; }
.bookhead__cover { width: 84px; border-radius: var(--r-sm); box-shadow: 0 2px 4px rgb(0 0 0 / .12), 0 14px 26px -10px rgb(0 0 0 / .35); }
.bookhead h1 { margin-bottom: 6px; }
@media (min-width: 720px) { .bookhead { grid-template-columns: 136px 1fr; gap: 32px; } .bookhead__cover { width: 136px; } }
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 32px; margin: 12px 0 0; padding: 0; list-style: none; }
.chapters a { display: grid; grid-template-columns: 2.6em 1fr auto; align-items: baseline; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.chapters a:hover { color: var(--lapis); }
.chapters__num { color: var(--faint); font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.chapters__count { color: var(--faint); font-size: var(--t-xs); }
.filter { max-width: 420px; margin: 8px 0; }

/* ---------- Reader ---------- */
.readbar { position: sticky; top: var(--bar-h); z-index: 40; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--rule); }
.readbar__inner { display: flex; align-items: center; gap: 2px; max-width: 1280px; height: 48px; margin: 0 auto; padding: 0 6px; }
.readbar__title { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: 600 var(--t-sm)/1 var(--sans); cursor: pointer; }
.readbar__title > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.readbar__title:hover { background: var(--lapis-wash); }
.readbar__title .icon { width: 1em; height: 1em; color: var(--faint); }

.cartouche { position: relative; max-width: 560px; margin: 32px auto 0; padding: 20px 60px 16px; border: 1px solid var(--gilt); outline: 1px solid var(--gilt); outline-offset: 4px; border-radius: 3px; background: var(--gilt-wash); text-align: center; }
.cartouche__star { position: absolute; top: 50%; width: 22px; height: 22px; margin-top: -11px; color: var(--gilt); }
.cartouche__star--start { left: 16px; }
.cartouche__star--end { right: 16px; }
.cartouche h1 { margin: 0; font-size: clamp(var(--t-xl), 1.3rem + 1.4vw, var(--t-2xl)); }
.cartouche h1:lang(ar) { font-size: clamp(2rem, 1.6rem + 2vw, 2.7rem); font-weight: 400; line-height: 1.5; }
.cartouche__sub { margin: 2px 0 0; color: var(--faint); font-size: var(--t-sm); }
.reader__books { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 18px 0 0; padding: 0; list-style: none; }
.reader__books li { padding: 3px 12px; border: 1px solid var(--rule); border-radius: 999px; color: var(--faint); font-size: var(--t-xs); }

.chapter-note { max-width: var(--measure); margin: 20px auto 0; }
.disclosure > summary { display: inline-flex; align-items: center; gap: 6px; color: var(--lapis); font-size: var(--t-sm); font-weight: 600; list-style: none; cursor: pointer; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .icon { width: 1em; height: 1em; transition: transform .2s; }
.disclosure[open] > summary .icon { transform: rotate(90deg); }
.disclosure > .prose { margin-top: 10px; padding: 12px 16px; border-left: 2px solid var(--gilt); border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--leaf); font-size: var(--t-sm); }

.verses { display: grid; grid-template-columns: minmax(0, 1fr); margin: 24px auto 0; }
.verses:not(.is-columns) { max-width: calc(var(--measure) + 56px); }
.vrow { padding: 16px 0 18px; border-bottom: 1px solid var(--rule); scroll-margin-top: calc(var(--bar-h) + 64px); }
.vrow:last-child { border-bottom: 0; }
.vcell { min-width: 0; }
.vcell + .vcell { margin-top: 12px; }
.vtag { display: block; margin: 0 6px 2px; color: var(--faint); font: 500 var(--t-xs)/1.4 var(--sans); }
.verse { margin: 0; padding: 4px 6px; border-radius: var(--r-sm); font-family: var(--serif); font-size: calc(var(--t-md) * 1.06 * var(--reader-scale)); line-height: calc(1.75 * var(--reader-leading)); overflow-wrap: anywhere; transition: background-color .35s ease; }
.vcell--bn .verse { font-family: var(--bn); font-size: calc(var(--t-md) * 1.12 * var(--reader-scale)); line-height: calc(1.9 * var(--reader-leading)); }
.vcell--ara .verse { font-family: var(--ar); font-size: calc(var(--t-md) * 1.75 * var(--reader-scale)); line-height: calc(2.2 * var(--reader-leading)); }
.vcell--en .verse, .vcell--de .verse { hyphens: auto; }
.verse__title { display: block; margin-bottom: 4px; font-weight: 700; }
.verse mark { padding: 0 .12em; border-radius: 3px; background: var(--mark); color: inherit; }
.verse.is-playing { background: var(--gilt-wash); }
.vrow:target { box-shadow: inset 3px 0 0 var(--lapis); padding-left: 10px; animation: target-flash 2.4s ease-out; }
@keyframes target-flash { from { background-color: var(--lapis-wash); } }
.dict-term { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline dotted var(--gilt) 2px; text-underline-offset: .32em; cursor: pointer; }
.dict-term:hover { color: var(--lapis); }
.vnote { margin: 4px 6px 0; }
.vnote > summary { font-size: var(--t-xs); }
.vcell.is-hidden { display: none; }
@media (min-width: 720px) {
    /* Side by side: as many columns as fit at a readable width; more books wrap onto a second line. */
    .verses--multi.is-columns .vrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px 32px; }
    .verses--multi.is-columns .vcell + .vcell { margin-top: 0; }
    .container:has(> .verses--multi.is-columns) { max-width: 1680px; }
    /* Don't stretch a few books across a very wide screen: about 440 px per book at most. */
    .verses--multi.is-columns { max-width: calc(var(--cols, 2) * 440px); margin-inline: auto; }
}
.reader__foot { display: flex; justify-content: space-between; gap: 12px; max-width: calc(var(--measure) + 56px); margin: 32px auto 0; }

/* ---------- Sheets: bottom sheet on phones, dialog on desktop ---------- */
.sheet {
    width: 100%; max-width: 100%; max-height: 88vh; margin: auto 0 0; padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
    border: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--leaf); color: var(--ink); box-shadow: var(--lift);
}
.sheet[open] { animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1); }
.sheet::backdrop { background: var(--scrim); }
.sheet__grip { display: block; width: 40px; height: 4px; margin: 4px auto 12px; border-radius: 2px; background: var(--rule); }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet__head h2 { margin: 0; font-size: var(--t-lg); }
.sheet__head form { margin: 0 -10px 0 0; }
@media (min-width: 720px) {
    .sheet { width: min(540px, calc(100vw - 48px)); margin: auto; padding: 20px 24px 24px; border-radius: var(--r-lg); }
    .sheet[open] { animation: fade-in .15s ease-out; }
    .sheet__grip { display: none; }
    .sheet--wide { width: min(760px, calc(100vw - 48px)); }
}
.sheet__quote { margin: 0 0 16px; padding: 10px 14px; border-left: 2px solid var(--gilt); border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--paper); font-size: var(--t-sm); max-height: 6.5em; overflow: hidden; }
.sheet-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.sheet-actions button, .sheet-actions a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 80px; padding: 10px 6px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--paper); color: var(--ink); font: 500 var(--t-xs)/1.2 var(--sans); text-align: center; text-decoration: none; cursor: pointer; }
.sheet-actions button:hover, .sheet-actions a:hover { border-color: var(--lapis); color: var(--lapis); }
.sheet-actions .icon { width: 24px; height: 24px; }
.settings { display: grid; gap: 22px; }
.settings__row { display: grid; gap: 8px; }
.settings__label { font-size: var(--t-sm); font-weight: 600; }
.settings__range { display: flex; align-items: center; gap: 12px; }
.settings__range > span { min-width: 2.5em; color: var(--faint); font-size: var(--t-sm); text-align: center; }
.settings__books { display: grid; gap: 2px; }
.picklist { display: grid; max-height: 62vh; margin: 0 -8px; padding: 0; overflow: auto; list-style: none; }
.picklist a { display: grid; grid-template-columns: 2.8em 1fr auto; align-items: baseline; gap: 10px; padding: 11px 8px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; }
.picklist a:hover { background: var(--lapis-wash); }
.picklist a[aria-current="page"] { background: var(--lapis-wash); color: var(--lapis); font-weight: 600; }
.picklist__n, .picklist__v { color: var(--faint); font-size: var(--t-sm); font-variant-numeric: tabular-nums; }

/* Skeleton */
.skeleton { display: grid; gap: 10px; padding: 4px 0; }
.skeleton span { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--rule), var(--paper), var(--rule)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton span:nth-child(2) { width: 86%; }
.skeleton span:nth-child(3) { width: 58%; }

/* ---------- Player ---------- */
.player { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); z-index: 52; padding: 0 8px 8px; animation: rise .2s ease-out; }
@media (min-width: 900px) { .player { bottom: 16px; } }
.player__inner { display: grid; grid-template-columns: auto auto auto 1fr auto; align-items: center; gap: 2px; max-width: 680px; margin: 0 auto; padding: 6px; border-radius: var(--r-lg); background: var(--ink); color: var(--paper); box-shadow: var(--lift); }
.player .iconbtn:hover { background: rgb(127 127 127 / .22); }
.player .iconbtn.player__play { width: 46px; height: 46px; background: var(--gilt); color: #1a1406; }
.player__info { display: grid; gap: 5px; min-width: 0; padding: 0 8px; }
.player__label { overflow: hidden; font-size: var(--t-sm); font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.player__status { color: color-mix(in srgb, var(--paper) 70%, transparent); font-size: var(--t-xs); }
.player__progress { width: 100%; height: 4px; min-height: 4px; accent-color: var(--gilt); }
.player .when-playing { display: none; }
.player.is-playing .when-playing { display: block; }
.player.is-playing .when-paused { display: none; }
body:has(.player:not([hidden])) main { padding-bottom: 120px; }

/* ---------- Search ---------- */
.searchform { margin: 8px 0 28px; }
.searchform__row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.searchform__row input { min-height: 52px; }
.searchform__row .btn { min-height: 52px; }
.searchform__opts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; margin-top: 10px; }
.bookpicker__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0 20px; margin: 10px 0 0; padding: 0; list-style: none; }
.bookpicker__actions { display: flex; gap: 8px; margin-top: 10px; }
.results-summary { margin-bottom: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.results-summary h2 { margin: 0 0 4px; }
.result__ref { display: inline-block; margin: 0 6px 6px; font-size: var(--t-sm); font-weight: 600; }

/* ---------- Word by word ---------- */
.wbw__ayah { padding: 18px 0; border-bottom: 1px solid var(--rule); }
.wbw__ayah .mark { font-size: 1rem; }
.wbw__words { display: flex; flex-wrap: wrap; gap: 4px 2px; margin: 6px 0 0; padding: 0; list-style: none; }
.wbw__word { display: grid; justify-items: center; gap: 2px; min-width: 64px; padding: 6px 10px 8px; border: 0; border-radius: var(--r-md); background: none; color: inherit; font: inherit; cursor: pointer; }
.wbw__word:hover { background: var(--leaf); }
.wbw__word.is-playing { background: var(--gilt-wash); }
.wbw__ar { font-family: "QuranWBW", var(--ar); font-size: 1.9rem; line-height: 1.9; }
.wbw__bn { font-family: var(--bn); font-size: var(--t-sm); }
.wbw__en:lang(en) { font-family: var(--sans); }
.wbw__en { color: var(--faint); font-size: var(--t-xs); }

/* ---------- Bookmarks ---------- */
.bmlist { display: grid; margin: 0; padding: 0; list-style: none; }
.bmlist li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.bmlist a { color: var(--ink); text-decoration: none; }
.bmlist a:hover strong { color: var(--lapis); }
.bmlist strong { display: block; font-size: var(--t-sm); }
.bmlist small { display: block; margin-top: 2px; color: var(--faint); font-size: var(--t-sm); line-height: 1.5; }

/* ---------- Content, tables, auth, empty ---------- */
.prose { max-width: var(--measure); line-height: 1.75; }
.prose p { margin: 0 0 .9em; }
.about h3, .about h4 { margin-top: 1.6em; font-family: var(--bn); }
.empty { padding: 56px 16px; color: var(--faint); text-align: center; }
.empty h1, .empty h2 { color: var(--ink); }
.empty__mark { width: 56px; height: 56px; margin-bottom: 8px; color: var(--gilt); }
.empty__code { margin: 0 0 8px; color: var(--faint); font: 600 var(--t-3xl)/1 var(--serif); }
.auth { padding-top: 40px; }
.auth h1 { margin-bottom: 20px; }
.auth > p.muted { margin-bottom: 24px; }
.auth__links { margin-top: 20px; color: var(--faint); font-size: var(--t-sm); text-align: center; }
.deflist { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0 0 32px; }
.deflist dt { color: var(--faint); }
.deflist dd { margin: 0; font-weight: 600; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 28px 0; }
.pagination a, .pagination span { display: grid; place-items: center; min-width: 42px; height: 42px; padding: 0 10px; border-radius: var(--r-md); color: var(--ink); text-decoration: none; }
.pagination a:hover { background: var(--leaf); }
.pagination [aria-current] { background: var(--ink); color: var(--paper); }
.tablewrap { position: relative; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--leaf); }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th, .table td { padding: 11px 14px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.table th { background: var(--paper); color: var(--faint); font-weight: 600; white-space: nowrap; }
.table th a { color: inherit; text-decoration: none; }
.table tr:last-child td { border-bottom: 0; }
.table td[dir="rtl"] { text-align: right; }
.table .rowactions { white-space: nowrap; text-align: right; }
.table form { margin: 0; }
code.wrap { white-space: pre-wrap; word-break: break-word; font-size: var(--t-xs); }

/* ---------- Admin ---------- */
.page-admin main { padding-bottom: 48px; }
.page-admin h1:first-child { margin-top: 24px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 16px; }
.pagehead h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 0 0 28px; padding: 0; list-style: none; }
.stats li, .stats a { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--leaf); color: var(--ink); text-decoration: none; }
.stats li:has(a) { padding: 0; border: 0; }
.stats strong { font: 600 var(--t-2xl)/1.1 var(--serif); }
.stats span { color: var(--faint); font-size: var(--t-sm); }
.grid2 { display: grid; gap: 16px; }
@media (min-width: 800px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.panel { margin-bottom: 16px; padding: 18px 20px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--leaf); }
.panel h2 { font-size: var(--t-lg); }
.linklist { columns: 2; padding-left: 1.2em; font-size: var(--t-sm); }
.activity { display: grid; gap: 12px; margin: 0 0 12px; padding: 0; list-style: none; font-size: var(--t-sm); }
.activity li { display: flex; flex-direction: column; }
.thumb { width: 90px; margin-bottom: 8px; border-radius: var(--r-sm); }
.dictrows { display: grid; gap: 12px; }
.dictrow { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--leaf); }
@media (min-width: 720px) { .dictrow { grid-template-columns: 1fr 2fr; } }
.diff { display: grid; gap: 12px; padding-left: 1.2em; }
.diff del, .diff ins { display: block; margin-top: 4px; padding: 6px 10px; border-radius: var(--r-sm); text-decoration: none; }
.diff del { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.diff ins { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.danger-zone { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--rule); }
.suggestion header { margin-bottom: 8px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); color: var(--faint); font-size: var(--t-xs); font-weight: 600; }
.suglist { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.suglist li { padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.suglist p { margin: 0 0 6px; }
.rate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.rate select, .rate input { width: auto; min-height: 38px; }

/* ---------- Motion (only in answer to an action) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-rise { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; transform: scale(.98); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.settings__range > .settings__big { font-size: var(--t-xl); }

/* Player options */
.repeat-opts { display: flex; flex-wrap: wrap; gap: 12px; }
.field--inline-sm { max-width: 140px; }
.player__inner { grid-template-columns: auto auto auto 1fr auto auto; }
.player__label { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-size: var(--t-sm); font-weight: 600; text-align: left; cursor: pointer; }
.vrow.is-playing-row { background: linear-gradient(var(--gilt-wash), var(--gilt-wash)) no-repeat; background-size: 100% 100%; border-radius: var(--r-sm); }
/* Phones: info and seek bar on top, controls below */
.player__inner { grid-template-columns: auto auto auto 1fr auto auto; grid-template-areas: "info info info info info info" "prev play next . opts close"; row-gap: 4px; padding: 10px 6px 6px; }
.player__info { grid-area: info; padding: 0 10px; }
.player [data-player="prev"] { grid-area: prev; }
.player [data-player="toggle"] { grid-area: play; }
.player [data-player="next"] { grid-area: next; }
.player [data-player="options"] { grid-area: opts; }
.player [data-player="close"] { grid-area: close; }
@media (min-width: 720px) {
    .player__inner { grid-template-areas: "prev play next info opts close"; padding: 6px; }
}

/* ---------- Offline ---------- */
.netbar { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; background: var(--ink); color: var(--paper); font-size: var(--t-sm); text-align: center; }
.offline-note { display: flex; align-items: center; gap: 6px; margin: 16px 0 0; color: var(--faint); font-size: var(--t-sm); }
.dl-section { margin-top: 32px; }
.dl-section h2 { padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.storage { max-width: 520px; }
.storage__bar { height: 8px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.storage__bar span { display: block; width: 0; height: 100%; background: var(--lapis); transition: width .3s; }
.storage + p { margin-top: 8px; }
.dl-list { display: grid; margin: 0; padding: 0; list-style: none; }
.dl-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.dl-item__name { font-weight: 600; }
.dl-item__meta { color: var(--faint); font-size: var(--t-sm); }
.dl-item__actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.dl-item progress, .dl-progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--lapis); }
.dl-audio-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; max-width: 640px; }
.dl-audio-form .field:first-child { grid-column: 1 / -1; }
@media (min-width: 720px) { .dl-audio-form { grid-template-columns: 2fr 1fr 1fr auto; } .dl-audio-form .field:first-child { grid-column: auto; } }
.book-offline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.book-offline progress { width: 160px; accent-color: var(--lapis); }

/* ---------- Personal notes ---------- */
.mynote { margin: 6px 6px 4px; padding: 10px 14px; border-left: 3px solid var(--lapis); border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--lapis-wash); font-family: var(--sans); font-size: var(--t-sm); }
.mynote p { margin: 2px 0 6px; white-space: pre-wrap; }
.mynote__label { color: var(--lapis); font-size: var(--t-xs); font-weight: 600; }
.mynote__actions { display: flex; gap: 16px; }
.mynote--conflict { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--leaf)); }
.mynote--conflict .mynote__label { color: var(--danger); }
.bmlist__note { margin: 4px 0; white-space: pre-wrap; }
.bmlist li.is-conflict strong::after { content: " (conflicting copy)"; color: var(--danger); font-weight: 600; }

/* ---------- AI ---------- */
.ai { display: grid; gap: 16px; }
.ai__controls { display: grid; gap: 12px; justify-items: start; }
.ai__ask { display: grid; grid-template-columns: 1fr auto; gap: 8px; width: 100%; }
.ai__result { padding-top: 12px; border-top: 1px solid var(--rule); }
.ai__text { line-height: 1.75; }
.ai__text p { margin: 0 0 .8em; white-space: pre-wrap; }
.ai__label { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 4px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--paper); color: var(--faint); font-size: var(--t-xs); }
.ai__label .icon { flex: none; color: var(--lapis); }
.ai__report > summary { color: var(--faint); font-size: var(--t-xs); cursor: pointer; }
.ai__report form { margin-top: 10px; }
.ai__error { color: var(--danger); }

/* Admin log viewer */
.loglines { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.loglines li { padding: 6px 10px; border-radius: var(--r-sm); background: var(--leaf); border: 1px solid var(--rule); }

/* ---------- Books on the page, layout switches ---------- */
.booksbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; margin: 18px 0 0; }
.bookchips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.bookchip { display: inline-flex; align-items: center; gap: 2px; min-height: 34px; padding: 0 4px 0 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--leaf); color: var(--ink); font: 500 var(--t-xs)/1.2 var(--sans); }
.bookchip:not(:has(.bookchip__remove)) { padding-right: 12px; }
.bookchip__remove { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--faint); }
.bookchip__remove:hover { background: var(--lapis-wash); color: var(--danger); }
.bookchip__remove .icon { width: 14px; height: 14px; }
.bookchip--add { gap: 6px; padding: 0 14px; border-style: dashed; border-color: var(--lapis); color: var(--lapis); cursor: pointer; }
.bookchip--add:hover { background: var(--lapis-wash); }
.bookchip--add .icon { width: 14px; height: 14px; }
.viewswitch { display: none; }
.viewswitch button { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; }
.viewswitch .icon { width: 16px; height: 16px; }
@media (min-width: 720px) { .viewswitch { display: inline-flex; } }
.addlist a { grid-template-columns: 5.5em 1fr auto; align-items: center; }
.addlist__lang { color: var(--faint); font-size: var(--t-xs); }
.addlist a .icon { color: var(--lapis); }

.libbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
.libbar .chips { margin-top: 0; }
@media (min-width: 720px) {
    .is-list .books { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 2px 28px; }
    .is-list .book { grid-template-columns: 48px 1fr auto; align-items: center; gap: 14px; padding: 8px 4px; }
    .is-list .book:hover { background: var(--leaf); }
    .is-list .book__cover { grid-column: auto; width: 48px; border-radius: 3px; box-shadow: 0 1px 3px rgb(0 0 0 / .2); transition: none; }
    .is-list .book:hover .book__cover { transform: none; }
    .is-list .pick { margin: 0; }
}

/* ---------- Admin: a dark "spine" holding the navigation, content set on a plain page ---------- */
.page-admin { padding-bottom: 0; background: var(--leaf); --spine: #12284a; --spine-ink: #e6ecf6; --spine-faint: #9aabc8; --spine-gilt: #d6a94e; }
:root[data-theme="dark"] .page-admin { --spine: #080e1b; --spine-faint: #8090ad; }
:root[data-theme="sepia"] .page-admin { --spine: #3d2c14; --spine-ink: #f6ead2; --spine-faint: #c6b28d; }
.adminwrap { display: block; }
.spine { display: grid; grid-template-columns: 1fr auto; align-items: center; background: var(--spine); color: var(--spine-ink); }
.spine a { color: inherit; text-decoration: none; }
.spine__brand { display: inline-flex; align-items: center; gap: 10px; padding: 14px 16px; font: 600 var(--t-lg)/1 var(--serif); }
.spine__brand small { margin-left: 2px; color: var(--spine-faint); font: 400 var(--t-sm)/1 var(--serif); font-style: italic; }
.spine__mark { width: 26px; height: 26px; color: var(--spine-gilt); }
.spine__nav { grid-column: 1 / -1; grid-row: 2; display: flex; gap: 2px; padding: 0 8px 8px; overflow-x: auto; scrollbar-width: none; }
.spine__group { display: contents; }
.spine__label { display: none; }
.spine__nav a { position: relative; display: inline-flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 4px; color: var(--spine-faint); font-size: var(--t-sm); white-space: nowrap; }
.spine__nav a .icon { width: 17px; height: 17px; opacity: .8; }
.spine__nav a:hover { color: var(--spine-ink); background: rgb(255 255 255 / .05); }
.spine__nav a[aria-current="page"] { color: var(--spine-ink); background: rgb(255 255 255 / .08); }
.spine__nav a[aria-current="page"] .icon { color: var(--spine-gilt); opacity: 1; }
.spine__count { color: var(--spine-gilt); font: 600 var(--t-sm)/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.spine__foot { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 4px; padding-right: 8px; font-size: var(--t-sm); }
.spine__foot form { margin: 0; }
.spine__foot a, .spine__foot button { padding: 8px 10px; border: 0; border-radius: 4px; background: none; color: var(--spine-faint); font: inherit; cursor: pointer; }
.spine__foot a:hover, .spine__foot button:hover { color: var(--spine-ink); }
.spine__who { display: none; }
.spine :focus-visible { outline: 2px solid var(--spine-gilt); outline-offset: 2px; }
.adminmain { min-width: 0; padding: 8px 16px 64px; outline: none; }
.adminmain .flashes { padding: 0; }
@media (min-width: 1024px) {
    .adminwrap { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
    /* Tooled double rule down the spine's edge, as on a bound cover. */
    .spine { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; align-items: stretch; box-shadow: inset -1px 0 0 rgb(214 169 78 / .45), inset -5px 0 0 var(--spine), inset -6px 0 0 rgb(214 169 78 / .25); }
    .spine__brand { padding: 28px 24px 26px; }
    .spine__nav { flex: 1; display: block; padding: 0 14px 0 0; overflow-y: auto; }
    .spine__group { display: block; margin-bottom: 22px; }
    .spine__label { display: block; margin: 0 0 6px; padding-left: 24px; color: var(--spine-faint); font: italic 400 var(--t-sm)/1.2 var(--serif); opacity: .75; }
    .spine__nav a { display: flex; padding: 9px 12px 9px 24px; border-radius: 0 4px 4px 0; }
    /* The current page is marked with a bookmark ribbon. */
    .spine__nav a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 9px; background: var(--spine-gilt); clip-path: polygon(0 0, 100% 0, 55% 50%, 100% 100%, 0 100%); }
    .spine__count { margin-left: auto; }
    .spine__foot { display: grid; gap: 2px; padding: 16px 14px 20px 12px; border-top: 1px solid rgb(255 255 255 / .08); }
    .spine__who { display: flex; align-items: center; gap: 8px; padding: 6px 12px 8px; color: var(--spine-ink); }
    .spine__who .icon { width: 16px; height: 16px; color: var(--spine-faint); }
    .spine__foot a, .spine__foot button { width: 100%; padding: 6px 12px; text-align: left; }
    .adminmain { padding: 36px 56px 80px; max-width: 1280px; }
}
.page-admin .pagehead { align-items: flex-end; margin: 24px 0 24px; }
.page-admin .pagehead p { margin: 6px 0 0; }
.page-admin h1 { font-size: var(--t-3xl); font-weight: 500; letter-spacing: -.015em; }
.page-admin h2 { font-weight: 500; }
.pagehead__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-admin h1:first-child { margin-top: 0; }
.page-admin .crumbs { margin: 20px 0 0; }
.page-admin .panel { border-radius: 4px; }
.page-admin .btn { border-radius: 4px; }
@media (min-width: 1024px) { .page-admin .pagehead { margin-top: 0; } }

/* Today: the work queue as the headline */
.today { max-width: 52rem; margin: 16px 0 48px; }
.today__headline { margin: 0 0 20px; font-size: clamp(2rem, 1.3rem + 2vw, 3rem); font-weight: 500; line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; }
.today__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.today__sub { margin: 0 0 28px; color: var(--faint); }
.today__library { max-width: 44em; margin: 0; padding-top: 18px; border-top: 1px solid var(--rule); color: var(--faint); font: 400 var(--t-md)/1.65 var(--serif); font-variant-numeric: oldstyle-nums; }
.today__library a { color: var(--ink); text-decoration-color: var(--gilt); }
.setup { margin: 0 0 48px; }
.setup h2, .sectionhead h2 { margin: 0; font-size: var(--t-xl); }
.setup__list { display: grid; gap: 16px 32px; margin: 14px 0 0; padding: 0; list-style: none; }
@media (min-width: 900px) { .setup__list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.setup__item { padding: 2px 0 2px 16px; border-left: 2px solid var(--rule); font-size: var(--t-sm); }
.setup__item--warn { border-left-color: var(--gilt); }
.setup__item p { margin: 0; }
.setup__how { margin-top: 4px !important; color: var(--faint); }
.setup__item a { display: inline-block; margin-top: 4px; }
.dashgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; }
@media (min-width: 1100px) { .dashgrid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 56px; align-items: start; } }
.sectionhead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.sectionhead__links { display: flex; gap: 16px; font-size: var(--t-sm); }
.timeline { margin: 0; padding: 0; list-style: none; font-size: var(--t-sm); }
.timeline li { display: grid; grid-template-columns: 4.2em minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.timeline time { color: var(--faint); font-variant-numeric: tabular-nums; }
.timeline a { color: var(--ink); }
.timeline a:hover { color: var(--lapis); }
.timeline small { display: block; margin-top: 2px; }

/* Ledger tables: no boxes, a firm rule under the header, book names in the serif */
.table--ledger th { padding: 8px 12px; border-bottom: 1px solid var(--ink); background: none; color: var(--faint); font-size: var(--t-xs); font-weight: 500; }
.table--ledger td { padding: 10px 12px; vertical-align: middle; }
.table--ledger tbody tr:hover td { background: color-mix(in srgb, var(--lapis-wash) 40%, transparent); }
.table--ledger th:first-child, .table--ledger td:first-child { padding-left: 0; }
.table--ledger tr:last-child td { border-bottom: 1px solid var(--rule); }
.ledger__name, .table--ledger .bookcell__name { color: var(--ink); font: 400 var(--t-md)/1.3 var(--serif); text-decoration: none; }
.ledger__name:hover { color: var(--lapis); text-decoration: underline; }
.ledger__name:lang(bn), .table--ledger .bookcell__name:lang(bn) { font-family: var(--bn); }
.table--ledger .ledger__shelf th { padding: 28px 0 8px; border-bottom: 1px solid var(--rule); color: var(--ink); font: 500 var(--t-lg)/1.2 var(--serif); }
.table--ledger tbody:first-of-type .ledger__shelf th { padding-top: 16px; }
.table--ledger .ledger__shelf:hover th { background: none; }
.table--ledger .ledger__shelf .muted { margin-left: 4px; font-size: var(--t-sm); font-variant-numeric: oldstyle-nums; }
.table--ledger .rowactions a:not(.iconbtn) { margin-right: 6px; font-size: var(--t-sm); }
.flag { display: inline-block; margin-right: 10px; color: var(--faint); font: italic 400 var(--t-sm)/1.3 var(--serif); white-space: nowrap; }
.flag--off { color: var(--danger); }
.page-admin .badge { padding: 0; border: 0; background: none; color: var(--faint); font: italic 400 var(--t-sm)/1.3 var(--serif); }
.page-admin .badge--ok { color: var(--ok); }
.page-admin .badge--off { color: var(--danger); }

/* Tables */
.tablewrap--flat { border: 0; border-radius: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table--compact th, .table--compact td { padding: 8px 10px; }
.table--rows tbody tr:hover { background: color-mix(in srgb, var(--lapis-wash) 45%, transparent); }
.rowactions { display: table-cell; }
.rowactions > * { vertical-align: middle; }
.rowactions .btn + .btn, .rowactions .btn + .iconbtn { margin-left: 4px; }
.badges { display: table-cell; }
.badges .badge { margin: 2px 4px 2px 0; }
.badge--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--rule)); }
.badge--off { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--rule)); }
.bookcell { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.bookcell:hover .bookcell__name { color: var(--lapis); }
.bookcell__cover { flex: none; width: 32px; aspect-ratio: 5 / 7; overflow: hidden; border-radius: 3px; background: var(--rule); box-shadow: 0 1px 2px rgb(0 0 0 / .2); }
.bookcell__cover img { width: 100%; height: 100%; object-fit: cover; }
.bookcell__name { display: block; font-weight: 600; }
.bookcell__sub { display: block; font-size: var(--t-xs); }

/* Verse list with inline editing */
.chapternav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.chapternav__jump select { min-height: 38px; max-width: 320px; padding: 6px 10px; }
.chapternav--foot { margin-top: 16px; }
.versetable td { vertical-align: top; }
.versetable__n { width: 3.5em; color: var(--faint); }
.versetable__text { width: 100%; }
.versetable__text[dir="rtl"] { text-align: right; }
.versetable__text:lang(ar) .versetable__view, .versetable__text:lang(ar) .versetable__input { font-family: var(--ar); font-size: 1.35rem; line-height: 2; }
.versetable__text:lang(bn) .versetable__view, .versetable__text:lang(bn) .versetable__input { font-family: var(--bn); font-size: 1.05rem; line-height: 1.8; }
.versetable__title { display: block; margin-bottom: 2px; }
.versetable__view { margin: -4px -6px; padding: 4px 6px; border-radius: var(--r-sm); cursor: text; }
.versetable__view:hover { background: var(--lapis-wash); }
.versetable__input { width: 100%; min-height: 90px; font: inherit; line-height: 1.7; }
.versetable__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.versetable tr.is-editing { background: var(--leaf); box-shadow: inset 3px 0 0 var(--lapis); }
.versetable tr.is-saved { animation: saved-flash 1.8s ease-out; }
@keyframes saved-flash { from { background: color-mix(in srgb, var(--ok) 18%, transparent); } }

/* Verse editor */
.editgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1100px) { .editgrid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } .refpanel { position: sticky; top: calc(var(--bar-h) + 16px); max-height: calc(100vh - var(--bar-h) - 32px); overflow: auto; } }
.editgrid > .panel { margin: 0; }
.versetext { font-size: 1.05rem; line-height: 1.8; }
.versetext:lang(ar) { font-family: var(--ar); font-size: 1.4rem; line-height: 2.1; }
.versetext:lang(bn) { font-family: var(--bn); }
.savebar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px -20px -18px; padding: 12px 20px; border-top: 1px solid var(--rule); background: var(--leaf); border-radius: 0 0 var(--r-md) var(--r-md); }
.refpanel h2 { font-size: var(--t-md); margin-bottom: 10px; }
.refpanel__item { padding: 10px 0; border-top: 1px solid var(--rule); }
.refpanel__item:first-of-type { border-top: 0; }
.refpanel__head { display: flex; align-items: baseline; gap: 8px; font-size: var(--t-sm); font-weight: 600; }
.refpanel__head a { margin-left: auto; font-weight: 500; }
.refpanel__text { margin: 4px 0 0; font-size: var(--t-sm); line-height: 1.7; }
.refpanel__text--ara { font-family: var(--ar); font-size: 1.2rem; line-height: 2; }
.btn.is-disabled { opacity: .4; pointer-events: none; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* Suggestions */
.diffbox { margin: 8px 0 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--paper); }
.diffbox h3 { display: flex; gap: 12px; align-items: baseline; margin: 0 0 6px; }
.diffbox__text { margin: 0; line-height: 1.9; }
.diffbox del, .diffkey del { background: color-mix(in srgb, var(--danger) 16%, transparent); color: inherit; text-decoration: line-through; text-decoration-color: var(--danger); border-radius: 3px; padding: 0 2px; }
.diffbox ins, .diffkey ins { background: color-mix(in srgb, var(--ok) 20%, transparent); color: inherit; text-decoration: none; border-radius: 3px; padding: 0 2px; }
.diffkey { font-weight: 400; }
@media (max-width: 719px) {
    .page-admin .pagehead { align-items: flex-start; }
    /* Verse list: each verse as a block, buttons under the text. */
    .versetable thead { display: none; }
    .versetable tr { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); border-bottom: 1px solid var(--rule); }
    .versetable td { border-bottom: 0; }
    .versetable td:nth-child(3):empty { display: none; }
    .versetable td:nth-child(3), .versetable .rowactions { grid-column: 2; padding-top: 0; text-align: left; }
    .chapternav { flex-wrap: wrap; }
    .chapternav__jump { order: -1; flex-basis: 100%; }
    .chapternav__jump select { max-width: none; width: 100%; }
}

/* Suggestions review: one entry per verse, reading on the left, decision on the right */
.page-admin .tabs { gap: 24px; margin: 0 0 8px; border-bottom: 1px solid var(--rule); }
.page-admin .tabs a { display: inline-flex; gap: 6px; margin-bottom: -1px; padding: 8px 0 10px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--faint); font-size: var(--t-sm); text-decoration: none; }
.page-admin .tabs a span { font-variant-numeric: tabular-nums; }
.page-admin .tabs a:hover { color: var(--ink); }
.page-admin .tabs a[aria-current="page"] { border-bottom-color: var(--ink); background: none; color: var(--ink); font-weight: 600; }
.review__none { padding: 32px 0; }
.review { padding: 28px 0 32px; border-bottom: 1px solid var(--rule); }
.review__head { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; margin-bottom: 14px; }
.review__book { grid-column: 1 / -1; margin: 0 0 2px; color: var(--faint); font-family: var(--bn); font-size: var(--t-sm); }
.review__ref { margin: 0; font: 600 var(--t-lg)/1.35 var(--bn); }
.review__ref a { color: var(--ink); text-decoration: none; }
.review__ref a:hover { color: var(--lapis); text-decoration: underline; }
.review__meta { align-self: end; margin: 0; font-size: var(--t-sm); }
.review__body { display: grid; gap: 20px; }
@media (min-width: 1100px) { .review__body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; } }
.review__diff .diffbox__text { margin: 0 0 6px; font: 1.12rem/1.95 var(--bn); }
.review__diff .diffkey { margin: 0 0 10px; }
.review__same { margin: 0 0 8px; color: var(--gilt); font: italic var(--t-sm)/1.4 var(--serif); }
.review__full { margin-top: 10px; font-family: var(--bn); }
.review__form { display: grid; gap: 12px; }
.review__form textarea { font: 1.05rem/1.8 var(--bn); }
.review__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.table--ledger .rowactions > * + * { margin-left: 14px; }
.table--ledger .rowactions .linkbtn { font-size: var(--t-sm); }
.table--ledger td.num:first-child, .versetable__n { color: var(--faint); font-family: var(--serif); font-variant-numeric: oldstyle-nums; }
/* Admin sections sit on the page; only the verse editor keeps a frame, as the sheet being worked on. */
.page-admin .panel { margin: 0 0 44px; padding: 0; border: 0; background: none; }
.page-admin .panel > h2:first-child, .page-admin .panel > .row-between:first-child h2 { font-size: var(--t-xl); }
.page-admin .editgrid > .panel { padding: 18px 20px; border: 1px solid var(--rule); background: var(--leaf); }
.page-admin .stats { display: flex; flex-wrap: wrap; gap: 20px 40px; margin: 8px 0 40px; }
.page-admin .stats li, .page-admin .stats a { padding: 0; border: 0; background: none; }
.page-admin .stats strong { font: 400 var(--t-2xl)/1.1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.page-admin .stats span { max-width: 11em; font-size: var(--t-sm); }
.spine__brand { white-space: nowrap; }
@media (max-width: 719px) {
    .review__head { grid-template-columns: minmax(0, 1fr); }
    .review__meta { margin-top: 4px; }
    .spine__brand { padding: 12px 16px; }
}
.spine__foot a, .spine__foot button { white-space: nowrap; }
@media (max-width: 479px) { .spine__brand small { display: none; } .spine__foot a, .spine__foot button { padding: 8px 6px; } }

/* ---------- Prayer times ---------- */
.prayer { max-width: 960px; padding-bottom: 48px; }
.prayer__head { margin: 28px 0 18px; }
.prayer__head h1 { margin-bottom: 4px; }
.prayer__head p { margin: 0; }
.prayer:not(.has-place) .prayer__for, .prayer:not(.has-place) .prayer__today, .prayer:not(.has-place) .prayer__week { display: none; }
.prayer.has-place .prayer__empty { display: none; }
.prayer__place { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-bottom: 24px; }
.prayer__district { flex: 1 1 260px; max-width: 360px; }
.prayer__locnote { flex-basis: 100%; margin: 0; min-height: 1.4em; }
.prayer__empty { padding: 24px 0; }
.prayer__today { display: grid; gap: 20px; margin-bottom: 40px; }
@media (min-width: 760px) { .prayer__today { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px; align-items: stretch; } }
/* The next prayer: a lapis cartouche with the Arabic name as its ornament. */
.prayernext { display: grid; align-content: center; justify-items: center; padding: 28px 20px 26px; border-radius: var(--r-lg); background: var(--lapis); color: var(--lapis-ink); text-align: center; box-shadow: inset 0 0 0 5px var(--lapis), inset 0 0 0 6px color-mix(in srgb, var(--gilt) 70%, transparent); }
.prayernext__ar { margin: 0; color: color-mix(in srgb, var(--gilt) 70%, var(--lapis-ink)); font: 2.6rem/1.3 var(--ar); }
.prayernext__name { margin: 2px 0 6px; color: inherit; font: 700 var(--t-2xl)/1.2 var(--bn); }
.prayernext__en { font: 400 var(--t-lg)/1 var(--serif); opacity: .8; }
.prayernext__when { margin: 0; font-size: var(--t-md); }
.prayernext__when strong { font: 600 var(--t-xl)/1 var(--serif); }
.prayerlist { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.prayerlist__item { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) auto; align-items: baseline; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
.prayerlist__bn { font: 600 var(--t-lg)/1.3 var(--bn); }
.prayerlist__en { color: var(--faint); font-size: var(--t-sm); }
.prayerlist__en em { margin-left: 6px; color: var(--gilt); font: italic 600 var(--t-sm)/1 var(--serif); }
.prayerlist__time { font: 500 var(--t-xl)/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.prayerlist__item.is-sun { color: var(--faint); }
.prayerlist__item.is-sun .prayerlist__bn, .prayerlist__item.is-sun .prayerlist__time { font-weight: 400; }
.prayerlist__item.is-current { background: var(--gilt-wash); box-shadow: inset 3px 0 0 var(--gilt); }
.prayerlist__item.is-next .prayerlist__time { color: var(--lapis); }
.prayer__week, .prayer__method { margin-bottom: 36px; }
.prayer__week h2, .prayer__method h2 { font-size: var(--t-xl); }
.prayerweek th, .prayerweek td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.prayerweek td { text-align: right; }
.prayerweek thead th:not(:first-child) { text-align: right; }
.prayerweek tr.is-today th, .prayerweek tr.is-today td { background: var(--gilt-wash); font-weight: 600; }
.prayer__asr { display: grid; gap: 10px; margin: 0 0 14px; padding: 0; border: 0; }
.prayer__asr legend { margin-bottom: 8px; font-weight: 600; }
.prayer__asr label { display: flex; gap: 10px; align-items: flex-start; max-width: 60ch; }
.prayer__asr input { margin-top: 3px; flex: none; }
.prayer__method > p { max-width: 68ch; }
/* Next prayer on the library page */
.prayerstrip { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 16px; padding: 12px 16px; border-left: 3px solid var(--gilt); border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--gilt-wash); color: var(--ink); text-decoration: none; }
.prayerstrip:hover { background: color-mix(in srgb, var(--gilt-wash) 70%, var(--gilt) 12%); }
.prayerstrip__name { font: 700 var(--t-lg)/1.2 var(--bn); }
.prayerstrip__text { font-size: var(--t-sm); }
.prayerstrip__text strong { font: 600 var(--t-md)/1 var(--serif); }
.prayer__locnote:empty { display: none; }
@media (max-width: 559px) {
    /* District and location button share one line; the button becomes an icon with a hidden label. */
    .prayer__place { flex-wrap: wrap; }
    .prayer__district { flex: 1 1 0; min-width: 0; max-width: none; }
    .prayer__locate { flex: none; width: 46px; height: 46px; padding: 0; justify-content: center; }
    .prayer__locate-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* Type-to-search list (district picker) */
.field > label { font-size: var(--t-sm); font-weight: 600; }
.combo { position: relative; }
.combo > .icon { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--faint); pointer-events: none; }
.combo input { padding-left: 42px; text-overflow: ellipsis; }
.combo__list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: min(340px, 50vh); margin: 0; padding: 4px; overflow-y: auto; list-style: none; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--leaf); box-shadow: var(--lift); overscroll-behavior: contain; }
.combo__option { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; }
.combo__option small { color: var(--faint); font-size: var(--t-xs); white-space: nowrap; }
.combo__option [lang="bn"] { margin-left: 4px; color: var(--faint); }
.combo__option:hover { background: var(--paper); }
.combo__option[aria-selected="true"] { background: var(--lapis-wash); color: var(--lapis); }
.combo__option mark { background: none; color: inherit; font-weight: 700; text-decoration: underline; text-decoration-color: var(--gilt); text-underline-offset: 3px; }
.combo__group { padding: 10px 12px 4px; color: var(--faint); font: italic var(--t-sm)/1.2 var(--serif); }
.combo__none { padding: 12px; color: var(--faint); font-size: var(--t-sm); }

/* ---------- Home: intro and today's verse side by side on wide screens ---------- */
.home { display: grid; gap: 28px; padding-top: 28px; }
.home__intro { padding: 0; }
.home__intro h1 { font-size: clamp(var(--t-2xl), 1.4rem + 1.6vw, var(--t-3xl)); letter-spacing: -.02em; }
.home__intro > p { margin: 0; }
.home__intro .lib-search { max-width: none; margin-top: 20px; }
.home__intro .resume { margin-top: 14px; }
.home__intro .prayerstrip { margin: 12px 0 0; }
@media (min-width: 960px) {
    .home--verse { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 48px; align-items: center; padding-top: 44px; }
}
/* The verse sits in the reader's gilt frame: a double rule round a washed panel. */
.verseday { margin: 4px; padding: 28px 28px 18px; border: 1px solid var(--gilt); outline: 1px solid var(--gilt); outline-offset: 4px; border-radius: 3px; background: var(--gilt-wash); }
.verseday__quote { margin: 0; text-align: center; }
.verseday__ar { margin: 0 0 14px; color: var(--ink); font: 400 clamp(1.7rem, 1.2rem + 1.4vw, 2.3rem)/2 var(--ar); text-wrap: balance; }
.verseday__mark { width: 2.4em; height: 2.4em; margin: 0 .15em; font-family: var(--ar); font-size: .5em; vertical-align: -.35em; cursor: default; }
.verseday__mark .mark__n { font-size: 1.3em; }
.verseday__bn { max-width: 40em; margin: 0 auto 8px; font: 1.12rem/1.8 var(--bn); text-wrap: balance; }
.verseday__en { max-width: 40em; margin: 0 auto; color: var(--faint); font: italic var(--t-md)/1.6 var(--serif); text-wrap: balance; }
.verseday__ref { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-top: 18px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--gilt) 45%, transparent); color: var(--faint); font-size: var(--t-sm); }
.verseday__ref a { font-weight: 600; }
@media (max-width: 559px) { .verseday { padding: 22px 16px 14px; } }

.libhead { display: flex; align-items: baseline; gap: 12px; margin-top: 48px; padding-bottom: 4px; }
.libhead h2 { margin: 0; font-size: var(--t-2xl); }
.libhead + .libbar { margin-top: 12px; }
/* Denser shelves on wide screens: covers are recognised at a smaller size. */
@media (min-width: 1100px) {
    .books { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 30px 24px; }
}
/* A book without a cover image gets a plain bound cover: lapis cloth, gilt medallion, its name. */
.book__plain { display: grid; place-items: center; align-content: center; gap: 10%; width: 100%; height: 100%; padding: 12%; background: var(--lapis); box-shadow: inset 0 0 0 5px var(--lapis), inset 0 0 0 6px color-mix(in srgb, var(--gilt) 70%, transparent); color: #f3e7c9; text-align: center; }
.book__plain svg { width: 42%; aspect-ratio: 1; color: var(--gilt); }
.book__plain span { font: 600 clamp(.55rem, 1.1vw, .8rem)/1.3 var(--serif); overflow-wrap: anywhere; }
.book__plain span:lang(bn) { font-family: var(--bn); }
@media (max-width: 719px) { .book__plain span { display: none; } }
@media (max-width: 559px) {
    .resume { grid-template-columns: auto minmax(0, 1fr); }
    .resume__go { grid-column: 2; }
    .home__intro > p { font-size: var(--t-sm); }
}
