/* ==========================================================================
   Mantle Library — stylesheet (v2 design system)

   Family base tokens (shared with sibling apps) + Mantle identity:
   logo GREEN + antique GOLD on dark (default); illuminated manuscript
   GREEN + GOLD on paper for the light theme.

   Every colour flows through the CSS variables below — no hard-coded
   hex/rgb values appear anywhere else in this file.

   Dark theme lives on :root (default); light theme under html.light.
   ========================================================================== */

/* ---------- Font-face slots ----------------------------------------------
   Both DigitalKhatt faces ARE bundled (SIL OFL 1.1 — see fonts/README.txt):
   'DigitalKhatt IndoPak' (13-line IndoPak mushaf style) is the primary
   Arabic face; 'DigitalKhatt V2' (New Madina) is the bundled fallback.
   Amiri Quran / Noto Naskh remain optional drop-in fallbacks; until added,
   local() and the system serif keep those slots readable. Family names
   are stable.
   ------------------------------------------------------------------------- */

@font-face {
  font-family: 'DigitalKhatt IndoPak';
  src: local('DigitalKhatt IndoPak'),
       local('DigitalKhatt-IndoPak'),
       url('../fonts/DigitalKhattIndoPak.otf') format('opentype');
  font-display: swap;
}

@font-face {
  font-family: 'DigitalKhatt V2';
  src: local('DigitalKhatt New Madina'),
       local('DigitalKhattV2'),
       url('../fonts/DigitalKhattV2.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'Amiri Quran';
  src: local('Amiri Quran'),
       local('AmiriQuran');
  font-display: swap;
}

@font-face {
  font-family: 'Noto Naskh';
  src: local('Noto Naskh Arabic'),
       local('Noto Naskh'),
       local('NotoNaskh');
  font-display: swap;
}

/* Honorific ligatures (ﷺ ﷻ ﷽ ﷲ ﵀ ﵁ ﵂ ﵃ ﵇ …) for Latin and Arabic text.
   Subsetting of Noto Naskh (SIL OFL 1.1) containing Unicode 14.0 presentation forms. */
@font-face {
  font-family: 'Honorifics';
  src: url('../fonts/honorifics.ttf') format('truetype');
  unicode-range: U+0611-0613, U+FD40-FD48, U+FDF2-FDFB, U+FDFD;
  font-weight: 100 900;
  font-style: normal italic;
  size-adjust: 65%;
  font-display: swap;
}

/* ---------- Design tokens: dark theme (default) ---------- */

:root {
  /* Family base (dark) — Family Green (matches the app icon's deep green) */
  --bg: rgb(16, 22, 19);
  --cream: rgb(240, 235, 220);
  --fg: var(--cream);
  --card: rgb(30, 41, 34);
  --border: rgb(54, 68, 58);            /* muted, derived from --card */
  --border-hover: rgb(100, 118, 100);   /* warmed card derivative */
  --dim: rgba(240, 235, 220, 0.72);
  --faint: rgba(240, 235, 220, 0.48);

  /* Mantle identity: logo green + antique gold */
  --gold: rgb(214, 174, 94);            /* primary accent / underlines / links */
  --accent: rgb(36, 90, 62);            /* logo green: badges / buttons / active */
  --accent-strong: rgb(46, 112, 78);    /* hover & emphasis green */
  --accent-text: rgb(167, 201, 137);    /* family light green for text on dark */

  /* Utility shades */
  --selection: rgba(214, 174, 94, 0.35);
  --shadow: rgba(0, 0, 0, 0.4);
  --overlay: rgba(9, 13, 10, 0.82);
  --badge-fg: rgb(240, 235, 220);

  /* Per-channel text colours */
  --vc-ar: var(--cream);                /* Arabic: cream */
  --vc-en: rgb(214, 208, 192);          /* English: slightly softer */

  /* Per-script font scaling (70–160%, set from the Display panel) */
  --fs-ar: 1;
  --fs-en: 1;

  /* Typography */
  --serif-display: 'Honorifics', Georgia, 'Times New Roman', serif;
  --serif-body: 'Honorifics', Georgia, 'Times New Roman', 'Nimbus Roman', serif;
  --arabic-stack: 'Honorifics', 'DigitalKhatt IndoPak', 'DigitalKhatt V2', 'Amiri Quran', 'Noto Naskh', serif;

  --radius: 14px;
  --max-width: 46rem;
}

/* ---------- Design tokens: light theme ---------- */

html.light {
  /* Family base (light) — Illuminated manuscript */
  --paper: rgb(246, 240, 224);
  --ink: rgb(28, 24, 16);
  --bg: var(--paper);
  --fg: var(--ink);
  --card: rgb(255, 252, 243);           /* lifted parchment card */
  --border: rgb(214, 200, 168);         /* muted, derived from --paper */
  --border-hover: rgb(176, 158, 118);
  --dim: rgba(30, 24, 16, 0.90);
  --faint: rgba(30, 24, 16, 0.72);

  /* Mantle identity: deep green + antique gold on paper */
  --gold: rgb(146, 112, 44);
  --accent: rgb(36, 90, 62);
  --accent-strong: rgb(24, 64, 44);
  --accent-text: rgb(28, 72, 50);

  /* Utility shades */
  --selection: rgba(146, 112, 44, 0.3);
  --shadow: rgba(40, 34, 24, 0.22);
  --overlay: rgba(40, 34, 24, 0.82);
  --badge-fg: rgb(246, 240, 224);

  /* Per-channel text colours: deep bistre Arabic & rich charcoal book-ink English */
  --vc-ar: rgb(20, 16, 10);
  --vc-en: rgb(36, 30, 22);
}

/* ---------- Reset & base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* Keep the footer/audio clear of content when jumping to anchors. */
  scroll-padding-bottom: calc(185px + env(safe-area-inset-bottom));
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: url('../icons/bg-tile-dark.jpg');
  background-repeat: repeat;
  color: var(--fg);
  font-family: var(--serif-body);
  font-size: 1.05rem;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 200ms ease, color 200ms ease;
}

/* Light theme swaps in the light arabesque tile over the paper base. */
html.light body {
  background-color: var(--paper);
  background-image: url('../icons/bg-tile-light.jpg');
}

img, audio { max-width: 100%; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Containers receiving programmatic focus on navigation do not show visual outlines */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible,
main:focus,
main:focus-visible {
  outline: none;
}

::selection { background: var(--selection); }

/* ---------- Accessibility helpers ---------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--badge-fg);
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  font-weight: bold;
  z-index: 100;
}
.skip-link:focus {
  left: 0;
  text-decoration: none;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ----------
   In-column page header (the pattern used by the sibling apps, Munajaat
   Maqbool and JustQuran): no full-width app bar — the header lives inside
   the centred content column, so the site already presents like the
   planned mobile app. Round logo + large serif title with circular icon
   buttons at the right of the row, a small italic gold subtitle, and a
   thin accent rule beneath. Rendered by app.js (.view-header).
   privacy.html / support.html still use the legacy .site-nav (rules kept
   below). */

.view-header {
  margin: 0 0 1.75rem;
  padding-top: calc(18px + env(safe-area-inset-top, 0px));
}

.view-header::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: 0.85rem;
  background: var(--accent);
}

