/* ============================================================
   Noor Al-Islam · design system
   ============================================================ */
:root {
  --bg: #081611;
  --bg-2: #0c1f18;
  --bg-3: #12291f;
  --card: rgba(255, 255, 255, 0.035);
  --card-strong: rgba(255, 255, 255, 0.06);
  --stroke: rgba(228, 197, 120, 0.14);
  --stroke-soft: rgba(255, 255, 255, 0.07);
  --gold: #e3b64f;
  --gold-2: #f5d78a;
  --green: #1f8a66;
  --green-2: #2fb886;
  --text: #f2ede1;
  --muted: #b7ae99;
  --danger: #e06060;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font-ui: 'Cairo', 'Segoe UI', system-ui, sans-serif;
  --font-quran: 'Scheherazade New', 'Amiri Quran', 'Amiri', serif;
  --font-ar: 'Scheherazade New', 'Amiri', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

.pulse-highlight {
  animation: cardGlow 1.5s ease-in-out infinite alternate;
}
@keyframes cardGlow {
  0% { box-shadow: 0 0 10px rgba(227, 182, 79, 0.2); border-color: var(--gold); }
  100% { box-shadow: 0 0 35px rgba(227, 182, 79, 0.7); border-color: #fff; }
}

body {
  font-family: var(--font-ui);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(47, 184, 134, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(227, 182, 79, 0.07), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
  overflow-x: hidden;
}

/* Subtle Islamic 8-point star lattice */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23e3b64f' stroke-opacity='0.05' stroke-width='1'%3E%3Cpath d='M48 8 58 38 88 48 58 58 48 88 38 58 8 48 38 38Z'/%3E%3Ccircle cx='48' cy='48' r='12'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 96px 96px;
}

::selection { background: rgba(227, 182, 79, 0.35); }
a { color: var(--gold-2); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ---------- layout ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
main { padding-bottom: 96px; min-height: 70vh; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(8, 22, 17, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--stroke);
}
.topbar-in {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 20px; max-width: 1120px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); white-space: nowrap; }
.brand img { width: 38px; height: 38px; }
.brand .ar { font-family: var(--font-ar); color: var(--gold); font-size: 1.3rem; line-height: 1; }

.nav-links { display: flex; gap: 4px; margin-inline-start: auto; }
.nav-links a {
  padding: 8px 14px; border-radius: 999px; color: var(--muted);
  font-weight: 600; font-size: 0.95rem; transition: 0.2s;
}
.nav-links a:hover { color: var(--gold-2); background: var(--card-strong); }
.nav-links a.active { color: #10231b; background: linear-gradient(135deg, var(--gold), var(--gold-2)); }

.lang-wrap { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--card-strong); color: var(--text);
  border: 1px solid var(--stroke); border-radius: 999px;
  padding: 7px 14px; font-weight: 700; font-size: 0.9rem;
}
.lang-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 60;
  background: var(--bg-3); border: 1px solid var(--stroke); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 6px; display: none;
  grid-template-columns: 1fr 1fr; gap: 2px; width: 300px; max-height: 60vh; overflow: auto;
}
.lang-menu.open { display: grid; }
.lang-menu button {
  background: none; border: 0; color: var(--text); text-align: start;
  padding: 8px 12px; border-radius: 8px; font-size: 0.92rem;
}
.lang-menu button:hover { background: var(--card-strong); }
.lang-menu button.on { color: var(--gold); font-weight: 800; }

.install-btn {
  display: flex; align-items: center; gap: 6px;
  background: transparent; color: var(--gold);
  border: 1px solid var(--gold); border-radius: 999px;
  padding: 7px 14px; font-weight: 700; font-size: 0.9rem; transition: 0.2s;
}
.install-btn:hover { background: var(--gold); color: #10231b; }
.install-btn.show { display: flex; }

/* ---------- mobile bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 50; display: none;
  background: rgba(10, 26, 20, 0.94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--stroke);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 0.62rem; font-weight: 700; padding: 4px 0; border-radius: 10px;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--gold); }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .bottom-nav { display: flex; }
  .brand span.name { display: none; }
}

/* ---------- hero ---------- */
.hero { text-align: center; padding: 64px 20px 30px; position: relative; }
.hero .bismillah { font-family: var(--font-quran); color: var(--gold); font-size: clamp(1.6rem, 4vw, 2.4rem); opacity: 0.95; margin-bottom: 18px; }
.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 900; line-height: 1.2;
  background: linear-gradient(135deg, #fff 20%, var(--gold-2) 60%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .sub { color: var(--muted); max-width: 640px; margin: 14px auto 0; font-size: 1.05rem; }
.hero .ornament { color: var(--gold); letter-spacing: 12px; margin-top: 22px; opacity: 0.7; }

/* ---------- prayer strip (home) ---------- */
.prayer-strip {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(31, 138, 102, 0.25), rgba(227, 182, 79, 0.08));
  border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 16px 22px; margin: 26px auto; max-width: 760px;
}
.prayer-strip .icon { font-size: 1.8rem; }
.prayer-strip .label { color: var(--muted); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.prayer-strip .val { font-weight: 900; font-size: 1.25rem; color: var(--gold-2); }
.prayer-strip .count { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--green-2); }
.prayer-strip a.more { margin-inline-start: auto; font-weight: 700; font-size: 0.9rem; }

/* ---------- cards grid ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-top: 26px; }
.card {
  position: relative; display: block; overflow: hidden;
  background: var(--card); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius); padding: 26px 22px;
  transition: transform 0.25s, border-color 0.25s, background 0.25s;
}
.card:hover { transform: translateY(-5px); border-color: var(--stroke); background: var(--card-strong); }
.card .glyph { font-size: 2rem; margin-bottom: 12px; display: block; }
.card h3 { font-size: 1.18rem; font-weight: 800; margin-bottom: 6px; color: var(--text); }
.card p { color: var(--muted); font-size: 0.92rem; }
.card .arrow { position: absolute; top: 20px; inset-inline-end: 18px; color: var(--gold); opacity: 0; transition: 0.25s; }
.card:hover .arrow { opacity: 1; }

/* ---------- section headers ---------- */
.page-head { padding: 44px 0 8px; }
.page-head h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 900; }
.page-head h1 .ar { font-family: var(--font-ar); color: var(--gold); }
.page-head p { color: var(--muted); max-width: 640px; margin-top: 6px; }
.rule-line { height: 2px; margin: 18px 0 26px; border: 0; background: linear-gradient(90deg, var(--gold), transparent 70%); opacity: 0.5; }
[dir='rtl'] .rule-line { background: linear-gradient(270deg, var(--gold), transparent 70%); }

/* ---------- inputs ---------- */
.search-row { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
.input {
  flex: 1; min-width: 220px;
  background: var(--card-strong); color: var(--text);
  border: 1px solid var(--stroke-soft); border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 1rem; outline: none; transition: 0.2s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227, 182, 79, 0.15); }
select.input {
  flex: initial;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--bg-3) !important;
  color: var(--gold-2) !important;
  border: 1.5px solid var(--gold) !important;
  border-radius: var(--radius-sm) !important;
  padding: 8px 32px 8px 14px !important;
  font-family: inherit !important;
  font-weight: 700 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23e3b64f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: left 10px center !important;
}
[dir='rtl'] select.input {
  background-position: left 10px center !important;
}
select.input option {
  background-color: #0d1e17 !important;
  color: #f2ede1 !important;
  font-family: var(--font-ar), inherit !important;
  font-size: 1rem !important;
  padding: 10px 14px !important;
}
select.input option:checked,
select.input option:hover {
  background-color: #1a3d2e !important;
  color: var(--gold-2) !important;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #10231b;
  border: 0; border-radius: var(--radius-sm); padding: 12px 22px;
  font-weight: 800; font-size: 0.98rem; transition: 0.2s; text-align: center;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--gold); border: 1px solid var(--gold); }
.btn.ghost:hover { background: rgba(227, 182, 79, 0.12); }
.btn.green { background: linear-gradient(135deg, var(--green), var(--green-2)); color: #fff; }
.btn.sm { padding: 8px 14px; font-size: 0.85rem; border-radius: 10px; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--card-strong); color: var(--muted);
  border: 1px solid var(--stroke-soft); border-radius: 999px;
  padding: 7px 16px; font-weight: 700; font-size: 0.88rem; transition: 0.2s;
}
.chip:hover { color: var(--gold-2); border-color: var(--stroke); }
.chip.on { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #10231b; border-color: transparent; }

/* ---------- surah list ---------- */
.surah-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.surah-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm); padding: 12px 16px; transition: 0.2s; color: var(--text);
}
.surah-item:hover { border-color: var(--stroke); background: var(--card-strong); transform: translateY(-2px); }
.surah-num {
  width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center;
  background: rgba(227, 182, 79, 0.12); color: var(--gold);
  font-weight: 800; font-size: 0.9rem;
  clip-path: polygon(50% 0, 85% 15%, 100% 50%, 85% 85%, 50% 100%, 15% 85%, 0 50%, 15% 15%);
}
.surah-item .en { font-weight: 700; font-size: 0.95rem; }
.surah-item .meta { color: var(--muted); font-size: 0.75rem; }
.surah-item .arname { margin-inline-start: auto; font-family: var(--font-ar); font-size: 1.35rem; color: var(--gold-2); }

/* ---------- quran reader ---------- */
.reader-head {
  text-align: center; padding: 30px 16px 10px;
  background: var(--card); border: 1px solid var(--stroke-soft); border-radius: var(--radius);
  margin-top: 20px;
}
.reader-head .arname { font-family: var(--font-quran); font-size: 2.4rem; color: var(--gold); line-height: 1.4; }
.reader-head .sub { color: var(--muted); font-size: 0.95rem; }
.reader-tools { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 16px; }
.reader-note { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 0 16px 14px; }

