/* مصحف التبيان المفصل لمتشابهات القرآن — موقع تفاعلي */
:root,
html[data-theme="dark"] {
  /* Slightly lifted dark palette — same hierarchy, less heavy black */
  --bg: #171d26;
  --bg-soft: #222b38;
  --bg-card: #273242;
  --bg-elevated: #2f3c4f;
  --gold: #d0ab35;
  --gold-light: #ebcb55;
  --gold-dim: rgba(208, 171, 53, 0.16);
  --maroon: #7a2836;
  --maroon-soft: #9a3a4a;
  --cream: #f7f2e9;
  --text: #eeeae2;
  --text-muted: #a8b0be;
  --border: rgba(208, 171, 53, 0.28);
  --accent: #357a5c;
  --danger: #cc6430;
  --blue: #265a96;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  --header-bg: rgba(23, 29, 38, 0.94);
  --body-glow-1: rgba(122, 40, 54, 0.2);
  --body-glow-2: rgba(208, 171, 53, 0.1);
  --font-ar: "Amiri", "Scheherazade New", "Traditional Arabic", "Noto Naskh Arabic", serif;
  /* Hafs Uthmani display — Amiri Quran is designed for Hafs orthography */
  --font-quran: "Amiri Quran", "Amiri", "Scheherazade New", "Noto Naskh Arabic", "Traditional Arabic", serif;
  --font-ui: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --mushaf-font-size: 28px;
  --mushaf-paper: #f3e9d2;
  --mushaf-ink: #1c1610;
  --mushaf-border: #8a7349;
  --mushaf-border-inner: #c4a35a;
  --mushaf-header: #0f3d32;
  --mushaf-header-edge: #1a5c4a;
  /* Contrast tokens — icons / labels on dark or tinted surfaces */
  --on-dark: #f7e7a8;
  --on-gradient: #fffef8;
  --float-bar-bg: rgba(30, 40, 54, 0.95);
  --float-bar-border: rgba(201, 162, 39, 0.28);
  --float-bar-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
  --focus-exit-bg: rgba(30, 40, 54, 0.92);
  --focus-exit-bg-hover: rgba(45, 55, 70, 0.96);
  --scope-same-fg: #7dcea0;
  --scope-same-bg: linear-gradient(145deg, rgba(45, 106, 79, 0.35), rgba(45, 106, 79, 0.15));
  --scope-cross-fg: #7eb6e8;
  --scope-cross-bg: linear-gradient(145deg, rgba(29, 78, 137, 0.4), rgba(29, 78, 137, 0.15));
  --scope-same-active-bg: linear-gradient(145deg, #2d6a4f, #1b4332);
  --scope-cross-active-bg: linear-gradient(145deg, #1d4e89, #123a66);
  --scope-active-fg: #f1faf4;
  --tag-same-fg: #9fe0b8;
  --tag-same-bg: rgba(45, 106, 79, 0.25);
  --tag-same-border: rgba(45, 106, 79, 0.45);
  --tag-cross-fg: #9ec9f0;
  --tag-cross-bg: rgba(29, 78, 137, 0.28);
  --tag-cross-border: rgba(29, 78, 137, 0.5);
  --diff-fg: #ffb4a2;
  --diff-bg: rgba(196, 92, 38, 0.35);
  --same-fg: #95d5b2;
  --same-bg: rgba(45, 106, 79, 0.25);
  --rev-makkah: #d4b86a;
  --rev-madinah: #7dcea0;
  --badge-ready: #7dcea0;
  color-scheme: dark;
}

/* Light mode */
html[data-theme="light"] {
  --bg: #f6f1e6;
  --bg-soft: #efe6d4;
  --bg-card: #fffdf8;
  --bg-elevated: #f3ead8;
  --gold: #a8841a;
  --gold-light: #8a6d12;
  --gold-dim: rgba(168, 132, 26, 0.14);
  --maroon: #7a2432;
  --maroon-soft: #9a3545;
  --cream: #3d3428;
  --text: #1e1a14;
  --text-muted: #5c554a;
  --border: rgba(138, 109, 30, 0.28);
  --accent: #1f5c44;
  --danger: #b04a1c;
  --blue: #1a4578;
  --shadow: 0 8px 28px rgba(60, 45, 20, 0.12);
  --header-bg: rgba(255, 253, 248, 0.92);
  --body-glow-1: rgba(168, 132, 26, 0.12);
  --body-glow-2: rgba(122, 36, 50, 0.06);
  /* Stronger icon/label contrast on light surfaces */
  --on-dark: #fff8e7;
  --on-gradient: #fffef8;
  --float-bar-bg: rgba(255, 253, 248, 0.96);
  --float-bar-border: rgba(138, 109, 30, 0.35);
  --float-bar-shadow: 0 6px 18px rgba(60, 45, 20, 0.14);
  --focus-exit-bg: rgba(255, 253, 248, 0.96);
  --focus-exit-bg-hover: #fffdf8;
  --scope-same-fg: #145a3a;
  --scope-same-bg: linear-gradient(145deg, rgba(45, 106, 79, 0.22), rgba(45, 106, 79, 0.1));
  --scope-cross-fg: #0f3d6e;
  --scope-cross-bg: linear-gradient(145deg, rgba(29, 78, 137, 0.2), rgba(29, 78, 137, 0.08));
  --scope-same-active-bg: linear-gradient(145deg, #2d6a4f, #1b4332);
  --scope-cross-active-bg: linear-gradient(145deg, #1d4e89, #123a66);
  --scope-active-fg: #f8fffb;
  --tag-same-fg: #145a3a;
  --tag-same-bg: rgba(45, 106, 79, 0.14);
  --tag-same-border: rgba(45, 106, 79, 0.4);
  --tag-cross-fg: #0f3d6e;
  --tag-cross-bg: rgba(29, 78, 137, 0.12);
  --tag-cross-border: rgba(29, 78, 137, 0.4);
  --diff-fg: #9a3412;
  --diff-bg: rgba(196, 92, 38, 0.18);
  --same-fg: #166534;
  --same-bg: rgba(45, 106, 79, 0.14);
  --rev-makkah: #8a6d12;
  --rev-madinah: #1f5c44;
  --badge-ready: #1f5c44;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  direction: rtl;
  background-image:
    radial-gradient(ellipse at 20% 0%, var(--body-glow-1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, var(--body-glow-2) 0%, transparent 45%);
  transition: background-color 0.25s ease, color 0.2s ease;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

/* Light / Dark theme toggle */
.theme-toggle {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--gold-light);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, color 0.2s;
  position: relative;
}

.theme-toggle:hover {
  background: var(--bg-elevated);
  border-color: var(--gold);
  color: var(--gold);
}

.theme-toggle:active {
  transform: scale(0.94);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.theme-icon {
  display: none;
  position: absolute;
}

/* Dark mode → show sun (switch to light) */
html[data-theme="dark"] .theme-icon-sun,
html:not([data-theme]) .theme-icon-sun {
  display: block;
}

/* Light mode → show moon (switch to dark) */
html[data-theme="light"] .theme-icon-moon {
  display: block;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--maroon), var(--gold));
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  box-shadow: 0 0 0 2px var(--gold-dim);
  color: var(--on-gradient);
  font-weight: 800;
}

.brand-text h1 {
  font-family: var(--font-ar);
  font-size: 1.15rem;
  color: var(--gold-light);
  font-weight: 700;
  line-height: 1.3;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-tabs button {
  font-family: var(--font-ui);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: 0.2s;
}

.nav-tabs button:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.nav-tabs button.active {
  color: var(--on-gradient);
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  font-weight: 700;
  border-color: transparent;
}

/* Main */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

.view { display: none; animation: fadeIn 0.35s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ========== Home landing (الرئيسية) ========== */
.home-landing {
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

.home-hero {
  position: relative;
  text-align: center;
  padding: 2.25rem 1.25rem 2rem;
  margin-bottom: 0.5rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.home-hero-glow {
  position: absolute;
  inset: -40% -20% auto;
  height: 80%;
  background:
    radial-gradient(ellipse at 30% 0%, var(--body-glow-1), transparent 55%),
    radial-gradient(ellipse at 70% 20%, var(--gold-dim), transparent 50%);
  pointer-events: none;
}

.home-hero-ornament {
  position: relative;
  font-size: 1.5rem;
  color: var(--gold);
  letter-spacing: 0.45rem;
  margin-bottom: 0.5rem;
}

.home-kicker {
  position: relative;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.home-title {
  position: relative;
  font-family: var(--font-ar);
  font-size: clamp(1.85rem, 4.5vw, 2.65rem);
  color: var(--gold-light);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.home-lead {
  position: relative;
  color: var(--text-muted);
  max-width: 40rem;
  margin: 0 auto 1.35rem;
  font-size: 1.02rem;
  line-height: 1.85;
}

.home-lead strong {
  color: var(--text);
  font-weight: 700;
}

.home-hero-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.home-stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.55rem;
  max-width: 720px;
  margin: 0 auto;
}

.home-stat {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.5rem;
  text-align: center;
}

.home-stat-num {
  display: block;
  font-family: var(--font-ar);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--gold-light);
  line-height: 1.2;
}

.home-stat-label {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.home-section-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: -0.5rem 0 1rem;
}

/* Full feature hub */
.home-hub {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-bottom: 0.5rem;
}

@media (min-width: 720px) {
  .home-hub {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1000px) {
  .home-hub {
    grid-template-columns: 1fr 1fr;
  }

  .home-hub-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    max-width: 50%;
    justify-self: center;
    width: 100%;
  }
}

.home-hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.3rem;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: var(--shadow);
  text-align: right;
}

.home-hub-card:hover,
.home-hub-card:focus-visible {
  border-color: var(--gold);
  transform: translateY(-3px);
  background: var(--bg-elevated);
  outline: none;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.home-hub-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  background: var(--gold-dim);
  border: 1px solid var(--border);
  color: var(--gold-light);
}

.home-hub-body h3 {
  font-family: var(--font-ar);
  font-size: 1.3rem;
  color: var(--gold-light);
  margin-bottom: 0.4rem;
}

.home-hub-body > p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 0.65rem;
}

.home-hub-features {
  margin: 0;
  padding: 0 1.1rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.65;
}

.home-hub-features li {
  margin-bottom: 0.2rem;
}

.home-hub-cta {
  margin-top: auto;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gold);
}

/* Steps */
.home-steps {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  margin-bottom: 0.5rem;
}

@media (min-width: 700px) {
  .home-steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.home-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  text-align: center;
}

.home-step-num {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.55rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--on-gradient);
  font-weight: 800;
  font-size: 0.9rem;
}

.home-step strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.35rem;
  font-size: 0.98rem;
}

.home-step p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.home-more-row {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0 0.5rem;
}

.home-tips {
  margin-top: 2rem;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--gold-dim), transparent);
}

.home-tips-title {
  font-family: var(--font-ar);
  color: var(--gold-light);
  font-size: 1.15rem;
  margin-bottom: 0.55rem;
}

.home-tips ul {
  margin: 0;
  padding: 0 1.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.8;
}

.home-tips code {
  font-size: 0.82em;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Legacy hero (keep for any residual use) */
.hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  margin-bottom: 2rem;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--gold-dim), transparent);
  border-radius: var(--radius);
  pointer-events: none;
}