.view-header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.view-header-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--gold);   /* echoes the gold mantle in the app icon */
}

.view-header-title {
  font-size: clamp(1.2rem, 5vw, 1.9rem);
  margin: 0;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.view-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.view-header-sub {
  font-style: italic;
  color: var(--gold);
  font-size: 0.95rem;
  margin: 0.3rem 0 0;
}

/* Circular outline icon buttons (header actions / verse copy). */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--gold);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}
.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
  color: var(--gold);
  border-color: var(--gold);
}
.icon-btn svg { width: 1.1rem; height: 1.1rem; display: block; }

/* privacy.html / support.html legacy nav (static pages without the view header) */
.site-header:has(> .site-nav) {
  position: relative;
  border-bottom: none;
  padding: 1rem 1.25rem 0;
}

.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 1.25rem;
  justify-content: flex-end;
  align-items: center;
  font-size: 0.95rem;
}

.nav-link {
  color: var(--dim);
  padding: 0.35rem 0.25rem;
  border-bottom: 2px solid transparent;
}
.nav-link:hover { color: var(--fg); text-decoration: none; border-bottom-color: var(--border-hover); }
.nav-link[aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent-text); }

/* ---------- Settings page ---------- */

.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.settings-heading {
  font-size: 1.1rem;
  color: var(--accent-text);
  margin: 0 0 0.75rem;
}

.settings-desc {
  font-size: 0.85rem;
  color: var(--dim);
  margin: 0 0 1rem;
  line-height: 1.45;
}

.layer-group {
  margin-bottom: 1.1rem;
}
.layer-group:last-child {
  margin-bottom: 0.2rem;
}

.layer-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
  gap: 0.5rem;
}

.layer-title {
  font-size: 0.92rem;
  color: var(--fg);
  font-weight: 500;
}

.layer-subtitle {
  font-size: 0.78rem;
  color: var(--dim);
}

.layer-choices {
  display: flex;
  gap: 0.5rem;
}

.layer-choice {
  flex: 1;
  padding: 0.55rem 0.5rem;
  font: inherit;
  font-size: 0.84rem;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.layer-choice:hover { border-color: var(--border-hover); }
.layer-choice[aria-pressed="true"] {
  color: var(--badge-fg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.theme-choices {
  display: flex;
  gap: 0.6rem;
}

.theme-choice {
  flex: 1;
  padding: 0.55rem 0.9rem;
  font: inherit;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.theme-choice:hover { border-color: var(--border-hover); }
.theme-choice[aria-pressed="true"] {
  color: var(--badge-fg);
  background: var(--accent);
  border-color: var(--accent);
}

.settings-note {
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
}

.fs-row {
  display: grid;
  grid-template-columns: 4rem 1fr 2.9rem;
  align-items: center;
  gap: 0.6rem;
  margin: 0.45rem 0;
  font-size: 0.9rem;
  color: var(--dim);
}
.fs-row input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent-strong);
}
.fs-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}

/* ---------- Responsive Desktop Sidebar & Dual-Pane Layout ---------- */
.desktop-sidebar { display: none; }
.layout-container { width: 100%; min-height: 100vh; }
.main-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Layout ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  box-sizing: border-box;
}

.view { min-height: 40vh; }

/* ---------- Headings with gold underline accent ---------- */

h1, h2, h3 {
  font-family: var(--serif-display);
  font-weight: normal;
  line-height: 1.3;
}

.app-title, .page-title {
  text-align: center;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  margin: 1.25rem 0 1.75rem;
  letter-spacing: 0.01em;
}

.app-title::after, .page-title::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 3px;
  margin: 0.7rem auto 0;
  background: var(--accent);
  border-radius: 2px;
}

.section-heading {
  font-size: 1.25rem;
  color: var(--accent-text);
  margin: 0 0 0.75rem;
}

/* ---------- Menu rows (app-style home) ----------
   Two-column tiles: circular gold-ringed icon on top, bold title with
   its bracketed gloss and Arabic subtitle centred beneath.
   Using minmax(0, 1fr) ensures columns never exceed screen width on
   narrow high-DPI viewports like RedMagic 10 Pro. */

.menu-rows {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  width: 100%;
  box-sizing: border-box;
}

.menu-row {
  min-width: 0;
  max-width: 100%;
}

.menu-row-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.55rem;
  min-height: 76px;
  height: 100%;
  box-sizing: border-box;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  min-width: 0;
  max-width: 100%;
}
.menu-row-link:hover {
  text-decoration: none;
  border-color: var(--gold);
  box-shadow: 0 2px 10px var(--shadow);
}
.menu-row-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  text-decoration: none;
}

.menu-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  flex-shrink: 0;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
}
.menu-row-icon svg { width: 0.95rem; height: 0.95rem; display: block; }

.menu-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  flex: 1;
  align-items: center;
  text-align: center;
  overflow: visible;
}

.menu-row-title {
  font-family: var(--serif-display);
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--fg);
  overflow-wrap: break-word;
  word-break: break-word;
  text-align: center;
  max-width: 100%;
}

/* Bracketed English gloss always on its own line under a page/section title. */
.page-title-gloss {
  display: block;
  font-size: 0.52em;
  font-weight: normal;
  color: var(--dim);
  margin-top: 0.4rem;
  letter-spacing: 0.01em;
}

.block-gloss { display: block; }
/* Modern simplification beneath the historical (Victorian) translation. */
.translation-modern {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
  font-size: 0.88em;
  color: var(--dim);
}

.translation-modern-label {
  display: block;
  font-size: 0.68rem;
  font-family: var(--sans, inherit);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.25rem;
}

/* Explains the modern layer's status on pages that contain it. */
.modern-layer-note {
  display: inline-block;
  max-width: min(34rem, 90vw);
  text-align: left;
  font-size: 0.78rem;
  color: var(--dim);
  border-left: 2px solid var(--gold);
  padding: 0.1rem 0 0.1rem 0.65rem;
  margin: 0.85rem auto 0;
  line-height: 1.5;
}

/* English gloss (the bracketed translation) on its own line under the title. */
.menu-row-gloss {
  font-family: var(--serif-display);
  font-size: 0.78rem;
  color: var(--dim);
  overflow-wrap: break-word;
  word-break: break-word;
  text-align: center;
  max-width: 100%;
}

.menu-row-sub {
  font-size: 0.82rem;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  width: 100%;
  display: block;
  text-align: center;
}

.menu-row-chevron {
  display: none;
}

/* Arabic subtitle inside a work row gets the Arabic typeface.
   Single-line, elegant clamp that prevents tile overflow and preserves full diacritics. */
.menu-row-sub[lang="ar"] {
  font-family: var(--arabic-stack);
  font-size: clamp(0.88rem, 1.5vh, 1.1rem);
  line-height: 1.55;
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  display: inline-block;
  text-align: center;
  margin-top: 0.1rem;
  padding: 0.1rem 0.25rem;
}

/* ---------- Landscape Card: Historic Gramophone Archive (Home Screen) ---------- */

