/* Layout concept: a quiet "library hall" — deep green ink header and wayfinding, brass for sacred accents,
   the mushaf set on its own paper sheet like the printed Madani page. */
:root {
  --bg: #eef1ec;
  --bg-2: #e3e9e3;
  --surface: #ffffff;
  --surface-2: #f6f8f4;
  --line: #d6ded6;
  --text: #13231f;
  --muted: #5a6b65;
  --ink: #0f3b36;
  --ink-2: #185049;
  --on-ink: #f1f5ef;
  --gold: #a87b2c;
  --gold-2: #c9a14f;
  --gold-soft: #f1e6cc;
  --paper: #fdfaf2;
  --paper-line: #e6d9b8;
  --qtext: #1a1a1a;
  --hl: rgba(201, 161, 79, .28);
  --ok: #2f7d4f;
  --kid-1: #2a8bd0;
  --kid-2: #f5a623;
  --kid-3: #e45b7c;
  --kid-bg: #eaf5fd;
  --shadow: 0 1px 2px rgba(15, 59, 54, .06), 0 8px 24px rgba(15, 59, 54, .07);
  --r: 14px;
  --f-ui: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --f-display: "Reem Kufi", "IBM Plex Sans Arabic", sans-serif;
  --f-text: "Amiri", "Traditional Arabic", serif;
  --f-quran: "Amiri Quran", "Amiri", serif;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1614; --bg-2: #0f1e1b; --surface: #12211e; --surface-2: #172925; --line: #24403a;
    --text: #e6eee8; --muted: #9bb0a8; --ink: #0a2724; --ink-2: #14403a; --on-ink: #eef4ee;
    --gold: #d9b064; --gold-2: #e2bd72; --gold-soft: #3a3220; --paper: #161f1d; --paper-line: #3b3624;
    --qtext: #ece6d6; --hl: rgba(217, 176, 100, .22); --kid-bg: #10242f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1614; --bg-2: #0f1e1b; --surface: #12211e; --surface-2: #172925; --line: #24403a;
  --text: #e6eee8; --muted: #9bb0a8; --ink: #0a2724; --ink-2: #14403a; --on-ink: #eef4ee;
  --gold: #d9b064; --gold-2: #e2bd72; --gold-soft: #3a3220; --paper: #161f1d; --paper-line: #3b3624;
  --qtext: #ece6d6; --hl: rgba(217, 176, 100, .22); --kid-bg: #10242f;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--f-ui); font-size: 16px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--ink-2); }
:root[data-theme="dark"] a { color: var(--gold); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; border-radius: 6px; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.35; text-wrap: balance; margin: 0; }

/* ---------- Topbar ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--ink); }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: var(--ink); color: var(--on-ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 6px 20px rgba(0,0,0,.12);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 18px;
  padding-block: 10px; padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand-star { width: 38px; height: 38px; flex: none; }
.brand-star path { fill: var(--gold-2); stroke: none; }
.brand-star circle { fill: var(--ink); stroke: var(--gold-2); stroke-width: 3; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-family: var(--f-display); font-size: 1.15rem; font-weight: 600; }
.brand-text small { font-size: .72rem; color: #cfdcd5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mainnav { display: flex; gap: 2px; margin-inline-start: auto; flex-wrap: nowrap; }
.mainnav a {
  color: #d5e2db; text-decoration: none; padding: 7px 11px; border-radius: 9px; font-size: .92rem; white-space: nowrap;
  transition: background .15s, color .15s;
}
.mainnav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.mainnav a.active { background: rgba(201,161,79,.18); color: var(--gold-2); }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: transparent; border: 1px solid transparent; color: inherit; font-size: 20px;
}
.topbar .icon-btn { color: var(--on-ink); border-color: rgba(255,255,255,.14); }
.icon-btn:hover { background: rgba(127,127,127,.12); }
.menu-btn { display: none; }
@media (max-width: 1180px) {
  .menu-btn { display: inline-grid; }
  .mainnav {
    position: absolute; top: 100%; inset-inline: 0; flex-direction: column; background: var(--ink);
    padding: 8px var(--gutter) 16px; gap: 2px; display: none; border-top: 1px solid rgba(255,255,255,.08);
  }
  .mainnav.open { display: flex; }
  .mainnav a { padding: 11px 14px; font-size: 1rem; }
  .top-actions { margin-inline-start: auto; }
}

/* ---------- Generic layout ---------- */
main { min-height: 70vh; outline: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding-block: 28px 40px; padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); color: var(--ink-2); }
:root[data-theme="dark"] .page-head h1 { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .page-head h1 { color: var(--gold); } :root:not([data-theme="light"]) a { color: var(--gold); } }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.eyebrow { font-size: .78rem; letter-spacing: .04em; color: var(--gold); font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.muted { color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: .95rem; text-decoration: none; transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--gold-2); }
.btn-primary { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.btn-primary:hover { background: var(--ink); border-color: var(--gold-2); }
.btn-gold { background: var(--gold-2); border-color: var(--gold-2); color: #1d1606; }
.btn svg { font-size: 1.05em; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: .9rem; color: var(--text);
}
.chip.active, .chip[aria-pressed="true"] { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
.input, .select {
  height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); min-width: 0;
}
.input:focus, .select:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 3px var(--hl); }
.loader { display: grid; place-items: center; padding: 48px 16px; color: var(--muted); gap: 12px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { padding: 18px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line); color: var(--muted); text-align: center; }

/* ---------- Home ---------- */
.hero {
  position: relative; overflow: hidden; background: var(--ink); color: var(--on-ink);
}
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .12;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23c9a14f' stroke-width='1.2'%3E%3Cpath d='M40 4l10 14 17-3-3 17 14 10-14 10 3 17-17-3-10 14-10-14-17 3 3-17L2 40l14-10-3-17 17 3z'/%3E%3Ccircle cx='40' cy='40' r='11'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 80px 80px;
}
.hero-inner {
  position: relative; max-width: 1180px; margin: 0 auto; padding-block: 44px 40px;
  padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center;
}
.memorial-label { display: inline-flex; align-items: center; gap: 8px; color: var(--gold-2); font-weight: 600; font-size: .92rem; letter-spacing: .02em; }
.memorial-label::before { content: ""; width: 28px; height: 1px; background: var(--gold-2); }
.hero h1 { font-size: clamp(2rem, 5vw, 3.3rem); margin: 10px 0 6px; color: #fff; font-weight: 700; }
.hero h1 .name { color: var(--gold-2); display: block; font-size: .72em; margin-top: 6px; }
.hero .rahimahu { font-family: var(--f-text); font-size: 1.35rem; color: #e6efe9; margin: 0 0 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero .btn { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.2); color: #fff; }
.hero .btn:hover { border-color: var(--gold-2); }
.hero .btn-gold { background: var(--gold-2); color: #1d1606; border-color: var(--gold-2); }
.hadith-sadaqa {
  background: rgba(0,0,0,.18); border: 1px solid rgba(201,161,79,.35); border-radius: 16px; padding: 22px 24px;
  font-family: var(--f-text); font-size: 1.28rem; line-height: 2; color: #f3efe2;
}
.hadith-sadaqa cite { display: block; font-family: var(--f-ui); font-style: normal; font-size: .85rem; color: var(--gold-2); margin-top: 8px; }
@media (max-width: 820px) { .hero-inner { grid-template-columns: 1fr; padding-block: 30px; } }

.home-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: -22px; position: relative; }
.strip-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.strip-card .label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.strip-card .big { font-family: var(--f-display); font-size: 1.5rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .strip-card .big { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .strip-card .big { color: var(--gold); } }
.strip-card a { font-size: .9rem; }
@media (max-width: 820px) { .home-strip { grid-template-columns: 1fr; margin-top: 18px; } }

.section-title { display: flex; align-items: center; gap: 12px; margin: 38px 0 16px; font-size: 1.35rem; color: var(--text); }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile {
  display: flex; flex-direction: column; gap: 10px; padding: 20px; text-decoration: none; color: var(--text);
  transition: transform .15s, border-color .15s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--gold-2); }
.tile-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); font-size: 24px; }
.tile h3 { font-size: 1.12rem; }
.tile p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.6; }
@media (max-width: 960px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .tiles { grid-template-columns: 1fr; } }