.hero-ornament {
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
  letter-spacing: 0.5rem;
}

.hero h2 {
  font-family: var(--font-ar);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: var(--gold-light);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

/* Cards */
.section-title {
  font-family: var(--font-ar);
  font-size: 1.4rem;
  color: var(--gold);
  margin: 2rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  transition: 0.2s;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  background: var(--bg-elevated);
}

.card h3 {
  font-family: var(--font-ar);
  font-size: 1.15rem;
  color: var(--cream);
  margin-bottom: 0.4rem;
}

.card p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.card .tag-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--gold-dim);
  color: var(--gold-light);
  border: 1px solid var(--border);
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 0.35rem;
  vertical-align: middle;
}

/* Search */
/* Mutashabihat scope icons: same-surah / cross-surah */
.muta-scope-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.muta-scope-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 280px;
  text-align: right;
  font-family: var(--font-ui);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.65rem 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: 0.18s ease;
  box-shadow: var(--shadow);
}

.muta-scope-btn:hover {
  border-color: var(--gold);
  background: var(--bg-elevated);
}

.muta-scope-btn.active {
  border-color: var(--gold);
  background: var(--gold-dim);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.25), var(--shadow);
}

.muta-scope-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--gold-light);
  flex-shrink: 0;
}

.muta-scope-icon.same {
  background: var(--scope-same-bg);
  color: var(--scope-same-fg);
}

.muta-scope-icon.cross {
  background: var(--scope-cross-bg);
  color: var(--scope-cross-fg);
}

.muta-scope-btn.active .muta-scope-icon.same {
  background: var(--scope-same-active-bg);
  color: var(--scope-active-fg);
}

.muta-scope-btn.active .muta-scope-icon.cross {
  background: var(--scope-cross-active-bg);
  color: var(--scope-active-fg);
}

.muta-scope-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.muta-scope-text strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cream);
}

.muta-scope-btn.active .muta-scope-text strong {
  color: var(--gold-light);
}

.muta-scope-text small {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.muta-scope-count {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 0.85rem;
}

/* Mutashabihat page numbers */
.muta-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.55rem;
  margin: 1.35rem 0 0.35rem;
  padding: 0.85rem 0.5rem;
}

.muta-page-numbers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.muta-page-btn {
  min-width: 2.35rem;
  height: 2.35rem;
  padding: 0 0.45rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
  line-height: 1;
}

.muta-page-btn:hover:not(:disabled):not(.active) {
  background: var(--bg-elevated);
  border-color: var(--gold);
  color: var(--gold-light);
}

.muta-page-btn.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--on-gradient);
  border-color: transparent;
  font-weight: 800;
  cursor: default;
}

.muta-page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.muta-page-nav {
  font-size: 1.25rem;
  font-weight: 700;
  min-width: 2.5rem;
}

.muta-page-ellipsis {
  min-width: 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  user-select: none;
}

.muta-page-meta {
  width: 100%;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.muta-scope-detail {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: -0.25rem 0 0.85rem;
  line-height: 1.55;
}

.tag.muta-scope-tag.same {
  background: var(--tag-same-bg);
  color: var(--tag-same-fg);
  border: 1px solid var(--tag-same-border);
}

.tag.muta-scope-tag.cross {
  background: var(--tag-cross-bg);
  color: var(--tag-cross-fg);
  border: 1px solid var(--tag-cross-border);
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-bar input,
.search-bar select {
  flex: 1;
  min-width: 180px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  outline: none;
}

.search-bar input:focus,
.search-bar select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

/* Detail panel */
.detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
  box-shadow: var(--shadow);
}

.detail-panel h2 {
  font-family: var(--font-ar);
  color: var(--gold-light);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.tip-box {
  background: var(--gold-dim);
  border-right: 3px solid var(--gold);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  color: var(--cream);
  font-size: 0.95rem;
}

.ayah-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.ayah-card {
  background: var(--bg-soft);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  border-right: 4px solid var(--gold);
  transition: 0.2s;
}

.ayah-card:hover {
  background: var(--bg-elevated);
}

.ayah-card .ref {
  font-size: 0.8rem;
  color: var(--gold);
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ayah-card .text {
  font-family: var(--font-ar);
  font-size: 1.35rem;
  line-height: 2;
  color: var(--cream);
}

.ayah-card .note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.ayah-card mark,
.ayah-text mark {
  background: rgba(201, 162, 39, 0.35);
  color: var(--gold-light);
  padding: 0 0.15em;
  border-radius: 3px;
}

/* Rules */
.rule-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0.85rem;
  transition: 0.2s;
}

.rule-card:hover { border-color: var(--gold); }

.rule-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  cursor: pointer;
}

.rule-num {
  min-width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--maroon), var(--gold));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--on-gradient);
  flex-shrink: 0;
}

.rule-header h3 {
  font-family: var(--font-ar);
  font-size: 1.15rem;
  color: var(--gold-light);
}

.rule-header .short {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.rule-body {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.rule-card.open .rule-body { display: block; }

.rule-body p {
  margin-bottom: 0.75rem;
  color: var(--text);
}

.rule-body .example {
  background: var(--bg-soft);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Quran browser — Madinah Mushaf */
.quran-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.quran-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Dedicated Surah Index icon button */
.surah-index-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold-light);
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem 0.4rem 0.55rem;
  cursor: pointer;
  transition: 0.18s ease;
  box-shadow: var(--shadow);
}

.surah-index-icon-btn:hover,
.surah-index-icon-btn[aria-expanded="true"] {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: var(--gold-light);
}

.surah-index-icon {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--maroon-soft), var(--maroon));
  color: var(--on-dark);
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.surah-index-icon svg {
  display: block;
}

.surah-index-label {
  white-space: nowrap;
}