.archive-card {
  margin: 0 0 2rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.archive-card-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.15rem;
  padding: 1.15rem 1.35rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.archive-card-link:hover {
  text-decoration: none;
  border-color: var(--gold);
  box-shadow: 0 4px 20px var(--shadow), 0 0 12px rgba(214, 174, 94, 0.15);
  background: rgba(214, 174, 94, 0.04);
}

.archive-card-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.archive-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 3.2rem;
  flex-shrink: 0;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(214, 174, 94, 0.08);
}

.archive-card-icon svg {
  width: 1.65rem;
  height: 1.65rem;
  display: block;
}

.archive-card-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  min-width: 0;
  max-width: 100%;
  flex: 1;
  overflow: hidden;
}

.archive-card-title {
  font-family: var(--serif-display);
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--fg);
  line-height: 1.25;
  text-align: center;
  overflow-wrap: break-word;
  word-break: break-word;
}

.archive-card-gloss {
  font-size: 0.82rem;
  color: var(--dim);
  line-height: 1.35;
  text-align: center;
  overflow-wrap: break-word;
  word-break: break-word;
}

.archive-card-sub[lang="ar"] {
  display: none;
}

.archive-card-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  width: 2.6rem;
  font-size: 1.55rem;
  line-height: 1;
  color: var(--gold);
  flex-shrink: 0;
  padding-left: 0.25rem;
  transition: transform 160ms ease;
}

.archive-card-link:hover .archive-card-chevron {
  transform: translateX(4px);
}

@media (max-width: 30rem) {
  .archive-card-link {
    gap: 0.85rem;
    padding: 1rem 1rem;
  }
  .archive-card-icon {
    width: 2.7rem;
    height: 2.7rem;
  }
  .archive-card-icon svg {
    width: 1.4rem;
    height: 1.4rem;
  }
  .archive-card-title {
    font-size: 1rem;
  }
}

/* ---------- Dedicated Archive Page Styling ---------- */

.archive-page-header {
  margin-bottom: 1.75rem;
  text-align: center;
}

.archive-page-intro {
  color: var(--dim);
  max-width: 38rem;
  margin: 0.85rem auto 0;
  line-height: 1.65;
  font-size: 0.95rem;
}

.archive-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  margin: 1.5rem 0 2rem;
}

.archive-filter-btn {
  padding: 0.45rem 1rem;
  font-size: 0.84rem;
  font-family: var(--sans, inherit);
  background: var(--card);
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 160ms ease;
}

.archive-filter-btn:hover {
  border-color: var(--gold);
  color: var(--fg);
}

.archive-filter-btn.is-active {
  background: var(--gold);
  color: #101613;
  border-color: var(--gold);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(214, 174, 94, 0.25);
}

.archive-provenance-note {
  margin-top: 3rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--faint);
  line-height: 1.6;
  text-align: center;
}

/* ---------- Genre groups within Historic Recordings ---------- */

.genre-group { margin-top: 1.75rem; }
.genre-group:first-of-type { margin-top: 0.9rem; }

.genre-heading {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin: 0 0 0.85rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

/* ---------- Reader view ---------- */

/* ---------- Sub-view Navigation Bar ---------- */
.sub-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg);
  background-image: url('../icons/bg-tile-dark.jpg');
  background-repeat: repeat;
  border-bottom: 1px solid rgba(214, 174, 94, 0.25);
  margin-bottom: 1.25rem;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 1rem 8px;
  box-sizing: border-box;
}

html.light .sub-nav-bar {
  background-color: var(--paper);
  background-image: url('../icons/bg-tile-light.jpg');
  border-bottom-color: rgba(156, 118, 46, 0.25);
}

.sub-nav-left, .sub-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sub-nav-center {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 0 0.5rem;
}

.sub-nav-title {
  font-family: var(--serif-display);
  font-size: clamp(0.88rem, 3.2vw, 1.08rem);
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}


.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.work-header { text-align: center; margin-bottom: 2rem; }

.work-title-ar {
  font-family: var(--arabic-stack);
  font-size: calc(clamp(1.7rem, 6vw, 2.3rem) * var(--fs-ar));
  line-height: 2;
  color: var(--vc-ar);
  margin: 0.5rem 0 0.25rem;
}

.work-author { color: var(--dim); margin: 0.25rem 0; }
.work-description { color: var(--dim); max-width: 36rem; margin: 0.75rem auto 0; }

.work-source {
  color: var(--faint);
  font-size: 0.85rem;
  max-width: 36rem;
  margin: 1rem auto 0;
}
.work-source summary {
  cursor: pointer;
  font-weight: bold;
  color: var(--dim);
  display: inline-block;
  list-style-position: inside;
}
.work-source summary::before { content: "▸ "; }
details.work-source[open] summary::before { content: "▾ "; }
.work-source p { margin: 0.5rem 0 0; }

/* ---------- Reader: verse-per-card (Munajaat-style) ---------- */

.verse-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.verse-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1.2rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.verse-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 10px var(--shadow);
}
.verse-card.is-seekable {
  cursor: pointer;
}
.verse-card.is-active-verse {
  border: 2px solid var(--gold) !important;
  padding: calc(1.1rem - 1px) calc(1.25rem - 1px) calc(1.2rem - 1px);
  background: rgba(214, 174, 94, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 0 16px rgba(214, 174, 94, 0.25);
  transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
}
html.light .verse-card.is-active-verse {
  background: #FFFDF7 !important;
  border: 2px solid var(--gold) !important;
  padding: calc(1.1rem - 1px) calc(1.25rem - 1px) calc(1.2rem - 1px);
  box-shadow: 0 4px 18px rgba(140, 102, 32, 0.22), 0 0 12px rgba(214, 174, 94, 0.2);
}
.verse-card.is-active-verse .verse-badge {
  background: var(--gold);
  color: #101613;
  font-weight: bold;
}

/* Follow-along: the words being recited turn gold, not just the card border. */
.verse-card .arabic-text,
.verse-card .translation {
  transition: color 250ms ease, text-shadow 250ms ease;
}
.verse-card.is-active-verse .arabic-text,
.verse-card.is-active-verse .translation {
  color: var(--gold) !important;
}
.verse-card.is-active-verse .arabic-text {
  text-shadow: 0 0 12px rgba(214, 174, 94, 0.3);
}
html.light .verse-card.is-active-verse .arabic-text {
  text-shadow: none;
}

.verse-label-refrain {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--gold);
  margin-left: 8px;
  font-family: var(--sans-ui);
}
html.light .verse-label-refrain {
  color: var(--accent-strong);
  font-weight: 600;
}

/* ---------- Translation Layers & Collapsible Dropdowns ---------- */
.translation-dropdown {
  margin: 0.75rem 0 0.25rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}
