/* ═══════════════════════════════════════
   MUSHAF CSS (Modern Aesthetic, 3 Themes & Direct Search)
═══════════════════════════════════════ */

@font-face {
  font-family: 'Elgharib-Basmala';
  src: url('../fonts/Elgharib-Basmala.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Elgharib-SurahName';
  src: url('../fonts/Elgharib-SurahName.woff2') format('woff2');
  font-display: swap;
}

/* ═══════════════════════════════════════
   KING FAHD COMPLEX QCF V1 FONTS (Local woff2)
   font-display: block prevents flash of unstyled glyphs
═══════════════════════════════════════ */
@font-face {
  font-family: 'QCF_BSML';
  src: url('../fonts/QCF1/QCF_BSML.woff2') format('woff2');
  font-display: block;
}

@font-face {
  font-family: 'QCF_P001';
  src: url('../fonts/QCF1/QCF_P001.woff2') format('woff2');
  font-display: block;
}

@font-face {
  font-family: 'QCF_P002';
  src: url('../fonts/QCF1/QCF_P002.woff2') format('woff2');
  font-display: block;
}

@font-face {
  font-family: 'QCF_P003';
  src: url('../fonts/QCF1/QCF_P003.woff2') format('woff2');
  font-display: block;
}

@font-face {
  font-family: 'QCF2001';
  src: url('../fonts/QCF2/QCF2001.woff2') format('woff2');
  font-display: block;
}

@font-face {
  font-family: 'QCF2002';
  src: url('../fonts/QCF2/QCF2002.woff2') format('woff2');
  font-display: block;
}

@font-face {
  font-family: 'QCF2003';
  src: url('../fonts/QCF2/QCF2003.woff2') format('woff2');
  font-display: block;
}

@font-face {
  font-family: 'QCF4_Hafs_01_W';
  src: url('../fonts/QCF4-Hafs/QCF4_Hafs_01_W.woff2') format('woff2');
  font-display: block;
}

@font-face {
  font-family: 'QCF4_Hafs_02_W';
  src: url('../fonts/QCF4-Hafs/QCF4_Hafs_02_W.woff2') format('woff2');
  font-display: block;
}

@font-face {
  font-family: 'QCF4_Hafs_03_W';
  src: url('../fonts/QCF4-Hafs/QCF4_Hafs_03_W.woff2') format('woff2');
  font-display: block;
}

@font-face {
  font-family: 'QCF4_BSML';
  src: url('../fonts/QCF4-Hafs/QCF4_QBSML.ttf') format('truetype');
  font-display: block;
}


:root {
  --mushaf-bg-light: #fdfcf9;
  --mushaf-bg-dark: #0f1117;
  --mushaf-bg-night: #000000;

  --mushaf-card-light: #ffffff;
  --mushaf-card-dark: #161821;
  --mushaf-card-night: #000000;

  --mushaf-text-light: #090a0f;
  --mushaf-text-dark: #e2e8f0;
  --mushaf-text-night: #ffffff;

  --mushaf-border-light: rgba(0, 0, 0, 0.08);
  --mushaf-border-dark: rgba(255, 255, 255, 0.1);
  --mushaf-border-night: rgba(255, 255, 255, 0.16);

  --mushaf-accent: #0284c7;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.mushaf-mode {
  background-color: var(--mushaf-bg-light);
  color: var(--mushaf-text-light);
  overflow-x: hidden;
  font-family: 'Thmanyah Sans', sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* 1. Theme Dark (Charcoal Dark) */
body.theme-dark.mushaf-mode,
.mushaf-mode.theme-dark {
  --mushaf-bg: #0f1117;
  --mushaf-card: #161821;
  --mushaf-text: #ffffff;
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.12);
  background-color: var(--mushaf-bg-dark) !important;
  color: #ffffff !important;
}

/* 2. Theme Night (Pure OLED Pitch Black) */
body.theme-night.mushaf-mode,
.mushaf-mode.theme-night {
  --mushaf-bg: #000000;
  --mushaf-card: #000000;
  --mushaf-text: #ffffff;
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.18);
  background-color: var(--mushaf-bg-night) !important;
  color: #ffffff !important;
}