.mushaf-font-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.45rem;
  box-shadow: var(--shadow);
}

.mushaf-font-btn {
  font-family: var(--font-ar);
  font-size: 1.05rem;
  font-weight: 700;
  min-width: 2.4rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--gold-light);
  cursor: pointer;
  transition: 0.15s;
  line-height: 1;
}

.mushaf-font-btn:hover:not(:disabled) {
  background: var(--gold-dim);
  border-color: var(--gold);
}

.mushaf-font-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mushaf-font-value {
  min-width: 2.25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: var(--cream);
  font-weight: 600;
}

/* Keep screen awake (Wake Lock) — small icon-only control */
.mushaf-wake-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.45rem;
  height: 2.45rem;
  padding: 0;
  gap: 0;
  font-family: var(--font-ui);
  font-size: 0;
  color: var(--gold-light);
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: 0.18s ease;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.mushaf-wake-btn .mushaf-wake-label {
  display: none !important;
}

.mushaf-wake-btn:hover {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: var(--gold-light);
}

.mushaf-wake-btn[aria-pressed="true"],
.mushaf-wake-btn.is-enabled {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: var(--gold-light);
  box-shadow: 0 0 0 1px rgba(208, 171, 53, 0.25), var(--shadow);
}

.mushaf-wake-btn[aria-pressed="true"] svg,
.mushaf-wake-btn.is-active svg {
  color: #7dcea0;
}

.mushaf-wake-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mushaf-wake-btn svg {
  display: block;
  flex-shrink: 0;
  width: 1.2rem;
  height: 1.2rem;
}

/* Fullscreen / focus mode — ayahs only */
.mushaf-focus-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gold-light);
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.42rem 0.85rem 0.42rem 0.55rem;
  cursor: pointer;
  transition: 0.18s ease;
  box-shadow: var(--shadow);
}

.mushaf-focus-btn:hover,
.mushaf-focus-btn[aria-pressed="true"] {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: var(--gold-light);
}

.mushaf-focus-btn svg {
  display: block;
  flex-shrink: 0;
}

/* True fullscreen shell — edge-to-edge, no browser chrome / empty gutters */
html:fullscreen,
html:-webkit-full-screen,
html:-ms-fullscreen {
  width: 100%;
  height: 100%;
  background: var(--mushaf-paper);
}

html:fullscreen body,
html:-webkit-full-screen body,
html:-ms-fullscreen body,
body.mushaf-focus-mode {
  overflow: auto;
  margin: 0 !important;
  padding: 0 !important;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--mushaf-paper);
}

/* Hide chrome; keep ayahs + floating font / scroll-top / exit */
body.mushaf-focus-mode .site-header,
body.mushaf-focus-mode .site-footer,
body.mushaf-focus-mode .quran-section-head,
body.mushaf-focus-mode .surah-index-panel,
body.mushaf-focus-mode .surah-index-backdrop {
  display: none !important;
}

body.mushaf-focus-mode main {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  min-height: 100dvh;
}

body.mushaf-focus-mode .view:not([data-view="quran"]) {
  display: none !important;
}

body.mushaf-focus-mode .view[data-view="quran"] {
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100%;
  min-height: 100dvh;
}

body.mushaf-focus-mode .quran-layout {
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
  width: 100% !important;
  min-height: 100dvh;
}

body.mushaf-focus-mode .ayahs-panel {
  min-height: 100dvh;
  width: 100%;
  margin: 0;
  padding: 0;
}

body.mushaf-focus-mode .mushaf-page {
  max-width: none !important;
  width: 100% !important;
  min-height: 100dvh;
  margin: 0 !important;
  border-radius: 0;
  border-left: none;
  border-right: none;
  box-shadow: none;
}

body.mushaf-focus-mode .mushaf-page.mushaf-page-full {
  padding-inline: clamp(0.65rem, 2.5vw, 1.75rem);
  padding-block: 0.5rem 3.5rem;
  box-sizing: border-box;
}

body.mushaf-focus-mode .mushaf-text {
  max-width: none;
  width: 100%;
}

/* Minimal top inset — exit control is transparent over the text */
body.mushaf-focus-mode .mushaf-page-full > .mushaf-ornament.top {
  margin-top: 0.35rem;
}

/* Exit fullscreen — transparent so it does not cover the top mushaf text */
.mushaf-focus-exit {
  position: fixed;
  z-index: 170;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(92, 72, 24, 0.55);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  box-shadow: none;
  backdrop-filter: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.mushaf-focus-exit[hidden] {
  display: none !important;
}

.mushaf-focus-exit:hover,
.mushaf-focus-exit:focus-visible {
  color: rgba(92, 72, 24, 0.95);
  background: rgba(243, 233, 210, 0.35);
  border-color: rgba(138, 115, 73, 0.35);
  outline: none;
}

.mushaf-focus-exit svg {
  display: block;
  opacity: 0.7;
}

.mushaf-focus-exit:hover svg,
.mushaf-focus-exit:focus-visible svg {
  opacity: 1;
}

@media (max-width: 600px) {
  .mushaf-focus-label {
    display: none;
  }

  .mushaf-focus-btn {
    padding: 0.45rem;
    border-radius: 50%;
    width: 2.55rem;
    height: 2.55rem;
    justify-content: center;
  }
}

/* Compact floating font controls (only − size + · while scrolled down) */
.float-font-pop {
  position: fixed;
  z-index: 160;
  left: 1rem;
  bottom: 4.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.22rem 0.28rem;
  border-radius: 999px;
  background: var(--float-bar-bg);
  border: 1px solid var(--float-bar-border);
  box-shadow: var(--float-bar-shadow), 0 0 0 1px var(--gold-dim);
  backdrop-filter: blur(10px);
  touch-action: none;
  user-select: none;
  cursor: grab;
  transition: opacity 0.2s, box-shadow 0.15s, background 0.2s, border-color 0.2s;
  color: var(--text);
}

.float-font-pop[hidden] {
  display: none !important;
}

.float-font-pop.is-dragging {
  opacity: 0.94;
  cursor: grabbing;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.48);
}

.float-font-pop .float-font-btn {
  min-width: 1.55rem;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--gold-light);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.float-font-pop .float-font-btn:hover:not(:disabled) {
  background: var(--gold-dim);
  border-color: var(--gold);
}

.float-font-pop .float-font-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.float-font-pop .float-font-label {
  min-width: 1.35rem;
  padding: 0 0.1rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  cursor: grab;
}

.float-font-dismiss {
  width: 1.15rem;
  height: 1.15rem;
  margin-inline-start: 0.08rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  flex-shrink: 0;
  opacity: 0.75;
}

.float-font-dismiss:hover {
  color: var(--gold-light);
  opacity: 1;
  background: var(--bg-elevated);
}

/* Scroll to top — circular button */
.scroll-top-btn {
  position: fixed;
  z-index: 160;
  left: 1rem;
  bottom: 1.15rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, var(--maroon-soft), var(--maroon));
  color: var(--on-dark);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
}

.scroll-top-btn[hidden] {
  display: none !important;
}

.scroll-top-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  border-color: var(--gold);
}

.scroll-top-btn:active {
  transform: translateY(0);
}

.scroll-top-btn svg {
  display: block;
}

@media (max-width: 600px) {
  .float-font-pop {
    left: 0.75rem;
    bottom: 4.35rem;
  }

  .scroll-top-btn {
    left: 0.75rem;
    bottom: 0.9rem;
    width: 2.75rem;
    height: 2.75rem;
  }
}

.quran-layout {
  display: block;
  position: relative;
}

/* Backdrop when Surah Index is open */
.surah-index-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(8, 10, 14, 0.55);
  backdrop-filter: blur(2px);
}

.surah-index-backdrop[hidden] {
  display: none !important;
}

/* Surah Index panel (opens from icon) */
.surah-list.surah-index-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 130;
  width: min(320px, 92vw);
  max-height: none;
  margin: 0;
  border-radius: 0;
  border: none;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(0);
  animation: surah-panel-in 0.22s ease;
}

.surah-list.surah-index-panel[hidden] {
  display: none !important;
}

@keyframes surah-panel-in {
  from {
    transform: translateX(100%);
    opacity: 0.6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.surah-index-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-card));
  flex-shrink: 0;
}

.surah-index-header h3 {
  margin: 0;
  font-family: var(--font-ar);
  font-size: 1.2rem;
  color: var(--gold-light);
}

.surah-index-close {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: 0.15s;
}

.surah-index-close:hover {
  border-color: var(--gold);
  color: var(--gold-light);
  background: var(--gold-dim);
}