.translation-dropdown-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-family: var(--sans-ui);
  color: var(--gold);
  cursor: pointer;
  user-select: none;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  background: rgba(214, 174, 94, 0.08);
  border: 1px solid rgba(214, 174, 94, 0.22);
  transition: all 140ms ease;
}
.translation-dropdown-summary:hover {
  background: rgba(214, 174, 94, 0.16);
  border-color: var(--gold);
}
html.light .translation-dropdown-summary {
  color: var(--accent-strong);
  background: rgba(36, 90, 62, 0.08);
  border-color: rgba(36, 90, 62, 0.25);
  font-weight: 500;
}
html.light .translation-dropdown-summary:hover {
  background: rgba(36, 90, 62, 0.14);
  border-color: var(--accent-strong);
}
.translation-dropdown-summary::-webkit-details-marker {
  display: none;
}
.translation-dropdown-summary .dropdown-arrow {
  display: inline-block;
  transition: transform 180ms ease;
  font-size: 0.75rem;
}
.translation-dropdown[open] .dropdown-arrow {
  transform: rotate(180deg);
}
.translation-dropdown-content {
  padding-top: 0.65rem;
  padding-left: 0.25rem;
}
.translation-dropdown-content .translation {
  margin: 0;
  font-size: calc(0.96rem * var(--fs-en));
  line-height: 1.6;
  opacity: 0.9;
}
html.light .translation-dropdown-content .translation {
  opacity: 1;
  color: var(--vc-en);
}

/* ---------- Reader Bottom Bar (Media & Section Navigation Dock) ---------- */
.reader-wrap {
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
}

.reader-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 680px;
  margin: 0 auto;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
}
.reader-footer-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
}
.reader-footer-progress-bar {
  height: 100%;
  background: var(--gold);
  width: 0%;
  transition: width 150ms linear;
}
.reader-footer-center {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  justify-content: center;
  margin: 0 10px;
}
.reader-footer-center.non-audio {
  padding: 8px 0;
}
.reader-footer .section-indicator {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--fg);
  opacity: 0.85;
}
.reader-footer .audio-play-btn {
  background: var(--accent);
  color: var(--gold);
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 120ms ease, background 160ms ease;
}
.reader-footer .audio-play-btn:hover {
  transform: scale(1.06);
  background: var(--accent-strong);
}
.reader-footer .audio-play-btn svg {
  width: 18px;
  height: 18px;
}
.reader-footer .audio-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 220px;
}
.reader-footer .audio-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-footer .audio-timer {
  font-size: 0.74rem;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reader-footer .audio-autoscroll-btn {
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 140ms ease;
}
.reader-footer .audio-autoscroll-btn.is-active {
  background: var(--gold);
  color: #101613;
  border-color: var(--gold);
}
.reader-footer .audio-loop-btn {
  font-size: 0.95rem;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 140ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.reader-footer .audio-loop-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}
.reader-footer .audio-loop-btn.is-active {
  background: var(--gold);
  color: #101613;
  border-color: var(--gold);
}
html.light .reader-footer {
  box-shadow: 0 -4px 20px rgba(40, 34, 24, 0.12);
  background: var(--paper);
}
.reader-footer .nav-section-btn {
  color: var(--gold);
  min-width: 36px;
  min-height: 36px;
  padding: 6px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  margin: 0 2px;
}
.reader-footer .nav-section-btn.is-disabled {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}
.reader-footer .nav-section-btn svg {
  width: 20px;
  height: 20px;
}

/* Desktop floating media capsule dock */
@media (min-width: 960px) {
  .reader-wrap {
    padding-bottom: 120px !important;
  }
  .reader-footer {
    left: 260px;
    right: 0;
    margin: 0 auto;
    bottom: 24px;
    width: fit-content;
    min-width: 440px;
    max-width: 620px;
    border-radius: 9999px;
    padding: 8px 24px;
    gap: 16px;
    background: var(--card);
    border: 1.5px solid var(--gold);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .reader-footer-progress {
    border-radius: 9999px 9999px 0 0;
  }
}

/* ---------- iOS PWA Install Banner ---------- */
#ios-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  background: var(--card);
  color: var(--fg);
  border: 1.5px solid var(--gold);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
#ios-banner[hidden] {
  display: none !important;
}
#ios-banner button {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 2px 8px;
  flex-shrink: 0;
}

.verse-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.verse-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.3rem;
  font-weight: bold;
  font-size: 0.95rem;
  color: var(--badge-fg);
  background: var(--accent);
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
}

.verse-play,
.verse-copy {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.verse-play svg,
.verse-copy svg {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}
.verse-play.is-playing {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(214, 174, 94, 0.15);
}
html.light .verse-play.is-playing {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
  background: rgba(36, 90, 62, 0.12);
}
.verse-copy.is-copied {
  color: var(--gold);
  border-color: var(--gold);
}

.verse-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}


.arabic-text {
  font-family: var(--arabic-stack);
  font-size: calc(1.7rem * var(--fs-ar));
  line-height: 2.2;
  color: var(--vc-ar);
  margin: 0 0 1rem;
  white-space: pre-line;
}

.translation {
  margin: 0;
  color: var(--vc-en);
  font-size: calc(1rem * var(--fs-en));
  white-space: pre-line;
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
}

.section-note {
  font-size: 0.9rem;
  color: var(--faint);
  font-style: italic;
  margin: -0.4rem 0 1.1rem;
}

.translation-pending {
  font-size: 0.85rem;
  color: var(--faint);
  font-style: italic;
  margin: -0.4rem 0 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
}

.verse-num {
  color: var(--gold);
  font-size: 0.75em;
  font-family: var(--latin-stack, serif);
}

/* ---------- Work index: section list (Munajaat-style rows) ---------- */

.section-index {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.section-item-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  color: inherit;
  transition: border-color 160ms ease;
}
.section-item-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.section-item-text { flex: 1; min-width: 0; text-align: center; }

.section-item-heading {
  display: block;
  font-size: 1.08rem;
}

.section-item-count {
  display: block;
  color: var(--dim);
  font-size: 0.88rem;
  margin-top: 0.15rem;
}

.section-item-chevron {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 1.7rem;
  line-height: 1;
}

/* ---------- Section reader: previous / next bar ---------- */

.section-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.section-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  max-width: 38%;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--dim);
}
.section-nav-link:hover {
  color: var(--accent-text);
  border-color: var(--accent);
  text-decoration: none;
}
.section-nav-link.is-disabled { visibility: hidden; }

.section-nav-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-nav-arrow { flex: 0 0 auto; }

.section-nav-pos {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 0.88rem;
  white-space: nowrap;
}

/* ---------- Audio ---------- */

.audio-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.25rem;
}

.audio-block h2 {
  font-size: 1.3rem;
  text-align: center;
  margin: 0 0 1rem;
}
.audio-block h2::after {
  content: "";
  display: block;
  width: 2.25rem;
  height: 2px;
  margin: 0.5rem auto 0;
  background: var(--accent);
  border-radius: 2px;
}

audio {
  display: block;
  width: 100%;
  height: 2.75rem;
  border-radius: var(--radius);
}

/* ---------- Recording tile grid ---------- */

.tile-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem 0.9rem;
}