.basmala { font-family: var(--font-quran); text-align: center; font-size: 2rem; color: var(--text); padding: 26px 10px 6px; }

.ayah-list { margin-top: 8px; }
.ayah-card {
  background: var(--card); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius); padding: 22px 24px; margin: 12px 0; transition: border-color 0.2s;
}
.ayah-card:hover { border-color: var(--stroke); }
.ayah-ar { font-family: var(--font-quran); font-size: var(--quran-size, 1.9rem); line-height: 2.3; text-align: justify; direction: rtl; color: var(--text); }
.ayah-end {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 42px; margin: 0 8px; padding: 4px;
  color: var(--gold); font-size: 1rem; font-weight: 700; font-family: var(--font-ui);
  background: rgba(227, 182, 79, 0.1); border: 1px solid rgba(227, 182, 79, 0.35); border-radius: 50%;
}
.ayah-tr { color: var(--muted); font-size: 1rem; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--stroke-soft); }
.ayah-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.play-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--stroke);
  background: var(--card-strong); color: var(--gold); font-size: 0.85rem;
  display: inline-flex; align-items: center; justify-content: center; transition: 0.2s;
}
.play-btn:hover { background: var(--gold); color: #10231b; }
.play-btn.playing { background: var(--green-2); color: #fff; border-color: transparent; }
.ayah-ref { color: var(--muted); font-size: 0.8rem; font-weight: 700; }

/* Tajweed colors · verified from alquran.cloud/tajweed-guide */
tajweed, .tj { font-family: inherit; }
.ham_wasl, .slnt, .laam_shamsiyah { color: #AAAAAA; }
.madda_normal { color: #537FFF; }
.madda_permissible { color: #4050FF; }
.madda_necessary { color: #5B67FF; }
.madda_obligatory { color: #7B87FF; }
.qalaqah { color: #DD0008; }
.ikhafa_shafawi { color: #D500B7; }
.ikhafa { color: #B948DE; }
.idgham_shafawi { color: #58B800; }
.iqlab { color: #26BFFD; }
.idgham_ghunnah { color: #1BC29A; }
.idgham_wo_ghunnah { color: #48c214; }
.idgham_mutajanisayn, .idgham_mutaqaribayn { color: #A1A1A1; }
.ghunnah { color: #FF7E1E; }
.tafkheem { color: #FFD54F; }

.tafsir-box {
  margin-top: 12px; border: 1px solid var(--stroke-soft); border-radius: var(--radius-sm);
  background: rgba(227, 182, 79, 0.05); overflow: hidden;
}
.tafsir-box summary {
  cursor: pointer; list-style: none; padding: 10px 16px;
  color: var(--gold-2); font-weight: 700; font-size: 0.88rem;
}
.tafsir-box summary::-webkit-details-marker { display: none; }
.tafsir-text { padding: 4px 16px 14px; color: var(--muted); font-size: 0.95rem; white-space: pre-line; }

.audio-cap { color: var(--muted); font-size: 0.8rem; font-weight: 700; margin-bottom: 4px; text-align: center; }

/* adhkar */
.dhikr-card {
  background: var(--card); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius); padding: 22px 24px; margin: 12px 0;
}
.dhikr-ar { font-family: var(--font-ar); font-size: 1.5rem; line-height: 2.1; direction: rtl; text-align: right; }
.dhikr-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.repeat-chip {
  background: rgba(47, 184, 134, 0.15); color: var(--green-2);
  border-radius: 999px; padding: 3px 14px; font-weight: 800; font-size: 0.85rem;
}

.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; padding: 16px; }
.legend .li { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--muted); }
.legend .dot { width: 14px; height: 14px; border-radius: 4px; flex: none; }

.audio-bar { position: sticky; bottom: 66px; z-index: 30; margin: 10px 0; }
.audio-bar audio { width: 100%; border-radius: 12px; }
@media (min-width: 861px) { .audio-bar { bottom: 12px; } }

.progress-wrap { background: var(--card-strong); border-radius: 999px; height: 10px; overflow: hidden; margin: 10px 0; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--green), var(--gold)); transition: width 0.2s; }

/* ---------- hadith ---------- */
.book-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.book-card {
  position: relative; overflow: hidden; color: var(--text);
  background: linear-gradient(160deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--stroke-soft); border-radius: var(--radius);
  padding: 22px; transition: 0.25s; display: block;
}
.book-card::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 6px;
  background: linear-gradient(180deg, var(--gold), var(--green));
}
.book-card:hover { transform: translateY(-4px); border-color: var(--stroke); }
.book-card .ar { font-family: var(--font-ar); font-size: 1.5rem; color: var(--gold-2); display: block; }
.book-card .en { font-weight: 700; color: var(--text); }
.book-card .meta { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }

.section-list { display: flex; flex-direction: column; gap: 6px; }
.section-item {
  display: flex; gap: 12px; align-items: center; text-align: start;
  background: var(--card); border: 1px solid var(--stroke-soft); color: var(--text);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 0.95rem; font-weight: 600; transition: 0.15s;
}
.section-item:hover { border-color: var(--stroke); background: var(--card-strong); }
.section-item .n { color: var(--gold); font-weight: 800; min-width: 34px; }

.hadith-card {
  background: var(--card); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius); padding: 22px 24px; margin: 12px 0;
}
.hadith-card .num {
  display: inline-block; background: rgba(47, 184, 134, 0.15); color: var(--green-2);
  font-weight: 800; font-size: 0.8rem; border-radius: 999px; padding: 3px 12px; margin-bottom: 12px;
}
.hadith-ar { font-family: var(--font-ar); font-size: 1.45rem; line-height: 2.1; direction: rtl; text-align: right; color: var(--text); }
.hadith-en { color: var(--muted); margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--stroke-soft); font-size: 0.97rem; }
.grade-chip {
  display: inline-block; font-size: 0.75rem; font-weight: 700;
  border: 1px solid var(--stroke); color: var(--gold-2);
  padding: 2px 10px; border-radius: 999px; margin: 8px 6px 0 0;
}

/* ---------- library ---------- */
.lib-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lib-card {
  background: var(--card); border: 1px solid var(--stroke-soft); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 8px; transition: 0.2s;
}
.lib-card:hover { border-color: var(--stroke); transform: translateY(-3px); }
.lib-card .ar { font-family: var(--font-ar); font-size: 1.6rem; color: var(--gold-2); }
.lib-card .latin { font-weight: 800; }
.lib-card .author { color: var(--green-2); font-size: 0.85rem; font-weight: 700; }
.lib-card .desc { color: var(--muted); font-size: 0.88rem; flex: 1; }
.lib-card .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- convert ---------- */
.shahada-hero {
  text-align: center; padding: 44px 24px;
  background: linear-gradient(150deg, rgba(31, 138, 102, 0.25), rgba(227, 182, 79, 0.1));
  border: 1px solid var(--stroke); border-radius: var(--radius); margin-top: 20px;
}
.shahada-hero .ar { font-family: var(--font-quran); font-size: clamp(1.7rem, 4.5vw, 2.6rem); color: var(--gold-2); line-height: 1.9; direction: rtl; }
.shahada-hero .tr { color: var(--text); font-style: italic; margin-top: 14px; font-size: 1.05rem; }
.shahada-hero .mean { color: var(--muted); margin-top: 8px; max-width: 560px; margin-inline: auto; }

.pillars { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: 16px; }
.pillar {
  text-align: center; background: var(--card); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm); padding: 18px 12px; font-weight: 700; font-size: 0.92rem;
}
.pillar .n {
  width: 34px; height: 34px; margin: 0 auto 10px; display: flex; align-items: center; justify-content: center;
  background: rgba(227, 182, 79, 0.14); color: var(--gold); border-radius: 50%; font-weight: 900;
}

.faq-item { background: var(--card); border: 1px solid var(--stroke-soft); border-radius: var(--radius-sm); margin: 8px 0; overflow: hidden; }
.faq-item summary {
  cursor: pointer; list-style: none; padding: 16px 20px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; color: var(--gold); font-size: 1.3rem; font-weight: 400; flex: none; }
.faq-item[open] summary::after { content: '−'; }
.faq-item .a { padding: 0 20px 16px; color: var(--muted); }

.steps { counter-reset: step; display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.step {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--stroke-soft); border-radius: var(--radius-sm); padding: 14px 18px;
}
.step::before {
  counter-increment: step; content: counter(step);
  width: 30px; height: 30px; flex: none; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--green), var(--green-2)); color: #fff; border-radius: 50%; font-weight: 900; font-size: 0.9rem;
}

.cta-box {
  text-align: center; margin-top: 30px; padding: 34px 22px;
  background: linear-gradient(135deg, rgba(227, 182, 79, 0.14), rgba(31, 138, 102, 0.18));
  border: 1px solid var(--stroke); border-radius: var(--radius);
}
.cta-box h2 { font-size: 1.5rem; font-weight: 900; }
.cta-box p { color: var(--muted); max-width: 520px; margin: 8px auto 18px; }
.cta-box .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- prayer ---------- */
.loc-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.loc-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card-strong); border: 1px solid var(--stroke-soft);
  border-radius: 999px; padding: 8px 16px; color: var(--muted); font-size: 0.9rem; font-weight: 700;
}
.times-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 18px; }
.time-card {
  text-align: center; background: var(--card); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius); padding: 20px 10px; transition: 0.2s;
}
.time-card .nm { color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.time-card .tm { font-size: 1.5rem; font-weight: 900; margin-top: 4px; font-variant-numeric: tabular-nums; }
.time-card.next { background: linear-gradient(150deg, rgba(31, 138, 102, 0.35), rgba(227, 182, 79, 0.12)); border-color: var(--green-2); }
.time-card.next .nm { color: var(--green-2); }
.time-card .cd { color: var(--gold-2); font-size: 0.8rem; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hijri-line { color: var(--gold-2); font-weight: 700; margin-top: 10px; }

.qibla-box { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.compass { position: relative; width: 230px; height: 230px; flex: none; margin: 0 auto; }
.compass .rose {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--stroke); background: radial-gradient(circle, var(--bg-3), var(--bg-2));
  transition: transform 0.15s linear;
}
.compass .mark { position: absolute; inset-inline-start: 50%; top: 8px; transform: translateX(-50%); color: var(--muted); font-weight: 900; font-size: 0.8rem; }
.compass .needle {
  position: absolute; inset-inline-start: 50%; top: 50%; width: 4px; height: 92px;
  background: linear-gradient(180deg, var(--gold), transparent);
  transform-origin: 50% 0%; border-radius: 4px;
}
.compass .kaaba { position: absolute; inset-inline-start: 50%; top: 50%; font-size: 1.6rem; transform: translate(-50%, -50%); }
.qibla-info .deg { font-size: 2.6rem; font-weight: 900; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.qibla-info { flex: 1; min-width: 240px; }

/* ---------- misc ---------- */
.spinner {
  width: 44px; height: 44px; margin: 60px auto; border-radius: 50%;
  border: 3px solid var(--stroke-soft); border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.notice { text-align: center; color: var(--muted); padding: 40px 16px; }
.error-box { text-align: center; padding: 40px 16px; color: var(--danger); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-3); color: var(--text); border: 1px solid var(--stroke);
  border-radius: 14px; padding: 12px 20px; font-weight: 600; font-size: 0.9rem;
  opacity: 0; pointer-events: none; transition: 0.28s; z-index: 3500; box-shadow: var(--shadow);
  width: max-content; max-width: min(440px, calc(100vw - 28px));
  white-space: normal; text-align: center; line-height: 1.5;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 861px) { .toast { bottom: 28px; } } /* no bottom nav on desktop */

footer {
  border-top: 1px solid var(--stroke); margin-top: 60px;
  padding: 30px 20px calc(100px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 0.9rem;
}
@media (max-width: 860px) { footer { display: none !important; } }
@media (min-width: 861px) { footer { padding-bottom: 30px; } }
footer .ar { font-family: var(--font-ar); color: var(--gold); font-size: 1.2rem; }

/* Onboarding Splash Screen */
.splash-overlay {
  position: fixed; inset: 0; background: #081611;
  display: flex; align-items: center; justify-content: center;
  z-index: 99999; transition: opacity 0.45s ease, visibility 0.45s ease;
  text-align: center; padding: 24px;
}
.splash-overlay.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-logo { width: 84px; height: 84px; margin-bottom: 12px; animation: pulseGlow 2s infinite alternate; }
.splash-title { font-family: var(--font-ar); color: var(--gold-2); font-size: 2.2rem; margin-bottom: 8px; }
.splash-ayah { font-family: var(--font-ar); color: var(--gold); font-size: 1.4rem; font-weight: 700; margin: 12px 0 6px; }
.splash-sub { color: var(--muted); font-size: 0.95rem; }
@keyframes pulseGlow { from { filter: drop-shadow(0 0 8px rgba(227,182,79,0.3)); } to { filter: drop-shadow(0 0 20px rgba(227,182,79,0.85)); } }

.fade-in { animation: fadeIn 0.35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* section title rows */
.sec-title { display: flex; align-items: center; gap: 12px; margin: 34px 0 14px; font-size: 1.25rem; font-weight: 900; }
.sec-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--stroke), transparent); }

/* ============================================================
   Responsive tuning: small phones, big phones, tablets, desktops
   ============================================================ */

/* Large desktops: wider content, larger Quran text */
@media (min-width: 1500px) {
  .container, .topbar-in { max-width: 1280px; }
  .ayah-ar { --quran-base: 2.1rem; }
}

/* Tablets */
@media (max-width: 1024px) {
  .container { padding: 0 16px; }
}

/* Small phones and below */
@media (max-width: 480px) {
  .container { padding: 0 12px; }
  .hero { padding: 40px 12px 20px; }
  .hero .bismillah { font-size: 1.5rem; }
  .hero .sub { font-size: 0.95rem; }
  .page-head { padding: 28px 0 6px; }
  .card { padding: 20px 16px; }
  .reader-head { padding: 20px 10px 8px; }
  .reader-head .arname { font-size: 1.9rem; }
  .reader-tools { padding: 10px 6px; gap: 6px; }
  .chip { padding: 6px 12px; font-size: 0.8rem; }
  .btn { padding: 11px 16px; font-size: 0.92rem; }
  .ayah-card, .hadith-card, .dhikr-card { padding: 16px 14px; margin: 10px 0; }
  .ayah-ar { line-height: 2.15; }
  .ayah-end { min-width: 34px; height: 34px; margin: 0 5px; font-size: 0.85rem; }
  .hadith-ar { font-size: 1.3rem; }
  .dhikr-ar { font-size: 1.35rem; }
  .shahada-hero { padding: 30px 14px; }
  .prayer-strip { padding: 14px 14px; gap: 10px; }
  .prayer-strip .val { font-size: 1.05rem; }
  .times-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .time-card { padding: 14px 6px; }
  .time-card .tm { font-size: 1.15rem; }
  .compass { width: 190px; height: 190px; }
  .compass .needle { height: 74px; }
  .qibla-info .deg { font-size: 2rem; }
  .lang-menu { width: min(300px, calc(100vw - 24px)); }
  .surah-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .surah-item { padding: 10px 10px; gap: 8px; }
  .surah-item .arname { font-size: 1.1rem; }
  .surah-item .en { font-size: 0.82rem; }
  .surah-item .meta { font-size: 0.65rem; }
  .surah-num { width: 32px; height: 32px; font-size: 0.75rem; }
  .book-grid, .lib-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .book-card { padding: 14px 12px 14px 16px; }
  .book-card .ar { font-size: 1.15rem; }
  .book-card .en { font-size: 0.82rem; }
  .lib-card { padding: 16px 14px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card .glyph { font-size: 1.6rem; margin-bottom: 8px; }
  .card h3 { font-size: 1rem; }
  .card p { font-size: 0.8rem; }
  .legend { grid-template-columns: 1fr 1fr; }
  .legend .li { font-size: 0.72rem; }
  .cta-box .row .btn { width: 100%; }
  .search-row .input { min-width: 0; }
  .loc-bar .input { max-width: none !important; flex: 1; }
}

/* Very small phones */
@media (max-width: 360px) {
  .grid, .surah-grid, .book-grid, .lib-grid, .legend { grid-template-columns: 1fr; }
  .times-grid { grid-template-columns: repeat(2, 1fr); }
  .bottom-nav a { font-size: 0.55rem; }
  .bottom-nav a svg { width: 19px; height: 19px; }
  .brand .ar { font-size: 1.1rem; }
  .lang-btn { padding: 6px 10px; font-size: 0.8rem; }
  .hero h1 { font-size: 1.9rem; }
}

/* Short landscape phones: keep the audio bar out of the way */
@media (max-height: 480px) {
  .audio-bar { position: static; }
}

/* calendar (hijri + gregorian) */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0; }
.cal-title { text-align: center; line-height: 1.5; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-wd { text-align: center; color: var(--muted); font-size: 0.72rem; font-weight: 800; padding: 4px 0; text-transform: uppercase; }
.cal-cell { background: var(--card); border: 1px solid var(--stroke-soft); border-radius: 10px; text-align: center; padding: 8px 2px; min-height: 52px; }
.cal-cell.empty { background: none; border: none; }
.cal-cell .g { font-weight: 800; font-size: 0.95rem; }
.cal-cell .h { color: var(--gold-2); font-size: 0.68rem; font-weight: 700; }
.cal-cell.today { background: linear-gradient(150deg, rgba(31,138,102,0.4), rgba(227,182,79,0.15)); border-color: var(--green-2); }
@media (max-width: 480px) {
  .cal-cell { min-height: 44px; padding: 5px 1px; border-radius: 7px; }
  .cal-cell .g { font-size: 0.82rem; }
  .cal-cell .h { font-size: 0.58rem; }
}

/* bottom nav: many items stay usable on narrow phones */
.bottom-nav { overflow-x: auto; scrollbar-width: none; }
.bottom-nav::-webkit-scrollbar { display: none; }
.bottom-nav a { flex: 1 0 auto; min-width: 58px; }
.bottom-nav a span { white-space: nowrap; max-width: 74px; overflow: hidden; text-overflow: ellipsis; }

/* top nav: wrap gracefully on mid-size screens */
.nav-links { flex-wrap: wrap; justify-content: flex-end; }

/* top-nav "More" dropdown */
.nav-more { position: relative; }
.nav-more-btn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
  font-family: inherit; transition: 0.2s;
}
.nav-more-btn:hover { color: var(--gold-2); background: var(--card-strong); }
.nav-more-btn.active { color: #10231b; background: linear-gradient(135deg, var(--gold), var(--gold-2)); }
.nav-drop {
  display: none; position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 60;
  background: var(--bg-3); border: 1px solid var(--stroke); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 6px; min-width: 190px;
}
.nav-drop.open { display: block; }
.nav-drop a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px; color: var(--text);
  font-weight: 600; font-size: 0.95rem; white-space: nowrap;
}
.nav-drop a svg { width: 18px; height: 18px; color: var(--gold); flex: none; }
.nav-drop a:hover { background: var(--card-strong); }
.nav-drop a.active { color: var(--gold); }

/* language menu on phones: pin under the header, always fully visible */
@media (max-width: 600px) {
  .lang-menu {
    position: fixed;
    top: 66px;
    inset-inline: 12px;
    width: auto;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    grid-template-columns: 1fr 1fr;
  }
  .lang-menu button { padding: 12px 12px; font-size: 1rem; }
}

/* install help modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.65);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--bg-3); border: 1px solid var(--stroke);
  border-radius: var(--radius); box-shadow: var(--shadow);
  max-width: 380px; width: 100%; padding: 28px 24px; text-align: center;
}
.modal-card h3 { margin: 8px 0; font-size: 1.2rem; }
.modal-card p { color: var(--muted); margin-bottom: 18px; }

/* Arabic kitab name shown next to the English chapter name */
.sec-ar { font-family: var(--font-ar); color: var(--gold-2); font-size: 1.05rem; margin-inline-start: 8px; }

/* chatbot */
.chat-wrap { max-width: 760px; margin: 0 auto; }
.chat-box {
  min-height: 340px; max-height: 62vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px;
}
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.bot { justify-content: flex-start; }
.chat-bubble {
  max-width: 85%; padding: 12px 16px; border-radius: 16px;
  font-size: 0.97rem; line-height: 1.7; word-wrap: break-word;
}
.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, var(--green), var(--green-2)); color: #fff;
  border-end-end-radius: 4px;
}
.chat-msg.bot .chat-bubble {
  background: var(--card-strong); border: 1px solid var(--stroke-soft); color: var(--text);
  border-end-start-radius: 4px;
}
.chat-sources { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.src-chip { font-size: 0.72rem; padding: 4px 10px; }
.chat-suggest { display: flex; gap: 8px; flex-wrap: wrap; }
.chat-input-row { display: flex; gap: 8px; margin-top: 12px; }
.chat-input-row .input { flex: 1; }
.chat-input-row .btn { padding: 12px 18px; }

.typing { display: inline-flex; gap: 5px; align-items: center; }
.typing span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--gold);
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.chat-fab {
  position: fixed; inset-inline-end: 16px; bottom: 84px; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; box-shadow: var(--shadow); transition: 0.2s;
}
.chat-fab:hover { transform: scale(1.08); }
@media (min-width: 861px) { .chat-fab { bottom: 24px; } }

/* themed scrollbars (chat + menus) */
.chat-box, .lang-menu {
  scrollbar-width: thin;
  scrollbar-color: rgba(227, 182, 79, 0.45) transparent;
}
.chat-box::-webkit-scrollbar, .lang-menu::-webkit-scrollbar { width: 6px; }
.chat-box::-webkit-scrollbar-track, .lang-menu::-webkit-scrollbar-track { background: transparent; }
.chat-box::-webkit-scrollbar-thumb, .lang-menu::-webkit-scrollbar-thumb {
  background: rgba(227, 182, 79, 0.4); border-radius: 99px;
}
.chat-box::-webkit-scrollbar-thumb:hover, .lang-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(227, 182, 79, 0.7);
}
.chat-fab svg { display: block; }

/* voice buttons */
.mic-btn { padding: 12px 14px; font-size: 1.05rem; }
.mic-btn.listening {
  background: rgba(224, 96, 96, 0.18); border-color: var(--danger); color: var(--danger);
  animation: micpulse 1.1s infinite;
}
@keyframes micpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 96, 96, 0.45); }
  50% { box-shadow: 0 0 0 9px rgba(224, 96, 96, 0); }
}
.speak-btn {
  border: 1px solid var(--stroke); background: var(--card-strong); color: var(--gold-2);
  border-radius: 999px; padding: 4px 12px; font-size: 0.8rem; cursor: pointer; transition: 0.2s;
}
.speak-btn:hover { background: rgba(227, 182, 79, 0.15); }
.speak-btn.playing { background: linear-gradient(135deg, var(--green), var(--green-2)); color: #fff; border-color: transparent; }

/* auto-growing chat input */
.chat-ta {
  resize: none; overflow-y: auto; max-height: 130px; line-height: 1.55;
  scrollbar-width: thin; scrollbar-color: rgba(227, 182, 79, 0.45) transparent;
}
.chat-ta::-webkit-scrollbar { width: 5px; }
.chat-ta::-webkit-scrollbar-thumb { background: rgba(227, 182, 79, 0.4); border-radius: 99px; }
.chat-input-row { align-items: flex-end; }

/* modern chat input bar + icon buttons */
.chat-input-row {
  background: var(--card-strong); border: 1px solid var(--stroke-soft);
  border-radius: 26px; padding: 6px; gap: 6px; align-items: flex-end;
}
.chat-input-row .chat-ta {
  background: transparent; border: none; box-shadow: none; padding: 10px 14px; min-width: 0;
}
.chat-input-row .chat-ta:focus { border: none; box-shadow: none; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: 0.2s; border: none; padding: 0;
}
.icon-btn.send { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #10231b; }
.icon-btn.send:hover { filter: brightness(1.1); transform: scale(1.06); }
.icon-btn.mic { background: transparent; border: 1px solid var(--stroke); color: var(--gold-2); }
.icon-btn.mic:hover { background: rgba(227, 182, 79, 0.12); }
.icon-btn.mic.listening {
  border-color: var(--danger); color: var(--danger);
  animation: micpulse 1.1s infinite;
}
[dir='rtl'] .send-svg { transform: scaleX(-1); }
/* advanced qibla compass (physical left/top coords: directions must never flip in RTL) */
.rose2 {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, var(--bg-3), var(--bg-2));
  border: 2px solid var(--stroke);
  transition: transform 0.12s linear;
}
.cpt { position: absolute; font-weight: 900; font-size: 0.85rem; color: var(--muted); }
.cpt.cn { top: 22px; left: 50%; transform: translateX(-50%); color: #e05555; }
.cpt.cs { bottom: 22px; left: 50%; transform: translateX(-50%); }
.cpt.ce { right: 22px; top: 50%; transform: translateY(-50%); }
.cpt.cw { left: 22px; top: 50%; transform: translateY(-50%); }
.qibla-pointer { position: absolute; inset: 0; transform-origin: 50% 50%; }
.q-arrow {
  position: absolute; left: calc(50% - 5px); bottom: 50%; width: 10px; height: 72px;
  background: linear-gradient(to top, rgba(227, 182, 79, 0.05), var(--gold));
  clip-path: polygon(50% 0, 100% 22%, 68% 22%, 68% 100%, 32% 100%, 32% 22%, 0 22%);
}
.q-kaaba {
  position: absolute; top: 30px; left: 50%; transform: translateX(-50%);
  font-size: 1.35rem; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.7));
}
.compass-center {
  position: absolute; left: 50%; top: 50%; width: 16px; height: 16px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: var(--gold); border: 3px solid var(--bg); z-index: 2;
}
.compass.aligned .rose2 {
  border-color: var(--green-2);
  box-shadow: 0 0 28px rgba(47, 184, 134, 0.55);
}
/* phone not held flat: dim the dial to signal the reading is paused */
.compass.tilted .rose2 { opacity: 0.35; filter: grayscale(0.4); }
.compass.tilted .qibla-pointer { opacity: 0.5; }