.surah-list input {
  width: calc(100% - 1rem);
  margin: 0.65rem 0.5rem 0.35rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-family: var(--font-ui);
  outline: none;
  flex-shrink: 0;
}

.surah-list input:focus {
  border-color: var(--gold);
}

.surah-list-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0.5rem 0.75rem;
}

.surah-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.15s;
  border: 1px solid transparent;
}

.surah-item:hover,
.surah-item.active {
  background: var(--bg-elevated);
  border-color: var(--border);
}

.surah-item.active {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.surah-num {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  color: var(--gold);
  flex-shrink: 0;
}

.surah-item .name {
  font-family: var(--font-ar);
  font-size: 1.05rem;
  flex: 1;
}

.surah-item .count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ayahs-panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  min-height: 400px;
  height: auto;
  max-height: none;
  overflow: visible;
}

/* —— Madinah page frame (full surah on one continuous page) —— */
.mushaf-page {
  --mushaf-font-size: 28px;
  position: relative;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.35), transparent 55%),
    linear-gradient(180deg, #f7efdc 0%, var(--mushaf-paper) 40%, #efe3c8 100%);
  color: var(--mushaf-ink);
  border: 3px solid var(--mushaf-border);
  border-radius: 6px;
  padding: 1.35rem 1.5rem 1.6rem;
  box-shadow:
    inset 0 0 0 2px var(--mushaf-border-inner),
    inset 0 0 0 7px var(--mushaf-paper),
    inset 0 0 0 9px rgba(138, 115, 73, 0.55),
    0 12px 40px rgba(0, 0, 0, 0.35);
  min-height: 420px;
  height: auto;
  max-height: none;
  overflow: visible;
}

.mushaf-page-full {
  /* Entire surah scrolls with the document — no internal paging */
  display: block;
}

.mushaf-ornament {
  height: 10px;
  margin: 0 auto 0.85rem;
  max-width: 70%;
  background:
    linear-gradient(90deg, transparent, var(--mushaf-border-inner) 15%, var(--mushaf-border) 50%, var(--mushaf-border-inner) 85%, transparent);
  opacity: 0.75;
  border-radius: 999px;
}

.mushaf-ornament.bottom {
  margin: 1.1rem auto 0;
}

.mushaf-surah-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(180deg, var(--mushaf-header-edge), var(--mushaf-header));
  color: #f0d78c;
  border: 2px solid var(--mushaf-border-inner);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  margin-bottom: 1.15rem;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mushaf-header-side {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  opacity: 0.9;
  min-width: 2.5rem;
  text-align: center;
  border: 1px solid rgba(240, 215, 140, 0.35);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.mushaf-header-main {
  text-align: center;
}

.mushaf-surah-name {
  font-family: var(--font-ar);
  font-size: 1.55rem;
  font-weight: 700;
  color: #f7e7a8;
  margin: 0;
  line-height: 1.3;
}

.mushaf-surah-meta {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: rgba(247, 231, 168, 0.8);
  margin: 0.1rem 0 0;
}

.mushaf-bismillah {
  font-family: var(--font-quran);
  text-align: center;
  color: #3a2a12;
  font-size: calc(var(--mushaf-font-size) * 1.05);
  line-height: 2;
  margin: 0.25rem 0 1.15rem;
  letter-spacing: 0.01em;
}

.mushaf-text {
  font-family: var(--font-quran);
  font-size: var(--mushaf-font-size);
  line-height: 2.55;
  text-align: justify;
  text-align-last: center;
  direction: rtl;
  color: var(--mushaf-ink);
  word-spacing: 0.04em;
  height: auto;
  max-height: none;
  overflow: visible;
  white-space: normal;
}

.mushaf-text-full {
  /* Continuous single-page flow for the whole surah */
  display: block;
  width: 100%;
}

.muta-badge-more {
  background: transparent !important;
  color: #6b5a38 !important;
  border: 1px dashed rgba(138, 115, 73, 0.55) !important;
  cursor: default;
}

.mushaf-ayah {
  display: inline;
}

/* Whole ayah stays clickable; gold mark is only on similar words (.mushaf-hl) */
.mushaf-ayah.has-mutashabih {
  cursor: pointer;
}

.mushaf-ayah.has-mutashabih:hover .mushaf-hl {
  background: rgba(201, 162, 39, 0.38);
  box-shadow: inset 0 -2px 0 rgba(139, 105, 20, 0.55);
}

/* Highlight only the mutashabih phrase / words inside the ayah */
.mushaf-hl {
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.28), rgba(201, 162, 39, 0.14));
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  box-shadow: inset 0 -2px 0 rgba(139, 105, 20, 0.4);
  padding: 0 0.05em;
  color: inherit;
}

.ayah-end {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55em;
  height: 1.55em;
  margin: 0 0.12em 0 0.18em;
  border: 1.5px solid #8b6914;
  border-radius: 50%;
  font-family: var(--font-ui);
  font-size: 0.48em;
  font-weight: 700;
  color: #5c4818;
  background:
    radial-gradient(circle at 40% 35%, #fff8e7, #f0e0b0 55%, #e2c878);
  vertical-align: middle;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  user-select: none;
}

.mushaf-muta-bar {
  margin-top: 1.25rem;
  padding-top: 0.9rem;
  border-top: 1px dashed rgba(138, 115, 73, 0.45);
}

.mushaf-muta-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: #6b5a38;
  margin-bottom: 0.45rem;
  font-weight: 600;
}

.mushaf-muta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.muta-badge {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  background: var(--maroon);
  color: var(--on-dark);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-block;
  border: none;
  cursor: pointer;
  transition: 0.15s;
}

.muta-badge:hover {
  filter: brightness(1.1);
}

.ayahs-panel .empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 3rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Legacy ayah helpers still used in mutashabihat cards */
.ayah-text {
  font-family: var(--font-ar);
  font-size: 1.4rem;
  line-height: 2.1;
}

.ayah-num-badge {
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  color: var(--gold);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .mushaf-page {
    padding: 1rem 0.85rem 1.15rem;
  }

  .mushaf-surah-header {
    grid-template-columns: 1fr;
    border-radius: 16px;
    text-align: center;
  }

  .mushaf-header-side {
    display: none;
  }
}

/* Compare */
.compare-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 700px) {
  .compare-box { grid-template-columns: 1fr; }
}

.compare-side {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

.compare-side h4 {
  color: var(--gold);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Prophets */
.prophet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.prophet-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
}

.prophet-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.prophet-card .icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.prophet-card h3 {
  font-family: var(--font-ar);
  color: var(--gold-light);
  margin-bottom: 0.4rem;
}

.prophet-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  font-family: var(--font-ui);
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.25rem;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #1a1508; /* dark ink on gold — readable in both themes */
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.btn-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  justify-content: center;
}

/* About */
.about-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.about-block h3 {
  font-family: var(--font-ar);
  color: var(--gold);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.about-block p, .about-block li {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.about-block ul {
  padding-right: 1.25rem;
}

.about-block li { margin-bottom: 0.35rem; }

/* ========== تدبّر السور · فهرس + وحدة موضوعية ========== */
.fatihah-page {
  max-width: 860px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

/* When showing the full 114-card index, allow a wider layout */
.fatihah-page:has(.fth-index) {
  max-width: 1100px;
}

/* ----- فهرس ١١٤ سورة (بطاقات) ----- */
.fth-index-hero {
  text-align: center;
  padding: 1.25rem 0.5rem 1.5rem;
}

.fth-index-tools {
  margin-top: 1.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.fth-index-search-wrap {
  width: min(100%, 22rem);
}

.fth-index-search {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  text-align: center;
}

.fth-index-search:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.fth-index-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.fth-index-filter {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s;
}

.fth-index-filter:hover {
  border-color: var(--gold);
  color: var(--text);
}

.fth-index-filter.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold-light);
}

.fth-index-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0;
}

.fth-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.75rem;
  padding: 0.25rem 0 1.5rem;
}

.fth-index-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

.fth-surah-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 0.95rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  text-align: right;
  min-height: 9.5rem;
}

.fth-surah-card:hover,
.fth-surah-card:focus-visible {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--gold) 40%, transparent);
  outline: none;
}

.fth-surah-card.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.fth-surah-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.fth-surah-card-num {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--gold-dim);
  color: var(--gold-light);
  border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
}