@media (min-width: 34rem) {
  .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.tile { min-width: 0; }

.tile-button {
  display: block;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: pointer;
}

.tile-art {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: 0 2px 10px var(--shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.tile-button:hover .tile-art,
.tile-button:focus-visible .tile-art {
  border-color: var(--gold);
  box-shadow: 0 3px 14px var(--shadow);
}

.tile-artist {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: break-word;
}

.tile-title {
  display: block;
  color: var(--dim);
  font-size: 0.8rem;
  line-height: 1.35;
  margin-top: 0.1rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ---------- Recording detail sheet (opened from a tile) ---------- */

.rec-dialog {
  position: relative;
  width: min(94vw, 30rem);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 12px 40px var(--shadow);
  text-align: center;
}

.rec-dialog-art {
  display: block;
  width: min(55vw, 12.5rem);
  margin: 0 auto 1.25rem;
  padding: 0;
  border: 4px solid var(--accent);
  border-radius: 50%;
  overflow: hidden;
  background: #0a0e0c;
  cursor: zoom-in;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), inset 0 0 0 3px rgba(255, 255, 255, 0.08);
  transition: border-color 160ms ease, box-shadow 300ms ease;
}
.rec-dialog-art:hover { border-color: var(--gold); }
.rec-dialog-art img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
}
.rec-dialog-art.is-playing img {
  animation: vinyl-spin 4s linear infinite;
}
.rec-dialog-art.is-paused img {
  animation: vinyl-spin 4s linear infinite;
  animation-play-state: paused;
}
.rec-dialog-art.is-playing {
  border-color: var(--gold);
  box-shadow: 0 0 25px rgba(201, 166, 88, 0.35), 0 8px 24px rgba(0, 0, 0, 0.5);
}
@keyframes vinyl-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.rec-dialog-artist {
  margin: 0 0 0.2rem;
  font-size: 1.3rem;
}

.rec-dialog-title {
  margin: 0 0 0.45rem;
  color: var(--dim);
}

.rec-dialog-meta {
  margin: 0 0 0.9rem;
  color: var(--faint);
  font-size: 0.88rem;
}

.rec-dialog-desc {
  margin: 0 0 1rem;
  color: var(--vc-en);
  font-size: 0.95rem;
  text-align: left;
}

.rec-dialog-note {
  margin: -0.35rem 0 1rem;
  color: var(--faint);
  font-size: 0.82rem;
  font-style: italic;
  text-align: left;
}

.rec-dialog-credit {
  margin: 0.75rem 0 0;
  color: var(--faint);
  font-size: 0.78rem;
  font-style: italic;
}

/* Identified text & translation inside the recording sheet */
.rec-text {
  margin: 1rem 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
}

.rec-text-summary {
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--vc-en);
  user-select: none;
}

.rec-text-summary:hover { color: var(--fg); }

.rec-text[open] .rec-text-summary { border-bottom: 1px solid var(--border); }

.rec-text-body {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.rec-text-source {
  margin: 0;
  color: var(--dim);
  font-size: 0.85rem;
}

.rec-text-heading {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  color: var(--fg);
}

.rec-text-credit {
  margin: 0.25rem 0 0;
  color: var(--faint);
  font-size: 0.78rem;
  font-style: italic;
}

.rec-dialog-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  width: 2.25rem;
  height: 2.25rem;
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--badge-fg);
  background: var(--accent);
  border: 1px solid var(--accent-strong);
  border-radius: 50%;
  cursor: pointer;
}
.rec-dialog-close:hover { background: var(--accent-strong); }

/* Full-size label viewer overlay (opened from the thumbnail). */
.art-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--overlay);
}

.art-overlay-img {
  max-width: min(92vw, 40rem);
  max-height: 82vh;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px var(--shadow);
}

.art-overlay-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--badge-fg);
  background: var(--accent);
  border: 1px solid var(--accent-strong);
  border-radius: 50%;
  cursor: pointer;
}
.art-overlay-close:hover { background: var(--accent-strong); }

/* ---------- Notices / states ---------- */

.notice, .loading, .error-box {
  text-align: center;
  color: var(--dim);
  padding: 2rem 1rem;
}

.error-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.error-box strong { color: var(--accent-text); }

/* ---------- About page ---------- */

.prose p { margin: 0 0 1.1rem; }
.prose ul { padding-left: 1.4rem; margin: 0 0 1.1rem; }

/* ---------- Support page (support.html) ---------- */

/* Top Family Switcher */
.family-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 1rem 14px;
  max-width: var(--max-width, 48rem);
  width: 100%;
}
@media (min-width: 600px) {
  .family-bar {
    flex-direction: row;
    justify-content: center;
    gap: 12px;
  }
}
.family-bar-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.family-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.family-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 9999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--fg);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 1px 3px var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.family-pill:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
}
.family-pill.active {
  border-color: var(--accent);
  background: rgba(36, 90, 62, 0.18);
  font-weight: 600;
  color: var(--accent-text);
}
html.light .family-pill.active {
  background: rgba(36, 90, 62, 0.08);
}
.family-pill-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.support-hero {
  text-align: center;
  margin: 0.5rem 0 2rem;
}
.support-hero-icon {
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 24%;
  box-shadow: 0 3px 14px var(--shadow);
}
.support-hero-title {
  font-family: var(--serif-display);
  font-size: 1.8rem;
  margin: 0.9rem 0 0.25rem;
}
.support-hero-tag {
  font-family: var(--arabic-stack);
  font-size: calc(1.15rem * var(--fs-ar));
  color: var(--gold);
  margin: 0 0 0.6rem;
}
.support-badges {
  color: var(--dim);
  font-size: 0.9rem;
  margin: 0;
}

/* Card System */
.support-wrap {
  width: 100%;
  max-width: var(--max-width, 48rem);
  margin: 0 auto;
}
.support-wrap .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1.35rem;
}
.support-wrap .card h2 {
  font-family: var(--serif-display);
  font-size: 0.82rem;
  letter-spacing: 1.5px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}
.support-wrap .card p {
  margin: 0.5rem 0;
  line-height: 1.65;
}
.support-wrap .card p.dim,
.support-wrap .dim {
  color: var(--dim);
  font-size: 0.92rem;
}

/* Centered Button Rows */
.btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 1.1rem 0 0.75rem;
  width: 100%;
  text-align: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 22px;
  border-radius: 9999px;
  background: var(--accent);
  color: var(--badge-fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  border: 1.5px solid var(--accent);
  box-shadow: 0 1px 3px var(--shadow);
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.btn:hover {
  opacity: 0.94;
  transform: translateY(-1px);
  text-decoration: none;
  background: var(--accent-strong);
}
.btn.ghost {
  background: transparent;
  color: var(--accent-text);
  border-color: var(--accent);
  box-shadow: none;
}
.btn.ghost:hover {
  background: rgba(36, 90, 62, 0.12);
  color: var(--accent-text);
}
html.light .btn.ghost:hover {
  background: rgba(36, 90, 62, 0.08);
}
.kofi-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 24px;
  border-radius: 9999px;
  background: var(--gold);
  color: #101613;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  box-shadow: 0 2px 8px var(--shadow);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.kofi-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  text-decoration: none;
}