/* smooth mobile tab bar scrolling */
.bottom-nav {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 12px;
}
.bottom-nav a { scroll-snap-align: center; }

/* pulsing "more tabs" hint at the edge of the mobile tab bar */
.bn-more {
  position: fixed; bottom: calc(8px + env(safe-area-inset-bottom)); right: 0; z-index: 56;
  width: 40px; height: 52px; border: none; padding: 0;
  display: none; align-items: center; justify-content: center;
  background: linear-gradient(to right, rgba(10, 26, 20, 0), rgba(10, 26, 20, 0.97) 45%);
  color: var(--gold); font-size: 1.1rem; cursor: pointer;
}
.bn-more.show { display: flex; }
[dir='rtl'] .bn-more { right: auto; left: 0; transform: scaleX(-1); }
.bn-more .ch { animation: bn-nudge 1.5s infinite; font-weight: 900; }
@keyframes bn-nudge {
  0%, 100% { transform: translateX(0); opacity: 0.7; }
  50% { transform: translateX(4px); opacity: 1; }
}
@media (min-width: 861px) { .bn-more { display: none !important; } }

/* ===== senior UX pass ===== */

/* back to top */
.to-top {
  position: fixed; inset-inline-start: 16px; bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 60; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(12, 31, 24, 0.92); border: 1px solid var(--stroke); color: var(--gold);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: 0.25s;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
@media (min-width: 861px) { .to-top { bottom: 24px; } }

/* reading progress line */
.read-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--green-2), var(--gold));
  z-index: 80; transition: width 0.15s linear; pointer-events: none;
}