.fth-surah-card-rev {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.fth-surah-card-rev.rev-makkah {
  background: color-mix(in srgb, #1d6a8a 18%, var(--bg-soft));
  color: var(--text);
}

.fth-surah-card-rev.rev-madinah {
  background: color-mix(in srgb, #2d6a4f 18%, var(--bg-soft));
  color: var(--text);
}

.fth-surah-card-name {
  font-family: var(--font-ar);
  font-size: 1.15rem;
  color: var(--gold-light);
  margin: 0.15rem 0 0;
  line-height: 1.35;
}

html[data-theme="light"] .fth-surah-card-name {
  color: var(--text);
}

.fth-surah-card-theme {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fth-surah-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.fth-surah-card-cta {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-top: 0.15rem;
}

/* Detail top bar (back + prev/next) */
.fth-detail-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  padding: 0.35rem 0;
}

.fth-detail-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.fth-detail-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.fth-back-btn {
  font-weight: 700;
}

.fth-sections-wrap {
  margin: 1.5rem 0 1.25rem;
}

.fth-sections-wrap > .fth-block-title {
  margin-bottom: 1rem;
}

.fth-connections {
  margin: 1.25rem 0 1.5rem;
}

.fth-connections > .fth-block-title {
  margin-bottom: 0.85rem;
}

.fth-mem-prompt {
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
}

.fth-mem-prompt-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.75;
  font-style: italic;
}

@media (max-width: 560px) {
  .fth-index-grid {
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  }
  .fth-detail-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .fth-detail-nav {
    justify-content: space-between;
  }
}

.fth-hero {
  text-align: center;
  padding: 1.5rem 0.5rem 1.75rem;
}

.fth-hero-ornament {
  color: var(--gold);
  letter-spacing: 0.35em;
  margin-bottom: 0.5rem;
  opacity: 0.85;
}

.fth-kicker {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.fth-title {
  font-family: var(--font-ar);
  font-size: 2rem;
  color: var(--gold-light);
  font-weight: 700;
  line-height: 1.3;
}

.fth-subtitle {
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-size: 0.95rem;
}

.fth-names {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
}

.fth-name-tag {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--gold-dim);
  color: var(--gold-light);
}

.fth-central {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.fth-central h3 {
  font-family: var(--font-ar);
  color: var(--gold-light);
  font-size: 1.25rem;
  margin-bottom: 0.65rem;
}

.fth-central-short {
  font-weight: 700;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-right: 3px solid var(--gold);
  background: var(--gold-dim);
  border-radius: 0 8px 8px 0;
}

.fth-central-long {
  color: var(--text-muted);
  line-height: 1.85;
  font-size: 0.95rem;
}

.fth-unity {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.5rem;
}

.fth-block-title {
  font-family: var(--font-ar);
  color: var(--gold-light);
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.fth-unity > p {
  color: var(--text-muted);
  line-height: 1.85;
  margin-bottom: 1.15rem;
}

.fth-path-diagram {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.65rem;
}

.fth-path-step {
  min-width: 6.5rem;
  text-align: center;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--fth-c) 18%, var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--fth-c) 45%, transparent);
  color: var(--text);
}

.fth-path-num {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  margin: 0 auto 0.35rem;
  border-radius: 50%;
  background: var(--fth-c);
  color: var(--on-gradient);
  font-size: 0.8rem;
  font-weight: 800;
}

.fth-path-step strong {
  display: block;
  font-size: 0.95rem;
}

.fth-path-step small {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.fth-path-join {
  color: var(--gold);
  font-size: 1.25rem;
  font-weight: 700;
}

.fth-sections-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.fth-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.3rem;
  border-right: 4px solid var(--fth-c);
  box-shadow: var(--shadow);
}

.fth-section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.fth-section-order {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--fth-c);
  color: var(--on-gradient);
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 1rem;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fth-c) 25%, transparent);
}

.fth-section-titles h3 {
  font-family: var(--font-ar);
  font-size: 1.25rem;
  color: var(--cream);
  margin-bottom: 0.4rem;
}

html[data-theme="light"] .fth-section-titles h3 {
  color: var(--text);
}

.fth-section-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.fth-chip {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.fth-chip-range {
  background: color-mix(in srgb, var(--fth-c) 22%, var(--bg-soft));
  border-color: color-mix(in srgb, var(--fth-c) 40%, transparent);
  color: var(--text);
}

.fth-ayahs {
  background: var(--mushaf-paper);
  color: var(--mushaf-ink);
  border: 1px solid var(--mushaf-border-inner);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  font-family: var(--font-quran);
  font-size: 1.35rem;
  line-height: 2.15;
  text-align: center;
}

.fth-ayah {
  display: inline;
}

.fth-ayah-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
  margin: 0 0.2em;
  border: 1.5px solid #8b6914;
  border-radius: 50%;
  font-family: var(--font-ui);
  font-size: 0.55em;
  font-weight: 700;
  color: #5c4818;
  background: #f0e0b0;
  vertical-align: middle;
}

.fth-purpose,
.fth-tadabbur {
  margin-bottom: 0.85rem;
}

.fth-purpose strong,
.fth-tadabbur strong {
  display: block;
  color: var(--gold-light);
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.fth-purpose p,
.fth-tadabbur li {
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 0.94rem;
}

.fth-tadabbur ul {
  padding-right: 1.15rem;
  margin: 0;
}

.fth-tadabbur li {
  margin-bottom: 0.4rem;
}

.fth-link-next {
  margin-top: 0.5rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.fth-link-next span {
  color: var(--gold-light);
  font-weight: 700;
  margin-left: 0.35rem;
}

.fth-flow-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.35rem 0;
  color: var(--gold);
  opacity: 0.75;
}

.fth-flow-line {
  width: 2px;
  height: 1.1rem;
  background: linear-gradient(180deg, var(--border), var(--gold));
  border-radius: 2px;
}

.fth-connections-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 700px) {
  .fth-connections-grid {
    grid-template-columns: 1fr;
  }
}

.fth-connection {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.fth-connection-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fth-conn-arrow {
  color: var(--gold);
  font-weight: 700;
}

.fth-conn-label {
  display: block;
  color: var(--gold-light);
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
}

.fth-connection p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.75;
  margin: 0;
}

.fth-closing {
  margin-top: 1.5rem;
  text-align: center;
  padding: 1.35rem 1.25rem;
  background: linear-gradient(180deg, var(--gold-dim), transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.fth-closing p {
  color: var(--text);
  line-height: 1.85;
  font-size: 0.98rem;
  max-width: 40rem;
  margin: 0 auto;
}

/* روابط الحفظ بين الآيات */
.fth-hero-jumps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 1rem;
}

.fth-jump-mem {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gold-light);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  background: var(--gold-dim);
  transition: 0.15s;
}

.fth-jump-mem:hover {
  border-color: var(--gold);
  background: var(--bg-elevated);
}

/* خطة الخريطة الذهنية البصرية */
.fth-mindmap-plan {
  margin-top: 1.75rem;
  scroll-margin-top: 5rem;
}

.fth-mm-core {
  text-align: center;
  margin: 1rem auto 1.35rem;
  max-width: 28rem;
  padding: 1.1rem 1.25rem;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
  border: 2px solid var(--gold);
  box-shadow: var(--shadow), 0 0 0 6px var(--gold-dim);
}

.fth-mm-core-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.fth-mm-core-title {
  display: block;
  font-family: var(--font-ar);
  font-size: 1.45rem;
  color: var(--gold-light);
  margin-bottom: 0.35rem;
}

.fth-mm-core p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
  margin: 0;
}

.fth-mm-subhead {
  font-family: var(--font-ar);
  color: var(--gold-light);
  font-size: 1.05rem;
  margin: 1.25rem 0 0.75rem;
}

.fth-mm-quarters {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 720px) {
  .fth-mm-quarters {
    grid-template-columns: 1fr 1fr;
  }
}

.fth-mm-quarter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  border-right: 4px solid var(--fth-c);
}

.fth-mm-q-head {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.fth-mm-q-order {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--fth-c);
  color: var(--on-gradient);
  font-weight: 800;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.fth-mm-q-head h4 {
  font-family: var(--font-ar);
  font-size: 1.05rem;
  color: var(--cream);
  margin: 0 0 0.35rem;
}

html[data-theme="light"] .fth-mm-q-head h4 {
  color: var(--text);
}

.fth-mm-ayahs {
  background: var(--mushaf-paper);
  color: var(--mushaf-ink);
  border: 1px solid var(--mushaf-border-inner);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.65rem;
  font-family: var(--font-quran);
  font-size: 1.1rem;
  line-height: 1.95;
  text-align: center;
}

.fth-mm-ayah {
  display: inline;
}

.fth-mm-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.65rem;
}