.daily { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.daily .card { padding: 22px 24px; min-width: 0; }
.daily .ayah-text { font-family: var(--f-quran); font-size: 1.7rem; line-height: 2.2; color: var(--qtext); margin: 8px 0; }
.daily .hadith-text { font-family: var(--f-text); font-size: 1.35rem; line-height: 2; margin: 8px 0; }
.daily .ref { color: var(--gold); font-size: .88rem; }
@media (max-width: 820px) { .daily { grid-template-columns: 1fr; } }

.dua-band { margin-top: 38px; padding: 26px 28px; background: var(--gold-soft); border: 1px solid var(--paper-line); border-radius: var(--r); }
.dua-band h2 { font-size: 1.25rem; color: var(--gold); margin-bottom: 10px; }
.dua-band p { font-family: var(--f-text); font-size: 1.3rem; line-height: 2.05; margin: 0 0 8px; }

/* ---------- Quran ---------- */
.q-toolbar {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 60px); z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.q-toolbar-inner {
  max-width: 1180px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding-block: 10px; padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.q-toolbar .select { height: 38px; max-width: 200px; }
.q-toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 7px 12px; font-size: .88rem; }
.seg button[aria-pressed="true"] { background: var(--ink-2); color: #fff; }
.reciter-pick { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); max-width: 260px; }
.reciter-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mushaf-stage { padding-block: 22px 80px; padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; align-items: center; gap: 26px; }
.mushaf-page {
  --pw: min(100%, var(--page-w, 560px));
  width: var(--pw); container-type: inline-size;
  background: var(--paper); border-radius: 6px; position: relative;
  box-shadow: 0 0 0 1px var(--paper-line), 0 0 0 7px var(--paper), 0 0 0 8px var(--paper-line), var(--shadow);
  padding: 18px 4.2cqw 14px; margin: 8px 0;
}
.mp-head { display: flex; justify-content: space-between; font-size: .82rem; color: var(--gold); padding: 0 2px 8px; border-bottom: 1px solid var(--paper-line); margin-bottom: 8px; font-family: var(--f-ui); }
.mp-foot { text-align: center; font-size: .9rem; color: var(--gold); padding-top: 8px; border-top: 1px solid var(--paper-line); margin-top: 8px; font-variant-numeric: tabular-nums; }
.mp-lines { display: flex; flex-direction: column; }
.mline {
  display: flex; justify-content: space-between; align-items: center; direction: rtl;
  font-size: 5.55cqw; line-height: 1; height: 1.9em; color: var(--qtext); white-space: nowrap;
}
.mushaf-page.centered .mline { justify-content: center; gap: .18em; }
.mline .w { cursor: pointer; border-radius: 4px; transition: background .12s; padding: 0 .02em; }
.mline .w:hover, .mline .w.hl { background: var(--hl); }
.mline .w.end { color: var(--qtext); }
.mline.fallback { font-family: var(--f-quran); font-size: 4.4cqw; }
.mline.sura-head {
  justify-content: center; height: 1.9em; margin: 0 2%;
  background: linear-gradient(var(--gold-soft), var(--gold-soft)) padding-box;
  border: 1.5px solid var(--gold-2); border-radius: 999px; position: relative;
  font-family: var(--f-display); font-size: 4.4cqw; color: var(--gold);
}
.mline.sura-head::before, .mline.sura-head::after { content: "۞"; position: absolute; top: 50%; transform: translateY(-50%); font-size: .8em; color: var(--gold-2); }
.mline.sura-head::before { right: 4%; } .mline.sura-head::after { left: 4%; }
.mline.basmala { justify-content: center; font-family: var(--f-quran); font-size: 5.1cqw; }
.page-skeleton { aspect-ratio: 0.66; display: grid; place-items: center; color: var(--muted); }
.q-nav-bottom { display: flex; gap: 10px; justify-content: center; }

.ayah-pop .ayah-full { font-family: var(--f-quran); font-size: 1.6rem; line-height: 2.2; color: var(--qtext); background: var(--paper); padding: 14px 16px; border-radius: 12px; border: 1px solid var(--paper-line); }
.ayah-pop h4 { margin: 16px 0 6px; font-family: var(--f-display); color: var(--gold); font-weight: 600; }
.ayah-pop .tafsir { font-family: var(--f-text); font-size: 1.15rem; line-height: 1.95; }
.ayah-pop .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* index lists */
.surah-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.surah-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-align: start; width: 100%;
  transition: border-color .15s;
}
.surah-item:hover { border-color: var(--gold-2); }
.surah-num {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center; font-size: .85rem; font-weight: 600; color: var(--gold);
  background: var(--gold-soft); clip-path: polygon(50% 0, 63% 15%, 85% 15%, 85% 37%, 100% 50%, 85% 63%, 85% 85%, 63% 85%, 50% 100%, 37% 85%, 15% 85%, 15% 63%, 0 50%, 15% 37%, 15% 15%, 37% 15%);
  font-variant-numeric: tabular-nums;
}
.surah-meta { min-width: 0; flex: 1; }
.surah-meta b { display: block; font-family: var(--f-text); font-size: 1.2rem; font-weight: 700; }
.surah-meta small { color: var(--muted); font-size: .8rem; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.juz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.last-read { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; margin-bottom: 18px; flex-wrap: wrap; }
.search-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.search-row .input { flex: 1; min-width: 200px; }
.search-results { display: flex; flex-direction: column; gap: 10px; }
.sr-item { padding: 14px 16px; }
.sr-item .t { font-family: var(--f-quran); font-size: 1.35rem; line-height: 2; }
.sr-item mark { background: var(--hl); color: inherit; border-radius: 3px; }

/* ---------- Listen ---------- */
.letters-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.letters-bar button { min-width: 36px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.letters-bar button.active { background: var(--ink-2); color: #fff; border-color: var(--ink-2); }
.reciter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.reciter-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: start; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.reciter-card:hover, .reciter-card.active { border-color: var(--gold-2); }
.reciter-card.active { box-shadow: 0 0 0 2px var(--hl); }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-2); color: var(--gold-2); font-family: var(--f-display); font-size: 1.2rem; }
.reciter-card .meta { min-width: 0; }
.reciter-card b { display: block; font-weight: 600; font-size: .98rem; }
.reciter-card small { color: var(--muted); font-size: .78rem; }
.reciter-detail { padding: 20px; margin-bottom: 20px; }
.reciter-detail .head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.reciter-detail .head h2 { font-size: 1.4rem; }
.play-surah { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); width: 100%; text-align: start; }
.play-surah:hover { border-color: var(--gold-2); }
.play-surah.playing { border-color: var(--gold-2); background: var(--gold-soft); }
.play-surah .pi { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-2); color: #fff; font-size: 13px; flex: none; }
.play-surah b { font-family: var(--f-text); font-size: 1.12rem; }
.radio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.modal-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow: auto; margin-top: 10px; }
.modal-list button { text-align: start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: flex; justify-content: space-between; gap: 10px; }
.modal-list button:hover, .modal-list button.active { border-color: var(--gold-2); background: var(--gold-soft); }
.modal-list small { color: var(--muted); }