/* ═══════════════════════════════════════
   MUSHAF MODERN FROSTED HEADER (4-ELEMENT SYSTEM)
═══════════════════════════════════════ */
.mushaf-mode .site-header,
.mushaf-site-header {
  position: fixed;
  top: 12px;
  top: max(12px, env(safe-area-inset-top, 12px));
  left: 0;
  right: 0;
  z-index: 950;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

.mushaf-mode .header-inner,
.mushaf-header-bar {
  pointer-events: auto;
  max-width: 860px;
  width: 100%;
  height: 52px;
  background: rgba(255, 255, 255, 0.90);
  border: 1px solid var(--border);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  gap: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  position: relative;
  transition: all 0.3s ease;
}

body.theme-dark.mushaf-mode .header-inner,
body.theme-dark.mushaf-mode .mushaf-header-bar {
  background: rgba(22, 24, 33, 0.92);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

body.theme-night.mushaf-mode .header-inner,
body.theme-night.mushaf-mode .mushaf-header-bar {
  background: rgba(10, 10, 12, 0.96);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
}

/* 1. Back Arrow Button (Returns 1 step to copier) */
.mushaf-back-pill-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  cursor: pointer;
}

body.theme-dark.mushaf-mode .mushaf-back-pill-btn,
body.theme-night.mushaf-mode .mushaf-back-pill-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.mushaf-back-pill-btn:hover {
  background: var(--pill-bg);
  color: var(--pill-text);
  border-color: transparent;
  transform: scale(1.06);
}

.mushaf-back-icon {
  width: 17px;
  height: 17px;
  transition: transform 0.22s ease;
}

.mushaf-back-pill-btn:hover .mushaf-back-icon {
  transform: translateX(2px);
}

/* 2. Direct Verse Search Bar */
.mushaf-mode .header-search-capsule,
.mushaf-search-capsule {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  height: 40px;
  padding: 0 12px;
  flex: 1;
  min-width: 110px;
  max-width: 320px;
  position: relative;
  gap: 8px;
  transition: all 0.22s ease;
}

body.theme-dark.mushaf-mode .mushaf-search-capsule,
body.theme-dark.mushaf-mode .header-search-capsule {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

body.theme-night.mushaf-mode .mushaf-search-capsule,
body.theme-night.mushaf-mode .header-search-capsule {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.mushaf-search-capsule:focus-within,
.mushaf-mode .header-search-capsule:focus-within {
  border-color: var(--text-primary);
  background: var(--bg-surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.mushaf-search-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.mushaf-search-input,
.mushaf-mode .header-search-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-family: 'Thmanyah Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  padding: 0;
}

/* 3. Surah & Page Navigation Capsule */
.mushaf-nav-capsule {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  height: 40px;
  position: relative;
  flex-shrink: 0;
  transition: all 0.22s ease;
}

body.theme-dark.mushaf-mode .mushaf-nav-capsule {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

body.theme-night.mushaf-mode .mushaf-nav-capsule {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.mushaf-nav-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.mheader-custom-select {
  position: relative;
  display: flex;
  height: 100%;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.custom-select-trigger {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px 0 24px;
  color: var(--text-primary);
  font-family: 'Thmanyah Sans', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.custom-select-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mheader-select-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  width: 12px;
  height: 12px;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.mheader-custom-select.active .mheader-select-icon {
  transform: translateY(-50%) rotate(180deg);
}

/* 4. Theme Toggle Button (Light / Night / Dark) */
.mushaf-theme-toggle-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  padding: 0;
}

body.theme-dark.mushaf-mode .mushaf-theme-toggle-btn,
body.theme-night.mushaf-mode .mushaf-theme-toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.mushaf-theme-toggle-btn:hover {
  background: var(--pill-bg);
  color: var(--pill-text);
  border-color: transparent;
  transform: scale(1.06);
}

/* Mobile & iPhone & Android Responsive Optimization */
@media (max-width: 640px) {

  .mushaf-site-header,
  .mushaf-mode .site-header {
    padding: 0 8px;
    top: max(6px, env(safe-area-inset-top, 6px));
    width: 100%;
    box-sizing: border-box;
  }

  .mushaf-header-bar,
  .mushaf-mode .header-inner {
    height: 44px;
    padding: 3px 6px;
    gap: 5px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap;
    overflow: visible;
  }

  .mushaf-back-pill-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    flex-shrink: 0;
  }

  .mushaf-back-icon {
    width: 14px;
    height: 14px;
  }

  .mushaf-search-capsule,
  .mushaf-mode .header-search-capsule {
    height: 34px;
    padding: 0 8px;
    gap: 4px;
    min-width: 45px;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .mushaf-search-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }

  .mushaf-search-input,
  .mushaf-mode .header-search-input {
    font-size: 0.78rem;
    min-width: 25px;
  }

  .mushaf-nav-capsule {
    height: 34px;
    flex-shrink: 0;
  }

  .custom-select-trigger {
    padding: 0 5px 0 16px;
    font-size: 0.76rem;
    max-width: 78px;
  }

  .mheader-select-icon {
    left: 4px;
    width: 9px;
    height: 9px;
  }

  .mushaf-theme-toggle-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    flex-shrink: 0;
  }
}

@media (max-width: 400px) {

  .mushaf-site-header,
  .mushaf-mode .site-header {
    padding: 0 4px;
  }

  .mushaf-header-bar,
  .mushaf-mode .header-inner {
    gap: 3px;
    padding: 2px 4px;
    height: 42px;
  }

  .mushaf-back-pill-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .mushaf-search-capsule,
  .mushaf-mode .header-search-capsule {
    height: 32px;
    padding: 0 6px;
    min-width: 38px;
    gap: 3px;
  }

  .mushaf-search-icon {
    width: 13px;
    height: 13px;
  }

  .mushaf-search-input,
  .mushaf-mode .header-search-input {
    font-size: 0.74rem;
    min-width: 20px;
  }

  .mushaf-nav-capsule {
    height: 32px;
  }

  .custom-select-trigger {
    padding: 0 4px 0 13px;
    font-size: 0.72rem;
    max-width: 68px;
  }

  .mheader-select-icon {
    left: 3px;
    width: 8px;
    height: 8px;
  }

  .mushaf-theme-toggle-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }
}

/* Custom Dropdown Options */
.custom-select-options {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12);
  max-height: 320px;
  min-width: 170px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1050;
}

body.theme-dark.mushaf-mode .custom-select-options {
  background: #18191f;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.14);
}

body.theme-night.mushaf-mode .custom-select-options {
  background: #0d0e12;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85);
  border-color: rgba(255, 255, 255, 0.22);
}

.mheader-custom-select.active .custom-select-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.custom-option {
  padding: 10px 16px;
  text-align: right;
  font-family: 'Thmanyah Sans', sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: all 0.15s ease;
}

.custom-option:last-child {
  border-bottom: none;
}

.custom-option:hover {
  background: var(--bg-elevated);
  padding-right: 20px;
  color: var(--accent);
}

/* ═══════════════════════════════════════
   MUSHAF READING CANVAS
═══════════════════════════════════════ */
.mushaf-container {
  padding-top: 86px;
  padding-bottom: 70px;
  min-height: 100vh;
  box-sizing: border-box;
}

.mushaf-pages-wrapper {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Page Frame (Authentic Quran Sheet) */
.mushaf-page {
  padding: 34px 28px 24px;
  min-height: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  background: var(--mushaf-card-light);
  border: 1px solid var(--mushaf-border-light);
  border-radius: 26px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.03);
  scroll-margin-top: 80px;
}

body.theme-dark.mushaf-mode .mushaf-page {
  background: var(--mushaf-card-dark);
  border-color: var(--mushaf-border-dark);
  box-shadow: 0 8px 35px rgba(0, 0, 0, 0.4);
}

body.theme-night.mushaf-mode .mushaf-page {
  background: var(--mushaf-card-night);
  border-color: var(--mushaf-border-night);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Placeholder (skeleton) before lazy render fills the page */
.mushaf-page.mushaf-page-placeholder {
  min-height: 60vh;
  border-radius: 26px;
  background: var(--mushaf-card-light);
  border: 1px solid var(--mushaf-border-light);
  opacity: 0.35;
  scroll-margin-top: 80px;
}

body.theme-dark.mushaf-mode .mushaf-page.mushaf-page-placeholder {
  background: var(--mushaf-card-dark);
  border-color: var(--mushaf-border-dark);
}

body.theme-night.mushaf-mode .mushaf-page.mushaf-page-placeholder {
  background: var(--mushaf-card-night);
  border-color: var(--mushaf-border-night);
}

/* Surah Header Block */
.surah-header-block {
  text-align: center;
  margin-bottom: 18px;
  margin-top: 8px;
}

.surah-name-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  padding: 6px 28px;
  min-width: 190px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

body.theme-dark.mushaf-mode .surah-name-wrapper {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

body.theme-night.mushaf-mode .surah-name-wrapper {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Surah Name Calligraphy Font */
.surah-name-art {
  font-family: 'Elgharib-SurahName', 'Thmanyah Sans', sans-serif !important;
  font-size: 2.1rem;
  line-height: 1.1;
  color: var(--text-primary);
  display: inline-block;
  user-select: none;
  font-feature-settings: normal !important;
  font-variant-ligatures: normal !important;
}

body.theme-dark.mushaf-mode .surah-name-art,
body.theme-night.mushaf-mode .surah-name-art {
  color: #ffffff !important;
}

/* Basmala Calligraphy Font */
.basmala-text {
  display: block;
  text-align: center;
  margin: 10px 0 16px;
  font-family: 'Elgharib-Basmala', serif !important;
  font-size: 1.7rem;
  color: var(--text-primary);
  opacity: 0.95;
  user-select: none;
}

body.theme-dark.mushaf-mode .basmala-text,
body.theme-night.mushaf-mode .basmala-text {
  color: #ffffff !important;
}

/* Text Content Area */
.mushaf-text-block {
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  line-height: 2.15;
  text-align: justify;
  text-justify: inter-word;
  text-align-last: center;
  direction: rtl;
  word-spacing: 0.04em;
  color: var(--text-primary);
  flex: 1;
}

body.theme-dark.mushaf-mode .mushaf-text-block,
body.theme-night.mushaf-mode .mushaf-text-block {
  color: #ffffff !important;
}

body.theme-dark.mushaf-mode .custom-select-trigger,
body.theme-night.mushaf-mode .custom-select-trigger,
body.theme-dark.mushaf-mode .header-search-input,
body.theme-night.mushaf-mode .header-search-input,
body.theme-dark.mushaf-mode .custom-option,
body.theme-night.mushaf-mode .custom-option,
body.theme-dark.mushaf-mode .brand-title,
body.theme-night.mushaf-mode .brand-title {
  color: #ffffff !important;
}

body.theme-dark.mushaf-mode .mheader-select-icon,
body.theme-night.mushaf-mode .mheader-select-icon,
body.theme-dark.mushaf-mode .header-search-icon,
body.theme-night.mushaf-mode .header-search-icon {
  color: #cbd5e1 !important;
}

body.theme-dark.mushaf-mode .header-search-input::placeholder,
body.theme-night.mushaf-mode .header-search-input::placeholder {
  color: #94a3b8 !important;
}

.mushaf-verse-inline {
  display: inline;
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 2px;
  margin: 0;
  transition: background-color 0.2s ease;
  scroll-margin-top: 90px;
}

.mushaf-verse-inline:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

body.theme-dark.mushaf-mode .mushaf-verse-inline:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

body.theme-night.mushaf-mode .mushaf-verse-inline:hover {
  background-color: rgba(255, 255, 255, 0.14);
}

/* ═══════════════════════════════════════
   KING FAHD COMPLEX QCF MUSHAF ENGINE
   — QCF V1 (QCF_P###), QCF V2 (QCF2###) & QCF V4 (QCF4_Hafs_##_W)
   All use .is-qcf-page — same layout engine
═══════════════════════════════════════ */
.mushaf-page.is-qcf-page {
  padding: 24px 26px 22px;
}

/* Page Font Design Badge (for Designers) */
.mushaf-page-font-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.18);
  color: var(--primary, #0284c7);
  padding: 3px 12px;
  border-radius: 20px;
  font-family: 'Thmanyah Sans', sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  margin-bottom: 12px;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.2s ease;
  align-self: center;
}

.mushaf-page-font-badge strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  direction: ltr;
  display: inline-block;
  color: var(--text-primary);
  background: var(--surface, #fff);
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-right: 3px;
}

body.theme-dark .mushaf-page-font-badge,
body.theme-night .mushaf-page-font-badge {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
}

body.theme-dark .mushaf-page-font-badge strong,
body.theme-night .mushaf-page-font-badge strong {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.15);
}

.qcf4-chunk {
  display: inline;
}

.is-qcf4-page .mushaf-text-block,
.is-qcf4-page .mushaf-verse-inline,
.is-qcf4-page .qcf4-chunk {
  direction: rtl !important;
  unicode-bidi: bidi-override !important;
}

.verse-flash {
  background-color: rgba(2, 132, 199, 0.22) !important;
  border-radius: 6px;
  transition: background-color 0.4s ease;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(70px);
  background: var(--bg-card, #ffffff);
  border: 1px solid rgba(2, 132, 199, 0.35);
  color: var(--primary, #0284c7);
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 0.86rem;
  font-weight: 700;
  font-family: 'Thmanyah Sans', sans-serif;
  display: flex;
  align-items: center;
  gap: 7px;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

body.theme-dark .toast,
body.theme-night .toast {
  background: #1e293b;
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.is-qcf-page .mushaf-text-block {
  direction: rtl;
  text-align: justify;
  text-align-last: center;
  line-height: 2.25;
  font-size: clamp(1.4rem, 3.1vw, 1.85rem);
  word-spacing: 0.05em;
  letter-spacing: 0;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

/* Page 1 (Al-Fatiha) & Page 2 (Al-Baqarah 1-5) centered Mushaf layout */
.is-qcf-page#page-1,
.is-qcf-page#page-2 {
  padding: 42px 30px 26px;
}

.is-qcf-page#page-1 .mushaf-text-block,
.is-qcf-page#page-2 .mushaf-text-block {
  text-align: center !important;
  text-align-last: center !important;
  line-height: 2.7;
  font-size: clamp(1.45rem, 3.3vw, 1.95rem);
  padding: 12px 14px;
}

.is-qcf-page .mushaf-verse-inline {
  display: inline;
  padding: 0;
  margin: 0;
  border-radius: 4px;
}

.is-qcf-page .mushaf-verse-inline:hover {
  background-color: rgba(2, 132, 199, 0.08);
}

/* Pulse Highlight for Searched Verse */
.mushaf-verse-inline.highlight-pulse {
  animation: pulseVerse 3.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  border-radius: 8px;
}

@keyframes pulseVerse {
  0% {
    background-color: rgba(2, 132, 199, 0.45);
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.25);
  }

  50% {
    background-color: rgba(2, 132, 199, 0.3);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
  }

  100% {
    background-color: transparent;
    box-shadow: none;
  }
}

.mushaf-verse-num {
  font-family: 'Thmanyah Sans', sans-serif;
  font-size: 0.8em;
  font-weight: 800;
  display: inline-block;
  margin: 0 4px;
  color: var(--text-muted);
}

body.theme-dark.mushaf-mode .mushaf-verse-num,
body.theme-night.mushaf-mode .mushaf-verse-num {
  color: #cbd5e1 !important;
}

/* Page Indicator Footer */
.mushaf-page-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.mushaf-page-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.mushaf-page-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.035);
  border: 1px solid var(--border);
  font-family: 'Thmanyah Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
}

body.theme-dark.mushaf-mode .mushaf-page-number-badge {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

body.theme-night.mushaf-mode .mushaf-page-number-badge {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #f8fafc;
}

/* ═══════════════════════════════════════
   RESPONSIVE MUSHAF ADJUSTMENTS (Desktop, Tablet & iPhone)
═══════════════════════════════════════ */
/* ═══════════════════════════════════════
   RESPONSIVE MUSHAF ADJUSTMENTS (Desktop, Tablet & iPhone)
═══════════════════════════════════════ */
@media (max-width: 768px) {
  .mushaf-site-header,
  .mushaf-mode .site-header {
    top: 10px;
    top: max(10px, env(safe-area-inset-top, 10px));
    padding: 0 10px;
  }

  .mushaf-header-bar,
  .mushaf-mode .header-inner {
    height: 48px;
    padding: 4px 6px;
    gap: 6px;
  }

  .mushaf-back-pill-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .mushaf-back-icon {
    width: 16px;
    height: 16px;
  }

  .mushaf-search-capsule,
  .mushaf-mode .header-search-capsule {
    height: 38px;
    padding: 0 10px;
    gap: 6px;
    max-width: 220px;
  }

  .mushaf-search-input,
  .mushaf-mode .header-search-input {
    font-size: 0.84rem;
  }

  .mushaf-nav-capsule {
    height: 38px;
  }

  .custom-select-trigger {
    padding: 0 10px 0 20px;
    font-size: 0.82rem;
  }

  .mheader-select-icon {
    left: 6px;
    width: 11px;
    height: 11px;
  }

  .mushaf-theme-toggle-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .mushaf-container {
    padding: 72px 8px 36px;
  }

  .mushaf-pages-wrapper {
    max-width: 680px;
    padding: 0 4px;
    gap: 22px;
  }

  .mushaf-page {
    padding: 24px 24px 20px;
    border-radius: 22px;
    min-height: auto;
  }

  .surah-name-wrapper {
    padding: 5px 22px;
    min-width: 170px;
    margin-bottom: 10px;
  }

  .surah-name-art {
    font-size: 1.75rem;
  }

  .basmala-text {
    font-size: 1.45rem;
    margin: 8px 0 12px;
  }

  .mushaf-text-block {
    font-size: clamp(1.28rem, 4.0vw, 1.55rem);
    line-height: 2.12;
    word-spacing: 0.02em;
    padding: 0 4px;
  }
}

@media (max-width: 480px) {
  .mushaf-site-header,
  .mushaf-mode .site-header {
    top: 8px;
    top: max(8px, env(safe-area-inset-top, 8px));
    padding: 0 6px;
  }

  .mushaf-header-bar,
  .mushaf-mode .header-inner {
    height: 44px;
    padding: 3px 5px;
    gap: 5px;
  }

  .mushaf-back-pill-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .mushaf-back-icon {
    width: 14px;
    height: 14px;
  }

  .mushaf-search-capsule,
  .mushaf-mode .header-search-capsule {
    height: 34px;
    padding: 0 8px;
    gap: 5px;
    min-width: 75px;
  }

  .mushaf-search-input,
  .mushaf-mode .header-search-input {
    font-size: 0.78rem;
  }

  .mushaf-nav-capsule {
    height: 34px;
  }

  .custom-select-trigger {
    padding: 0 6px 0 16px;
    font-size: 0.76rem;
  }

  .mheader-select-icon {
    left: 4px;
    width: 9px;
    height: 9px;
  }

  .mushaf-theme-toggle-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
  }

  .mushaf-container {
    padding: 62px 4px 30px;
    padding-top: max(62px, env(safe-area-inset-top, 62px));
  }

  .mushaf-pages-wrapper {
    padding: 0 2px;
    gap: 16px;
    width: 100%;
  }

  .mushaf-page {
    padding: 20px 20px 16px;
    border-radius: 18px;
    min-height: auto;
  }

  .surah-header-block {
    margin-top: 4px;
    margin-bottom: 12px;
  }

  .surah-name-wrapper {
    padding: 4px 16px;
    min-width: 135px;
    margin-bottom: 6px;
  }

  .surah-name-art {
    font-size: 1.5rem;
  }

  .basmala-text {
    font-size: 1.3rem;
    margin: 4px 0 10px;
  }

  .mushaf-text-block {
    font-size: clamp(1.24rem, 4.8vw, 1.44rem);
    line-height: 2.08;
    word-spacing: 0.01em;
    padding: 0 8px;
  }

  .mushaf-verse-inline {
    padding: 0 1px;
    margin: 0;
  }

  .mushaf-verse-num {
    font-size: 0.85em;
    margin: 0 1.5px;
  }

  .mushaf-page-indicator {
    margin-top: 14px;
    padding-top: 10px;
  }

  .mushaf-page-number-badge {
    padding: 2px 10px;
    font-size: 0.76rem;
  }
}

/* ═══════════════════════════════════════
   ANDROID SPECIFIC MUSHAF TUNING
   Maximizes line width and balances verse flow
═══════════════════════════════════════ */
html.is-android .mushaf-container {
  padding: 58px 4px 28px !important;
}

html.is-android .mushaf-pages-wrapper {
  padding: 0 2px !important;
  gap: 14px !important;
}

html.is-android .mushaf-page {
  padding: 16px 18px 14px !important;
  border-radius: 16px !important;
  min-height: auto !important;
}

html.is-android .surah-header-block {
  margin-top: 2px !important;
  margin-bottom: 10px !important;
}

html.is-android .surah-name-wrapper {
  padding: 3px 14px !important;
  min-width: 125px !important;
  margin-bottom: 4px !important;
}

html.is-android .surah-name-art {
  font-size: 1.45rem !important;
}

html.is-android .basmala-text {
  font-size: 1.25rem !important;
  margin: 4px 0 8px !important;
}

html.is-android .mushaf-text-block {
  font-size: 1.28rem !important;
  line-height: 2.05 !important;
  word-spacing: 0.01em !important;
  padding: 0 8px !important;
}

html.is-android .mushaf-verse-inline {
  padding: 0 1px !important;
  margin: 0 !important;
}

html.is-android .mushaf-verse-num {
  font-size: 0.82em !important;
  margin: 0 1px !important;
}

html.is-android .mushaf-page-indicator {
  margin-top: 12px !important;
  padding-top: 8px !important;
}

html.is-android .mushaf-page-number-badge {
  padding: 2px 9px !important;
  font-size: 0.72rem !important;
}