.fth-mm-node-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fth-c) 18%, var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--fth-c) 35%, transparent);
  color: var(--text);
}

.fth-mm-benefit,
.fth-mm-ruling {
  margin-top: 0.45rem;
}

.fth-mm-benefit strong,
.fth-mm-ruling strong {
  display: block;
  font-size: 0.8rem;
  color: var(--gold-light);
  margin-bottom: 0.2rem;
}

.fth-mm-benefit p,
.fth-mm-ruling p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.fth-mm-ruling {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
}

.fth-mm-micro-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 560px) {
  .fth-mm-micro-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.fth-mm-micro {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.fth-mm-micro-visual {
  font-size: 1.1rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.fth-mm-micro-body strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.fth-mm-micro-body p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.fth-mm-howto {
  margin-top: 1.15rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--gold-dim), transparent);
  border: 1px solid var(--border);
}

.fth-mm-howto strong {
  display: block;
  color: var(--gold-light);
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.fth-mm-howto p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.8;
}

.fth-memorization {
  margin-top: 1.75rem;
  scroll-margin-top: 5rem;
}

.fth-mem-prompt {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}

.fth-mem-prompt-text {
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.85;
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.fth-mem-help {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 1.15rem;
}

.fth-mem-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fth-mem-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  border-right: 4px solid var(--gold);
}

.fth-mem-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}

.fth-mem-step {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--on-gradient);
  font-weight: 800;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.fth-mem-head h4 {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--gold-light);
  font-weight: 700;
  margin: 0;
}

.fth-mem-arrow {
  display: inline-block;
  margin: 0 0.25rem;
  color: var(--gold);
}

.fth-mem-verses {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.fth-mem-verse {
  background: var(--mushaf-paper);
  color: var(--mushaf-ink);
  border: 1px solid var(--mushaf-border-inner);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
}

.fth-mem-verse-next {
  box-shadow: inset 3px 0 0 var(--accent);
}

.fth-mem-verse-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  color: #6b5a38;
  margin-bottom: 0.3rem;
}

.fth-mem-verse-text {
  font-family: var(--font-quran);
  font-size: 1.2rem;
  line-height: 2;
  margin: 0 0 0.35rem;
  text-align: center;
}

.fth-mem-hook {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: #5c4818;
  text-align: center;
}

.fth-mem-hook strong {
  font-family: var(--font-quran);
  font-size: 1.05rem;
  color: #1a4d3e;
}

.fth-mem-bridge-icon {
  text-align: center;
  color: var(--gold);
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.1rem 0;
}

.fth-mem-bridge,
.fth-mem-tip {
  margin-top: 0.65rem;
}

.fth-mem-bridge strong,
.fth-mem-tip strong {
  display: block;
  color: var(--gold-light);
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

.fth-mem-bridge p,
.fth-mem-tip p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.8;
  margin: 0;
}

.fth-mem-tip {
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
}

/* ========== Mind Map (خريطة ذهنية) ========== */
body.mindmap-mode main {
  max-width: none;
  padding: 0;
  margin: 0;
}

body.mindmap-mode .site-footer {
  display: none;
}

.view.mindmap-view.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 72px);
}

.mindmap-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: calc(100vh - 72px);
}

/* --- فهرس السور (بطاقات) --- */
.mindmap-index {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.1rem 3rem;
}

.mindmap-index-hero {
  text-align: center;
  margin-bottom: 1.75rem;
  padding: 1.4rem 1rem 1.2rem;
  border-radius: 18px;
  background:
    radial-gradient(ellipse 70% 80% at 50% 0%, var(--gold-dim), transparent 70%),
    var(--bg-soft);
  border: 1px solid var(--border);
}

.mindmap-index-ornament {
  color: var(--gold);
  letter-spacing: 0.35em;
  font-size: 0.85rem;
  opacity: 0.85;
  margin-bottom: 0.45rem;
}

.mindmap-index-kicker {
  font-size: 0.82rem;
  color: var(--gold-light);
  margin: 0 0 0.35rem;
}

.mindmap-index-title {
  font-family: var(--font-ar);
  font-size: clamp(1.45rem, 3.5vw, 1.9rem);
  color: var(--text);
  margin: 0 0 0.55rem;
  line-height: 1.35;
}

.mindmap-index-lead {
  max-width: 38rem;
  margin: 0 auto 1.15rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.mindmap-index-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 0.85rem;
}

.mindmap-index-search-wrap {
  flex: 1 1 220px;
  max-width: 320px;
}

.mindmap-index-search {
  width: 100%;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.mindmap-index-search:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.mindmap-index-filters {
  display: flex;
  gap: 0.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem;
}

.mindmap-index-filter {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s;
}

.mindmap-index-filter:hover {
  color: var(--text);
}

.mindmap-index-filter.active {
  background: var(--gold-dim);
  color: var(--gold-light);
}

.mindmap-index-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 5rem;
  margin: 0;
}

.mindmap-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 0.85rem;
}

.mindmap-index-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.mindmap-surah-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.95rem 0.9rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  cursor: pointer;
  text-align: start;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  outline: none;
  min-height: 168px;
}

.mindmap-surah-card:hover,
.mindmap-surah-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.mindmap-surah-card.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.mindmap-surah-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.mindmap-surah-card-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.4rem;
  border-radius: 10px;
  background: var(--gold-dim);
  color: var(--gold-light);
  font-weight: 800;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.mindmap-surah-card-rev {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.mindmap-surah-card-rev.rev-makkah {
  color: var(--rev-makkah);
  border-color: color-mix(in srgb, var(--rev-makkah) 40%, transparent);
  font-weight: 700;
}

.mindmap-surah-card-rev.rev-madinah {
  color: var(--rev-madinah);
  border-color: color-mix(in srgb, var(--rev-madinah) 40%, transparent);
  font-weight: 700;
}

.mindmap-surah-card-name {
  font-family: var(--font-ar);
  font-size: 1.15rem;
  margin: 0.15rem 0 0;
  color: var(--text);
  line-height: 1.3;
}

.mindmap-surah-card-theme {
  flex: 1;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mindmap-surah-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.mindmap-surah-card-cta {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-top: 0.2rem;
}

.mindmap-map-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: calc(100vh - 72px);
}

.mindmap-map-panel[hidden] {
  display: none !important;
}

.mindmap-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s;
  white-space: nowrap;
}

.mindmap-back-btn:hover {
  border-color: var(--gold);
  color: var(--gold-light);
  background: var(--gold-dim);
}

.mindmap-surah-item .badge-ready {
  background: var(--tag-same-bg);
  color: var(--badge-ready);
  border: 1px solid var(--tag-same-border);
}

.linkish {
  border: none;
  background: none;
  color: var(--gold-light);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .mindmap-index {
    padding: 1rem 0.75rem 2.5rem;
  }

  .mindmap-index-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.65rem;
  }

  .mindmap-surah-card {
    min-height: 150px;
    padding: 0.8rem 0.75rem;
  }
}

.mindmap-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.1rem;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 50;
}

.mindmap-page-title {
  font-family: var(--font-ar);
  font-size: 1.2rem;
  color: var(--gold-light);
  line-height: 1.2;
}

.mindmap-page-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.12rem;
}

.mindmap-toolbar-end {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.mindmap-toolbar-start {
  margin-inline-start: auto;
  text-align: start;
}

.mindmap-zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.18rem 0.3rem;
}

.mindmap-tool-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: 0.15s;
}

.mindmap-tool-btn:hover {
  background: var(--gold-dim);
  color: var(--gold-light);
}

.mindmap-tool-wide {
  width: auto;
  min-width: 32px;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.95rem;
}

.mindmap-zoom-label {
  min-width: 3rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Style switcher — 3 designs */
.mindmap-style-switcher {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.3rem 0.4rem;
}

.mindmap-style-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0 0.35rem;
  font-weight: 600;
}

.mindmap-style-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: 0.18s;
}

.mindmap-style-btn:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.mindmap-style-btn.active {
  background: rgba(201, 162, 39, 0.14);
  border-color: var(--border);
  color: var(--gold-light);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.2);
}