/* Family of Apps Section */
.family-intro {
  color: var(--dim);
  font-size: 0.94rem;
  line-height: 1.65;
  margin-bottom: 1rem !important;
}
.app-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 1.1rem 1.25rem;
  margin-top: 1rem;
  box-shadow: 0 1px 4px var(--shadow);
}
.app-item.active-app {
  border-color: var(--accent);
  background: rgba(36, 90, 62, 0.06);
}
html.light .app-item.active-app {
  background: rgba(36, 90, 62, 0.04);
}
.app-item-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 0.5rem;
}
.app-item-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: 0 2px 6px var(--shadow);
  flex-shrink: 0;
  object-fit: cover;
}
.app-item-info {
  flex: 1;
  min-width: 0;
}
.app-item-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.app-item-name {
  font-family: var(--serif-display);
  font-size: 1.15rem;
  color: var(--accent-text);
  margin: 0;
}
.app-badge-current {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--badge-fg);
}
.app-item-arabic {
  font-family: var(--arabic-stack);
  font-size: calc(1.05rem * var(--fs-ar));
  color: var(--gold);
  margin-left: auto;
}
.app-item-subtitle {
  font-size: 0.85rem;
  color: var(--dim);
  font-style: italic;
  margin: 2px 0 0 !important;
}
.app-item-desc {
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.6;
  margin: 0.6rem 0 0.85rem !important;
}
.app-item-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.85rem;
}
.app-item-actions .btn {
  padding: 7px 18px;
  font-size: 0.86rem;
  margin: 0;
}

/* Books from Munajaat Press (support page) */
.book-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.book-item-cover {
  flex: 0 0 72px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 1px 4px var(--shadow);
}
.book-item-info { flex: 1; min-width: 0; }
.book-item .app-item-name { font-size: 1rem; line-height: 1.35; }
.book-item .app-item-desc { margin: 0.35rem 0 0.6rem !important; }
.book-item-links { display: flex; gap: 8px; flex-wrap: wrap; }
/* Readers' Favorite review under The Garden of Purity, Vol 1 */
.book-item-review { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; }
.book-item-review img { flex: 0 0 48px; width: 48px; height: 48px; margin-top: 2px; }
.book-item-review p { flex: 1; min-width: 0; margin: 0 !important; font-size: 0.9rem; font-style: italic; line-height: 1.45; }
.book-item-review span { font-style: normal; opacity: 0.8; }
.book-item-links .btn { padding: 6px 16px; font-size: 0.84rem; margin: 0; }
.book-item-sample { margin: 0.6rem 0 0 !important; font-size: 0.88rem; }
.book-item-sample a { text-decoration: underline; }
@media (max-width: 480px) {
  .book-item { gap: 12px; padding: 0.9rem; }
  .book-item-cover { flex-basis: 60px; width: 60px; }
  .book-item-links .btn { padding: 5px 12px; }
}

.licence-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 0.5rem;
  font-size: 0.92rem;
}
.licence-table th,
.licence-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.6rem 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.licence-table th {
  width: 32%;
  font-family: var(--serif-display);
  color: var(--fg);
}
.licence-table td { color: var(--dim); }

.support-footer-credit {
  margin-top: 1.5rem;
  color: var(--faint);
  font-size: 0.88rem;
  text-align: center;
}
.prose li { margin-bottom: 0.4rem; }

.credit-line {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1rem 1.25rem;
  font-style: italic;
  color: var(--dim);
}

/* ---------- Netlify OSS Footer (Web Version) ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 0.5rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 0.75rem;
  color: var(--dim);
  margin: 0.75rem auto 0;
  max-width: var(--max-width);
  width: 100%;
  box-sizing: border-box;
}
.site-footer a {
  color: var(--dim);
  text-decoration: none;
  opacity: 0.85;
}
.site-footer a:hover {
  color: var(--gold);
  text-decoration: underline;
  opacity: 1;
}
html.is-native-android .site-footer {
  display: none !important;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- App logo ---------- */
.app-logo {
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 auto 0.75rem;
  border-radius: 22%;
}

/* ---------- Home: historic recordings listed under the works ---------- */
.home-media { margin-top: 2.25rem; }
.home-media h2 { margin-bottom: 0.25rem; }
.home-media .media-sub {
  text-align: center;
  color: var(--faint);
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
}

/* ---------- Zero-Scroll Mobile Home Dashboard (< 768px, e.g. RedMagic 10 Pro) ---------- */
@media (max-width: 768px) {
  html.is-home, body.is-home {
    height: 100dvh;
    height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  body.is-home .layout-container {
    height: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
  }
  body.is-home .main-content {
    flex: 1;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }
  body.is-home main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 0.75rem 0.25rem;
    box-sizing: border-box;
    overflow: hidden;
  }
  body:not(.is-home) main {
    padding-top: 0;
  }
  body.is-home #app,
  body.is-home .reader-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0 !important;
  }
  body.is-home .view-header {
    flex: 0 0 auto;
    margin: 0 0 clamp(0.4rem, 1.2vh, 0.75rem);
    padding: 0 0 clamp(0.25rem, 0.7vh, 0.45rem);
  }
  body.is-home .view-header-logo {
    width: clamp(38px, 5vh, 48px);
    height: clamp(38px, 5vh, 48px);
  }
  body.is-home .view-header-title {
    font-size: clamp(1.35rem, 2.5vh, 1.65rem);
  }
  body.is-home .view-header-sub {
    font-size: clamp(0.8rem, 1.3vh, 0.92rem);
    margin-top: 0.2rem;
  }

  body.is-home #featured-card-container {
    flex: 0 0 auto;
    margin-bottom: clamp(0.4rem, 1vh, 0.7rem);
  }
  body.is-home .featured-card .archive-card-link {
    padding: clamp(0.7rem, 1.4vh, 1.05rem) clamp(0.75rem, 1.8vw, 1.1rem);
  }
  body.is-home .featured-card .archive-card-title {
    font-size: clamp(1.05rem, 2vh, 1.3rem);
  }
  body.is-home .featured-card .archive-card-gloss {
    font-size: clamp(0.8rem, 1.3vh, 0.92rem);
  }

  body.is-home .menu-rows {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: clamp(0.45rem, 1.1vh, 0.75rem);
    margin: 0 0 clamp(0.4rem, 1vh, 0.7rem);
  }
  body.is-home .menu-row {
    height: 100%;
    min-height: 0;
  }
  body.is-home .menu-row-link {
    height: 100%;
    box-sizing: border-box;
    padding: clamp(0.6rem, 1.3vh, 1rem) clamp(0.45rem, 1.2vw, 0.75rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: clamp(0.2rem, 0.5vh, 0.4rem);
    min-height: 0;
  }
  body.is-home .menu-row-icon {
    width: clamp(2rem, 3.4vh, 2.6rem);
    height: clamp(2rem, 3.4vh, 2.6rem);
  }
  body.is-home .menu-row-icon svg {
    width: clamp(1rem, 1.7vh, 1.3rem);
    height: clamp(1rem, 1.7vh, 1.3rem);
  }
  body.is-home .menu-row-title {
    font-size: clamp(0.95rem, 1.6vh, 1.15rem);
    line-height: 1.25;
  }
  body.is-home .menu-row-gloss {
    font-size: clamp(0.76rem, 1.2vh, 0.86rem);
    line-height: 1.2;
  }
  body.is-home .menu-row-sub[lang="ar"] {
    font-size: clamp(0.9rem, 1.55vh, 1.12rem);
    line-height: 1.55;
    margin-top: 0.1rem;
    padding: 0.1rem 0.35rem;
    overflow: visible;
    text-overflow: unset;
    white-space: nowrap;
    display: inline-block;
  }

  body.is-home #archive-card-container {
    flex: 0 0 auto;
    margin-bottom: 0;
  }
  body.is-home .archive-card {
    margin: 0;
  }
  body.is-home .archive-card-link {
    padding: clamp(0.7rem, 1.4vh, 1.05rem) clamp(0.75rem, 1.8vw, 1.1rem);
    gap: clamp(0.6rem, 1.3vh, 0.9rem);
  }
  body.is-home .archive-card-icon {
    width: clamp(2.1rem, 3.4vh, 2.6rem);
    height: clamp(2.1rem, 3.4vh, 2.6rem);
  }
  body.is-home .archive-card-icon svg {
    width: clamp(1.05rem, 1.7vh, 1.3rem);
    height: clamp(1.05rem, 1.7vh, 1.3rem);
  }
  body.is-home .archive-card-title {
    font-size: clamp(1rem, 1.8vh, 1.2rem);
  }
  body.is-home .archive-card-gloss {
    font-size: clamp(0.78rem, 1.25vh, 0.88rem);
  }
  body.is-home .archive-card-sub {
    font-size: clamp(0.95rem, 1.5vh, 1.08rem);
  }
  body.is-home .site-footer {
    flex: 0 0 auto;
    border-top: none;
    margin: 0 auto;
    padding: clamp(0.25rem, 0.8vh, 0.5rem) 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    font-size: 0.72rem;
  }
}