/* continue-reading card */
.resume-card {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, rgba(31, 138, 102, 0.28), rgba(227, 182, 79, 0.1));
  border: 1px solid var(--stroke); border-radius: var(--radius-sm);
  padding: 13px 18px; margin-bottom: 6px; color: var(--text); font-weight: 800;
  transition: 0.2s;
}
.resume-card:hover { transform: translateY(-2px); border-color: var(--green-2); }

/* micro-interactions */
.btn:active, .chip:active, .icon-btn:active, .play-btn:active, .speak-btn:active,
.surah-item:active, .book-card:active, .card:active, .section-item:active { transform: scale(0.97); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* page-change fade */
#app.route-fade { animation: fadeIn 0.22s ease; }

/* accessibility: respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Masjid community channels ===== */
.masjid-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius); color: var(--text); transition: 0.2s;
}
.masjid-card:hover { transform: translateY(-3px); border-color: var(--stroke); }
.mj-cover {
  height: 120px; background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; font-size: 2.4rem;
}
.mj-cover.sm { height: 46px; width: 46px; border-radius: 12px; flex: none; font-size: 1.4rem; }
.mj-body { padding: 12px 14px; }
.mj-name { font-weight: 800; font-size: 1.02rem; }
.mj-loc { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.mj-meta { color: var(--gold-2); font-size: 0.78rem; margin-top: 6px; font-weight: 700; }

.mj-head {
  display: flex; align-items: center; gap: 12px; margin: 14px 0;
  background: var(--card); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius); padding: 12px 14px; position: sticky; top: 64px; z-index: 20;
  backdrop-filter: blur(8px);
}
.mj-chat {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 300px; max-height: 62vh; overflow-y: auto; padding: 6px 2px;
  scrollbar-width: thin; scrollbar-color: rgba(227,182,79,0.45) transparent;
}
.mj-chat::-webkit-scrollbar { width: 6px; }
.mj-chat::-webkit-scrollbar-thumb { background: rgba(227,182,79,0.4); border-radius: 99px; }
.mj-msg { display: flex; }
.mj-msg.mine { justify-content: flex-end; }
.mj-bubble {
  max-width: 82%; background: var(--card-strong); border: 1px solid var(--stroke-soft);
  border-radius: 16px; padding: 10px 14px; position: relative;
}
.mj-msg.mine .mj-bubble { background: linear-gradient(135deg, rgba(31,138,102,0.35), rgba(31,138,102,0.2)); border-end-end-radius: 4px; }
.mj-msg:not(.mine) .mj-bubble { border-end-start-radius: 4px; }
.mj-msg-head { font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.mj-msg-head b { color: var(--gold-2); }
.mj-text { line-height: 1.6; word-wrap: break-word; }
.mj-img { max-width: 220px; max-height: 260px; border-radius: 12px; margin: 4px 0; display: block; }
.mj-reply-quote {
  border-inline-start: 3px solid var(--gold); background: rgba(255,255,255,0.04);
  padding: 5px 10px; border-radius: 8px; font-size: 0.82rem; color: var(--muted); margin-bottom: 6px;
}
.mj-reply-quote b { color: var(--gold-2); }
.mj-actions { display: flex; gap: 10px; margin-top: 6px; }
.mj-act { background: none; border: none; color: var(--muted); font-size: 0.75rem; cursor: pointer; padding: 0; }
.mj-act:hover { color: var(--gold-2); }
.mj-reply-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--card-strong); border: 1px solid var(--stroke-soft);
  border-radius: 12px; padding: 8px 12px; margin: 8px 0 0; font-size: 0.85rem; color: var(--muted);
}
.mj-composer { margin-top: 10px; }
.mj-nick-line { color: var(--muted); font-size: 0.82rem; margin-top: 8px; text-align: center; }
.mj-nick-line a { color: var(--gold-2); }
.icon-btn.mic.on { background: rgba(47,184,134,0.2); border-color: var(--green-2); color: var(--green-2); }
.icon-btn.on { background: rgba(47,184,134,0.2); border-color: var(--green-2); color: var(--green-2); }