.mindmap-style-swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.mindmap-style-swatch.style-classic {
  background:
    linear-gradient(135deg, #f0e6d0 50%, transparent 50%),
    linear-gradient(135deg, #1d6a8a, #2d6a4f 55%, #8b3a5c);
}

.mindmap-style-swatch.style-tree {
  background:
    linear-gradient(90deg, #e8f0ea 40%, transparent 40%),
    linear-gradient(180deg, #2a7a5c, #5a9e7a);
}

.mindmap-style-swatch.style-cascade {
  background:
    linear-gradient(145deg, #e9e4f2 35%, transparent 35%),
    linear-gradient(145deg, #6b1d2a, #1d4e89 55%, #8b6914);
}

.mindmap-style-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: right;
}

.mindmap-style-text strong {
  font-size: 0.82rem;
  font-weight: 700;
}

.mindmap-style-text small {
  font-size: 0.65rem;
  opacity: 0.75;
}

/* Surah picker */
.mindmap-surah-picker {
  position: relative;
}

.mindmap-surah-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.85rem 0.45rem 0.65rem;
  background: linear-gradient(135deg, rgba(107, 29, 42, 0.55), rgba(201, 162, 39, 0.18));
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--cream);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: 0.2s;
  min-width: 150px;
}

.mindmap-surah-btn:hover,
.mindmap-surah-btn[aria-expanded="true"] {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-dim);
}

.mindmap-surah-btn svg {
  flex-shrink: 0;
  color: var(--gold-light);
}

.mindmap-surah-btn-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: right;
  line-height: 1.25;
}

.mindmap-surah-btn-text strong {
  font-size: 0.95rem;
  color: var(--gold-light);
}

.mindmap-surah-btn-text small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.mindmap-surah-chevron {
  margin-inline-start: 0.25rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.mindmap-surah-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  inset-inline-start: 0;
  width: min(300px, 92vw);
  max-height: min(420px, 60vh);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 60;
}

.mindmap-surah-panel[hidden] {
  display: none !important;
}

.mindmap-surah-search {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  outline: none;
}

.mindmap-surah-search:focus {
  background: var(--bg-elevated);
}

.mindmap-surah-list {
  overflow-y: auto;
  padding: 0.35rem;
}

.mindmap-surah-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: right;
  transition: 0.15s;
}

.mindmap-surah-item:hover:not(:disabled) {
  background: var(--bg-elevated);
}

.mindmap-surah-item.active {
  background: var(--gold-dim);
  color: var(--gold-light);
}

.mindmap-surah-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mindmap-surah-item .num {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.mindmap-surah-item.active .num {
  border-color: var(--gold);
  color: var(--gold-light);
}

.mindmap-surah-item .meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.mindmap-surah-item .meta small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.mindmap-surah-item .badge {
  font-size: 0.65rem;
  color: var(--gold);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}

/* ---- Infinite layered canvas ---- */
.mindmap-canvas-wrap {
  --mm-canvas-bg: #f0e6d0;
  position: relative;
  flex: 1;
  min-height: 520px;
  overflow: hidden;
  background: var(--mm-canvas-bg);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: background 0.35s ease;
}

.mindmap-canvas-wrap.is-panning {
  cursor: grabbing;
}

.mindmap-layer-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(90, 70, 40, 0.14) 1px, transparent 0);
  background-size: 28px 28px;
  opacity: 0.75;
}

.mindmap-canvas-wrap[data-style="tree"] .mindmap-layer-bg {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(40, 90, 60, 0.12) 1px, transparent 0);
}

.mindmap-canvas-wrap[data-style="cascade"] .mindmap-layer-bg {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(70, 40, 90, 0.11) 1px, transparent 0);
}