/* ---------- Mobile Viewport Optimizations (< 480px, e.g. RedMagic 10 Pro) ---------- */
@media (max-width: 480px) {
  main {
    padding: calc(12px + env(safe-area-inset-top, 0px)) 0.75rem 2.5rem;
  }
  body:not(.is-home) main {
    padding-top: 0;
  }
  .sub-nav-bar {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-bottom: 7px;
    margin-bottom: 0.85rem;
  }
  .sub-nav-title {
    font-size: 1.05rem;
    text-align: left;
  }

  .reader-footer {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .reader-footer-center {
    margin: 0 6px;
    gap: 6px;
  }
  .reader-footer .audio-info {
    max-width: 140px;
    flex: 1 1 auto;
  }
  .reader-footer .audio-title {
    font-size: 0.8rem;
  }
  .reader-footer .audio-timer {
    font-size: 0.7rem;
  }
  .reader-footer .audio-autoscroll-btn {
    padding: 3px 6px;
    font-size: 0.68rem;
  }
  .reader-footer .audio-loop-btn {
    width: 28px;
    height: 28px;
  }
  .reader-footer .audio-loop-btn svg {
    width: 13px;
    height: 13px;
  }
  .reader-footer .nav-section-btn {
    min-width: 32px;
    min-height: 32px;
    padding: 4px;
    margin: 0 1px;
  }
  .archive-card-link {
    padding: 0.9rem 0.8rem;
    gap: 0.75rem;
  }
  .archive-card-icon {
    width: 2.5rem;
    height: 2.5rem;
  }
  .archive-card-icon svg {
    width: 1.3rem;
    height: 1.3rem;
  }
  .archive-card-title {
    font-size: 0.95rem;
  }
  .archive-card-gloss {
    font-size: 0.76rem;
  }
  .verse-card {
    padding: 1rem 0.85rem 1rem;
  }
}

/* ---------- Responsive Desktop Sidebar & Dual-Pane Layout (Munajaat Pattern) ---------- */
@media (min-width: 960px) {
  .layout-container {
    display: flex;
    min-height: 100vh;
  }
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    width: 270px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 24px 16px 16px;
    box-sizing: border-box;
    z-index: 20;
  }
  .main-content {
    flex: 1;
    min-width: 0;
    padding: 24px 36px 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
  }
  .main-content main {
    max-width: 820px;
    width: 100%;
    margin: 0;
    padding: 0 0 24px;
    box-sizing: border-box;
  }
  .main-content .site-footer {
    max-width: 820px;
    width: 100%;
    margin: auto auto 0;
    box-sizing: border-box;
  }
  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    padding: 4px 8px 16px;
    border-bottom: 2px solid var(--gold);
    margin-bottom: 16px;
  }
  .sidebar-logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--gold);
  }
  .sidebar-title {
    font-family: var(--serif-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--fg);
    line-height: 1.2;
  }
  .sidebar-sub {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--gold);
    margin-top: 2px;
  }
  .sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .nav-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--dim);
    margin: 14px 8px 6px;
    text-transform: uppercase;
  }
  .sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--fg);
    font-size: 0.92rem;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
  }
  .sidebar-nav .nav-item:hover {
    background: rgba(214, 174, 94, 0.12);
    color: var(--fg);
    text-decoration: none;
  }
  .sidebar-nav .nav-item.active {
    background: var(--accent);
    color: var(--badge-fg);
    font-weight: 600;
  }
  .sidebar-nav .nav-item.active .nav-icon {
    color: var(--badge-fg);
  }
  .sidebar-nav .nav-item.active .nav-icon svg {
    stroke: var(--badge-fg);
  }
  .nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    flex-shrink: 0;
  }
  .nav-icon svg {
    width: 18px;
    height: 18px;
  }
  .nav-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar-foot {
    display: flex;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    margin-top: auto;
  }
  .sidebar-btn {
    flex: 1;
    background: rgba(128, 128, 128, 0.1);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 8px;
    font-size: 0.82rem;
    color: var(--dim);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
  }
  .sidebar-btn:hover {
    background: rgba(214, 174, 94, 0.15);
    color: var(--fg);
    text-decoration: none;
  }
}

/* ---------- Featured landscape card: the narrated Sīrah audiobook (Home) ---------- */