/* ---------- Prayer ---------- */
.prayer-top { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin-bottom: 16px; }
.next-prayer { padding: 26px; background: var(--ink); color: var(--on-ink); border: 0; position: relative; overflow: hidden; }
.next-prayer::before { content: ""; position: absolute; inset: 0; opacity: .1; background-image: inherit; }
.next-prayer .lbl { color: var(--gold-2); font-weight: 600; }
.next-prayer .pname { font-family: var(--f-display); font-size: 2.4rem; margin: 2px 0; }
.next-prayer .count { font-size: 2.6rem; font-variant-numeric: tabular-nums; font-weight: 300; letter-spacing: .02em; direction: ltr; text-align: right; }
.next-prayer .hijri { margin-top: 10px; color: #cfe0d8; }
.prayer-controls { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.prayer-controls .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.prayer-controls .row > * { flex: 1; min-width: 140px; }
.prayer-list { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.pcard { padding: 18px 12px; text-align: center; }
.pcard .n { font-family: var(--f-display); font-size: 1.15rem; }
.pcard .t { font-size: 1.6rem; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink-2); }
:root[data-theme="dark"] .pcard .t { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pcard .t { color: var(--gold); } }
.pcard.now { border-color: var(--gold-2); box-shadow: 0 0 0 2px var(--hl), var(--shadow); }
.pcard.now .n::after { content: " • التالية"; color: var(--gold); font-size: .75rem; font-family: var(--f-ui); }
.qibla { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; padding: 22px; margin-top: 16px; }
.compass { width: 170px; height: 170px; border-radius: 50%; position: relative; background: radial-gradient(circle, var(--surface) 55%, var(--surface-2) 56%); border: 2px solid var(--gold-2); }
.compass .tick { position: absolute; inset: 0; font-size: .8rem; color: var(--muted); font-weight: 600; }
.compass .tick span { position: absolute; left: 50%; top: 50%; transform-origin: 0 0; }
.compass .needle { position: absolute; left: 50%; top: 50%; width: 4px; height: 72px; margin-left: -2px; margin-top: -72px; background: linear-gradient(var(--gold-2), var(--ink-2)); border-radius: 4px; transform-origin: 50% 100%; transition: transform .6s; }
.compass .needle::before { content: "🕋"; position: absolute; top: -26px; left: 50%; transform: translateX(-50%); font-size: 20px; }
.compass .hub { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: var(--ink-2); border: 2px solid var(--gold-2); }
@media (max-width: 900px) { .prayer-top { grid-template-columns: 1fr; } .prayer-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) { .prayer-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } .qibla { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

/* ---------- Hadith ---------- */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.book {
  display: flex; flex-direction: column; gap: 4px; padding: 18px; text-align: start; width: 100%; position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.book::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 7px; background: var(--ink-2); }
.book:hover { border-color: var(--gold-2); }
.book b { font-family: var(--f-text); font-size: 1.3rem; }
.book small { color: var(--muted); }
.hadith-list { display: flex; flex-direction: column; gap: 14px; }
.hadith { padding: 20px 22px; }
.hadith .num { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--gold); font-weight: 600; margin-bottom: 6px; }
.hadith .txt { font-family: var(--f-text); font-size: var(--read-size, 1.32rem); line-height: 2.05; margin: 0; }
.hadith .actions { display: flex; gap: 6px; margin-top: 10px; }
.mini-btn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 4px 10px; font-size: .82rem; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }
.mini-btn:hover { color: var(--text); border-color: var(--gold-2); }
.section-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.section-list button { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); text-align: start; }
.section-list button:hover { border-color: var(--gold-2); }
.section-list small { display: block; color: var(--muted); font-size: .78rem; }
.pager { display: flex; justify-content: center; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.read-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Adhkar ---------- */
.dhikr-list { display: flex; flex-direction: column; gap: 14px; }
.dhikr { padding: 20px 22px; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; transition: opacity .3s, border-color .3s; }
.dhikr .txt { font-family: var(--f-text); font-size: var(--read-size, 1.35rem); line-height: 2.05; margin: 0; }
.dhikr .src { font-size: .82rem; color: var(--gold); margin-top: 6px; }
.dhikr .fadl { font-size: .88rem; color: var(--muted); margin-top: 4px; }
.counter {
  width: 76px; height: 76px; border-radius: 50%; border: 0; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--gold-2) calc(var(--p, 0) * 1%), var(--surface-2) 0); flex: none;
}
.counter::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.counter span { position: relative; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); line-height: 1.1; text-align: center; }
.counter span small { display: block; font-size: .68rem; color: var(--muted); font-weight: 400; }
.dhikr.done { opacity: .55; border-color: var(--ok); }
.dhikr.done .counter { background: var(--ok); }
.dhikr.done .counter span { color: var(--ok); }
.adhkar-progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin-bottom: 16px; }
.adhkar-progress i { display: block; height: 100%; background: var(--gold-2); width: 0; transition: width .3s; }
@media (max-width: 560px) { .dhikr { grid-template-columns: 1fr; } .counter { justify-self: center; } }