.mindmap-hint {
  position: absolute;
  bottom: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  font-size: 0.78rem;
  color: #3d3220;
  background: rgba(255, 252, 245, 0.95);
  border: 1px solid rgba(138, 115, 73, 0.35);
  border-radius: 999px;
  padding: 0.35rem 0.95rem;
  pointer-events: none;
  transition: opacity 0.4s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mindmap-hint.is-faded {
  opacity: 0;
}

/* Pan only (translate). Zoom is via --mm-zoom font/layout — stays razor sharp */
.mindmap-canvas {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
  z-index: 1;
}

.mindmap-edges {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 2;
  shape-rendering: geometricPrecision;
}

.mindmap-edges-glow {
  display: none; /* blur glow made nodes look soft/image-like */
}

.mindmap-world {
  --mm-zoom: 1;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  direction: rtl;
  /* Base type scale; zoom multiplies this — real text, not bitmap scale */
  font-size: calc(16px * var(--mm-zoom, 1));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

.mindmap-empty {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-content: center;
  text-align: center;
  color: #3d3220;
  font-size: 1.05rem;
  background: rgba(243, 236, 216, 0.96);
  padding: 2rem;
}

.mindmap-empty-sub {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #5c4a32;
}

/* ---- Nodes: crisp HTML cards (no CSS filters / no scale transform) ---- */
.mm-node {
  position: absolute;
  transform: translate(-50%, -50%);
  text-align: center;
  direction: rtl;
  font-family: var(--font-ui);
  --mm-c: #2d6a4f;
}

.mm-card {
  position: relative;
}

/* Title */
.mm-card-title {
  min-width: 15em;
  max-width: 24em;
}

.mm-title-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  margin-bottom: 0.4em;
  color: #9a7b3c;
  font-size: 0.95em;
}

.mm-title-ornament span {
  height: 2px;
  width: 3.2em;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #c9a227, transparent);
}

.mm-title-plate {
  padding: 3px;
  border-radius: 1em;
  background: linear-gradient(145deg, #e0c04a, #8a6b2e 48%, #e0c04a);
  box-shadow: 0 8px 20px rgba(60, 40, 10, 0.16);
}

.mm-title-plate-inner {
  background: #fffef9;
  border-radius: 0.85em;
  padding: 0.65em 1.4em 0.55em;
  border: 1px solid rgba(201, 162, 39, 0.35);
}

.mm-title-plate-inner h3 {
  font-family: var(--font-ar);
  font-size: 1.7em;
  color: #0f3d32;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
}

.mm-title-num {
  width: 1.85em;
  height: 1.85em;
  border-radius: 50%;
  background: #145a48;
  color: #fff8e7;
  font-size: 0.85em;
  display: grid;
  place-items: center;
  margin: 0.35em auto 0;
  box-shadow: 0 0 0 2px #c9a227;
  font-weight: 700;
}

.mm-title-theme {
  margin-top: 0.55em;
  font-family: var(--font-ar);
  font-size: 1.15em;
  color: #3d2a0a;
  font-weight: 700;
  line-height: 1.4;
}

.mm-title-summary {
  margin-top: 0.35em;
  font-size: 0.88em;
  color: #4a3c28;
  max-width: 22em;
  line-height: 1.55;
  margin-inline: auto;
  font-weight: 500;
}

/* removed: mm-flow-badge (يمين ← يسار) */
.mm-flow-badge {
  display: none;
}
  display: inline-block;
  margin-top: 0.5em;
  font-size: 0.72em;
  font-weight: 700;
  color: #5a4010;
  background: #f3e6c0;
  border: 1px solid #c9a227;
  border-radius: 999px;
  padding: 0.18em 0.65em;
}

/* Center hub */
.mm-card-center {
  min-width: 13.5em;
  max-width: 19em;
}

.mm-card-center .mm-card-body {
  padding: 0.75em 1.15em;
  border-radius: 0.75em;
  color: #fff;
  background: var(--mm-c);
  border: 2px solid #c9a227;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.mm-card-center .mm-card-label {
  font-weight: 800;
  font-size: 1.02em;
  line-height: 1.45;
  color: #fff;
}

.mm-card-center .mm-card-sub {
  margin-top: 0.35em;
  font-size: 0.82em;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
}

/* Section */
.mm-card-section {
  min-width: 9.5em;
  max-width: 12em;
  padding: 0.7em 0.8em 0.65em;
  border-radius: 0.7em;
  color: #fff;
  background: var(--mm-c);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.mm-sec-head {
  display: flex;
  align-items: flex-start;
  gap: 0.4em;
  text-align: right;
}

.mm-sec-idx {
  flex-shrink: 0;
  width: 1.45em;
  height: 1.45em;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-size: 0.78em;
  font-weight: 800;
  display: grid;
  place-items: center;
  color: #fff;
}

.mm-sec-titles {
  flex: 1;
  min-width: 0;
}

.mm-card-section .mm-card-label {
  font-weight: 800;
  font-size: 1.08em;
  line-height: 1.3;
  color: #fff;
}

.mm-card-section .mm-card-sub {
  font-size: 0.8em;
  margin-top: 0.2em;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.95);
}

.mm-chip {
  display: inline-block;
  margin-top: 0.4em;
  font-size: 0.78em;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 0.12em 0.55em;
  color: #fff;
}

.mm-chip-sm {
  font-size: 0.72em;
  padding: 0.1em 0.45em;
  background: var(--mm-c);
  color: #fff;
  border: none;
  flex-shrink: 0;
}

/* Leaf */
.mm-card-leaf {
  min-width: 10.5em;
  max-width: 13.5em;
  display: flex;
  text-align: right;
  background: #fffefb;
  border-radius: 0.65em;
  border: 1.5px solid color-mix(in srgb, var(--mm-c) 55%, #999);
  box-shadow: 0 6px 14px rgba(40, 30, 15, 0.1);
  overflow: hidden;
}

.mm-leaf-accent {
  width: 0.4em;
  flex-shrink: 0;
  background: var(--mm-c);
}

.mm-leaf-main {
  padding: 0.55em 0.65em 0.6em;
  flex: 1;
  min-width: 0;
}

.mm-leaf-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4em;
  flex-wrap: wrap;
}

.mm-card-leaf .mm-card-label {
  font-weight: 800;
  font-size: 0.95em;
  color: #1a1510;
  line-height: 1.35;
}

.mm-card-note {
  margin-top: 0.3em;
  font-family: var(--font-ar);
  font-size: 0.88em;
  color: #2e2418;
  line-height: 1.5;
  font-weight: 500;
}

/* Style accents (structure differs in JS; colors here) */
.mindmap-canvas-wrap[data-style="tree"] .mm-title-plate-inner h3 {
  color: #0f3324;
}

.mindmap-canvas-wrap[data-style="tree"] .mm-card-leaf {
  border-radius: 0.85em 0.35em 0.85em 0.35em;
}

.mindmap-canvas-wrap[data-style="cascade"] .mm-card-section {
  border-radius: 0.85em 0.85em 0.4em 0.4em;
  min-width: 10.5em;
  max-width: 12.5em;
}

.mindmap-canvas-wrap[data-style="cascade"] .mm-card-leaf {
  min-width: 11em;
  max-width: 13.5em;
  box-shadow: 0 10px 22px rgba(40, 20, 50, 0.12);
}

.mindmap-canvas-wrap[data-style="cascade"] .mm-title-plate {
  background: linear-gradient(145deg, #d4b43a, #6b1d2a 52%, #d4b43a);
}

.mindmap-canvas-wrap[data-style="cascade"] .mm-title-plate-inner h3 {
  color: #3a1018;
}

@media (max-width: 900px) {
  .mindmap-style-text small {
    display: none;
  }

  .mindmap-style-label {
    display: none;
  }
}

@media (max-width: 700px) {
  .mindmap-toolbar {
    align-items: stretch;
  }

  .mindmap-toolbar-end {
    width: 100%;
    justify-content: space-between;
  }

  .mindmap-surah-btn {
    flex: 1;
  }

  .mindmap-style-switcher {
    width: 100%;
    justify-content: center;
  }

  .mindmap-style-text strong {
    font-size: 0.75rem;
  }
}


/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.site-footer .basmala {
  font-family: var(--font-ar);
  color: var(--gold);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* Empty / loading */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.loading {
  text-align: center;
  padding: 2rem;
  color: var(--gold);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* Diff highlight for compare */
.diff-word {
  background: var(--diff-bg);
  color: var(--diff-fg);
  padding: 0 0.1em;
  border-radius: 3px;
  font-weight: 600;
}

.same-word {
  background: var(--same-bg);
  color: var(--same-fg);
  padding: 0 0.1em;
  border-radius: 3px;
  font-weight: 600;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  background: none;
  border: none;
  font-family: var(--font-ui);
}

.back-link:hover { color: var(--gold); }

/* Detail header: back + return-to-mushaf */
.detail-nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.detail-nav-row .back-link {
  margin-bottom: 0;
}

.btn-return-mushaf {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--on-dark);
  background: linear-gradient(145deg, var(--maroon-soft), var(--maroon));
  border: 1px solid rgba(201, 162, 39, 0.45);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: 0.15s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.btn-return-mushaf:hover {
  border-color: var(--gold);
  filter: brightness(1.08);
}

.btn-return-mushaf small {
  opacity: 0.9;
  font-weight: 500;
  font-size: 0.78rem;
}

.btn-return-mushaf svg {
  flex-shrink: 0;
}

.ayah-card.is-mushaf-source {
  background: rgba(201, 162, 39, 0.1);
  border: 1px solid rgba(201, 162, 39, 0.45);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.12);
}

.tag-source {
  background: var(--maroon) !important;
  color: var(--on-dark) !important;
  border-color: transparent !important;
}

.mushaf-origin-tip {
  border-color: rgba(201, 162, 39, 0.35);
}

/* Sticky return bar — only when mushaf → mutashabihat */
.mushaf-return-bar {
  position: fixed;
  z-index: 165;
  bottom: 1.15rem;
  right: 1rem;
  left: auto;
}

.mushaf-return-bar[hidden] {
  display: none !important;
}

.mushaf-return-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-width: min(320px, calc(100vw - 2rem));
  font-family: var(--font-ui);
  color: var(--on-dark);
  background: linear-gradient(145deg, var(--maroon-soft), var(--maroon));
  border: 1px solid rgba(201, 162, 39, 0.5);
  border-radius: 999px;
  padding: 0.55rem 0.95rem 0.55rem 0.7rem;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  transition: 0.15s;
}

.mushaf-return-btn:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.mushaf-return-btn svg {
  flex-shrink: 0;
}

.mushaf-return-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  text-align: right;
  line-height: 1.25;
}

.mushaf-return-text strong {
  font-size: 0.88rem;
  font-weight: 700;
}

.mushaf-return-text small {
  font-size: 0.75rem;
  opacity: 0.9;
  font-weight: 500;
}

.mushaf-ayah.flash-ayah {
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.4);
  transition: box-shadow 0.4s;
}

.mushaf-ayah.flash-ayah .mushaf-hl {
  background: rgba(201, 162, 39, 0.48) !important;
  box-shadow: inset 0 -2px 0 rgba(139, 105, 20, 0.6);
}

@media (max-width: 600px) {
  .mushaf-return-bar {
    right: 0.75rem;
    bottom: 4.6rem; /* above scroll-top when both could show on other pages */
  }

  body:not(.mushaf-focus-mode) .mushaf-return-bar {
    bottom: 1rem;
  }

  .btn-return-mushaf small {
    display: none;
  }
}

.hidden { display: none !important; }

.filter-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-chips button {
  font-family: var(--font-ui);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
}

.filter-chips button.active {
  background: var(--gold-dim);
  color: var(--gold-light);
  border-color: var(--gold);
}



/* ========== Theme contrast: icons / labels / SVGs (dark + light) ========== */
/* SVG icons inherit parent color in both themes */
.theme-toggle svg,
.surah-index-icon svg,
.scroll-top-btn svg,
.mushaf-return-btn svg,
.btn-return-mushaf svg,
.mushaf-focus-exit svg,
.muta-scope-icon svg,
.mushaf-focus-btn svg,
.mindmap-back-btn svg {
  color: inherit;
  stroke: currentColor;
}

/* Scope icon glyphs (SVG paths) */
.muta-scope-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

/* Light-mode: stronger borders on soft icon tiles for definition */
html[data-theme="light"] .muta-scope-icon {
  border: 1px solid color-mix(in srgb, currentColor 28%, transparent);
}

html[data-theme="light"] .home-hub-icon {
  border-color: color-mix(in srgb, var(--gold) 35%, transparent);
}

html[data-theme="light"] .surah-index-icon-btn {
  color: var(--gold-light);
}

html[data-theme="light"] .mushaf-font-btn,
html[data-theme="light"] .float-font-pop .float-font-btn {
  color: var(--gold-light);
  background: var(--bg-card);
}

html[data-theme="light"] .mushaf-font-value,
html[data-theme="light"] .float-font-pop .float-font-label {
  color: var(--text);
}

html[data-theme="light"] .scroll-top-btn,
html[data-theme="light"] .mushaf-return-btn,
html[data-theme="light"] .btn-return-mushaf {
  box-shadow: 0 8px 20px rgba(60, 45, 20, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Light-mode chips: readable body text; keep range chips emphasized */
html[data-theme="light"] .fth-chip {
  color: var(--text-muted);
}

html[data-theme="light"] .fth-chip-range {
  color: var(--text);
  font-weight: 700;
}

html[data-theme="light"] .fth-name-tag {
  color: var(--gold-light);
  font-weight: 700;
}