.featured-card {
  margin-bottom: 1.1rem;
}
.featured-card .archive-card-link {
  border: 1.5px solid rgba(214, 174, 94, 0.38);
  background: linear-gradient(135deg, rgba(214, 174, 94, 0.08) 0%, rgba(20, 52, 38, 0.42) 100%), var(--card);
  box-shadow: 0 4px 18px var(--shadow), 0 0 14px rgba(214, 174, 94, 0.10);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
html.light .featured-card .archive-card-link {
  border: 1.5px solid rgba(146, 112, 44, 0.48);
  background: linear-gradient(135deg, rgba(214, 174, 94, 0.12) 0%, rgba(36, 90, 62, 0.04) 100%), var(--card);
  box-shadow: 0 4px 18px var(--shadow), 0 2px 6px rgba(40, 34, 24, 0.08);
}
.featured-card .archive-card-link:hover {
  border-color: var(--gold);
  box-shadow: 0 6px 24px var(--shadow), 0 0 18px rgba(214, 174, 94, 0.20);
  background: linear-gradient(135deg, rgba(214, 174, 94, 0.14) 0%, rgba(20, 52, 38, 0.52) 100%), var(--card);
}
html.light .featured-card .archive-card-link:hover {
  border-color: var(--gold);
  box-shadow: 0 6px 20px var(--shadow), 0 0 12px rgba(146, 112, 44, 0.20);
  background: linear-gradient(135deg, rgba(214, 174, 94, 0.18) 0%, rgba(36, 90, 62, 0.06) 100%), var(--card);
}
.featured-card .archive-card-icon {
  background: rgba(214, 174, 94, 0.10);
  border: 1.5px solid var(--gold);
  color: var(--gold);
  box-shadow: inset 0 0 8px rgba(214, 174, 94, 0.14);
}
html.light .featured-card .archive-card-icon {
  background: rgba(146, 112, 44, 0.12);
  border: 1.5px solid var(--gold);
  color: var(--gold);
}
.featured-card .archive-card-link:hover .archive-card-icon {
  background: rgba(214, 174, 94, 0.18);
  color: #f3dfa2;
}
.featured-card .archive-card-title {
  font-size: 1.22rem;
}
.featured-badge {
  display: inline-flex;
  align-items: center;
  align-self: center;
  font-family: var(--sans-ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
  color: var(--gold);
  background: rgba(214, 174, 94, 0.12);
  border: 1px solid rgba(214, 174, 94, 0.32);
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  margin: 0 auto 0.2rem;
}
html.light .featured-badge {
  color: #724c08;
  background: rgba(146, 112, 44, 0.15);
  border: 1px solid rgba(146, 112, 44, 0.38);
  font-weight: 700;
}

/* ---------- Book Mode: paged reader (CSS multi-columns, JustQuran-style) ---------- */

.reader-wrap.is-book {
  padding-top: 0.35rem;
  padding-bottom: 0 !important;
}
.book-header {
  margin-bottom: 0.7rem;
}
.book-header .page-title {
  font-size: clamp(1.15rem, 4.2vw, 1.6rem);
  margin-bottom: 0.1rem;
}
.book-header .work-author {
  margin: 0.1rem 0;
  font-size: 0.88rem;
}
.book-about {
  margin: 0.35rem auto 0;
  font-size: 0.82rem;
}
.book-reader {
  max-width: 40rem;
  margin: 0 auto;
}
.book-tabs {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}
.book-tab {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  font-family: var(--sans-ui);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.48rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--card);
  color: var(--dim);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: all 160ms ease;
}
.book-tab-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.book-tab-icon {
  width: 14px;
  height: 14px;
  display: block;
}
.book-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-tab.is-active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(214, 174, 94, 0.12);
  font-weight: 600;
  box-shadow: 0 0 10px rgba(214, 174, 94, 0.12);
}
.book-tab:focus-visible,
.book-page-btn:focus-visible,
.book-para-num:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.book-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.book-strip {
  position: relative;
  width: 100%;
  column-fill: auto;
  transition: transform 280ms ease;
  will-change: transform;
}
/* Continuous flowing English story prose (JustQuran book-en style) */
.book-en-flow {
  margin: 0;
  padding: 0.25rem 0.5rem;
  font-family: Georgia, 'DejaVu Serif', serif;
  font-size: calc(1.05rem * var(--fs-en));
  line-height: 1.88;
  color: var(--vc-en);
  text-align: center;
  orphans: 2;
  widows: 2;
}

.verse-run {
  display: inline;
  cursor: pointer;
  border-radius: 4px;
  transition: color 180ms ease, text-shadow 180ms ease;
}

.verse-run.is-active-verse,
.verse-run.reciting {
  color: #ffd700 !important;
  background: transparent !important;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.32);
}

html.light .verse-run.is-active-verse,
html.light .verse-run.reciting {
  color: #7c4e00 !important;
  font-weight: 600 !important;
  background: transparent !important;
  text-shadow: none;
}

/* inline superscript verse-number marker in book prose (matches JustQuran bkmark) */
.bkmark {
  display: inline;
  background: none;
  border: none;
  padding: 0 2px;
  margin: 0 1px 0 2px;
  color: var(--gold);
  font-family: 'DejaVu Serif', Georgia, serif;
  font-size: 0.68em;
  vertical-align: super;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: color 180ms ease;
}

.verse-run.is-active-verse .bkmark,
.verse-run.reciting .bkmark {
  color: #ffd700 !important;
  font-weight: 700;
}

html.light .verse-run.is-active-verse .bkmark,
html.light .verse-run.reciting .bkmark {
  color: #7c4e00 !important;
  font-weight: 700 !important;
}

.bkmark:hover {
  text-decoration: underline;
}

.book-para {
  margin: 0 0 1.15em;
  padding: 0.3rem 0.55rem;
  border: 2px solid transparent;
  border-radius: 10px;
  font-family: Georgia, 'DejaVu Serif', serif;
  font-size: calc(1.04rem * var(--fs-en));
  line-height: 1.85;
  color: var(--vc-en);
  text-align: center;
  orphans: 2;
  widows: 2;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.book-para.is-active-verse {
  color: #ffd700 !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.28);
  transition: color 180ms ease, text-shadow 180ms ease;
}
html.light .book-para.is-active-verse {
  color: #7c4e00 !important;
  font-weight: 600 !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  text-shadow: none;
}
.book-para-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  margin-right: 0.45em;
  padding: 0;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: transparent;
  color: var(--gold);
  font-family: var(--sans-ui);
  font-size: 0.68em;
  font-weight: 700;
  line-height: 1;
  vertical-align: 0.12em;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}
.book-para.is-active-verse .book-para-num {
  border-color: #ffd700;
  color: #ffd700;
  background: rgba(255, 215, 0, 0.15);
}
html.light .book-para.is-active-verse .book-para-num {
  border-color: #7c4e00;
  color: #7c4e00;
  background: rgba(124, 78, 0, 0.12);
}
.book-note {
  margin: 0.4em 0 1em;
  font-family: var(--sans-ui);
  font-size: 0.8rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--faint);
}
.book-passage {
  margin-bottom: 1.4em;
}
.book-label {
  margin: 0 0 0.4em;
  font-family: var(--sans-ui);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  color: var(--gold);
}
.book-ar {
  margin: 0 0 0.6em;
  font-family: var(--arabic-stack);
  font-size: calc(1.55rem * var(--fs-ar));
  line-height: 2.2;
  color: var(--vc-ar);
  text-align: right;
}
.book-ref {
  margin: 0.2em 0 0;
  font-family: var(--sans-ui);
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--faint);
  text-align: left;
}
.book-vic {
  margin: 0 0 1.4em;
  padding: 0 0 0 0.9rem;
  border-left: 3px solid var(--gold);
}
.book-vic-text {
  margin: 0 0 0.7em;
  font-family: var(--serif-body);
  font-size: calc(1rem * var(--fs-en));
  line-height: 1.7;
  color: var(--vc-en);
}
.book-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.4rem;
  direction: ltr;
}
.book-page-btn {
  width: 2.8rem;
  height: 2.2rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--card);
  color: var(--gold);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.book-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.book-page-label {
  font-family: var(--sans-ui);
  font-size: 0.82rem;
  color: var(--dim);
}
@media (max-width: 30rem) {
  .book-tab {
    font-size: 0.72rem;
  }
}

/* ---------- Settings: simple checkbox toggle row ---------- */
.settings-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  font-family: var(--sans-ui);
}
.settings-toggle input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--gold);
}