/* ----- masjid: building status, notify bell, pin, voice, checkbox ----- */
.mj-build-chip {
  display: inline-block; font-size: 0.66rem; font-weight: 800; vertical-align: middle;
  color: #e0a83a; background: rgba(224,168,58,0.14); border: 1px solid rgba(224,168,58,0.4);
  padding: 1px 7px; border-radius: 999px; margin-inline-start: 6px; white-space: nowrap;
}
.masjid-card .mj-cover { position: relative; }
.mj-build-badge {
  position: absolute; inset-inline-start: 8px; top: 8px; font-size: 0.62rem; font-weight: 800;
  color: #1c130a; background: rgba(224,168,58,0.92); padding: 2px 8px; border-radius: 999px;
}
.mj-bell.on { background: rgba(227,182,79,0.2); border-color: var(--gold); color: var(--gold-2); }

/* pinned message banner (WhatsApp-style) */
.mj-pinned {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: linear-gradient(90deg, rgba(227,182,79,0.14), rgba(227,182,79,0.05));
  border: 1px solid rgba(227,182,79,0.35); border-inline-start: 3px solid var(--gold);
  border-radius: 12px; padding: 8px 12px; margin: 8px 0 0;
}
.mj-pin-ico { font-size: 0.95rem; flex: none; }
.mj-pin-body { flex: 1; min-width: 0; font-size: 0.85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mj-pin-body b { color: var(--gold-2); margin-inline-end: 4px; }
.mj-pin-x { flex: none; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.95rem; padding: 2px 4px; }
.mj-pin-x:hover { color: var(--gold-2); }
.mj-flash { animation: mj-flash 1.4s ease; }
@keyframes mj-flash { 0%, 40% { background: rgba(227,182,79,0.18); border-radius: 16px; } 100% { background: transparent; } }

/* voice note player inside a bubble */
.mj-audio { display: block; width: 230px; max-width: 62vw; height: 40px; margin: 4px 0; }

/* voice recording bar (replaces the composer while recording) */
.mj-rec-bar {
  display: flex; align-items: center; gap: 12px; margin-top: 10px;
  background: var(--card-strong); border: 1px solid var(--danger); border-radius: 14px; padding: 8px 12px;
}
.mj-rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); flex: none; animation: mj-pulse 1s infinite; }
@keyframes mj-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }
.mj-rec-time { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ink); }
.mj-rec-hint { flex: 1; color: var(--muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* under-construction checkbox in the create/edit form */
.mj-check { display: flex; align-items: center; gap: 9px; margin-top: 12px; cursor: pointer; font-weight: 600; color: var(--ink); }
.mj-check input { width: 18px; height: 18px; accent-color: var(--green-2); flex: none; }

/* chosen-image preview above the composer (shows what the user picked) */
.mj-img-preview {
  display: flex; align-items: center; gap: 10px; margin: 8px 0 0;
  background: var(--card-strong); border: 1px solid var(--stroke-soft); border-radius: 12px; padding: 8px 10px;
}
.mj-img-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; flex: none; }
.mj-img-cap { flex: 1; min-width: 0; color: var(--muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Mushaf image view + favorites ===== */
.ayah-card.mushaf {
  background: linear-gradient(#f6f1e2, #efe7d2); border-color: #d8c9a3;
}
.ayah-img-wrap { position: relative; text-align: center; }
.ayah-img { max-width: 100%; height: auto; display: inline-block; }
.ayah-card.mushaf .ayah-end {
  background: rgba(31,138,102,0.12); color: #1f8a66; border-color: rgba(31,138,102,0.4);
}
.ayah-card.mushaf .ayah-tr { color: #5b5230; border-top-color: #d8c9a3; }
.ayah-card.mushaf .ayah-ref { color: #7a6c45; }

/* favorite star (ayah + dhikr foot) */
.fav-star {
  background: none; border: none; cursor: pointer; font-size: 1.15rem;
  color: var(--muted); line-height: 1; padding: 2px 4px; transition: 0.15s;
}
.fav-star:hover { color: var(--gold); transform: scale(1.15); }
.fav-star.on { color: var(--gold); }
.ayah-card.mushaf .fav-star { color: #b9a44a; }
.ayah-card.mushaf .fav-star.on { color: #c79a2a; }

/* header favorites button */
.fav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; color: var(--gold);
  border: 1px solid var(--stroke); transition: 0.2s;
}
.fav-btn:hover { background: rgba(227,182,79,0.14); }
@media (max-width: 480px) { .fav-btn { width: 34px; height: 34px; } }

/* highlight an ayah/dhikr you jumped to */
.ayah-highlight { animation: ayah-flash 2.6s ease; }
@keyframes ayah-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47,184,134,0); }
  15% { box-shadow: 0 0 0 3px rgba(47,184,134,0.6); }
}

/* ===== tidy, uniform header controls (esp. mobile) ===== */
.topbar-in { gap: 12px; }
.fav-btn, .lang-btn, .install-btn { height: 40px; }
.lang-btn, .install-btn { border-radius: 999px; }
.fav-btn { width: 40px; }

@media (max-width: 860px) {
  .topbar-in { gap: 7px; padding: 9px 12px; }
  .brand img { width: 32px; height: 32px; }
  .brand .ar { font-size: 1.15rem; }
  /* push the control cluster to the far edge */
  .fav-btn { margin-inline-start: auto; }
  /* everything becomes an equal 38px icon button */
  .fav-btn, .install-btn, .lang-btn { height: 38px; }
  .fav-btn { width: 38px; }
  .install-btn {
    width: 38px; padding: 0; justify-content: center;
    border-radius: 50%; font-size: 1.05rem;
  }
  .install-btn span { display: none; }
  .lang-btn { padding: 0 11px; gap: 5px; font-size: 0.85rem; }
}
@media (max-width: 340px) {
  .topbar-in { gap: 5px; padding: 8px 10px; }
  .fav-btn, .install-btn, .lang-btn { height: 36px; }
  .fav-btn, .install-btn { width: 36px; }
  .brand .name, .brand .ar { display: none; }  /* just the crescent icon on tiny screens */
  .brand img { width: 30px; height: 30px; }
}

.mj-edit-chip { border-color: var(--gold); color: var(--gold); font-weight: 700; }
.mj-edit-chip:hover { background: rgba(227,182,79,0.14); }

/* ===== Mushaf full-page view ===== */
.mushaf-page-card {
  background: #fbf7ec; border: 1px solid #d8c9a3; border-radius: 10px;
  overflow: hidden; margin: 12px 0; box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.mushaf-page { display: block; width: 100%; height: auto; }
.mushaf-page-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; background: #efe7d2; border-top: 1px solid #d8c9a3;
}
.mushaf-page-num { color: #7a6c45; font-weight: 800; font-size: 0.85rem; white-space: nowrap; }
.mushaf-ayat { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.mushaf-ayah-chip {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; cursor: pointer;
  background: #fff; border: 1px solid #c9b788; color: #6b5d34; font-weight: 800; font-size: 0.85rem;
  transition: 0.15s;
}
.mushaf-ayah-chip:hover { background: #1f8a66; color: #fff; border-color: #1f8a66; }
.mushaf-ayah-chip.playing { background: #1f8a66; color: #fff; border-color: #1f8a66; }

/* ===== recite / follow-along تلاوة ===== */
.rc-chip { color: var(--green-2); border-color: var(--green-2); }
.rc-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.rc-bar .btn.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.rc-riwaya { color: var(--muted); font-family: var(--font-ar); margin-inline-start: auto; }
.rc-mode-note { color: var(--muted); font-size: 0.8rem; margin: -4px 0 10px; }
.rc-riwayas { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.rc-riwayas .chip { font-family: var(--font-ar); }
/* labelled setting rows (Reading / Recognition / Tajwid) — active choice is highlighted */
.rc-set { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.rc-set-lbl { color: var(--muted); font-size: 0.82rem; font-weight: 700; min-width: 92px; }
.rc-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.rc-chips .chip.on { background: var(--gold); color: #10231b; border-color: var(--gold); font-weight: 800; }
.rc-progress { height: 6px; background: var(--card-strong); border-radius: 99px; overflow: hidden; margin: 6px 0 14px; }
.rc-progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--green-2)); transition: width 0.3s; }
.rc-list {
  font-family: var(--font-quran); direction: rtl; text-align: justify; text-align-last: center;
  line-height: 2.6; font-size: 1.7rem; color: var(--ink);
  background: linear-gradient(#fbf7ec, #f3ecd8); border: 1px solid #d8c9a3;
  border-radius: 14px; padding: 20px 18px 26px; margin-top: 8px; color: #2a2410;
  max-height: 66vh; overflow-y: auto;
}
.rc-basmala { text-align: center; color: #4a3d1a; margin-bottom: 14px; }
.rc-ayah { border-radius: 10px; padding: 3px 5px; transition: background 0.25s; }
.rc-ayah.current { background: rgba(31,138,102,0.08); }
.rc-word { transition: color 0.15s, background 0.15s, box-shadow 0.15s; border-radius: 5px; padding: 0 2px; }
/* hidden until recited correctly (a neutral block, content not readable) */
.rc-word.hidden { color: transparent; background: linear-gradient(#d9cba6, #cdbd93); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.05); user-select: none; }
.rc-word.revealed { color: #1f8a66; background: transparent; }
/* with-tajwid: revealed words keep the tajwid colours (dark base so coloured rules stand out) */
.rc-list.rc-tajwid .rc-word.revealed { color: #2a2410; }
.rc-list.rc-tajwid .rc-word .tj { border-radius: 0; }
/* the word you should recite next */
.rc-word.current { box-shadow: 0 0 0 2px #c9a94a; background: linear-gradient(#e7d7a8, #ddca98); }
.rc-word.current.revealed { background: rgba(31,138,102,0.12); box-shadow: 0 0 0 2px var(--green-2); }
/* wrong word: red flash + it does not advance */
/* wrong attempt: reveal the word in RED so the reciter sees the mistake and repeats it */
.rc-word.wrong { color: #d43d3d !important; background: rgba(212,61,61,0.14); box-shadow: 0 0 0 2px #d43d3d; animation: rc-wrong 0.42s ease; }
.rc-list.rc-tajwid .rc-word.wrong { color: #d43d3d !important; }
.rc-word.wrong .tj { color: #d43d3d !important; }
@keyframes rc-wrong { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 60% { transform: translateX(4px); } }
.rc-num {
  font-family: var(--font-ui); font-size: 0.5em; font-weight: 700; color: #8a6a1c;
  display: inline-block; min-width: 1.1em; text-align: center; padding: 0.35em 0.4em; margin: 0 0.35em;
  border-radius: 50%; background: radial-gradient(circle at 50% 45%, #fdfaf0 55%, #f3e8cc 100%);
  box-shadow: 0 0 0 1.5px #c9a94a; vertical-align: 0.35em;
}

/* ===== in-app dialogs (custom prompt/confirm) ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(3, 10, 8, 0.62); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.18s ease;
}
.modal-overlay.show { opacity: 1; }
.modal-card {
  width: 100%; max-width: 400px; background: var(--card-strong, var(--card));
  border: 1px solid var(--stroke); border-radius: 18px; padding: 22px 20px 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5); text-align: center;
  transform: translateY(14px) scale(0.97); transition: transform 0.2s cubic-bezier(.2,.9,.3,1.2);
}
.modal-overlay.show .modal-card { transform: none; }
.modal-icon { font-size: 2.1rem; line-height: 1; margin-bottom: 8px; }
.modal-title { font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.modal-msg { color: var(--muted); margin-top: 8px; line-height: 1.55; font-size: 0.95rem; }
.modal-input { width: 100%; margin-top: 16px; text-align: start; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; justify-content: center; }
.modal-actions .modal-ok.danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ===== notifications panel ===== */
.notify-card { max-width: 640px; transition: border-color 0.25s, box-shadow 0.25s; }
.notify-card.on { border-color: color-mix(in srgb, var(--green-2) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--green-2) 30%, transparent) inset; }
.notify-head { display: flex; align-items: center; gap: 14px; }
.notify-bell { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 14px; color: var(--green-2); background: color-mix(in srgb, var(--green-2) 14%, transparent); }
.notify-card.on .notify-bell { color: #fff; background: linear-gradient(135deg, var(--green), var(--green-2)); animation: bell-in 0.4s ease; }
@keyframes bell-in { 0% { transform: scale(0.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.notify-title { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notify-badge { font-size: 0.68rem; font-weight: 700; color: var(--green-2); background: color-mix(in srgb, var(--green-2) 16%, transparent); padding: 2px 9px; border-radius: 999px; letter-spacing: 0.3px; }
.notify-sub { color: var(--muted); font-size: 0.85rem; margin-top: 4px; line-height: 1.5; }
.notify-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.notify-opt { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 0.9rem; cursor: pointer; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--stroke); background: var(--card-strong); color: var(--muted); transition: 0.18s; user-select: none; }
.notify-opt:hover { border-color: var(--green-2); }
.notify-opt.on { color: var(--ink); border-color: transparent; background: color-mix(in srgb, var(--green-2) 20%, var(--card-strong)); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--green-2) 55%, transparent) inset; }
.notify-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }
.notify-actions .btn.green { min-width: 220px; justify-content: center; }
.notify-actions .btn.green svg { width: 20px; height: 20px; }
.notify-note { color: var(--gold-2); font-size: 0.85rem; margin-top: 10px; min-height: 1em; }

/* ===== masjid chat: internal scroll, bottom-anchored, visible actions ===== */
.mj-chat {
  height: 56vh; min-height: 260px; max-height: none;
  display: flex; flex-direction: column;
}
.mj-chat::before { content: ''; margin-top: auto; }   /* pin few messages to the bottom */
.mj-actions { gap: 6px; margin-top: 8px; }
.mj-act {
  background: var(--card-strong); border: 1px solid var(--stroke-soft);
  color: var(--gold-2); font-size: 0.78rem; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
}
.mj-act:hover { background: rgba(227,182,79,0.14); border-color: var(--stroke); }
.mj-composer { position: sticky; bottom: 0; z-index: 12; }
.mj-reply-bar { position: sticky; bottom: 58px; z-index: 12; }
.mj-nick-line { padding-bottom: 4px; }
@media (max-width: 860px) {
  .mj-chat { height: 52vh; }
  .mj-head { position: static; }
  .mj-composer { bottom: 60px; }        /* clear the bottom tab bar */
  .mj-reply-bar { bottom: 118px; }
  .mj-act { padding: 5px 14px; font-size: 0.8rem; }
}

/* ===== mushaf-styled coloured text page (all riwayat, zoomable) ===== */
.mushaf-text-page {
  background: linear-gradient(#fbf7ec, #f3ecd8); border: 1px solid #d8c9a3;
  border-radius: 12px; padding: 22px 20px 30px; margin: 12px 0;
  box-shadow: 0 6px 20px rgba(0,0,0,0.22);
}
.mushaf-band {
  text-align: center; font-family: var(--font-quran); font-size: 1.9rem; color: #7a5c1e;
  border: 2px solid #c9a94a; border-radius: 10px; padding: 10px; margin-bottom: 14px;
  background: linear-gradient(#f7edcf, #efe3c0);
}
.mushaf-basmala { text-align: center; font-family: var(--font-quran); font-size: 1.7rem; color: #4a3d1a; margin-bottom: 14px; }
.mushaf-flow {
  font-family: var(--font-quran); direction: rtl; text-align: justify; text-align-last: center;
  color: #2a2410; line-height: 2.6; font-size: var(--quran-size, 1.9rem);
}
.mushaf-flow .m-ayah { cursor: pointer; border-radius: 6px; transition: background 0.15s; }
.mushaf-flow .m-ayah:hover { background: rgba(31,138,102,0.12); }
.mushaf-flow .m-ayah.playing { background: rgba(31,138,102,0.22); }
/* traditional end-of-ayah marker: an ornate double-ring rosette with the number inside */
.mushaf-flow .m-end {
  display: inline-block; vertical-align: 0.35em;
  font-family: var(--font-ui); font-size: 0.44em; font-weight: 700; line-height: 1;
  color: #8a6a1c; letter-spacing: 0.02em;
  direction: ltr; unicode-bidi: isolate;             /* Western numbers stay 25 not 52 */
  min-width: 1.15em; text-align: center;
  padding: 0.5em 0.5em; margin: 0 0.4em; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #fdfaf0 55%, #f3e8cc 100%);
  box-shadow: 0 0 0 1.5px #c9a94a, 0 0 0 3px rgba(201,169,74,0.28), inset 0 0 3px rgba(201,169,74,0.45);
}
/* colours on the coloured page inherit the .tj classes already; keep them vivid on parchment */
.mushaf-flow .tafkheem { color: #b8860b; }

/* juz / hizb / rub'-al-hizb division markers (verified King Fahd·Tanzil data) */
.mushaf-flow .m-division {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin: 16px 0; direction: rtl; font-size: 0.95rem;
}
.mushaf-flow .m-division::before, .mushaf-flow .m-division::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(to right, transparent, #cdae55, transparent);
}
.mushaf-flow .m-rosette { font-family: var(--font-quran); color: #b58a2b; font-size: 1.6em; line-height: 1; }
.mushaf-flow .m-div-label { white-space: nowrap; font-family: var(--font-quran); font-size: 1.25em; color: #6f5518; font-weight: 700; }
.mushaf-flow .m-division.hizb .m-div-label { color: #5a4412; }
/* juz start: a filled ornamental band so the start of a new juz stands out */
.mushaf-flow .m-division.juz {
  background: linear-gradient(#f4e5ba, #ecd9a0); border: 1px solid #c9a94a;
  border-radius: 10px; padding: 9px 14px; margin: 22px 0;
  box-shadow: 0 2px 7px rgba(122,92,30,0.2);
}
.mushaf-flow .m-division.juz::before, .mushaf-flow .m-division.juz::after { display: none; }
.mushaf-flow .m-division.juz .m-div-label { color: #6a3d0e; font-weight: 800; font-size: 1.35em; }
.mushaf-flow .m-division.juz .m-rosette { color: #a5702a; font-size: 1.8em; }

/* mushaf scanned-page zoom */
.mushaf-scale-wrap { width: 100%; overflow-x: auto; }
.mushaf-scale-wrap .mushaf-page-card { width: calc(100% * var(--mushaf-scale, 1)); max-width: none; margin-inline: auto; }

/* ---------- Authentic Tajweed Mushaf Frame (Matching User Screenshot) ---------- */
.mushaf-tajweed-page {
  background-color: #fbf6e1;
  border: 5px solid #3c5d3e;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  max-width: 740px;
  margin: 0 auto;
  font-family: var(--font-quran, 'Amiri Quran', 'Scheherazade New', serif);
  direction: rtl;
  color: #111;
  position: relative;
}

.mushaf-tajweed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #3c5d3e;
  padding-bottom: 10px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  font-weight: 800;
}

.mushaf-header-box {
  border: 1.5px solid #3c5d3e;
  background-color: #edf5eb;
  color: #1c361e;
  padding: 4px 16px;
  border-radius: 6px;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.05);
}

.mushaf-tajweed-content {
  font-size: 1.45rem;
  line-height: 2.3;
  text-align: justify;
  text-align-last: center;
  padding: 10px 14px;
  color: #1a1a1a;
}

.mushaf-tajweed-footer {
  border-top: 2px solid #3c5d3e;
  padding-top: 12px;
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1f3020;
  background: #edf5eb;
  border-radius: 8px;
  padding: 10px 14px;
  border: 1px solid #3c5d3e;
}

/* Authentic Traditional Physical Mushaf Surah Header Banner (Image 1) */
.mushaf-surah-header-frame {
  position: relative;
  width: 100%;
  margin: 20px 0 12px;
  padding: 6px 10px;
  background: #ecdcb0;
  border: 3px double #7c242e;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  direction: rtl;
  overflow: hidden;
}

.mushaf-header-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.28;
  background-image: radial-gradient(#8b2635 1.5px, transparent 1.5px), radial-gradient(#2d5a3f 1.5px, #ecdcb0 1.5px);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  pointer-events: none;
}

.mushaf-header-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  white-space: nowrap;
}

.mushaf-title-cartouche {
  flex: 1;
  max-width: 340px;
  background: #ffffff;
  border: 2px solid #8b2635;
  border-radius: 30px;
  padding: 4px 14px;
  text-align: center;
  font-family: var(--font-quran, 'Amiri Quran', 'Scheherazade New', serif);
  font-size: clamp(1.15rem, 3.5vw, 1.6rem);
  font-weight: 800;
  color: #1c361e;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), inset 0 0 6px rgba(139, 38, 53, 0.1);
  white-space: nowrap;
  margin: 0 auto;
}

.mushaf-seal {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #8b2635;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  font-family: var(--font-quran, 'Amiri Quran', serif);
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.mushaf-seal .seal-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: #7c242e;
}

.mushaf-seal .seal-num {
  font-size: 0.95rem;
  font-weight: 800;
  color: #111;
}
.mushaf-basmala-frame {
  text-align: center;
  font-family: var(--font-quran, 'Amiri Quran', 'Scheherazade New', serif);
  font-size: 1.55rem;
  font-weight: 800;
  color: #111;
  margin: 12px 0 16px;
  padding: 4px;
  letter-spacing: 0.5px;
}

.mushaf-legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ---------- tab bar & buttons ---------- */
.tab-bar {
  display: flex !important;
  gap: 10px !important;
  overflow-x: auto !important;
  padding: 8px 4px 12px 4px !important;
  margin: 16px 0 !important;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important; /* PREVENTS TEXT FROM SQUISHING/DISAPPEARING ON MOBILE! */
  white-space: nowrap !important;
  background: rgba(255, 255, 255, 0.12) !important;
  color: #f2ede1 !important;
  border: 1.5px solid rgba(227, 182, 79, 0.5) !important;
  border-radius: 999px !important;
  padding: 10px 22px !important;
  font-family: inherit !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  cursor: pointer !important;
  opacity: 1 !important;
  visibility: visible !important;
  transition: all 0.2s ease-in-out !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
}

.tab-btn:hover {
  background: rgba(227, 182, 79, 0.25) !important;
  border-color: rgba(227, 182, 79, 0.85) !important;
  color: #ffffff !important;
}

.tab-btn.active {
  background: linear-gradient(135deg, #e3b64f, #f5d78a) !important;
  color: #081611 !important;
  border-color: #f5d78a !important;
  font-weight: 900 !important;
  box-shadow: 0 4px 18px rgba(227, 182, 79, 0.45) !important;
}

.tab-btn span {
  display: inline-block !important;
  color: inherit !important;
  font-weight: inherit !important;
  font-size: inherit !important;
}

/* ---------- Quranic Duas Grid ---------- */
.qd-grid {
  display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* ---------- Prophets Family Tree (شجرة الأنبياء والنسب المرئي) ---------- */
.prophets-tree {
  display: flex; flex-direction: column; gap: 24px; margin-top: 18px; position: relative;
  padding-inline-start: 28px; border-inline-start: 3px solid var(--gold);
}
.tree-era-block {
  background: var(--card); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius); padding: 22px; position: relative;
  transition: border-color 0.25s;
}
.tree-era-block:hover { border-color: var(--stroke); }
.tree-era-block::before {
  content: ''; position: absolute; top: 26px; inset-inline-start: -31px;
  width: 28px; height: 3px; background: linear-gradient(90deg, var(--gold), var(--green-2));
}
.tree-era-block::after {
  content: '✦'; position: absolute; top: 16px; inset-inline-start: -41px;
  width: 22px; height: 22px; background: var(--bg-3); border: 2px solid var(--gold);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; color: var(--gold); z-index: 2; box-shadow: 0 0 10px rgba(227, 182, 79, 0.4);
}
.tree-era-title {
  display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.1rem;
  color: var(--gold-2); margin-bottom: 18px; padding-bottom: 10px;
  border-bottom: 1px dashed var(--stroke-soft);
}
.tree-era-title .badge {
  background: var(--green); color: #fff; font-size: 0.75rem; padding: 3px 10px; border-radius: 999px; font-weight: 700;
}
.tree-nodes-row {
  display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.tree-node-card {
  position: relative; background: var(--bg-3); border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-sm); padding: 18px; transition: all 0.25s;
  display: flex; flex-direction: column;
}
.tree-node-card:hover {
  transform: translateY(-4px); border-color: var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.tree-node-card.highlight {
  background: linear-gradient(135deg, rgba(31, 138, 102, 0.25), rgba(227, 182, 79, 0.12));
  border: 1px solid var(--gold);
}
.tree-node-card.direct-line {
  border: 2px solid var(--gold);
  box-shadow: 0 0 16px rgba(227, 182, 79, 0.25);
}
.direct-line-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #10231b; font-size: 0.72rem; font-weight: 800;
  padding: 3px 8px; border-radius: 6px; margin-bottom: 10px; width: fit-content;
}
.tree-node-num {
  position: absolute; top: 12px; inset-inline-end: 14px;
  font-size: 0.78rem; font-weight: 800; color: var(--gold); opacity: 0.85;
}
.tree-node-name {
  font-family: var(--font-ar); font-size: 1.3rem; font-weight: 800; color: var(--text); margin-bottom: 2px;
}
.tree-node-card.highlight .tree-node-name { color: var(--gold-2); }
.tree-node-latin {
  font-size: 0.85rem; color: var(--muted); font-weight: 600; margin-bottom: 8px;
}
.tree-node-tag {
  display: inline-block; font-size: 0.8rem; font-weight: 700; color: var(--green-2);
  background: rgba(31, 138, 102, 0.15); border-radius: 6px; padding: 3px 8px; margin-bottom: 8px; width: fit-content;
}
.tree-node-lineage {
  font-size: 0.82rem; color: var(--muted); line-height: 1.45; margin-bottom: 14px; flex: 1;
}
.tree-node-act { margin-top: auto; }


/* ============================================================
   Authentic Warsh (KFGQPC Uthmanic Warsh font) + play-until-unit
   ============================================================ */
@font-face {
  font-family: 'KFGQPC Warsh';
  src: url('../fonts/warsh.woff2') format('woff2'),
       url('../fonts/warsh.ttf') format('truetype');
  font-display: swap;
}
/* The bundled font file (fonts/warsh.ttf / .woff2) is the pristine, unmodified
   official "KFGQPC Uthmanic Warsh" font (v0.10, King Fahd Complex). It renders
   the standard/Mashriqi dotting: fa (ف) one dot ABOVE, qaf (ق) two dots ABOVE.
   A previous experiment hand-edited the fa glyphs with fontTools to move the
   dot below the baseline (Maghribi ڢ), but it was applied unevenly across the
   positional forms (isolated vs init/medi/fina) and looked broken, so it was
   reverted to the original font. Do NOT re-edit glyph dots in place; if a
   different dotting is ever wanted, swap in a purpose-built font instead.
   A separate font-weight:bold + text-stroke experiment for a heavier stroke
   also broke on-device layout and was removed; this font is used at normal
   weight only. */
.warsh-font .ayah-ar,
.ayah-card.warsh-font .ayah-ar,
.mushaf-flow.warsh-font,
.mushaf-flow.warsh-font .m-ayah,
.warsh-font .rc-word,
.warsh-font .rc-ayah-body {
  font-family: 'KFGQPC Warsh', var(--font-quran);
  line-height: 2.55;
}
.ayah-card.warsh-font .ayah-ar { line-height: 2.5; }

/* play-from-here (⏬) button — sits beside the ▶ per-ayah button */
.play-unit-btn {
  border: 1px solid var(--stroke); background: var(--card); color: var(--gold-2);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; transition: 0.15s;
}
.play-unit-btn:hover { background: var(--gold); color: #10231b; border-color: transparent; }

/* unit chooser popover */
.unit-menu {
  position: absolute; z-index: 1400; width: 220px; max-width: calc(100vw - 16px);
  background: var(--bg-2); border: 1px solid var(--stroke); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); overflow: hidden; padding: 4px;
}
.unit-menu button {
  display: block; width: 100%; text-align: start; background: transparent; color: var(--text);
  border: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-family: var(--font-ui);
  font-size: 0.92rem;
}
.unit-menu button:hover { background: var(--card-strong); color: var(--gold-2); }

/* currently-playing ayah highlight */
.ayah-card.ayah-playing {
  border-color: var(--green-2);
  box-shadow: 0 0 0 1px var(--green-2), 0 8px 30px rgba(47, 184, 134, 0.25);
}
/* selected play-unit range (the thumn/rub'/… you chose): whole span shown in light green */
.ayah-card.in-unit { border-color: color-mix(in srgb, var(--green-2) 45%, transparent); }
.mushaf-flow .m-ayah.in-unit { background: rgba(47, 184, 134, 0.13); }
/* the ayah currently being recited: strong green that follows along, ayah by ayah */
.mushaf-flow .m-ayah.ayah-playing {
  background: rgba(47, 184, 134, 0.28);
  box-shadow: 0 0 0 2px var(--green-2);
  color: #0d3325;
}
.mushaf-flow.warsh-font .m-ayah.ayah-playing { color: #0d3325; }

/* floating continuous-play control bar */
.unit-play-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 1500;
  display: flex; align-items: center; gap: 12px; padding: 8px 14px;
  background: var(--bg-2); border: 1px solid var(--gold); border-radius: 999px;
  box-shadow: var(--shadow); font-family: var(--font-ui); max-width: calc(100vw - 20px);
}
.unit-play-bar .upb-label { color: var(--gold-2); font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.unit-play-bar .upb-prog { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.unit-play-bar .upb-stop {
  border: 0; background: var(--danger); color: #fff; padding: 6px 12px; border-radius: 999px;
  cursor: pointer; font-weight: 700; font-size: 0.85rem;
}

/* division markers in the ayah list & recite views (dark theme, outside mushaf-flow) */
.ayah-list .m-division,
.rc-list .m-division {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin: 20px 0 14px; direction: rtl;
}
.ayah-list .m-division::before, .ayah-list .m-division::after,
.rc-list .m-division::before, .rc-list .m-division::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
}
.ayah-list .m-rosette, .rc-list .m-rosette {
  font-family: var(--font-quran); color: var(--gold); font-size: 1.5rem; line-height: 1;
}
.ayah-list .m-div-label, .rc-list .m-div-label {
  white-space: nowrap; font-family: var(--font-ar); font-size: 1.05rem; color: var(--gold-2); font-weight: 700;
}
.ayah-list .m-division.juz .m-div-label, .rc-list .m-division.juz .m-div-label { color: var(--gold-2); }
.ayah-list .m-division.juz, .rc-list .m-division.juz {
  background: linear-gradient(135deg, rgba(227,182,79,0.16), rgba(16,35,27,0.6));
  border: 1px solid var(--gold); border-radius: var(--radius-sm); padding: 8px 14px;
}
.ayah-list .m-division.juz::before, .ayah-list .m-division.juz::after,
.rc-list .m-division.juz::before, .rc-list .m-division.juz::after { display: none; }

/* ============================================================
   Authentic Warsh Uthmani mushaf page (matches the printed Maghribi mushaf)
   ============================================================ */
/* larger, calligraphic, generously spaced — like the printed page */
.mushaf-flow.warsh-font {
  font-size: calc(var(--quran-size, 1.9rem) * 1.12);
  line-height: 2.85;
  color: #1c1a12;
}
.mushaf-flow.warsh-font .m-ayah:hover { background: rgba(201,169,74,0.16); }
/* the embedded ۞ rub'-al-hizb / thumn octagram, coloured like the mushaf marginalia */
.m-rub-mark {
  color: #b8860b;
  font-family: 'KFGQPC Warsh', var(--font-quran);
  font-size: 1.15em;
  padding: 0 0.05em;
}
.mushaf-flow.warsh-font .m-rub-mark { color: #a9791a; }
/* Warsh end-of-ayah number: ornate gold ring, Western digits (Maghribi convention) */
.mushaf-flow.warsh-font .m-end {
  color: #7a5310;
  background: radial-gradient(circle at 50% 45%, #fffbf0 55%, #f0e2bd 100%);
  box-shadow: 0 0 0 1.5px #be9a3c, 0 0 0 3px rgba(190,154,60,0.30), inset 0 0 3px rgba(190,154,60,0.5);
}
/* full-surah Warsh play button (🔊) reuses .play-btn styling */
.warsh-surah-btn { font-size: 0.95rem; }

.unit-menu-note {
  padding: 8px 10px 4px; font-size: 0.76rem; color: var(--muted); line-height: 1.4;
  border-top: 1px solid var(--stroke-soft); margin-top: 4px;
}

/* ============================================================
   Tasbih (مِسبحة) counter — in the Learn (تعلّم الدين) section
   ============================================================ */
.tasbih-wrap { max-width: 480px; margin: 0 auto; text-align: center; padding-bottom: 96px; }
.tasbih-current {
  font-family: var(--font-ar); font-size: clamp(1.6rem, 6vw, 2.2rem); color: var(--gold-2);
  line-height: 1.8; margin: 6px 0 2px; direction: rtl;
}
.tasbih-tr { color: var(--muted); font-size: 0.9rem; margin-bottom: 18px; }
.tasbih-counter {
  width: min(240px, 68vw); height: min(240px, 68vw); border-radius: 50%;
  margin: 4px auto 10px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(circle at 50% 38%, rgba(47,184,134,0.28), rgba(16,35,27,0.9) 70%);
  border: 2px solid var(--gold);
  box-shadow: 0 10px 34px rgba(0,0,0,0.4), inset 0 0 40px rgba(47,184,134,0.12);
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.tasbih-counter:active {
  transform: scale(0.96);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4), inset 0 0 60px rgba(227,182,79,0.22);
}
.tasbih-num { font-size: clamp(2.8rem, 12vw, 4rem); font-weight: 900; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.tasbih-target { font-size: 1.1rem; font-weight: 700; color: var(--muted); }
.tasbih-hint { font-size: 0.8rem; color: var(--gold-2); opacity: 0.8; }
.tasbih-meta { display: flex; gap: 22px; justify-content: center; color: var(--muted); font-size: 0.95rem; margin: 4px 0 14px; }
.tasbih-meta b { color: var(--gold-2); font-variant-numeric: tabular-nums; }
.tasbih-ctrl { display: flex; gap: 12px; justify-content: center; }
.tasbih-ctrl .btn { min-width: 84px; }