/* ---------- Tasbeeh ---------- */
.tasbeeh-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.bead-btn {
  width: min(320px, 78vw); aspect-ratio: 1; border-radius: 50%; border: 0; margin: 10px auto; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--ink-2), var(--ink)); color: #fff; box-shadow: 0 0 0 10px var(--gold-soft), 0 18px 40px rgba(15,59,54,.3);
  transition: transform .08s; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.bead-btn:active { transform: scale(.97); }
.bead-btn .n { font-size: 4.2rem; font-weight: 300; font-variant-numeric: tabular-nums; line-height: 1; }
.bead-btn .d { font-family: var(--f-text); font-size: 1.3rem; color: var(--gold-2); margin-top: 8px; }
.tasbeeh-side { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.tasbeeh-side .chips { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 820px) { .tasbeeh-wrap { grid-template-columns: 1fr; } }

/* ---------- Names ---------- */
.names-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.name-card { padding: 18px 10px; text-align: center; position: relative; }
.name-card .i { position: absolute; top: 8px; inset-inline-start: 10px; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.name-card b { font-family: var(--f-text); font-size: 1.7rem; color: var(--ink-2); font-weight: 700; }
:root[data-theme="dark"] .name-card b { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .name-card b { color: var(--gold); } }

/* ---------- Kids ---------- */
.kids { background: var(--kid-bg); min-height: 80vh; }
.kids .page-head h1 { color: var(--kid-1); font-family: var(--f-display); }
.kids-tabs { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.kids-tabs button { padding: 10px 20px; border-radius: 999px; border: 2px solid var(--kid-1); background: var(--surface); color: var(--kid-1); font-weight: 700; font-size: 1rem; }
.kids-tabs button[aria-pressed="true"] { background: var(--kid-1); color: #fff; }
.kid-surahs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kid-surah {
  padding: 18px 10px 14px; border-radius: 20px; border: 0; text-align: center; color: #fff; position: relative;
  box-shadow: 0 6px 0 rgba(0,0,0,.12); transition: transform .12s;
}
.kid-surah:hover { transform: translateY(-3px) rotate(-1deg); }
.kid-surah b { display: block; font-family: var(--f-text); font-size: 1.55rem; }
.kid-surah small { opacity: .9; }
.kid-surah .stars { position: absolute; top: 6px; inset-inline-end: 10px; font-size: .8rem; }
.kid-reader { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.kid-panel { padding: 18px; border-radius: 20px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 140px; }
.kid-panel .field { color: var(--text); font-weight: 600; }
.kid-big-btn { height: 58px; border-radius: 16px; border: 0; font-size: 1.15rem; font-weight: 700; color: #fff; background: var(--kid-1); display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 5px 0 #1d6aa2; }
.kid-big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #1d6aa2; }
.kid-big-btn.stop { background: var(--kid-3); box-shadow: 0 5px 0 #b03e5c; }
.kid-status { text-align: center; font-weight: 700; color: var(--kid-1); min-height: 1.7em; font-size: 1.05rem; }
.kid-status.rep { color: var(--kid-2); }
.kid-ayahs { display: flex; flex-direction: column; gap: 12px; }
.kid-ayah {
  padding: 18px 20px; border-radius: 20px; background: var(--surface); border: 3px solid transparent;
  font-family: var(--f-quran); font-size: var(--kid-size, 2.1rem); line-height: 2.3; text-align: center; color: var(--qtext);
  cursor: pointer; transition: border-color .2s, transform .2s, box-shadow .2s; box-shadow: 0 4px 0 rgba(0,0,0,.06);
}
.kid-ayah .an { display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; font-size: .55em; border-radius: 50%; background: var(--gold-soft); color: var(--gold); font-family: var(--f-ui); font-weight: 700; vertical-align: middle; margin-inline-start: .3em; }
.kid-ayah.playing { border-color: var(--kid-1); transform: scale(1.015); box-shadow: 0 8px 22px rgba(42,139,208,.25); }
.kid-ayah.repeat { border-color: var(--kid-2); box-shadow: 0 8px 22px rgba(245,166,35,.3); }
.kid-ayah.done { border-color: #7cc98f; }
.kid-basmala { text-align: center; font-family: var(--f-quran); font-size: 1.8rem; color: var(--kid-1); margin-bottom: 4px; }
.letters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.letter-card { padding: 14px 8px; border-radius: 20px; border: 0; background: var(--surface); text-align: center; box-shadow: 0 5px 0 rgba(0,0,0,.08); transition: transform .12s; }
.letter-card:hover { transform: translateY(-3px); }
.letter-card b { display: block; font-family: var(--f-text); font-size: 3rem; line-height: 1.3; }
.letter-card .e { font-size: 1.7rem; }
.letter-card small { display: block; color: var(--muted); font-weight: 600; }
.letter-detail { text-align: center; }
.letter-detail .huge { font-family: var(--f-text); font-size: 7rem; line-height: 1.2; color: var(--kid-1); }
.letter-detail .forms { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 10px 0; }
.letter-detail .forms span { font-family: var(--f-text); font-size: 2.6rem; padding: 4px 18px; border-radius: 14px; background: var(--kid-bg); }
.celebrate { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.celebrate i { position: absolute; top: -40px; font-size: 28px; font-style: normal; animation: fall 2.4s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); opacity: .6; } }
@media (max-width: 860px) { .kid-reader { grid-template-columns: 1fr; } .kid-panel { position: static; } }

/* ---------- Autoscroll ---------- */
.autoscroll {
  position: fixed; z-index: 70; bottom: calc(18px + env(safe-area-inset-bottom, 0px) + var(--player-h, 0px)); left: max(16px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px; box-shadow: var(--shadow);
}
.as-toggle { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--ink-2); color: #fff; display: grid; place-items: center; font-size: 22px; }
.as-toggle .i-pause { display: none; }
.autoscroll.on .as-toggle { background: var(--gold-2); color: #1d1606; }
.autoscroll.on .as-toggle .i-pause { display: block; } .autoscroll.on .as-toggle .i-play { display: none; }
.as-panel { display: flex; flex-direction: column; gap: 0; padding-inline-end: 12px; font-size: .78rem; color: var(--muted); }
.as-panel input { width: 130px; accent-color: var(--gold-2); }
.as-panel output { font-weight: 700; color: var(--text); }

/* ---------- Player ---------- */
.player {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 80; background: var(--ink); color: var(--on-ink);
  padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -6px 24px rgba(0,0,0,.18);
}
.player-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding-block: 10px; padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.pl-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.08); color: #fff; display: grid; place-items: center; font-size: 18px; flex: none; }
.pl-btn:hover { background: rgba(255,255,255,.16); }
.pl-main { width: 48px; height: 48px; background: var(--gold-2); color: #1d1606; font-size: 20px; }
.pl-main:hover { background: var(--gold); }
.pl-main .i-pause { display: none; } .player.playing .pl-main .i-pause { display: block; } .player.playing .pl-main .i-play { display: none; }
.pl-main svg { fill: currentColor; }
.pl-small { width: 34px; height: 34px; font-size: 15px; }
.pl-small.on { background: var(--gold-2); color: #1d1606; }
.pl-info { flex: 1; min-width: 0; padding-inline: 8px; }
.pl-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--f-text); font-size: 1.12rem; line-height: 1.3; }
.pl-sub { font-size: .78rem; color: #b9cdc5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-bar { display: flex; align-items: center; gap: 8px; font-size: .75rem; font-variant-numeric: tabular-nums; color: #b9cdc5; }
.pl-bar input { flex: 1; min-width: 0; accent-color: var(--gold-2); height: 4px; }
.pl-rate { background: rgba(255,255,255,.08); color: #fff; border: 0; border-radius: 8px; height: 34px; padding: 0 6px; font-size: .8rem; }
.pl-rate option { color: #000; }
@media (max-width: 600px) { #plPrev, #plNext, .pl-rate { display: none; } }

/* ---------- Modal / toast ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 20, 18, .55); backdrop-filter: blur(2px); }
.modal-card { position: relative; width: min(640px, 100%); max-height: 88vh; overflow: auto; background: var(--surface); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { position: sticky; top: 0; background: var(--surface); display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); z-index: 1; }
.modal-head h3 { font-size: 1.15rem; }
.modal-body { padding: 18px; }
.toast { position: fixed; z-index: 120; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; transition: .25s; font-size: .92rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer ---------- */
.footer { background: var(--bg-2); border-top: 1px solid var(--line); padding-bottom: calc(var(--player-h, 0px) + 10px); }
.footer-inner { max-width: 1180px; margin: 0 auto; padding-block: 28px; padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); text-align: center; }
.footer-dua { font-family: var(--f-text); font-size: 1.25rem; color: var(--gold); margin: 0 0 10px; }
.footer-src { font-size: .8rem; color: var(--muted); margin: 0; }

@media (max-width: 700px) {
  .q-toolbar { position: static; }
  .q-toolbar .select { max-width: 150px; }
  .reciter-pick { max-width: 170px; }
  .mushaf-stage { padding-left: 8px; padding-right: 8px; }
  .mushaf-page { padding-inline: 3cqw; }
  .as-panel label { display: none; }
  .as-panel input { width: 96px; }
  .autoscroll { opacity: .92; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
