/* ==========================================================================
   بوابة القرآن الكريم المتطورة - Epsilon Quran Portal
   Design: Modern Islamic Minimalist with Emerald, Parchment, and Gold Accents
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&family=Amiri+Quran&family=Amiri:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --primary: #12372A;
  --primary-light: #1e523f;
  --accent-gold: #C5A059;
  --accent-gold-hover: #b08d48;
  --accent-gold-light: #f9f5ea;
  --accent-amber: #d97706;
  --bg-page: #f8faf9;
  --bg-card: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --quran-font-family: 'Amiri Quran', 'Amiri', 'Traditional Arabic', serif;
  --ui-font-family: 'Segoe UI', 'Tajawal', sans-serif;
  --ayah-highlight-bg: rgba(197, 160, 89, 0.15);
  --ayah-highlight-border: #C5A059;
  --ayah-font-size: 1.85rem;
  --ayah-line-height: 2.3;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

body, html, input, select, textarea, button {
  font-family: var(--ui-font-family);
}

/* Theme: Dark (ليلي كحلي فاخر) */
body.theme-dark {
  --primary: #34d399;
  --primary-light: #064e3b;
  --accent-gold: #e2ba6d;
  --accent-gold-hover: #f1cb80;
  --accent-gold-light: rgba(226, 186, 109, 0.12);
  --accent-amber: #fbbf24;
  --bg-page: #0d1412;
  --bg-card: #15221d;
  --text-main: #e6edea;
  --text-muted: #95a59f;
  --border-color: #21352d;
  --ayah-highlight-bg: rgba(226, 186, 109, 0.18);
  --ayah-highlight-border: #e2ba6d;
}

/* Theme: Sepia (ورقي هادئ للقراءة المريحة) */
body.theme-sepia {
  --primary: #3d3023;
  --primary-light: #5a4734;
  --accent-gold: #b37d36;
  --accent-gold-hover: #9c6c2e;
  --accent-gold-light: #f5eedf;
  --bg-page: #fbf6ec;
  --bg-card: #f5eee0;
  --text-main: #2d241c;
  --text-muted: #796c5f;
  --border-color: #e6dac6;
  --ayah-highlight-bg: rgba(179, 125, 54, 0.15);
  --ayah-highlight-border: #b37d36;
}

/* ==========================================================================
   Osclass Theme Integration: Header, Content & Footer Alignment
   ========================================================================== */
body.page-quran {
  background-color: var(--bg-page) !important;
  font-family: var(--ui-font-family) !important;
  margin: 0 !important;
  padding-top: 60px !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  padding-bottom: 0 !important;
}

body.page-quran .content {
  padding: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

body.page-quran #breadcrumbs,
body.page-quran #flashbox:empty,
body.page-quran section.promo,
body.page-quran #debug-mode {
  display: none !important;
}

@media (max-width: 767px) {
  body.page-quran #navi-bar {
    display: none !important;
  }
  body.page-quran {
    padding-bottom: 0 !important;
  }
}

body.page-quran {
  overflow-x: hidden;
}

.quran-site-wrapper *,
.quran-site-wrapper *::before,
.quran-site-wrapper *::after,
.audio-player-fixed,
.audio-player-fixed *,
.modal-overlay,
.modal-overlay * {
  box-sizing: border-box;
}

.quran-site-wrapper {
  background-color: var(--bg-page);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  min-height: auto;
  position: relative;
  overflow-x: clip;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-page);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-gold);
  border-radius: 4px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.quran-header,
.quran-site-wrapper .quran-header {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  display: block !important;
  background: var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  border-bottom: 1px solid var(--border-color);
  z-index: 50;
}

body.theme-dark .quran-header {
  background: #15221d;
  color: #e6edea;
  border-bottom-color: #21352d;
}

body.theme-sepia .quran-header {
  background: #f5eee0;
  color: #2d241c;
  border-bottom-color: #e6dac6;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  max-width: 1400px;
  margin: 0 auto;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-gold), #8a6a2a);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.brand-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--accent-gold);
  font-weight: 600;
}

.header-right-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-switcher-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Language Switcher (AR / EN / TR) */
.lang-switcher-group {
  display: flex;
  align-items: center;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2px 3px;
  gap: 3px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  line-height: 1.2;
}

.lang-btn:hover {
  color: var(--text-main);
}

.lang-btn.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

body.theme-dark .lang-btn.active {
  background: var(--accent-gold) !important;
  color: #121212 !important;
}

/* Ayah Translation Block in Cards View */
.ayah-translation-text {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text-main);
  margin-top: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  text-align: left;
  direction: ltr;
}

.ayah-translation-text.en-trans {
  background: rgba(2, 132, 199, 0.06);
  border-left: 3.5px solid #0284c7;
}

.ayah-translation-text.tr-trans {
  background: rgba(16, 185, 129, 0.06);
  border-left: 3.5px solid #10b981;
}

.ayah-trans-label {
  font-size: 0.76rem;
  font-weight: 800;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ayah-translation-text.en-trans .ayah-trans-label {
  color: #0284c7;
}
.ayah-translation-text.tr-trans .ayah-trans-label {
  color: #059669;
}

.btn-icon {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 15px;
}

body.theme-dark .btn-icon {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-icon:hover {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

.btn-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 14px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

body.theme-dark .btn-pill {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-pill:hover, .btn-pill.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px rgba(18, 55, 42, 0.25);
  transform: translateY(-1.5px);
}

/* Individual vibrant subnav pill styles */
.subnav-pill-topics {
  border-color: #059669 !important;
  color: #047857 !important;
  background: #ecfdf5 !important;
  font-weight: 700 !important;
}
.subnav-pill-topics:hover, .subnav-pill-topics.active {
  background: linear-gradient(135deg, #059669, #047857) !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35) !important;
}

.subnav-pill-concordance {
  border-color: #d97706 !important;
  color: #b45309 !important;
  background: #fffbeb !important;
  font-weight: 700 !important;
}
.subnav-pill-concordance:hover, .subnav-pill-concordance.active {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  color: #ffffff !important;
  border-color: #b45309 !important;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35) !important;
}

.subnav-pill-mutashabihat {
  border-color: #10b981 !important;
  color: #065f46 !important;
  background: #f0fdf4 !important;
  font-weight: 700 !important;
}
.subnav-pill-mutashabihat:hover, .subnav-pill-mutashabihat.active {
  background: linear-gradient(135deg, #10b981, #047857) !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35) !important;
}

.subnav-pill-miracles {
  border-color: #0284c7 !important;
  color: #0369a1 !important;
  background: #f0f9ff !important;
  font-weight: 700 !important;
}
.subnav-pill-miracles:hover, .subnav-pill-miracles.active {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35) !important;
}

.subnav-pill-admin {
  border-color: #f59e0b !important;
  color: #b45309 !important;
  background: #fffbeb !important;
  font-weight: 700 !important;
}
.subnav-pill-admin:hover, .subnav-pill-admin.active {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #ffffff !important;
  border-color: #d97706 !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35) !important;
}

.subnav-pill-bookmarks {
  border-color: #e11d48 !important;
  color: #be123c !important;
  background: #fff1f2 !important;
  font-weight: 700 !important;
}
.subnav-pill-bookmarks:hover, .subnav-pill-bookmarks.active {
  background: linear-gradient(135deg, #e11d48, #be123c) !important;
  color: #ffffff !important;
  border-color: #be123c !important;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.35) !important;
}

/* Dark mode overrides for subnav pills */
body.theme-dark .subnav-pill-topics {
  background: rgba(5, 150, 105, 0.18) !important;
  color: #34d399 !important;
  border-color: rgba(5, 150, 105, 0.4) !important;
}
body.theme-dark .subnav-pill-concordance {
  background: rgba(217, 119, 6, 0.18) !important;
  color: #fbbf24 !important;
  border-color: rgba(217, 119, 6, 0.4) !important;
}
body.theme-dark .subnav-pill-mutashabihat {
  background: rgba(16, 185, 129, 0.18) !important;
  color: #6ee7b7 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}
body.theme-dark .subnav-pill-miracles {
  background: rgba(2, 132, 199, 0.18) !important;
  color: #38bdf8 !important;
  border-color: rgba(2, 132, 199, 0.4) !important;
}
body.theme-dark .subnav-pill-admin {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
}
body.theme-dark .subnav-pill-bookmarks {
  background: rgba(225, 29, 72, 0.18) !important;
  color: #fda4af !important;
  border-color: rgba(225, 29, 72, 0.4) !important;
}

.btn-pill.tourist-btn {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  color: #fff !important;
  border-color: #f59e0b !important;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}
.btn-pill.tourist-btn:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #fff !important;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35) !important;
}

/* Secondary Tools Subnav Strip */
.quran-subnav-strip {
  background: var(--bg-page);
  border-top: 1px solid var(--border-color);
  padding: 8px 24px;
}

.subnav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 2px;
}
.subnav-container::-webkit-scrollbar {
  height: 4px;
}
.subnav-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* Feature Tabs Bar */
.features-bar {
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 20px;
  overflow-x: auto;
  white-space: nowrap;
}

.features-container {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ==========================================================================
   Surah Selector & Controls Bar
   ========================================================================== */
.controls-bar {
  background: var(--bg-card);
  border-bottom: 1.5px solid var(--border-color);
  padding: 12px 24px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 60px;
  z-index: 90;
}

.controls-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.controls-pickers-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.controls-mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Global visibility for mode and tab labels (avoids "مصحف مصحف" repetition) */
.tab-label-short,
.mode-label-short,
.vtype-label-short {
  display: none !important;
}
.tab-label-full,
.mode-label-full,
.vtype-label-full {
  display: inline !important;
}

/* Hide redundant outer labels on desktop & mobile for a clean modern pill toolbar */
.surah-select-label,
.surah-picker-meta-inline {
  display: none !important;
}

/* Surah Select Group & Searchable Picker */
.surah-select-group {
  display: flex;
  align-items: center;
  width: 180px;
  min-width: 155px;
  max-width: 200px;
  flex: 0 0 auto;
  height: 42px;
  box-sizing: border-box;
}

.ayah-select-group {
  display: flex;
  align-items: center;
  width: 95px;
  min-width: 85px;
  max-width: 110px;
  flex: 0 0 auto;
  height: 42px;
  box-sizing: border-box;
}

.searchable-ayah-picker {
  position: relative;
  width: 100%;
}

.ayah-picker-btn {
  padding: 8px 12px !important;
}

.ayah-picker-dropdown {
  min-width: 220px !important;
  max-width: 280px !important;
  padding: 10px !important;
  right: auto !important;
  left: 0 !important;
}

.ayah-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 2px;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  scroll-behavior: auto !important;
}

.ayah-grid-item {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 2px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-main);
  user-select: none;
}

.ayah-grid-item:hover {
  background: var(--accent-gold-light);
  border-color: var(--accent-gold);
  color: #854d0e;
  transform: translateY(-1px);
}

.ayah-grid-item.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Page Picker Dropdown & Grid */
.page-select-group {
  display: flex;
  align-items: center;
  width: 90px;
  min-width: 80px;
  max-width: 105px;
  flex: 0 0 auto;
  height: 42px;
  box-sizing: border-box;
}

.searchable-page-picker {
  position: relative;
  width: 100%;
}

.page-picker-btn {
  padding: 8px 12px !important;
}

.page-picker-dropdown {
  min-width: 270px !important;
  max-width: 320px !important;
  padding: 10px !important;
  right: auto !important;
  left: 0 !important;
}

.page-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 2px;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  scroll-behavior: auto !important;
}

.page-grid-item {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 2px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.page-grid-item:hover {
  background: var(--accent-gold-light);
  border-color: var(--accent-gold);
  color: #854d0e;
  transform: scale(1.05);
}
.page-grid-item.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Juz & Hizb Pickers */
.juz-select-group,
.hizb-select-group {
  display: flex;
  align-items: center;
  width: 95px;
  min-width: 85px;
  max-width: 110px;
  flex: 0 0 auto;
  height: 42px;
  box-sizing: border-box;
}

.searchable-juz-picker,
.searchable-hizb-picker {
  position: relative;
  width: 100%;
}

.juz-picker-btn,
.hizb-picker-btn {
  padding: 8px 12px !important;
}

.juz-picker-dropdown,
.hizb-picker-dropdown {
  min-width: 270px !important;
  max-width: 330px !important;
  padding: 10px !important;
  right: auto !important;
  left: 0 !important;
}

.juz-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 2px;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
}

.hizb-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 2px;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
}

.juz-grid-item,
.hizb-grid-item {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 4px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-main);
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.juz-grid-item span.sub,
.hizb-grid-item span.sub {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
}

.juz-grid-item:hover,
.hizb-grid-item:hover {
  background: var(--accent-gold-light);
  border-color: var(--accent-gold);
  color: #854d0e;
  transform: translateY(-1px);
}

.juz-grid-item.active,
.hizb-grid-item.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.juz-grid-item.active span.sub,
.hizb-grid-item.active span.sub {
  color: rgba(255, 255, 255, 0.85);
}

.surah-picker-direct-ayah {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.18));
  border: 1.5px solid #10b981;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.12);
  transition: all 0.2s ease;
}

.surah-picker-direct-ayah:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.28));
  border-color: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.surah-select-label {
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.95rem;
  color: var(--text-main);
}

.searchable-surah-picker {
  position: relative;
  width: 100%;
}

.surah-picker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-page);
  border: 1.5px solid var(--border-color);
  border-radius: 25px;
  color: var(--text-main);
  font-family: var(--ui-font-family);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  height: 44px;
  box-sizing: border-box;
}

.surah-picker-btn:hover,
.surah-picker-btn.active {
  border-color: var(--accent-gold);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.2);
}

.surah-picker-icon {
  font-size: 1.15rem;
  color: var(--accent-gold);
}

.surah-picker-text {
  flex: 1;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.surah-picker-arrow {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.surah-picker-btn.active .surah-picker-arrow {
  transform: rotate(180deg);
}

.surah-picker-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 350px;
  max-width: 440px;
  background: var(--bg-card);
  border: 1.5px solid var(--accent-gold);
  border-radius: 14px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.16);
  z-index: 1000;
  padding: 12px;
  animation: fadeInDown 0.18s ease-out;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDownCenter {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.surah-search-box-inner {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-page);
  border: 1.5px solid var(--accent-gold) !important;
  border-radius: 10px;
  padding: 3px 12px;
  margin-bottom: 10px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}
.surah-search-box-inner:focus-within {
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.25);
}

.surah-search-icon {
  color: var(--accent-gold);
  font-size: 1.05rem;
  margin-inline-end: 8px;
  flex-shrink: 0;
}

.surah-picker-search-input {
  flex: 1;
  width: 100%;
  border: none !important;
  background: transparent !important;
  padding: 7px 4px !important;
  font-family: var(--ui-font-family);
  font-size: 0.92rem;
  color: var(--text-main);
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
}

.surah-search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
  border-radius: 50%;
}
.surah-search-clear:hover {
  color: #ef4444;
}

.surah-picker-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.picker-filter-btn {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.picker-filter-btn.active,
.picker-filter-btn:hover {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #1a1a1a;
  font-weight: 700;
}

.surah-picker-list {
  max-height: 290px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  scroll-behavior: auto !important;
}

.surah-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.surah-picker-item:hover {
  background: var(--accent-gold-light);
  border-color: rgba(197, 160, 89, 0.35);
}

.surah-picker-item.selected {
  background: var(--accent-gold-light);
  border-color: var(--accent-gold);
  box-shadow: 0 1px 3px rgba(197, 160, 89, 0.2);
}

.surah-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.surah-num-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  min-width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.surah-name-ar {
  font-size: 0.98rem;
  color: var(--text-main);
  font-family: var(--ui-font-family);
}

.surah-meta-tags {
  display: flex;
  align-items: center;
  gap: 6px;
}

.surah-type-badge {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 8px;
  background: var(--bg-page);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}
.surah-type-badge.meccan {
  color: #b45309;
  border-color: #fde68a;
  background: #fffbeb;
}
.surah-type-badge.medinan {
  color: #047857;
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.surah-ayahs-badge {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.custom-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--ui-font-family);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.custom-select:focus {
  border-color: var(--accent-gold);
}

.font-size-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  padding: 3px 8px;
  border-radius: 25px;
  border: 1.5px solid var(--border-color);
  height: 44px;
  box-sizing: border-box;
}

.font-size-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 4px 8px;
  font-weight: 800;
  font-size: 0.95rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.font-size-btn:hover {
  background: var(--accent-gold-light);
  color: var(--primary);
  transform: scale(1.05);
}
.font-size-btn:active {
  transform: scale(0.92);
}

.font-size-badge {
  padding: 3px 10px;
  min-width: 54px;
  text-align: center;
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--primary);
  background: rgba(18, 55, 42, 0.08);
  border-radius: 12px;
  cursor: pointer;
  direction: ltr !important;
  unicode-bidi: isolate;
  transition: all 0.2s ease;
  user-select: none;
}
.font-size-badge:hover {
  background: var(--accent-gold-light);
  color: var(--primary);
  transform: scale(1.03);
}
body.theme-dark .font-size-badge {
  color: var(--accent-gold);
  background: rgba(197, 160, 89, 0.15);
}

/* نافذة المعاينة المباشرة لحجم الخط (Live Font Size Preview Toast) */
.quran-font-live-toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  background: var(--bg-card);
  color: var(--text-main);
  border: 2px solid var(--accent-gold);
  border-radius: 18px;
  padding: 14px 20px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
  z-index: 100000;
  text-align: center;
  max-width: 90%;
  width: 320px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.2s;
  backdrop-filter: blur(10px);
}
.quran-font-live-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}
.font-toast-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
}
.font-toast-head strong {
  color: var(--accent-gold);
  font-size: 1.15rem;
}
.font-toast-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 600;
}
.font-toast-preview {
  margin: 12px 0 8px 0;
  font-family: var(--ayah-font-family);
  color: var(--primary);
  line-height: 1.8;
  padding: 10px 8px;
  background: rgba(18, 55, 42, 0.05);
  border-radius: 10px;
  border: 1.5px dashed var(--border-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: font-size 0.2s ease;
}
body.theme-dark .font-toast-preview {
  color: var(--accent-gold);
  background: rgba(197, 160, 89, 0.1);
}
.font-toast-tip {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Redesigned Premium Search Bar */
.search-box-wrapper {
  position: relative;
  flex: 1 1 240px;
  min-width: 220px;
  max-width: 440px;
  margin: 0 4px;
}

.search-input-field-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--bg-page);
  border: 1.5px solid var(--accent-gold);
  border-radius: 30px;
  padding: 3px 6px 3px 6px;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  height: 44px;
  box-sizing: border-box;
}

.search-input-field-group:focus-within {
  box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.25), 0 2px 8px rgba(0, 0, 0, 0.08);
  background: var(--bg-card);
}

.search-icon-inside {
  color: var(--accent-gold);
  font-size: 1.15rem;
  margin-right: 4px;
  margin-left: 8px;
  display: flex;
  align-items: center;
  pointer-events: none;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  width: 100%;
  border: none !important;
  background: transparent !important;
  padding: 8px 6px !important;
  color: var(--text-main);
  font-family: var(--ui-font-family);
  font-size: 0.94rem;
  outline: none !important;
  box-shadow: none !important;
}

.search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.95rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.search-clear-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.search-submit-btn {
  background: linear-gradient(135deg, #1b3a2f, #0d5c3a);
  color: #ffffff;
  border: none;
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--ui-font-family);
  box-shadow: 0 2px 6px rgba(13, 92, 58, 0.25);
  flex-shrink: 0;
}
.search-submit-btn:hover {
  background: linear-gradient(135deg, #c5a059, #9b7936);
  color: #1a1a1a;
  box-shadow: 0 4px 10px rgba(197, 160, 89, 0.35);
  transform: translateY(-1px);
}

.search-toolbar-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.search-tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0 10px;
  border-radius: 14px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--ui-font-family);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  box-sizing: border-box;
  line-height: 1;
}
.search-tab-btn:hover {
  border-color: var(--accent-gold);
  color: var(--text-main);
}
.search-tab-btn.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #1a1a1a;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(197, 160, 89, 0.3);
}

.search-scope-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  height: 26px;
  line-height: 26px;
  margin-left: 2px;
}

/* Playback Mode Button (متابعة مستمرة / تكرار الآية / آية واحدة وتوقف) */
.playback-mode-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  height: 32px;
  padding: 0 10px;
  border-radius: 16px;
  font-size: 0.76rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: var(--ui-font-family);
  user-select: none;
}

.playback-mode-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: var(--accent-gold);
}

.playback-mode-btn.mode-repeat {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
}

.playback-mode-btn.mode-single {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  color: #ffffff !important;
  border-color: #f59e0b !important;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
}

/* سورة التوبة - استعاذة بلا بسملة */
.tawbah-istiadha-banner {
  text-align: center;
  margin: 14px 0 18px 0;
  padding: 12px 16px;
  background: rgba(197, 160, 89, 0.08);
  border: 1px dashed var(--accent-gold);
  border-radius: 12px;
}
.tawbah-istiadha-banner .istiadha-text {
  font-family: var(--quran-font-family);
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--accent-gold);
}
.tawbah-istiadha-banner .istiadha-hint {
  font-family: var(--ui-font-family);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.speed-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff !important;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  border-radius: 16px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  height: 32px;
  font-size: 0.78rem;
  line-height: 1;
  font-family: var(--ui-font-family);
  white-space: nowrap;
}

.speed-btn:hover {
  border-color: var(--accent-gold);
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff !important;
}

.speed-btn.speed-active {
  background: linear-gradient(135deg, #c5a059, #b38c45) !important;
  color: #12372A !important;
  border-color: #e2ba6d !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 8px rgba(197, 160, 89, 0.45);
}

.speed-btn.speed-active:hover {
  background: linear-gradient(135deg, #d4ae65, #c5a059) !important;
  color: #12372A !important;
  border-color: #f3d492 !important;
}

/* Floating Toast Notification */
.quran-toast-notification {
  position: fixed;
  bottom: 95px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(18, 55, 42, 0.96);
  color: #ffffff;
  border: 1.5px solid var(--accent-gold);
  border-radius: 25px;
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  z-index: 100000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--ui-font-family);
  white-space: nowrap;
}

.quran-toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 769px) and (max-width: 992px) {
  .controls-container {
    flex-wrap: wrap;
    align-items: center;
  }
  .surah-select-group,
  .search-box-wrapper {
    max-width: 100%;
  }
}

.quran-search-highlight {
  display: inline !important;
  color: #c2410c !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  font-weight: 700 !important;
  line-height: inherit !important;
  font-family: inherit !important;
  text-decoration: none !important;
  vertical-align: baseline !important;
}

body.theme-dark .quran-search-highlight {
  color: #fbbf24 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.theme-sepia .quran-search-highlight {
  color: #9a3412 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.search-concordance-card {
  background: linear-gradient(135deg, rgba(197, 160, 89, 0.12), rgba(16, 94, 73, 0.08));
  border-bottom: 2px solid var(--accent-gold);
  padding: 14px 18px;
}
.concordance-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.badge-gold {
  background: var(--accent-gold);
  color: #000;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 10px;
}
.concordance-freq {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 700;
}
body.theme-dark .concordance-freq {
  color: var(--accent-gold);
}
.concordance-details {
  font-size: 0.86rem;
  color: var(--text-main);
  line-height: 1.6;
}
.concordance-loc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-layout {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 20px auto 14px auto;
  padding: 0 20px;
}

/* Surah Header Card */
.surah-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 25px;
  border-top: 4px solid var(--accent-gold);
}

.surah-title-ar {
  font-family: var(--quran-font-family);
  font-size: 2.4rem;
  color: var(--primary);
  margin-bottom: 8px;
  font-weight: bold;
}
body.theme-dark .surah-title-ar {
  color: var(--accent-gold);
}

.surah-meta-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--accent-gold-light);
  color: var(--primary);
  border: 1px solid rgba(197, 160, 89, 0.3);
}

.bismillah-text {
  font-family: var(--quran-font-family);
  font-size: 2rem;
  color: var(--primary);
  margin: 20px 0 10px 0;
  text-align: center;
  letter-spacing: 1px;
  transition: all 0.3s ease;
}
.bismillah-text.active-bismillah-playing {
  color: var(--accent-gold) !important;
  text-shadow: 0 0 18px rgba(197, 160, 89, 0.6);
  transform: scale(1.05);
}
body.theme-dark .bismillah-text {
  color: var(--accent-gold);
}

/* ==========================================================================
   Ayahs Display & Reading Modes
   ========================================================================== */
.ayahs-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ayah-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
  position: relative;
}

.ayah-card:hover {
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-md);
}

.ayah-card.active-playing {
  background-color: var(--ayah-highlight-bg);
  border-color: var(--ayah-highlight-border);
  box-shadow: 0 0 18px rgba(197, 160, 89, 0.25);
  transform: scale(1.006);
}

.ayah-main-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.ayah-text {
  font-family: var(--quran-font-family);
  font-size: var(--ayah-font-size);
  line-height: var(--ayah-line-height);
  color: var(--text-main);
  flex: 1;
  text-align: justify;
  text-justify: inter-word;
}

/* Ayah End Number Medallion */
.ayah-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  background: var(--accent-gold-light);
  color: var(--primary);
  font-family: var(--ui-font-family);
  font-size: 0.85rem;
  font-weight: 800;
  margin: 0 8px;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
body.theme-dark .ayah-number-badge {
  color: var(--accent-gold);
  background: #192722;
}

/* Ayah Toolbar Actions */
.ayah-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
  flex-wrap: wrap;
}

.action-btn-sm {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--ui-font-family);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.action-btn-sm:hover {
  background: var(--accent-gold-light);
  color: var(--primary);
  border-color: var(--accent-gold);
}

.action-btn-sm.asbab-btn-active {
  background: #fef3c7;
  color: #92400e;
  border-color: #f59e0b;
  font-weight: 700;
}
body.theme-dark .action-btn-sm.asbab-btn-active {
  background: #3b2807;
  color: #fde68a;
  border-color: #b45309;
}

/* Ayah Listen/Pause Toggle Button in Cards & Mushaf Popover */
.action-btn-sm.ayah-listen-btn {
  font-weight: 600;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn-sm.ayah-listen-btn.is-playing {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.42) !important;
  font-weight: 700 !important;
  animation: pulseListenPlaying 1.8s infinite ease-in-out;
}

.action-btn-sm.ayah-listen-btn.is-playing:hover {
  background: linear-gradient(135deg, #059669, #047857) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

@keyframes pulseListenPlaying {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* ==========================================================================
   شريط التنقل بين السور في نهاية نمط البطاقات
   ========================================================================== */
.cards-surah-nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--accent-gold);
  border-radius: 18px;
  padding: 16px 20px;
  margin: 32px 0 24px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  position: relative;
  transition: all 0.3s ease;
}

body.theme-dark .cards-surah-nav-footer {
  background: var(--bg-card);
  border-color: rgba(197, 160, 89, 0.45);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.cards-nav-side {
  flex: 1;
  display: flex;
}

.cards-nav-prev {
  justify-content: flex-start;
}

.cards-nav-next {
  justify-content: flex-end;
}

.cards-nav-pill {
  background: var(--accent-gold-light);
  color: #854d0e;
  border: 1px solid rgba(197, 160, 89, 0.5);
  border-radius: 24px;
  padding: 8px 18px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
  text-decoration: none;
  max-width: 100%;
}

body.theme-dark .cards-nav-pill {
  background: rgba(197, 160, 89, 0.15);
  color: #fef08a;
  border-color: rgba(197, 160, 89, 0.4);
}

.cards-nav-pill:hover {
  background: var(--accent-gold);
  color: #ffffff;
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.3);
}

body.theme-dark .cards-nav-pill:hover {
  background: var(--accent-gold);
  color: #121212;
}

.cards-nav-pill .nav-arrow {
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
}

.cards-nav-pill .nav-label-prefix {
  font-size: 0.8rem;
  opacity: 0.82;
  font-weight: 600;
}

.cards-nav-pill .nav-surah-name {
  font-size: 0.95rem;
  font-weight: 800;
}

@media (max-width: 680px) {
  .cards-surah-nav-footer {
    flex-wrap: nowrap;
    padding: 12px 14px;
    gap: 10px;
  }
  .cards-nav-side {
    flex: 1 1 50%;
  }
  .cards-nav-pill {
    width: 100%;
    justify-content: center;
    padding: 9px 10px;
    font-size: 0.85rem;
    gap: 5px;
  }
  .cards-nav-pill .nav-label-prefix {
    display: none;
  }
  .cards-nav-pill .nav-surah-name {
    font-size: 0.88rem;
  }
}

/* Playback Mode Selection Modal Cards */
.playback-modes-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.playback-mode-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: right;
  direction: rtl;
  user-select: none;
}

.playback-mode-card:hover {
  border-color: var(--accent-gold);
  background: var(--accent-gold-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.playback-mode-card.active-mode {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.2);
}

body.theme-dark .playback-mode-card.active-mode {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.18);
}

.playback-mode-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  background: rgba(197, 160, 89, 0.15);
  border: 1px solid rgba(197, 160, 89, 0.3);
  flex-shrink: 0;
  margin-top: 2px;
}

.playback-mode-card.active-mode .playback-mode-icon-box {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.45);
}

.playback-mode-info {
  flex: 1;
  min-width: 0;
}

.playback-mode-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.playback-mode-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.playback-mode-badge {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-muted);
}

.playback-mode-card.active-mode .playback-mode-badge {
  background: #10b981;
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

.playback-mode-desc {
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.65;
  margin: 0 0 6px 0;
}

.playback-mode-recommend {
  font-size: 0.82rem;
  color: var(--accent-gold);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

body.theme-dark .playback-mode-recommend {
  color: #fde68a;
}

/* Tafsir Subtext Display */
.ayah-subtext-container {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  border-right: 3px solid var(--accent-gold);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-main);
  display: none;
}
.ayah-subtext-container.show {
  display: block;
}

/* ==========================================================================
   Fixed Audio Player Bar (ثابت دائماً في أسفل الشاشة بنعومة تامة)
   ========================================================================== */
.audio-player-fixed {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background: linear-gradient(180deg, #185a37 0%, #114227 100%);
  color: #fff;
  border-top: 2px solid #d4af37;
  padding: 12px 20px;
  z-index: 99999;
  box-shadow: 0 -4px 22px rgba(17, 66, 39, 0.45);
  backdrop-filter: blur(8px);
}

/* توفير مساحة سفلية كافية في الفوتر لضمان عدم حجب أي رابط أو نص بواسطة المشغل */
footer,
#footer,
.footer-wrap {
  padding-bottom: 115px !important;
}

/* Osmanle Feedback Box Integration on Quran Page */
body.page-quran .feedback-static-page-wrap {
  max-width: 960px !important;
  margin: 14px auto 20px auto !important;
  padding: 0 16px !important;
  clear: both !important;
  position: relative !important;
  z-index: 10 !important;
}

body.page-quran .feedback-static-page-wrap .osmanle-feedback-box {
  margin: 0 auto !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

@media (max-width: 768px) {
  body.page-quran .feedback-static-page-wrap {
    margin: 10px auto 16px auto !important;
    padding: 0 8px !important;
  }
}

.player-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.reciter-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  background: #254a3a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--accent-gold);
}

.player-labels {
  display: flex;
  flex-direction: column;
}

.player-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.player-reciter-name {
  font-size: 0.78rem;
  color: var(--accent-gold);
}

.player-controls-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.play-main-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: #12372A;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  box-shadow: 0 2px 10px rgba(197, 160, 89, 0.4);
}
.play-main-btn:hover {
  transform: scale(1.08);
  background: var(--accent-gold-hover);
}

.player-step-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.2s ease;
}
.player-step-btn:hover {
  color: var(--accent-gold);
  transform: scale(1.15);
}

.player-progress-section {
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gold);
  width: 0%;
  transition: width 0.1s linear;
}

.time-stamp {
  font-size: 0.75rem;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
  min-width: 42px;
}

.player-extra-options {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-select {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: var(--ui-font-family);
  outline: none;
  cursor: pointer;
}
.player-select option {
  background: var(--primary);
  color: #fff;
}

.player-toggle-btn {
  display: none;
}

.speed-btn {
  direction: ltr !important;
  unicode-bidi: isolate;
  min-width: 42px;
  text-align: center;
  transition: all 0.2s ease;
}

.speed-btn.speed-active {
  background: var(--accent-gold) !important;
  color: #12372A !important;
  border-color: var(--accent-gold) !important;
  font-weight: 800 !important;
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.5);
}

/* ==========================================================================
   Modals & Drawers Performance & Smooth Scrolling Fix
   ========================================================================== */

/* إلغاء الـ smooth-scroll البطيء في النوافذ ومكونات القرآن ليكون السحب والتمرير فوري، طبيعي وسريع */
html,
body,
.quran-site-wrapper,
.modal-overlay,
.modal-card,
.modal-body,
.surah-picker-list,
.ayah-picker-grid,
.search-results-dropdown,
.concordance-results,
.mutashabihat-results {
  scroll-behavior: auto !important;
}

/* تثبيت خلفية الصفحة ومنع تحركها أو تدحرجها البطيء أثناء فتح أي بوب اب */
body.quran-modal-open {
  overflow: hidden !important;
  touch-action: none;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 16, 22, 0.78);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.16s ease-out, visibility 0.16s ease-out;
  transform: translateZ(0);
  will-change: opacity;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 45px rgba(0, 0, 0, 0.35);
  max-width: 850px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box !important;
  border: 1px solid var(--border-color);
  transform: translateZ(0);
  will-change: transform, opacity;
  animation: modalFastPop 0.18s cubic-bezier(0, 0, 0.2, 1);
}

@keyframes modalFastPop {
  from {
    transform: scale(0.96) translateY(8px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 15px 22px;
  background: linear-gradient(135deg, #12372A 0%, #1a523e 55%, #12372A 100%) !important;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2.5px solid var(--accent-gold) !important;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(18, 55, 42, 0.2);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff !important;
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-back-btn {
  background: rgba(197, 160, 89, 0.22);
  color: #ffd875;
  border: 1.5px solid var(--accent-gold);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.modal-back-btn:hover {
  background: var(--accent-gold);
  color: #1a1a1a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.45);
}
.modal-back-btn:active {
  transform: translateY(0);
}
.modal-nav-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(27, 58, 47, 0.08), rgba(197, 160, 89, 0.16));
  border: 1.5px solid var(--accent-gold);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-nav-banner-btn {
  background: var(--accent-gold);
  color: #1a1a1a;
  font-weight: 700;
  border: none;
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.modal-nav-banner-btn:hover {
  background: #e6be6d;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(197, 160, 89, 0.35);
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.35) !important;
  color: #ffffff !important;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.modal-close-btn:hover {
  background: #dc2626 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  transform: rotate(90deg) scale(1.05);
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  overflow-x: hidden !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  flex: 1;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  scroll-behavior: auto !important;
}

.modal-body::-webkit-scrollbar {
  width: 6px !important;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent !important;
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(197, 160, 89, 0.45) !important;
  border-radius: 4px !important;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold) !important;
}

.modal-body h1,
.modal-body h2,
.modal-body h3,
.modal-body h4,
.modal-body h5,
.modal-body h6 {
  color: var(--primary) !important;
  font-family: var(--ui-font-family) !important;
}
body.theme-dark .modal-body h1,
body.theme-dark .modal-body h2,
body.theme-dark .modal-body h3,
body.theme-dark .modal-body h4,
body.theme-dark .modal-body h5,
body.theme-dark .modal-body h6 {
  color: var(--accent-gold) !important;
}

/* Tabs inside Modal */
.modal-tab-nav {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
  gap: 10px;
  overflow-x: auto;
}

.modal-tab-btn {
  background: none;
  border: none;
  padding: 10px 16px;
  color: var(--text-muted);
  font-family: var(--ui-font-family);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.modal-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--accent-gold);
}
body.theme-dark .modal-tab-btn.active {
  color: var(--accent-gold);
}

/* Modal Buttons - Unified High Contrast & Crisp Styles */
.modal-btn-primary {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  border: 1px solid #047857 !important;
  border-radius: 20px !important;
  padding: 6px 16px !important;
  font-size: 0.84rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25) !important;
  text-decoration: none !important;
  font-family: var(--ui-font-family) !important;
  line-height: 1.4 !important;
}

.modal-btn-primary:hover {
  background: linear-gradient(135deg, #059669, #047857) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.35) !important;
  color: #ffffff !important;
}

.modal-btn-outline {
  background: var(--bg-card) !important;
  color: var(--primary) !important;
  border: 1.5px solid var(--accent-gold) !important;
  border-radius: 20px !important;
  padding: 6px 16px !important;
  font-size: 0.84rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  font-family: var(--ui-font-family) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  text-decoration: none !important;
  line-height: 1.4 !important;
}

.modal-btn-outline:hover {
  background: var(--accent-gold-light) !important;
  border-color: var(--accent-gold) !important;
  color: var(--primary) !important;
  transform: translateY(-1px) !important;
}

body.theme-dark .modal-btn-outline {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--accent-gold) !important;
  border-color: var(--accent-gold) !important;
}

body.theme-dark .modal-btn-outline:hover {
  background: rgba(197, 160, 89, 0.15) !important;
}

/* Universal high-contrast safety rule for all buttons in modal body */
.modal-body button[style*="var(--primary)"],
.modal-body .btn-pill[style*="var(--primary)"],
.modal-body button[style*="#12372A"],
.modal-body button[style*="#1b3a2f"] {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  font-weight: 700 !important;
}

.modal-body .btn-pill {
  font-family: var(--ui-font-family);
  font-size: 0.84rem;
}

/* Topic Verse Card (الموسوعة الموضوعية) */
.topic-verse-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border-right: 4px solid var(--accent-gold);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.topic-verse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 12px;
  flex-wrap: nowrap;
}

.topic-verse-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex-shrink: 0;
}

.topic-verse-surah {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.25;
}
body.theme-dark .topic-verse-surah {
  color: var(--accent-gold);
}

.topic-verse-ayah {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-amber);
  line-height: 1.2;
}

.topic-verse-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.topic-action-btn {
  background: var(--bg-card);
  color: var(--primary);
  border: 1.5px solid var(--accent-gold);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: var(--ui-font-family);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  user-select: none;
}

.topic-action-btn:hover {
  background: var(--accent-gold);
  color: #1a1a1a;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(197, 160, 89, 0.3);
}

.topic-action-btn:active {
  transform: translateY(0);
}

body.theme-dark .topic-action-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}
body.theme-dark .topic-action-btn:hover {
  background: var(--accent-gold);
  color: #121212;
}

.topic-verse-text {
  font-family: var(--quran-font-family);
  font-size: 1.3rem;
  line-height: 2;
  color: var(--text-main);
  padding-top: 4px;
}

/* Tafsir Modal Ayah Box */
.modal-tafsir-ayah-box {
  font-family: var(--quran-font-family);
  font-size: 1.45rem;
  line-height: 2.1;
  background: var(--bg-page);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  border-right: 4px solid var(--accent-gold);
  margin-bottom: 16px;
  color: var(--text-main);
  text-align: center;
}

/* Scientific Miracles Filter Grid (موسوعة الإعجاز العلمي) */
.miracle-filter-grid,
.mutashabihat-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.miracle-filter-grid .btn-pill,
.mutashabihat-filter-grid .btn-pill {
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  user-select: none;
  font-family: var(--ui-font-family);
  line-height: 1.3;
}

.miracle-filter-grid .btn-pill:hover,
.mutashabihat-filter-grid .btn-pill:hover {
  border-color: var(--accent-gold);
  background: var(--accent-gold-light);
  transform: translateY(-1px);
}

.miracle-filter-grid .btn-pill.active,
.mutashabihat-filter-grid .btn-pill.active {
  background: #185a37 !important;
  color: #ffffff !important;
  border-color: #185a37 !important;
  box-shadow: 0 2px 8px rgba(24, 90, 55, 0.25) !important;
}

.miracle-filter-grid .btn-pill .pill-badge,
.mutashabihat-filter-grid .btn-pill .pill-badge {
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.88;
}

body.theme-dark .miracle-filter-grid .btn-pill,
body.theme-dark .mutashabihat-filter-grid .btn-pill {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}
body.theme-dark .miracle-filter-grid .btn-pill:hover,
body.theme-dark .mutashabihat-filter-grid .btn-pill:hover {
  background: rgba(226, 186, 109, 0.15);
  border-color: var(--accent-gold);
}
body.theme-dark .miracle-filter-grid .btn-pill.active,
body.theme-dark .mutashabihat-filter-grid .btn-pill.active {
  background: var(--accent-gold) !important;
  color: #121212 !important;
  border-color: var(--accent-gold) !important;
}

/* ==========================================================================
   المعجم المفهرس القرآني - Concordance Styling
   ========================================================================== */
.concordance-search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.concordance-search-input {
  flex: 1;
  min-width: 240px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--accent-gold);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
}

.concordance-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 55, 42, 0.1);
}

.concordance-search-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: 1px solid #047857;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
  transition: all 0.2s ease;
  font-family: var(--ui-font-family);
}

.concordance-search-btn:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}

.concordance-examples-wrapper {
  margin-bottom: 16px;
}

.concordance-examples-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
  display: block;
}

.concordance-examples-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.concordance-example-pill {
  font-size: 0.78rem !important;
  padding: 4px 12px !important;
  border-radius: 16px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  cursor: pointer !important;
  transition: all 0.18s ease !important;
}

.concordance-example-pill:hover {
  border-color: var(--accent-gold) !important;
  background: var(--accent-gold-light) !important;
  color: var(--primary) !important;
}

/* بطاقة الإحصائية الرئيسية للفظ المعجمي */
.concordance-stat-card {
  background: linear-gradient(135deg, #fbfdfc 0%, #fcfaf5 100%);
  border: 1.5px solid var(--accent-gold);
  border-right: 5px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(18, 55, 42, 0.05);
}

.concordance-stat-header {
  margin-bottom: 8px;
}

.concordance-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-gold-light);
  color: #854d0e;
  border: 1px solid rgba(197, 160, 89, 0.4);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 3px 12px;
  border-radius: 20px;
}

.concordance-stat-headline {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.concordance-keyword {
  color: #d97706;
  font-weight: 900;
}

.concordance-count-pill {
  display: inline-block;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 1px 8px;
  font-weight: 800;
  margin: 0 3px;
}

.concordance-stat-sub {
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.7;
  margin-bottom: 10px;
}

.concordance-stat-locs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(197, 160, 89, 0.35);
}

.concordance-loc-chip {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.concordance-surahs-breakdown {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.concordance-breakdown-title {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.92rem;
  margin-bottom: 10px;
}

.concordance-surahs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.concordance-surah-chip {
  font-size: 0.8rem;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 12px;
  color: var(--text-main);
}

.concordance-ayahs-header {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.96rem;
  margin-bottom: 12px;
}

.concordance-ayahs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding-left: 4px;
}

/* Dark mode for Concordance */
body.theme-dark .concordance-stat-card {
  background: linear-gradient(135deg, #15221d 0%, #1a2c25 100%);
  border-color: rgba(226, 186, 109, 0.4);
  border-right-color: var(--accent-gold);
}
body.theme-dark .concordance-stat-badge {
  background: rgba(226, 186, 109, 0.15);
  color: var(--accent-gold);
  border-color: rgba(226, 186, 109, 0.3);
}
body.theme-dark .concordance-stat-headline {
  color: var(--accent-gold);
}
body.theme-dark .concordance-keyword {
  color: #ffd875;
}
body.theme-dark .concordance-loc-chip,
body.theme-dark .concordance-surah-chip {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

/* Gematria Calculator Styles */
.gematria-box {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.gematria-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.stat-metric-card {
  background: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-gold);
  line-height: 1.1;
  margin: 6px 0;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Letter frequency bars */
.letters-freq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
  gap: 8px;
  margin-top: 15px;
}

.letter-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  transition: transform 0.15s ease;
}
.letter-cell:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

.letter-char {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--primary);
}
body.theme-dark .letter-char {
  color: var(--accent-gold);
}

.letter-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Mutashabihat Side-by-Side */
.mutashabih-card {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.mut-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
body.theme-dark .mut-title {
  color: var(--accent-gold);
}

.mut-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
  margin-bottom: 14px;
}

.mut-verse-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  position: relative;
}

.mut-verse-text {
  font-family: var(--quran-font-family);
  font-size: 1.25rem;
  line-height: 1.9;
  margin-bottom: 8px;
}

.mut-highlight {
  background: rgba(197, 160, 89, 0.18);
  color: #92400e;
  border-bottom: 2.5px solid #c5a059;
  padding: 1px 6px 3px 6px;
  margin: 0 2px;
  border-radius: 4px;
  font-weight: 700;
  display: inline;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  box-shadow: 0 1px 3px rgba(197, 160, 89, 0.15);
  transition: all 0.2s ease;
}

.mut-highlight:hover {
  background: rgba(197, 160, 89, 0.3);
  border-bottom-color: #a47e3b;
}

body.theme-dark .mut-highlight {
  background: rgba(226, 186, 109, 0.24);
  color: #fde68a;
  border-bottom: 2.5px solid #e2ba6d;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

body.theme-dark .mut-highlight:hover {
  background: rgba(226, 186, 109, 0.36);
}

body.theme-sepia .mut-highlight {
  background: rgba(180, 83, 9, 0.16);
  color: #78350f;
  border-bottom: 2.5px solid #b45309;
}

/* Mutashabihat Navigation Tabs & Verse Header */
.mut-modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
}

.mut-modal-tabs .btn-pill {
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
  text-align: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.88rem;
  padding: 8px 12px;
  border-radius: 20px;
  cursor: pointer;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.mut-modal-tabs .btn-pill:hover {
  border-color: var(--accent-gold);
  background: var(--accent-gold-light);
}

.mut-modal-tabs .btn-pill.active {
  background: #185a37 !important;
  color: #ffffff !important;
  border-color: #185a37 !important;
  box-shadow: 0 2px 8px rgba(24, 90, 55, 0.25) !important;
}

body.theme-dark .mut-modal-tabs .btn-pill {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

body.theme-dark .mut-modal-tabs .btn-pill:hover {
  background: rgba(226, 186, 109, 0.15);
  border-color: var(--accent-gold);
}

body.theme-dark .mut-modal-tabs .btn-pill.active {
  background: var(--accent-gold) !important;
  color: #121212 !important;
  border-color: var(--accent-gold) !important;
}

.mut-verse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-color);
  flex-wrap: wrap;
}

.mut-verse-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: fit-content;
  flex-shrink: 0;
}

.mut-verse-surah {
  font-weight: 800;
  color: var(--primary);
  font-size: 0.98rem;
  white-space: nowrap;
}
body.theme-dark .mut-verse-surah {
  color: var(--accent-gold);
}

.mut-verse-ayah {
  font-size: 0.82rem;
  color: var(--accent-gold);
  font-weight: 700;
  white-space: nowrap;
}

.mut-verse-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Scientific Miracle Cards */
.miracle-card {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 20px;
  transition: all 0.2s ease;
}
.miracle-card:hover {
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-sm);
}

.miracle-field-badge {
  background: #dbeafe;
  color: #1e40af;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-block;
  margin-bottom: 8px;
}
body.theme-dark .miracle-field-badge {
  background: #1e3a8a;
  color: #bfdbfe;
}

.miracle-verse-quote {
  font-family: var(--quran-font-family);
  font-size: 1.35rem;
  line-height: 1.9;
  background: var(--bg-card);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border-right: 4px solid var(--accent-gold);
  margin: 12px 0;
}

/* Tourist Pack Styles */
.tourist-hero {
  background: linear-gradient(135deg, #f4fbf7 0%, #fdfbf5 100%);
  border: 1.5px solid rgba(197, 160, 89, 0.45);
  border-right: 5px solid var(--primary);
  padding: 20px 22px;
  border-radius: var(--radius-md);
  margin-bottom: 22px;
  box-shadow: 0 4px 15px rgba(18, 55, 42, 0.05);
  position: relative;
}

.tourist-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(18, 55, 42, 0.08);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: 20px;
  margin-bottom: 10px;
  border: 1px solid rgba(18, 55, 42, 0.15);
}

.tourist-hero h2 {
  color: var(--primary) !important;
  font-size: 1.35rem !important;
  font-weight: 800 !important;
  margin: 0 0 8px 0 !important;
  letter-spacing: -0.2px;
}

.tourist-hero p {
  color: var(--text-main) !important;
  font-size: 0.94rem !important;
  line-height: 1.75 !important;
  margin: 0 !important;
}

/* في الوضع الليلي */
body.theme-dark .tourist-hero {
  background: linear-gradient(135deg, #15221d 0%, #1a2c25 100%) !important;
  border-color: rgba(226, 186, 109, 0.35) !important;
  border-right-color: var(--accent-gold) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3) !important;
}
body.theme-dark .tourist-hero-badge {
  background: rgba(226, 186, 109, 0.15) !important;
  color: var(--accent-gold) !important;
  border-color: rgba(226, 186, 109, 0.3) !important;
}
body.theme-dark .tourist-hero h2 {
  color: var(--accent-gold) !important;
}
body.theme-dark .tourist-hero p {
  color: var(--text-main) !important;
}

/* في الوضع الورقي (Sepia) */
body.theme-sepia .tourist-hero {
  background: linear-gradient(135deg, #f5eee0 0%, #faf5ea 100%) !important;
  border-color: #d8c3a5 !important;
  border-right-color: var(--accent-gold) !important;
}
body.theme-sepia .tourist-hero-badge {
  background: rgba(179, 125, 54, 0.12) !important;
  color: var(--primary) !important;
}
body.theme-sepia .tourist-hero h2 {
  color: var(--primary) !important;
}
body.theme-sepia .tourist-hero p {
  color: var(--text-main) !important;
}

.tourist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.dua-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.dua-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
body.theme-dark .dua-title {
  color: var(--accent-gold);
}

.dua-verse {
  font-family: var(--quran-font-family);
  font-size: 1.25rem;
  line-height: 1.8;
  color: var(--accent-amber);
  margin-bottom: 10px;
}

/* Offline pack banner */
.offline-sync-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 20px;
}
body.theme-dark .offline-sync-box {
  background: #064e3b;
  border-color: #047857;
  color: #ecfdf5;
}

/* Search Results Popup */
.search-results-dropdown {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  background: var(--bg-card);
  border: 1.5px solid var(--accent-gold);
  border-radius: var(--radius-md);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.22);
  max-height: 520px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 9999 !important;
  margin-top: 6px !important;
  display: none;
}
@media (max-width: 640px) {
  .search-results-dropdown {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    max-height: 60vh !important;
    margin-top: 6px !important;
  }
}
.search-results-dropdown.show {
  display: block !important;
}

.search-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s ease;
}
.search-item:hover {
  background: var(--accent-gold-light);
}

.search-item-surah {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.search-item-text {
  font-family: var(--quran-font-family);
  font-size: 1.15rem;
  margin-top: 4px;
}

/* Responsive adjustments for Tablets */
@media (min-width: 769px) and (max-width: 900px) {
  .header-top {
    flex-wrap: wrap;
    gap: 12px;
  }
  .controls-container {
    flex-wrap: wrap;
    gap: 12px;
  }
  :root {
    --ayah-font-size: 1.6rem;
    --ayah-line-height: 2.5;
  }
}

/* ==========================================================================
   نمط القراءة ككتاب (صفحات المصحف الشريف المتصلة) - Mushaf Book View Mode
   ========================================================================== */

/* أزرار التبديل بين نمط البطاقات ونمط المصحف */
.reading-mode-toggle-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-page);
  border: 1.5px solid var(--border-color);
  border-radius: 25px;
  padding: 3px;
  height: 44px;
  box-sizing: border-box;
  gap: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.reading-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-family: var(--ui-font-family);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.reading-mode-btn:hover {
  color: var(--primary);
  background: rgba(197, 160, 89, 0.12);
}

.reading-mode-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

body.theme-dark .reading-mode-btn.active {
  background: var(--accent-gold);
  color: #0a1b15;
}

body.theme-sepia .reading-mode-btn.active {
  background: var(--accent-gold);
  color: #ffffff;
}

/* إخفاء كرت الهيدر التقليدي في نمط الكتاب لظهوره مدمجاً داخل إطار المصحف الملكي */
body.reading-mode-book #surahHeaderCard {
  display: none !important;
}

/* حاوية صفحات المصحف - توسيع العرض على شاشات الكمبيوتر */
.mushaf-book-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
}

/* إطار صفحة المصحف النبوي الشريف */
.mushaf-book-container {
  touch-action: pan-y;
}

.mushaf-mode-continuous .mushaf-page-frame {
  margin-bottom: 30px !important;
}

#mushafContinuousPagesWrapper {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
}

.mushaf-continuous-sentinel {
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 15px 0 40px 0;
  width: 100%;
}

.mushaf-mode-single .mushaf-page-frame {
  margin-bottom: 16px !important;
}

.mushaf-page-frame {
  background: var(--bg-card);
  border: 2px solid var(--accent-gold);
  border-radius: 16px;
  padding: 30px 36px 24px 36px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  position: relative;
  touch-action: pan-y;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  scroll-margin-top: 135px;
}

/* خط تزييني داخلي مزدوج */
.mushaf-page-frame::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(197, 160, 89, 0.38);
  border-radius: 12px;
  pointer-events: none;
}

/* ترويسة صفحة المصحف (الجزء، السورة، الحزب) */
.mushaf-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1.5px solid rgba(197, 160, 89, 0.35);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-gold);
  position: relative;
  z-index: 1;
}

.mushaf-page-header-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mushaf-page-surah-tag {
  font-family: var(--quran-font-family);
  font-size: 1.25rem;
  color: var(--primary);
  font-weight: bold;
}

body.theme-dark .mushaf-page-surah-tag {
  color: var(--accent-gold);
}

body.theme-sepia .mushaf-page-surah-tag {
  color: var(--primary);
}

/* لافتة بداية السورة الزخرفية داخل الصفحة */
.mushaf-surah-banner {
  margin: 8px 0 20px 0;
  border: 2px solid var(--accent-gold);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(18, 55, 42, 0.05), rgba(197, 160, 89, 0.15));
  padding: 14px 18px;
  text-align: center;
  position: relative;
  z-index: 1;
}

body.theme-dark .mushaf-surah-banner {
  background: linear-gradient(135deg, rgba(226, 186, 109, 0.1), rgba(22, 56, 44, 0.25));
}

.mushaf-surah-banner-name {
  font-family: var(--quran-font-family);
  font-size: 2.2rem;
  color: var(--primary);
  font-weight: bold;
  margin-bottom: 4px;
}

body.theme-dark .mushaf-surah-banner-name {
  color: var(--accent-gold);
}

.mushaf-surah-banner-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* البسملة داخل صفحة المصحف */
.mushaf-page-bismillah {
  font-family: var(--quran-font-family);
  font-size: 2rem;
  color: var(--primary);
  text-align: center;
  margin: 12px 0 20px 0;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

body.theme-dark .mushaf-page-bismillah {
  color: var(--accent-gold);
}

.mushaf-page-bismillah.active-bismillah-playing {
  color: var(--accent-gold) !important;
  text-shadow: 0 0 16px rgba(197, 160, 89, 0.6);
  transform: scale(1.05);
}

/* نص القرآن المتصل والمضبوط في الصفحة */
.mushaf-page-text {
  font-family: var(--quran-font-family);
  font-size: var(--ayah-font-size);
  line-height: 2.55;
  text-align: justify;
  text-justify: inter-word;
  text-align-last: center;
  color: var(--text-main);
  position: relative;
  z-index: 1;
  word-spacing: 2px;
}

/* العنصر النصي للآية الواحدة مع دعم الانكسار السلس عبر السطور */
.mushaf-ayah-span {
  display: inline;
  padding: 2px 3px;
  margin: 0;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.mushaf-ayah-span:hover {
  background-color: rgba(197, 160, 89, 0.14);
}

/* تظليل الآية التي يتم تلاوتها صوتياً - انسيابي شفاف بدون تشوه أو تكسر في الأسطر */
.mushaf-ayah-span.active-playing-mushaf {
  background: rgba(197, 160, 89, 0.22) !important;
  color: var(--primary) !important;
  border-bottom: 2.5px solid var(--accent-gold);
  border-radius: 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 2px 4px;
  box-shadow: none !important;
  outline: none !important;
}

body.theme-dark .mushaf-ayah-span.active-playing-mushaf {
  background: rgba(226, 186, 109, 0.24) !important;
  color: var(--accent-gold) !important;
  border-bottom-color: var(--accent-gold);
}

body.theme-sepia .mushaf-ayah-span.active-playing-mushaf {
  background: rgba(179, 125, 54, 0.2) !important;
  color: #2d241c !important;
  border-bottom-color: var(--accent-gold);
}

/* تحديد الآية عند النقر عليها لفتح قائمة الإجراءات */
.mushaf-ayah-span.selected-mushaf {
  background: rgba(197, 160, 89, 0.28) !important;
  border-bottom: 2px dashed var(--accent-gold);
  border-radius: 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 2px 4px;
  box-shadow: none !important;
  outline: none !important;
}

body.theme-dark .mushaf-ayah-span.selected-mushaf {
  background: rgba(226, 186, 109, 0.3) !important;
  border-bottom-color: var(--accent-gold);
}

body.theme-sepia .mushaf-ayah-span.selected-mushaf {
  background: rgba(179, 125, 54, 0.25) !important;
  border-bottom-color: var(--accent-gold);
}

/* رقم الآية ورمز الختام ﴿١﴾ */
.mushaf-ayah-marker {
  display: inline-block;
  font-family: var(--quran-font-family);
  color: var(--accent-gold);
  font-weight: bold;
  font-size: 0.9em;
  margin: 0 4px;
  user-select: none;
}

/* تذييل صفحة المصحف (رقم الصفحة) */
.mushaf-page-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 22px;
  padding-top: 12px;
  border-top: 1.5px solid rgba(197, 160, 89, 0.35);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-gold);
  position: relative;
  z-index: 1;
}

/* شريط الإجراءات السريع للآية في نمط المصحف (Popover) */
.mushaf-ayah-popover {
  position: fixed;
  bottom: 86px;
  left: 50%;
  transform: translateX(-50%) translateZ(0);
  width: min(92%, 680px);
  background: var(--bg-card);
  border: 1.5px solid var(--accent-gold);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  padding: 12px 18px;
  animation: mushafPopoverSlideUp 0.16s ease-out;
  will-change: transform, opacity;
  -webkit-overflow-scrolling: touch;
}

@keyframes mushafPopoverSlideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.mushaf-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
}

.mushaf-popover-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mushaf-popover-close {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.mushaf-popover-close:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.05);
}

.mushaf-popover-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

/* ==========================================================================
   التجاوب الممتاز وتنسيق أزرار ومشغل الصوتيات بالكامل لشاشات الجوال (Mobile First)
   ========================================================================== */
@media (max-width: 768px) {
  /* 1. ضبط التباعدات وحذف الفراغ الزائد أسفل السور على الجوال */
  .quran-site-wrapper {
    min-height: auto !important;
    padding-bottom: 0 !important;
  }
  .main-layout {
    margin: 6px auto 0 auto !important;
    padding-bottom: 0 !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    flex: none !important;
  }
  .ayahs-container {
    padding-bottom: 10px !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
  }
  .mushaf-book-container {
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    gap: 12px !important;
  }

  /* 2. الهيدر وشريط الأدوات السريعة */
  .header-top {
    padding: 8px 10px;
    gap: 6px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
  }
  .brand-section {
    min-width: 0;
    flex-shrink: 1;
    gap: 8px;
  }
  .brand-logo {
    width: 32px;
    height: 32px;
    font-size: 1.15rem;
    flex-shrink: 0;
  }
  .brand-title {
    font-size: 0.92rem;
    white-space: nowrap;
    line-height: 1.2;
  }
  .brand-subtitle {
    font-size: 0.65rem;
    white-space: nowrap;
    line-height: 1.2;
  }
  .header-right-tools {
    gap: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }
  .admin-session-badge {
    padding: 2px 7px !important;
    font-size: 0.72rem !important;
    gap: 3px !important;
    max-width: 130px;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    background: #fef3c7 !important;
    border: 1px solid #f59e0b !important;
    border-radius: 9999px !important;
    color: #92400e !important;
    font-weight: 600 !important;
  }
  .admin-session-badge .admin-badge-full {
    display: none !important;
  }
  .admin-session-badge .admin-badge-short {
    display: inline !important;
  }
  .admin-logout-btn {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
    font-size: 0.72rem;
    padding: 0 2px;
  }
  .theme-switcher-group {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
  }
  .theme-switcher-group .btn-icon {
    width: 28px;
    height: 28px;
    font-size: 12px;
    flex-shrink: 0;
    padding: 0;
  }

  /* إخفاء التفاصيل الطويلة من زر السورة على الشاشات الصغيرة لتجنب الاقتصاص (مك...) */
  .surah-picker-meta-inline {
    display: none !important;
  }

  /* شريط الفلاتر والمميزات: ظاهرة بالكامل بشبكة أنيقة متناسقة بدون سحب */
  .quran-subnav-strip {
    padding: 8px 10px !important;
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-color) !important;
  }
  .subnav-container {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
    overflow-x: visible !important;
    white-space: normal !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .subnav-container::-webkit-scrollbar {
    display: none;
  }
  .subnav-container .btn-pill {
    width: 100% !important;
    margin: 0 !important;
    padding: 7px 6px !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 4px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  /* العنصر الأخير إذا كان مفرداً (مثل الزر الخامس) يمتد بعرض الشاشة لمظهر متناسق */
  .subnav-container .btn-pill:last-child:nth-child(odd) {
    grid-column: 1 / -1 !important;
  }

  /* 3. شريط التحكم والأزرار الذكية المدمجة */
  .controls-bar {
    padding: 8px 10px !important;
    position: relative !important;
    top: auto !important;
  }

  .controls-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }

  /* صفوف الاختيار في الجوال: السورة والآية والصفحة والجزء والحزب بتنسيق أنيق متوازن */
  .controls-pickers-row {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
    align-items: center !important;
    flex: none !important;
    margin: 0 !important;
  }

  .surah-select-group {
    grid-column: span 3 !important;
  }
  .ayah-select-group {
    grid-column: span 3 !important;
  }
  .hizb-select-group {
    grid-column: span 2 !important;
  }
  .juz-select-group {
    grid-column: span 2 !important;
  }
  .page-select-group {
    grid-column: span 2 !important;
  }

  .surah-select-group,
  .ayah-select-group,
  .hizb-select-group,
  .juz-select-group,
  .page-select-group {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 38px !important;
    margin: 0 !important;
  }

  .surah-select-label {
    display: none !important;
  }

  .surah-picker-btn,
  .ayah-picker-btn,
  .page-picker-btn,
  .juz-picker-btn,
  .hizb-picker-btn {
    height: 38px !important;
    padding: 0 6px !important;
    font-size: 0.78rem !important;
    border-radius: 19px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  }

  .surah-picker-icon {
    font-size: 0.82rem !important;
    flex-shrink: 0 !important;
    margin-inline-end: 2px !important;
  }

  .surah-picker-text {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    flex: 1 !important;
    min-width: 0 !important;
    text-align: center !important;
    line-height: 1.2 !important;
  }

  .surah-picker-arrow {
    font-size: 0.58rem !important;
    color: #94a3b8 !important;
    flex-shrink: 0 !important;
    margin-inline-start: 2px !important;
  }

  /* ==========================================================================
     Pickers Dropdowns Responsive Bounds & Alignment (Mobile <= 768px)
     ========================================================================== */
  .surah-picker-dropdown,
  .ayah-picker-dropdown,
  .page-picker-dropdown,
  .juz-picker-dropdown,
  .hizb-picker-dropdown {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    z-index: 1050 !important;
  }

  .surah-picker-dropdown {
    max-width: min(380px, calc(100vw - 20px)) !important;
  }

  .ayah-picker-dropdown,
  .page-picker-dropdown,
  .juz-picker-dropdown,
  .hizb-picker-dropdown {
    max-width: min(320px, calc(100vw - 20px)) !important;
  }

  /* RTL (Arabic default) Mobile Alignment */
  /* Row 1: Surah (cols 4-6, right), Ayah (cols 1-3, left) */
  .surah-picker-dropdown {
    right: 0 !important;
    left: auto !important;
  }
  .ayah-picker-dropdown {
    left: 0 !important;
    right: auto !important;
  }

  /* Row 2: Hizb (cols 5-6, right), Juz (cols 3-4, center), Page (cols 1-2, left) */
  .hizb-picker-dropdown {
    right: 0 !important;
    left: auto !important;
  }
  .juz-picker-dropdown {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    animation: fadeInDownCenter 0.18s ease-out !important;
  }
  .page-picker-dropdown {
    left: 0 !important;
    right: auto !important;
  }

  /* LTR (English / Turkish) Mobile Alignment */
  /* Row 1: Surah (cols 1-3, left), Ayah (cols 4-6, right) */
  html[dir="ltr"] .surah-picker-dropdown,
  body.lang-ltr .surah-picker-dropdown {
    left: 0 !important;
    right: auto !important;
  }
  html[dir="ltr"] .ayah-picker-dropdown,
  body.lang-ltr .ayah-picker-dropdown {
    right: 0 !important;
    left: auto !important;
  }

  /* Row 2: Hizb (cols 1-2, left), Juz (cols 3-4, center), Page (cols 5-6, right) */
  html[dir="ltr"] .hizb-picker-dropdown,
  body.lang-ltr .hizb-picker-dropdown {
    left: 0 !important;
    right: auto !important;
  }
  html[dir="ltr"] .juz-picker-dropdown,
  body.lang-ltr .juz-picker-dropdown {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    animation: fadeInDownCenter 0.18s ease-out !important;
  }
  html[dir="ltr"] .page-picker-dropdown,
  body.lang-ltr .page-picker-dropdown {
    right: 0 !important;
    left: auto !important;
  }

  .ayah-quick-actions,
  .page-quick-actions,
  .juz-quick-actions,
  .hizb-quick-actions {
    display: flex !important;
    gap: 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .ayah-quick-actions .picker-filter-btn,
  .page-quick-actions .picker-filter-btn,
  .juz-quick-actions .picker-filter-btn,
  .hizb-quick-actions .picker-filter-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 3px 4px !important;
    font-size: 0.72rem !important;
    text-align: center !important;
  }

  .page-picker-grid,
  .ayah-picker-grid,
  .hizb-picker-grid,
  .juz-picker-grid {
    box-sizing: border-box !important;
  }

  .page-grid-item,
  .ayah-grid-item,
  .hizb-grid-item,
  .juz-grid-item {
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* السطر 2: حقل البحث بعرض كامل وأزرار النطاق المدمجة بدون فراغ إضافي */
  .search-box-wrapper {
    flex: none !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .search-input-field-group {
    height: 40px;
    border-radius: 20px;
    padding: 2px 4px 2px 4px;
  }

  .search-input {
    font-size: 0.86rem;
    padding: 4px 6px;
  }

  .search-submit-btn {
    padding: 4px 12px;
    font-size: 0.8rem;
    height: 32px;
    border-radius: 16px;
  }

  .search-toolbar-tabs {
    display: flex !important;
    gap: 4px;
    width: 100%;
    margin-top: 6px;
    margin-bottom: 0 !important;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    flex: none !important;
    height: auto !important;
  }

  .search-toolbar-tabs::-webkit-scrollbar {
    display: none;
  }

  .search-scope-hint {
    display: none !important;
  }

  .tab-label-short,
  .mode-label-short {
    display: none;
  }

  .tab-label-full,
  .mode-label-full {
    display: inline;
  }

  @media (max-width: 600px) {
    .tab-label-full,
    .mode-label-full {
      display: none !important;
    }
    .tab-label-short,
    .mode-label-short {
      display: inline !important;
    }
  }

  .search-tab-btn {
    flex: 1;
    min-width: 0;
    height: 27px;
    font-size: 0.72rem;
    padding: 0 4px;
    justify-content: center;
    border-radius: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  /* السطر 3 في الجوال: نمط القراءة (بطاقات / مصحف) وأدوات التكبير والتصغير جنباً إلى جنب براحة تامة */
  .controls-mode-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: 100% !important;
    flex: none !important;
    margin: 0 !important;
    margin-top: 2px !important;
  }

  .reading-mode-toggle-group {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: 210px !important;
    height: 38px !important;
    padding: 2px !important;
    gap: 3px !important;
    border-radius: 19px !important;
    display: flex !important;
    margin: 0 !important;
  }

  .reading-mode-btn {
    flex: 1 !important;
    min-width: 0 !important;
    padding: 2px 6px !important;
    font-size: 0.76rem !important;
    border-radius: 16px !important;
    justify-content: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
  }

  .font-size-controls {
    flex-shrink: 0 !important;
    min-width: 126px !important;
    height: 38px !important;
    padding: 2px 8px !important;
    border-radius: 19px !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px !important;
    display: flex !important;
    background: var(--bg-card) !important;
    border: 1.5px solid var(--border-color) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    margin: 0 !important;
    white-space: nowrap !important;
  }

  .font-size-btn {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    font-size: 0.85rem !important;
    font-weight: 800 !important;
    border-radius: 50% !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    color: var(--text-main) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    line-height: 1 !important;
  }

  .font-size-badge {
    padding: 2px 6px !important;
    min-width: 44px !important;
    height: 26px !important;
    text-align: center !important;
    font-weight: 800 !important;
    font-size: 0.74rem !important;
    color: var(--primary) !important;
    background: rgba(18, 55, 42, 0.08) !important;
    border-radius: 13px !important;
    cursor: pointer !important;
    direction: ltr !important;
    unicode-bidi: isolate !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
  body.theme-dark .font-size-badge {
    color: var(--accent-gold) !important;
    background: rgba(197, 160, 89, 0.15) !important;
  }

  /* 4. مشغل الصوتيات الرشيق والمدمج على شاشات الجوال */
  .audio-player-fixed {
    padding: 8px 10px 8px 10px;
    background: linear-gradient(180deg, #185a37 0%, #114227 100%) !important;
    border-top: 2px solid #d4af37 !important;
    box-shadow: 0 -4px 20px rgba(17, 66, 39, 0.45) !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 99999 !important;
    transition: padding 0.2s ease;
  }

  footer,
  #footer,
  .footer-wrap {
    padding-bottom: 130px !important;
  }

  /* زر تصغير / تكبير المشغل على الجوال متموضع على الطرف لمنع تغطية أزرار المحتوى */
  .player-toggle-btn {
    display: inline-flex !important;
    position: absolute;
    top: -22px;
    inset-inline-start: 14px;
    left: auto;
    right: auto;
    transform: none;
    background: #185a37 !important;
    border: 1.5px solid #d4af37 !important;
    border-bottom: none !important;
    border-radius: 8px 8px 0 0;
    padding: 2px 12px 1px 12px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fef08a !important;
    cursor: pointer;
    box-shadow: 0 -3px 8px rgba(0, 0, 0, 0.25);
    z-index: 10;
    align-items: center;
    gap: 4px;
    line-height: 1.3;
    font-family: var(--ui-font-family);
  }
  .player-toggle-btn:active {
    transform: scale(0.96);
  }

  .player-inner {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 4px 8px;
    align-items: center;
    width: 100%;
  }

  /* السطر 1 للمشغل: اسم السورة والآية يميناً، وأزرار التحكم يساراً */
  .player-info {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    min-width: 0;
    gap: 6px;
    display: flex;
    align-items: center;
    overflow: hidden;
  }

  .reciter-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 13px;
    flex-shrink: 0;
  }

  .player-labels {
    min-width: 0;
    overflow: hidden;
    flex: 1 1 auto;
  }

  .player-title {
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    line-height: 1.2;
    font-weight: 700;
  }

  .player-reciter-name {
    font-size: 0.66rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    line-height: 1.2;
    margin-top: 1px;
    color: var(--accent-gold);
  }

  .player-controls-main {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    gap: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .play-main-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    font-size: 13px !important;
    flex-shrink: 0 !important;
  }

  .player-step-btn {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    font-size: 12px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  /* السطر 2 للمشغل: شريط التقدم الزمني النحيف */
  .player-progress-section {
    grid-column: 1 / -1;
    grid-row: 2 / 3;
    width: 100%;
    min-width: 0;
    gap: 6px;
    display: flex;
    align-items: center;
    margin: 1px 0;
  }

  .progress-track {
    height: 4px;
    border-radius: 2px;
  }

  .time-stamp {
    font-size: 0.62rem;
    min-width: 26px;
  }

  /* السطر 3 للمشغل: اختيار القارئ وزر السرعة الرشيق */
  .player-extra-options {
    grid-column: 1 / -1;
    grid-row: 3 / 4;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
    min-width: 0;
  }

  .player-select {
    flex: 1 1 0;
    height: 27px;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.12);
    min-width: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .playback-mode-btn {
    height: 27px;
    padding: 0 7px;
    font-size: 0.68rem;
    border-radius: 13px;
    flex-shrink: 0;
    max-width: 95px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .playback-mode-btn .mode-long-text {
    display: none;
  }

  .speed-btn {
    height: 27px;
    min-width: 38px;
    padding: 0 6px;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 13px;
    flex-shrink: 0;
    text-align: center;
    direction: ltr !important;
    unicode-bidi: isolate;
  }

  /* نمط التصغير للمشغل عند النقر على [تصغير] على الجوال */
  .audio-player-fixed.is-collapsed {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
  }
  .audio-player-fixed.is-collapsed .player-inner {
    grid-template-rows: auto !important;
    gap: 0 !important;
  }
  .audio-player-fixed.is-collapsed .player-progress-section,
  .audio-player-fixed.is-collapsed .player-extra-options {
    display: none !important;
  }

  /* 5. صفحات المصحف وبطاقات الآيات على الجوال */
  .mushaf-page-frame {
    padding: 16px 10px 14px 10px;
    border-radius: 12px;
    border-width: 1.5px;
    margin-bottom: 10px;
  }
  .mushaf-page-frame::before {
    inset: 4px;
  }
  .mushaf-surah-banner-name {
    font-size: 1.5rem;
  }
  .mushaf-page-bismillah {
    font-size: 1.4rem;
    margin: 6px 0 14px 0;
  }
  .mushaf-page-body {
    font-size: var(--ayah-font-size) !important;
    line-height: var(--ayah-line-height, 2.3) !important;
    text-align: justify;
    text-justify: inter-word;
  }
  /* ==========================================================================
     Enhanced Mobile Ayah Action Buttons & Popover (Structured 3-Col Grid)
     ========================================================================== */
  .mushaf-ayah-popover {
    bottom: calc(var(--current-player-height, 135px) + 12px) !important;
    width: min(95%, 440px) !important;
    left: 50% !important;
    transform: translateX(-50%) translateZ(0) !important;
    padding: 12px 14px !important;
    border-radius: 16px !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35) !important;
    z-index: 100005 !important;
  }

  .mushaf-popover-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-bottom: 8px !important;
    margin-bottom: 10px !important;
    border-bottom: 1px solid var(--border-color) !important;
  }

  .mushaf-popover-title {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: var(--primary) !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
  }

  .mushaf-popover-close {
    width: 28px !important;
    height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid var(--border-color) !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: var(--text-muted) !important;
    padding: 0 !important;
  }

  body.theme-dark .mushaf-popover-close {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #e6edea !important;
  }

  .ayah-card {
    padding: 14px 12px !important;
    margin-bottom: 12px !important;
    border-radius: 14px !important;
  }

  /* Responsive 3-Column Grid for Ayah Actions & Popover */
  .ayah-actions-bar,
  #mushafPopoverActions {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 7px 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 12px !important;
    padding-top: 10px !important;
  }

  .ayah-actions-bar .action-btn-sm,
  #mushafPopoverActions .action-btn-sm {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 38px !important;
    padding: 6px 4px !important;
    font-size: 0.74rem !important;
    font-weight: 600 !important;
    border-radius: 9px !important;
    box-sizing: border-box !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    gap: 5px !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    transition: all 0.18s ease !important;
  }

  .ayah-actions-bar .action-btn-sm span:first-child,
  #mushafPopoverActions .action-btn-sm span:first-child {
    font-size: 0.88rem !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
  }

  .ayah-actions-bar .action-btn-sm .btn-text,
  #mushafPopoverActions .action-btn-sm .btn-text {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    display: inline-block !important;
  }

  /* If 7 items or trailing odd item, span full row */
  .ayah-actions-bar > .action-btn-sm:last-child:nth-child(3n + 1),
  #mushafPopoverActions > .action-btn-sm:last-child:nth-child(3n + 1) {
    grid-column: 1 / -1 !important;
  }

  .btn-text-full {
    display: none !important;
  }
  .btn-text-short {
    display: inline !important;
  }

  /* 6. النوافذ المنبثقة على الجوال - توسيع الإطار وتحسين الألوان والراحة البصرية */
  .modal-overlay {
    padding: 6px 4px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  .modal-card {
    width: 98% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    margin: 0 auto !important;
    border-radius: 14px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45) !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  .modal-header {
    padding: 10px 12px !important;
    background: linear-gradient(135deg, #12372A 0%, #1a523e 55%, #12372A 100%) !important;
    border-bottom: 2.5px solid var(--accent-gold) !important;
    gap: 8px !important;
  }
  .modal-title {
    font-size: 0.95rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
    flex: 1 !important;
  }
  .modal-back-btn {
    padding: 4px 10px !important;
    font-size: 0.78rem !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }
  .modal-close-btn {
    width: 28px !important;
    height: 28px !important;
    font-size: 13px !important;
    flex-shrink: 0 !important;
  }
  .modal-body {
    padding: 12px 10px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    max-width: 100% !important;
  }
  .modal-nav-banner {
    padding: 8px 10px !important;
    margin-bottom: 12px !important;
    font-size: 0.8rem !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
  }
  .modal-nav-banner span {
    font-size: 0.78rem !important;
    max-width: 65% !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .modal-nav-banner-btn {
    display: none !important;
  }
  .modal-tab-nav {
    display: flex !important;
    gap: 6px !important;
    margin-bottom: 14px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .modal-tab-nav::-webkit-scrollbar {
    display: none !important;
  }
  .modal-tab-btn {
    padding: 8px 10px !important;
    font-size: 0.82rem !important;
    flex-shrink: 0 !important;
  }
  .topic-verse-header,
  .mut-verse-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
    padding-bottom: 10px !important;
    border-bottom: 1px dashed var(--border-color) !important;
  }
  .topic-verse-meta,
  .mut-verse-meta {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 3px !important;
    width: 100% !important;
  }
  .topic-verse-surah,
  .mut-verse-surah {
    font-size: 0.98rem !important;
    font-weight: 800 !important;
    color: var(--primary) !important;
    white-space: nowrap !important;
    line-height: 1.3 !important;
  }
  body.theme-dark .topic-verse-surah,
  body.theme-dark .mut-verse-surah {
    color: var(--accent-gold) !important;
  }
  .topic-verse-ayah,
  .mut-verse-ayah {
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: var(--accent-gold) !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
  }
  .topic-verse-actions,
  .mut-verse-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .topic-verse-actions .topic-action-btn,
  .mut-verse-actions .action-btn-sm {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 7px 6px !important;
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    background: var(--bg-page) !important;
    border: 1px solid var(--border-color) !important;
  }
  .topic-verse-text {
    font-size: 1.2rem !important;
    line-height: 1.9 !important;
  }
  .modal-tafsir-ayah-box {
    font-size: 1.25rem !important;
    padding: 10px 12px !important;
    line-height: 1.95 !important;
  }
  .mut-modal-tabs {
    display: flex !important;
    gap: 6px !important;
    margin-bottom: 12px !important;
    padding-bottom: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .mut-modal-tabs .btn-pill {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    text-align: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 0.8rem !important;
    padding: 8px 6px !important;
  }
  .mut-control-row {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .mut-control-row > div {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100% !important;
  }
  .mut-compare-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .miracle-filter-grid,
  .mutashabihat-filter-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px 6px !important;
    margin-bottom: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .miracle-filter-grid .btn-pill,
  .mutashabihat-filter-grid .btn-pill {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 7px 4px !important;
    font-size: 0.77rem !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1.25 !important;
    border-radius: 20px !important;
    white-space: normal !important;
    gap: 4px !important;
    min-height: 40px !important;
    overflow: hidden !important;
    word-break: break-word !important;
  }
  .miracle-filter-grid .btn-pill.pill-all,
  .mutashabihat-filter-grid .btn-pill.pill-all {
    grid-column: span 2 !important;
    font-size: 0.88rem !important;
    font-weight: 800 !important;
    min-height: 38px !important;
  }
  .miracle-filter-grid .btn-pill .pill-badge,
  .mutashabihat-filter-grid .btn-pill .pill-badge {
    font-size: 0.76rem !important;
    font-weight: 800 !important;
    opacity: 0.9 !important;
  }
  .concordance-search-bar {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .concordance-search-input {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 10px 14px !important;
    font-size: 0.92rem !important;
  }
  .concordance-search-btn {
    width: 100% !important;
    padding: 10px 14px !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
  }
  .concordance-examples-pills {
    gap: 5px !important;
  }
  .concordance-example-pill {
    font-size: 0.74rem !important;
    padding: 4px 9px !important;
  }
  .concordance-stat-card {
    padding: 12px 14px !important;
  }
  .concordance-stat-headline {
    font-size: 1.05rem !important;
  }
  .concordance-stat-sub {
    font-size: 0.86rem !important;
  }
  .concordance-stat-locs {
    flex-direction: column !important;
    gap: 6px !important;
  }
  .concordance-loc-chip {
    font-size: 0.78rem !important;
  }
}

/* ==========================================================================
   زر الصعود للأعلى الخاص بالقالب - مطابق تماماً لصورة القالب (Image 1)
   ========================================================================== */
body.page-quran #scroll-to-top,
#body-quran #scroll-to-top,
html body.page-quran a#scroll-to-top,
html body a#scroll-to-top,
#scroll-to-top,
.theme-scroll-to-top {
  position: fixed !important;
  bottom: calc(var(--current-player-height, 95px) + 16px) !important;
  inset-inline-end: 18px !important;
  left: auto !important;
  width: 44px !important;
  height: 44px !important;
  background: #ffffff !important;
  color: #07698a !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 100001 !important;
  cursor: pointer !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s, background-color 0.2s, bottom 0.25s ease !important;
  text-decoration: none !important;
}

#scroll-to-top svg,
.theme-scroll-to-top svg {
  fill: #07698a !important;
  width: 18px !important;
  height: 18px !important;
  transition: transform 0.2s ease !important;
}

body.page-quran #scroll-to-top.is-visible,
#body-quran #scroll-to-top.is-visible,
html body.page-quran a#scroll-to-top.is-visible,
html body.page-quran #scroll-to-top.is-visible,
#scroll-to-top.is-visible,
.theme-scroll-to-top.is-visible {
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
  pointer-events: auto !important;
  transform: translateY(0) !important;
}

#scroll-to-top:hover,
.theme-scroll-to-top:hover {
  background: #f8fafc !important;
  box-shadow: 0 6px 24px rgba(7, 105, 138, 0.25) !important;
  transform: translateY(-2px) !important;
}

#scroll-to-top:hover svg,
.theme-scroll-to-top:hover svg {
  transform: translateY(-2px) !important;
}

body.theme-dark #scroll-to-top,
body.theme-dark .theme-scroll-to-top {
  background: #1e293b !important;
  color: #38bdf8 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4) !important;
}

body.theme-dark #scroll-to-top svg,
body.theme-dark .theme-scroll-to-top svg {
  fill: #38bdf8 !important;
}

/* ==========================================================================
   نمط ملء الشاشة لقراءة المصحف الشريف وأزرار التقليب والسحب وتصغير الشاشة
   ========================================================================== */
.mushaf-fs-btn {
  background: linear-gradient(135deg, rgba(24, 90, 55, 0.12), rgba(20, 83, 45, 0.18)) !important;
  border: 1px solid #166534 !important;
  color: #14532d !important;
  font-weight: 700 !important;
}

.mushaf-fs-btn:hover {
  background: #166534 !important;
  color: #ffffff !important;
}

.mushaf-fs-btn.active-fs {
  background: #dc2626 !important;
  border-color: #b91c1c !important;
  color: #ffffff !important;
}

/* التبديل بين صفحة صفحة كالكتاب أو صفحات متتالية للأسفل */
.mushaf-view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 900px;
  margin: 0 auto 12px auto;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.mushaf-vtype-subgroup {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  padding: 2px;
  border-radius: 20px;
}

.cards-mode-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 20px;
}

/* إظهار وإخفاء أدوات نمط المصحف أو نمط البطاقات بدقة تامة */
body.reading-mode-book .mushaf-vtype-subgroup {
  display: inline-flex !important;
}
body.reading-mode-book .cards-mode-hint {
  display: none !important;
}

body.reading-mode-cards .mushaf-vtype-subgroup {
  display: none !important;
}
body.reading-mode-cards .cards-mode-hint {
  display: inline-flex !important;
}

.mushaf-vtype-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mushaf-vtype-btn:hover {
  color: var(--text-main);
}

.mushaf-vtype-btn.active {
  background: #185a37;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.mushaf-fs-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(24, 90, 55, 0.1), rgba(20, 83, 45, 0.16));
  border: 1px solid #166534;
  color: #14532d;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.mushaf-fs-action-btn:hover {
  background: #166534;
  color: #ffffff;
  transform: translateY(-1px);
}

.mushaf-fs-action-btn.active-fs {
  background: #dc2626 !important;
  border-color: #b91c1c !important;
  color: #ffffff !important;
}

/* ==========================================================================
   شريط ملء الشاشة العلوي الثابت بنفس ألوان الصفحة (Seamless Page-Themed Top Bar)
   شريط نحيف (44px) متناسق مع لون خلفية المصحف، مستقر ولا يغطي أي آية
   ========================================================================== */
.mushaf-fullscreen-top-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 44px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1.5px solid var(--border-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  z-index: 100010;
  transition: background 0.3s ease, border-color 0.3s ease;
}

body.mushaf-fullscreen-active .mushaf-fullscreen-top-bar {
  display: flex !important;
}

.mushaf-fs-topbar-inner {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  box-sizing: border-box;
}

.mushaf-fs-page-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 700;
  font-family: var(--ui-font-family);
}

.mushaf-fs-icon {
  font-size: 1.05rem;
  color: var(--accent-gold);
}

.mushaf-fs-surah {
  color: var(--text-main);
  font-weight: 800;
}

.mushaf-fs-sep {
  color: var(--accent-gold);
  opacity: 0.75;
}

.mushaf-fs-page {
  color: var(--accent-gold);
  font-size: 0.88rem;
  font-weight: 700;
}

.mushaf-fs-exit-btn {
  background: var(--bg-page);
  color: var(--text-main);
  border: 1.5px solid var(--border-color);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--ui-font-family);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.mushaf-fs-exit-btn:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.15);
}

.mushaf-fs-exit-icon {
  font-size: 0.85rem;
  font-weight: 800;
}

/* سمات المظهر لشريط ملء الشاشة (متطابق 100% مع ألوان الصفحة) */
body.theme-dark .mushaf-fullscreen-top-bar {
  background: var(--bg-card);
  border-bottom-color: rgba(226, 186, 109, 0.3);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
body.theme-dark .mushaf-fs-exit-btn {
  background: var(--bg-page);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}
body.theme-dark .mushaf-fs-exit-btn:hover {
  background: rgba(220, 38, 38, 0.25);
  border-color: #ef4444;
  color: #fca5a5;
}

body.theme-sepia .mushaf-fullscreen-top-bar {
  background: var(--bg-card);
  border-bottom-color: rgba(179, 125, 54, 0.35);
  box-shadow: 0 2px 8px rgba(45, 36, 28, 0.06);
}
body.theme-sepia .mushaf-fs-exit-btn {
  background: var(--bg-page);
  border-color: rgba(179, 125, 54, 0.3);
  color: var(--text-main);
}
body.theme-sepia .mushaf-fs-exit-btn:hover {
  background: #fde8e8;
  border-color: #f87171;
  color: #b91c1c;
}

.mushaf-fullscreen-bottom-exit {
  display: none !important;
}

/* ==========================================================================
   حالة ملء الشاشة النشطة: إظهار صفحة المصحف فقط كاملة ونقية بدون أي مشتتات أو فراغ زائد
   ========================================================================== */
body.mushaf-fullscreen-active,
body.mushaf-fullscreen-active html {
  background: var(--bg-card) !important;
  overflow-y: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  min-height: 0 !important;
  height: auto !important;
}

body.mushaf-fullscreen-active header,
body.mushaf-fullscreen-active footer,
body.mushaf-fullscreen-active #footer,
body.mushaf-fullscreen-active #footerbck,
body.mushaf-fullscreen-active section.two,
body.mushaf-fullscreen-active section.promo,
body.mushaf-fullscreen-active .feedback-static-page-wrap,
body.mushaf-fullscreen-active .footer-hook,
body.mushaf-fullscreen-active .footer-widgets,
body.mushaf-fullscreen-active #navi-bar,
body.mushaf-fullscreen-active #top-progress-bar,
body.mushaf-fullscreen-active #glass-loader,
body.mushaf-fullscreen-active #breadcrumbs,
body.mushaf-fullscreen-active #flashbox,
body.mushaf-fullscreen-active .quran-portal-header-bar,
body.mushaf-fullscreen-active .top-announcement-bar,
body.mushaf-fullscreen-active .filters-pill-group,
body.mushaf-fullscreen-active .controls-bar,
body.mushaf-fullscreen-active .surah-header-card,
body.mushaf-fullscreen-active .font-size-controls,
body.mushaf-fullscreen-active:not(.audio-is-playing) .audio-player-fixed,
body.mushaf-fullscreen-active .quran-header,
body.mushaf-fullscreen-active .quran-subnav-strip,
body.mushaf-fullscreen-active .mushaf-view-toolbar {
  display: none !important;
}

body.mushaf-fullscreen-active.audio-is-playing .audio-player-fixed {
  display: block !important;
  z-index: 100004 !important;
}

body.mushaf-fullscreen-active .quran-site-wrapper,
body.mushaf-fullscreen-active div.content {
  margin: 0 !important;
  padding: 0 !important;
  padding-bottom: 0 !important;
  min-height: 0 !important;
}

body.mushaf-fullscreen-active .main-layout {
  padding: 52px 8px 14px 8px !important;
  max-width: 960px !important;
  margin: 0 auto !important;
  min-height: 0 !important;
}

body.mushaf-fullscreen-active.reading-mode-cards .main-layout {
  padding: 56px 12px 90px 12px !important;
}

body.mushaf-fullscreen-active .ayahs-container,
body.mushaf-fullscreen-active .mushaf-book-container {
  margin: 0 !important;
  padding: 0 !important;
  padding-bottom: 0 !important;
  min-height: 0 !important;
}

body.mushaf-fullscreen-active.reading-mode-cards .ayahs-container {
  padding-bottom: 50px !important;
}

body.mushaf-fullscreen-active .mushaf-page-frame {
  margin: 0 auto 10px auto !important;
  max-width: 900px !important;
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.1) !important;
}

/* في وضع ملء الشاشة: يظهر زر الصعود للأعلى حصراً أعلى زر (التالية) في أسفل اليسار عند التمرير */
body.mushaf-fullscreen-active #scroll-to-top,
body.mushaf-fullscreen-active .theme-scroll-to-top {
  display: flex !important;
  position: fixed !important;
  bottom: 58px !important;
  left: 16px !important;
  right: auto !important;
  inset-inline-end: 16px !important;
  inset-inline-start: auto !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 10px !important;
  background: var(--bg-card) !important;
  color: var(--accent-gold) !important;
  border: 1.5px solid var(--accent-gold) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16) !important;
  z-index: 100005 !important;
  cursor: pointer !important;
  transition: opacity 0.25s ease, transform 0.2s ease, background 0.2s ease !important;
}

body.mushaf-fullscreen-active #scroll-to-top:hover,
body.mushaf-fullscreen-active .theme-scroll-to-top:hover {
  background: var(--accent-gold) !important;
  color: #ffffff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24) !important;
}

body.mushaf-fullscreen-active #scroll-to-top svg,
body.mushaf-fullscreen-active .theme-scroll-to-top svg {
  width: 15px !important;
  height: 15px !important;
  fill: currentColor !important;
}

/* أنيميشن تقليب الصفحات مثل الكتاب الحقيقي (Book Page Turning) */
.mushaf-page-frame.page-turning-next {
  animation: pageFlipNext 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.mushaf-page-frame.page-turning-prev {
  animation: pageFlipPrev 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pageFlipNext {
  0% {
    opacity: 0.15;
    transform: translateX(-35px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes pageFlipPrev {
  0% {
    opacity: 0.15;
    transform: translateX(35px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* تذييل صفحة المصحف مع أزرار التقليب السريع */
.mushaf-page-footer {
  display: flex !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  padding: 8px 14px 6px 14px !important;
  border-top: 1px dashed rgba(197, 160, 89, 0.35) !important;
  margin-top: 12px !important;
}

.mushaf-next-btn-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.mushaf-page-scroll-top-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--accent-gold);
  border: 1.5px solid var(--accent-gold);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  transition: all 0.2s ease;
  user-select: none;
}

.mushaf-page-scroll-top-btn:hover {
  background: var(--accent-gold);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

/* يظهر زر الصعود فوق زر التالية حصراً في وضع ملء الشاشة بنمط صفحة واحدة */
body.mushaf-fullscreen-active:not(.mushaf-view-continuous) .mushaf-page-scroll-top-btn {
  display: inline-flex !important;
}

.mushaf-page-nav-pill {
  background: var(--accent-gold-light);
  color: #854d0e;
  border: 1px solid rgba(197, 160, 89, 0.5);
  border-radius: 16px;
  padding: 4px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mushaf-page-nav-pill:hover {
  background: var(--accent-gold);
  color: #ffffff;
  transform: translateY(-1px);
}

.mushaf-page-nav-pill:disabled,
.mushaf-page-nav-pill[disabled] {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
  box-shadow: none !important;
}

.mushaf-page-number-center {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-gold);
}

@media (max-width: 768px) {
  body.page-quran #scroll-to-top,
  #body-quran #scroll-to-top,
  html body.page-quran a#scroll-to-top,
  #scroll-to-top,
  .theme-scroll-to-top {
    bottom: calc(var(--current-player-height, 180px) + 16px) !important;
    inset-inline-end: 14px !important;
    inset-inline-start: auto !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
    z-index: 100001 !important;
  }
  body.page-quran.player-collapsed #scroll-to-top,
  body.player-collapsed #scroll-to-top,
  body.player-collapsed .theme-scroll-to-top {
    bottom: calc(var(--current-player-height, 48px) + 14px) !important;
    inset-inline-end: 14px !important;
    inset-inline-start: auto !important;
  }
  #scroll-to-top svg,
  .theme-scroll-to-top svg {
    width: 16px !important;
    height: 16px !important;
  }
  .vtype-label-full {
    display: none !important;
  }
  .vtype-label-short {
    display: inline !important;
  }
  .mushaf-view-toolbar {
    padding: 5px 8px !important;
    margin-bottom: 8px !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  body.reading-mode-book .mushaf-vtype-subgroup {
    display: flex !important;
    flex: 1 1 auto !important;
    gap: 4px !important;
    min-width: 0 !important;
  }
  body.reading-mode-cards .mushaf-vtype-subgroup {
    display: none !important;
  }
  body.reading-mode-book .cards-mode-hint {
    display: none !important;
  }
  body.reading-mode-cards .cards-mode-hint {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 4px 10px !important;
    font-size: 0.74rem !important;
    white-space: nowrap !important;
    flex: 0 1 auto !important;
  }
  .mushaf-vtype-btn {
    flex: 1 1 50% !important;
    padding: 5px 6px !important;
    font-size: 0.74rem !important;
    white-space: nowrap !important;
    justify-content: center !important;
    text-align: center !important;
    border-radius: 16px !important;
  }
  .mushaf-fs-action-btn {
    flex: 0 0 auto !important;
    padding: 5px 10px !important;
    font-size: 0.74rem !important;
    white-space: nowrap !important;
    border-radius: 16px !important;
  }
  .mushaf-fullscreen-top-bar {
    height: 42px;
  }
  body.mushaf-fullscreen-active .main-layout {
    padding-top: 48px !important;
  }
  .mushaf-fs-topbar-inner {
    padding: 0 10px;
  }
  .mushaf-fs-page-info {
    font-size: 0.82rem;
    gap: 6px;
  }
  .mushaf-fs-exit-btn {
    padding: 4px 10px;
    font-size: 0.74rem;
    gap: 4px;
  }
  .mushaf-fs-exit-text {
    font-size: 0.74rem;
  }
}

/* ==========================================================================
   إدارة زر الصعود في وضع ملء الشاشة:
   - في نمط (صفحة واحدة): إخفاء الزر العائم تماماً والاعتماد على الزر المدمج داخل التذييل فوق (التالية)
   - في نمط (صفحات متتالية): إظهار الزر العائم في أسفل الزاوية عند التمرير الطويل
   ========================================================================== */
html body.page-quran.mushaf-fullscreen-active:not(.mushaf-view-continuous) #scroll-to-top,
body.mushaf-fullscreen-active:not(.mushaf-view-continuous) #scroll-to-top,
body.mushaf-fullscreen-active:not(.mushaf-view-continuous) .theme-scroll-to-top,
html body.mushaf-fullscreen-active:not(.mushaf-view-continuous) a#scroll-to-top {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

html body.page-quran.mushaf-fullscreen-active.mushaf-view-continuous #scroll-to-top,
body.mushaf-fullscreen-active.mushaf-view-continuous #scroll-to-top,
body.mushaf-fullscreen-active.mushaf-view-continuous .theme-scroll-to-top {
  position: fixed !important;
  bottom: 24px !important;
  left: 16px !important;
  right: auto !important;
  inset-inline-end: 16px !important;
  inset-inline-start: auto !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 10px !important;
  background: var(--bg-card) !important;
  color: var(--accent-gold) !important;
  border: 1.5px solid var(--accent-gold) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16) !important;
  z-index: 100020 !important;
  cursor: pointer !important;
}

html body.page-quran.mushaf-fullscreen-active #scroll-to-top svg,
body.mushaf-fullscreen-active #scroll-to-top svg,
body.mushaf-fullscreen-active .theme-scroll-to-top svg {
  width: 15px !important;
  height: 15px !important;
  fill: var(--accent-gold) !important;
  color: var(--accent-gold) !important;
}

html body.page-quran.mushaf-fullscreen-active #scroll-to-top:hover,
body.mushaf-fullscreen-active #scroll-to-top:hover,
body.mushaf-fullscreen-active .theme-scroll-to-top:hover {
  background: var(--accent-gold) !important;
  color: #ffffff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24) !important;
}

html body.page-quran.mushaf-fullscreen-active #scroll-to-top:hover svg,
body.mushaf-fullscreen-active #scroll-to-top:hover svg {
  fill: #ffffff !important;
  color: #ffffff !important;
}

@media (max-width: 600px) {
  html body.page-quran.mushaf-fullscreen-active.mushaf-view-continuous #scroll-to-top,
  body.mushaf-fullscreen-active.mushaf-view-continuous #scroll-to-top,
  body.mushaf-fullscreen-active.mushaf-view-continuous .theme-scroll-to-top {
    bottom: 20px !important;
    left: 12px !important;
    inset-inline-end: 12px !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 9px !important;
  }
}

/* ==========================================================================
   Complete Multilingual & Text Direction (LTR for non-Arabic, RTL for Arabic)
   ========================================================================== */
html[dir="ltr"],
html[dir="ltr"] body,
html[dir="ltr"] .quran-site-wrapper,
html[dir="ltr"] .modal-overlay,
html[dir="ltr"] .modal-card,
html[dir="ltr"] .modal-body,
html[dir="ltr"] .modal-header,
body.lang-ltr,
body.lang-ltr .quran-site-wrapper,
body.lang-ltr .modal-overlay,
body.lang-ltr .modal-card,
body.lang-ltr .modal-body,
body.lang-ltr .modal-header {
  direction: ltr !important;
  text-align: left !important;
}

html[dir="ltr"] .quran-site-wrapper,
body.lang-ltr .quran-site-wrapper {
  text-align: left !important;
  direction: ltr !important;
}

/* Modals Header & Structure in LTR */
html[dir="ltr"] .modal-header,
body.lang-ltr .modal-header {
  direction: ltr !important;
  flex-direction: row !important;
  justify-content: space-between !important;
}

html[dir="ltr"] .modal-title,
body.lang-ltr .modal-title {
  text-align: left !important;
  direction: ltr !important;
  justify-content: flex-start !important;
}

html[dir="ltr"] .modal-close,
body.lang-ltr .modal-close {
  margin-left: auto !important;
  margin-right: 0 !important;
}

html[dir="ltr"] .modal-tab-nav,
body.lang-ltr .modal-tab-nav {
  direction: ltr !important;
  justify-content: flex-start !important;
}

html[dir="ltr"] .modal-nav-banner,
body.lang-ltr .modal-nav-banner {
  direction: ltr !important;
  text-align: left !important;
  border-right: none !important;
  border-left: 3.5px solid var(--accent-gold) !important;
}

/* Reverse right-borders to left-borders in LTR */
html[dir="ltr"] .ayah-subtext-container,
body.lang-ltr .ayah-subtext-container {
  direction: ltr !important;
  text-align: left !important;
  border-right: none !important;
  border-left: 3px solid var(--accent-gold) !important;
}

html[dir="ltr"] .mut-modal-tabs,
html[dir="ltr"] .mutashabihat-filter-grid,
html[dir="ltr"] .miracle-filter-grid,
body.lang-ltr .mut-modal-tabs,
body.lang-ltr .mutashabihat-filter-grid,
body.lang-ltr .miracle-filter-grid {
  direction: ltr !important;
  justify-content: flex-start !important;
}

html[dir="ltr"] .mut-control-row,
body.lang-ltr .mut-control-row {
  direction: ltr !important;
}

html[dir="ltr"] .mutashabih-card,
html[dir="ltr"] .miracle-card,
html[dir="ltr"] .dua-card,
html[dir="ltr"] .topic-verse-card,
html[dir="ltr"] .concordance-card,
body.lang-ltr .mutashabih-card,
body.lang-ltr .miracle-card,
body.lang-ltr .dua-card,
body.lang-ltr .topic-verse-card,
body.lang-ltr .concordance-card {
  direction: ltr !important;
  text-align: left !important;
}

html[dir="ltr"] .mut-title,
html[dir="ltr"] .mut-verse-header,
html[dir="ltr"] .topic-verse-header,
body.lang-ltr .mut-title,
body.lang-ltr .mut-verse-header,
body.lang-ltr .topic-verse-header {
  direction: ltr !important;
  flex-direction: row !important;
  justify-content: space-between !important;
}

html[dir="ltr"] .mut-verse-meta,
html[dir="ltr"] .topic-verse-meta,
body.lang-ltr .mut-verse-meta,
body.lang-ltr .topic-verse-meta {
  direction: ltr !important;
  flex-direction: column !important;
  align-items: flex-start !important;
}

@media (max-width: 768px) {
  html[dir="ltr"] .mut-verse-header,
  html[dir="ltr"] .topic-verse-header,
  body.lang-ltr .mut-verse-header,
  body.lang-ltr .topic-verse-header {
    flex-direction: column !important;
    align-items: stretch !important;
  }
}

html[dir="ltr"] .mut-verse-actions,
html[dir="ltr"] .topic-verse-actions,
body.lang-ltr .mut-verse-actions,
body.lang-ltr .topic-verse-actions {
  direction: ltr !important;
  justify-content: flex-end !important;
}

html[dir="ltr"] [style*="border-right:"],
html[dir="ltr"] [style*="border-right :"],
body.lang-ltr [style*="border-right:"],
body.lang-ltr [style*="border-right :"] {
  border-right: none !important;
  border-left: 4px solid var(--accent-gold) !important;
}

/* Quranic verses: Always preserve authentic RTL flow & centered Uthmani font */
html[dir="ltr"] .ayah-text,
html[dir="ltr"] .bismillah-text,
html[dir="ltr"] .mushaf-pages-container,
html[dir="ltr"] .mushaf-page-box,
html[dir="ltr"] .mushaf-ayah-span,
html[dir="ltr"] .modal-tafsir-ayah-box,
html[dir="ltr"] .mut-verse-text,
html[dir="ltr"] .topic-verse-text,
html[dir="ltr"] .dua-verse,
body.lang-ltr .ayah-text,
body.lang-ltr .bismillah-text,
body.lang-ltr .mushaf-pages-container,
body.lang-ltr .mushaf-page-box,
body.lang-ltr .mushaf-ayah-span,
body.lang-ltr .modal-tafsir-ayah-box,
body.lang-ltr .mut-verse-text,
body.lang-ltr .topic-verse-text,
body.lang-ltr .dua-verse {
  direction: rtl !important;
  text-align: center !important;
  font-family: var(--quran-font-family) !important;
}

/* Cards & Actions in LTR */
html[dir="ltr"] .ayah-card,
body.lang-ltr .ayah-card {
  direction: ltr !important;
  text-align: left !important;
}

html[dir="ltr"] .ayah-actions-bar,
body.lang-ltr .ayah-actions-bar {
  direction: ltr !important;
  justify-content: flex-start !important;
}

html[dir="ltr"] .ayah-translation-text,
body.lang-ltr .ayah-translation-text {
  direction: ltr !important;
  text-align: left !important;
}

html[dir="ltr"] .custom-select,
html[dir="ltr"] input[type="text"],
body.lang-ltr .custom-select,
body.lang-ltr input[type="text"] {
  direction: ltr !important;
  text-align: left !important;
}

/* Search icons and clearance in LTR */
html[dir="ltr"] .surah-search-icon,
body.lang-ltr .surah-search-icon {
  margin-inline-end: 8px !important;
  margin-inline-start: 0 !important;
  left: auto !important;
  right: auto !important;
}

html[dir="ltr"] .surah-search-clear,
body.lang-ltr .surah-search-clear {
  margin-inline-start: 6px !important;
  margin-inline-end: 0 !important;
  left: auto !important;
  right: auto !important;
}

html[dir="ltr"] .surah-picker-search-input,
body.lang-ltr .surah-picker-search-input {
  padding: 6px 0 !important;
  direction: ltr !important;
  text-align: left !important;
}

/* Pickers Dropdowns in LTR Desktop (min-width: 769px) */
@media (min-width: 769px) {
  html[dir="ltr"] .surah-picker-dropdown,
  body.lang-ltr .surah-picker-dropdown,
  html[dir="ltr"] .ayah-picker-dropdown,
  body.lang-ltr .ayah-picker-dropdown,
  html[dir="ltr"] .hizb-picker-dropdown,
  body.lang-ltr .hizb-picker-dropdown,
  html[dir="ltr"] .juz-picker-dropdown,
  body.lang-ltr .juz-picker-dropdown,
  html[dir="ltr"] .page-picker-dropdown,
  body.lang-ltr .page-picker-dropdown {
    left: 0 !important;
    right: auto !important;
  }
}

/* Pickers Dropdowns LTR text flow */
html[dir="ltr"] .surah-picker-dropdown,
body.lang-ltr .surah-picker-dropdown,
html[dir="ltr"] .ayah-picker-dropdown,
body.lang-ltr .ayah-picker-dropdown,
html[dir="ltr"] .hizb-picker-dropdown,
body.lang-ltr .hizb-picker-dropdown,
html[dir="ltr"] .juz-picker-dropdown,
body.lang-ltr .juz-picker-dropdown,
html[dir="ltr"] .page-picker-dropdown,
body.lang-ltr .page-picker-dropdown {
  direction: ltr !important;
  text-align: left !important;
}

html[dir="ltr"] .surah-picker-filters,
body.lang-ltr .surah-picker-filters {
  direction: ltr !important;
  justify-content: flex-start !important;
}

html[dir="ltr"] .surah-picker-item,
body.lang-ltr .surah-picker-item {
  direction: ltr !important;
  text-align: left !important;
}

html[dir="ltr"] .surah-item-right,
body.lang-ltr .surah-item-right {
  direction: ltr !important;
  flex-direction: row !important;
}

html[dir="ltr"] .surah-meta-tags,
body.lang-ltr .surah-meta-tags {
  direction: ltr !important;
  flex-direction: row !important;
}

html[dir="ltr"] .search-icon,
body.lang-ltr .search-icon {
  left: 14px !important;
  right: auto !important;
}

html[dir="ltr"] .search-clear-btn,
body.lang-ltr .search-clear-btn {
  right: 86px !important;
  left: auto !important;
}

html[dir="ltr"] .search-input,
body.lang-ltr .search-input {
  padding: 8px 110px 8px 38px !important;
}

html[dir="ltr"] .search-submit-btn,
body.lang-ltr .search-submit-btn {
  right: 6px !important;
  left: auto !important;
}

/* ==========================================================================
   فاصل الورد اليومي والعلامات والمفضلة (Daily Reading Mark & Bookmarks)
   ========================================================================== */

/* شريط استئناف فاصل الورد */
.resume-reading-bar {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.08) 0%, rgba(16, 185, 129, 0.12) 100%);
  border-bottom: 2px solid rgba(16, 185, 129, 0.35);
  border-top: 1px solid rgba(16, 185, 129, 0.2);
  padding: 10px 24px;
  animation: slideDownResumeBar 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 85;
}
@keyframes slideDownResumeBar {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.resume-bar-container {
  max-width: 1380px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.resume-bar-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
}

.resume-bar-ribbon-icon {
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: #ffffff;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.resume-bar-texts {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.resume-bar-title {
  font-weight: 800;
  color: #047857;
  font-size: 0.95rem;
}

.resume-bar-desc {
  font-weight: 600;
  color: #1e293b;
  font-size: 0.95rem;
}

.resume-bar-date {
  font-size: 0.8rem;
  color: #64748b;
  margin-right: 4px;
}

.resume-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-resume-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.btn-resume-jump:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
}

.btn-resume-dismiss {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #64748b;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.btn-resume-dismiss:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.25);
}

/* Dark mode overrides for Resume Bar */
body.theme-dark .resume-reading-bar {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.15) 0%, rgba(16, 185, 129, 0.2) 100%);
  border-bottom-color: rgba(16, 185, 129, 0.4);
  border-top-color: rgba(16, 185, 129, 0.25);
}

body.theme-dark .resume-bar-ribbon-icon {
  background: #1e293b;
  border-color: rgba(16, 185, 129, 0.4);
}

body.theme-dark .resume-bar-title {
  color: #34d399;
}

body.theme-dark .resume-bar-desc {
  color: #f1f5f9;
}

body.theme-dark .resume-bar-date {
  color: #94a3b8;
}

body.theme-dark .btn-resume-dismiss {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

/* زر فاصل الورد النشط وأزرار العلامات */
.action-btn-sm.is-active-reading-mark {
  background: linear-gradient(135deg, #059669, #047857) !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35) !important;
  font-weight: 800 !important;
}

.action-btn-sm.is-active-reading-mark:hover {
  background: linear-gradient(135deg, #047857, #065f46) !important;
}

.action-btn-sm.is-bookmarked {
  background: #fff1f2 !important;
  color: #e11d48 !important;
  border-color: #f43f5e !important;
  font-weight: 700 !important;
}

body.theme-dark .action-btn-sm.is-bookmarked {
  background: rgba(225, 29, 72, 0.2) !important;
  color: #fda4af !important;
  border-color: rgba(225, 29, 72, 0.4) !important;
}

/* نوافذ تبويبات فاصل الورد والعلامات (Modal) */
.bookmarks-modal-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.bookmarks-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.bookmarks-tab-btn:hover {
  border-color: #059669;
  color: #059669;
}

.bookmarks-tab-btn.active {
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  border-color: #047857;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

/* بطاقة فاصل الورد داخل النافذة */
.reading-mark-card {
  background: var(--bg-card);
  border: 2px solid rgba(16, 185, 129, 0.4);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.reading-mark-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #065f46;
  border: 1px solid rgba(5, 150, 105, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

body.theme-dark .reading-mark-header-pill {
  background: rgba(5, 150, 105, 0.2);
  color: #34d399;
  border-color: rgba(5, 150, 105, 0.4);
}

.reading-mark-meta-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.reading-mark-meta-sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 16px;
}

.reading-mark-verse-box {
  background: var(--bg-body);
  border-right: 4px solid #059669;
  padding: 16px 20px;
  border-radius: 10px;
  font-family: 'Amiri Quran', 'Amiri', serif;
  font-size: 1.35rem;
  line-height: 2.1;
  color: var(--text-main);
  margin-bottom: 20px;
}

.reading-mark-actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-mark-jump {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  border: none;
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(5, 150, 105, 0.3);
}

.btn-mark-jump:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  transform: translateY(-1.5px);
  box-shadow: 0 5px 14px rgba(5, 150, 105, 0.4);
}

.btn-mark-clear {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-mark-clear:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* بطاقة الحالة الفارغة */
.empty-tab-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: 16px;
}

.empty-tab-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-tab-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.empty-tab-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto 12px auto;
  line-height: 1.7;
}

.empty-tab-tip {
  display: inline-block;
  background: rgba(16, 185, 129, 0.08);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 700;
}

body.theme-dark .empty-tab-tip {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

/* قائمة العلامات المحفوظة */
.bookmarks-grid-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding-left: 4px;
}

.bookmark-row-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  transition: all 0.2s ease;
}

.bookmark-row-item:hover {
  border-color: rgba(225, 29, 72, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.bookmark-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.bookmark-item-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.bookmark-item-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.bookmark-item-text {
  font-family: 'Amiri Quran', 'Amiri', serif;
  font-size: 1.18rem;
  line-height: 2;
  color: var(--text-main);
  margin-bottom: 12px;
}

.bookmark-item-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-item-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #ffffff;
  border: none;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-item-jump:hover {
  background: linear-gradient(135deg, #be123c, #9f1239);
}

.btn-item-del {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-item-del:hover {
  background: #dc2626;
  color: #ffffff;
}

/* تبويب مزامنة الحساب */
.sync-tab-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
}

.sync-status-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.sync-status-card.logged-in {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.15));
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.sync-status-card.visitor {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(217, 119, 6, 0.12));
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.sync-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.sync-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.sync-card-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.sync-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.sync-btn-primary:hover {
  background: linear-gradient(135deg, #047857, #065f46);
  color: #ffffff;
}

.sync-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sync-btn-secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

body.theme-dark .sync-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
}




/* ==========================================================================
   شريط الاقتراحات والمحطات الإيمانية لصفحة القرآن الكريم (Spiritual Highlights Bar)
   ========================================================================== */
.quran-companion-bar {
  margin: 40px auto 35px auto;
  max-width: 1340px;
  padding: 0 16px;
  box-sizing: border-box;
}

.companion-bar-inner {
  background: #fdfcf9;
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 20px;
  padding: 26px 22px;
  box-shadow: 0 10px 32px rgba(180, 145, 60, 0.06);
  position: relative;
  overflow: hidden;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.companion-bar-inner::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  height: 4px;
  background: linear-gradient(90deg, #d4af37, #10b981, #d4af37);
  opacity: 0.85;
}

.companion-bar-header {
  margin-bottom: 22px;
}

.companion-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.companion-badge-icon {
  font-size: 2.2rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.12);
  border-radius: 14px;
  padding: 8px;
  flex-shrink: 0;
}

.companion-main-title {
  margin: 0 0 4px 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.2px;
}

.companion-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.5;
}

.companion-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.companion-card {
  background: #ffffff;
  border: 1px solid #e7e5e0;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.companion-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  border-color: rgba(212, 175, 55, 0.4);
}

.card-top-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.25);
}

.card-icon-badge {
  font-size: 1.35rem;
  background: rgba(212, 175, 55, 0.1);
  padding: 6px;
  border-radius: 10px;
  line-height: 1;
}

.card-titles h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e293b;
}

.card-titles .card-sub {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
}

/* Quick Surahs List (Desktop) */
.quick-surahs-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.quick-surah-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  text-align: start;
  font-family: inherit;
  transition: all 0.2s ease;
  min-width: 0;
}

.quick-surah-btn:hover {
  background: #fefce8;
  border-color: #facc15;
  transform: translateY(-1px);
}

.quick-surah-btn.quick-surah-kursi {
  grid-column: span 2;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.quick-surah-btn.quick-surah-kursi:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

.surah-num-pill {
  background: #047857;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 6px;
  flex-shrink: 0;
  line-height: 1;
}

.quick-surah-kursi .surah-num-pill {
  background: #0284c7;
}

.surah-info-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.surah-info-text strong {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.surah-info-text small {
  font-size: 0.72rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.btn-arrow {
  font-size: 0.9rem;
  color: #85581A;
  font-weight: bold;
  opacity: 0.6;
  transition: opacity 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.quick-surah-btn:hover .btn-arrow {
  opacity: 1;
  transform: translateX(-3px);
}

/* Duas Scroll List (Desktop) */
.duas-scroll-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 310px;
  overflow-y: auto;
  padding-inline-end: 4px;
}

.duas-scroll-list::-webkit-scrollbar {
  width: 5px;
}
.duas-scroll-list::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.3);
  border-radius: 4px;
}

.dua-item-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color 0.2s ease;
}

.dua-item-box:hover {
  border-color: rgba(212, 175, 55, 0.4);
}

.dua-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.dua-tag {
  font-size: 0.76rem;
  font-weight: 700;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 2px 8px;
  border-radius: 6px;
}

.copy-dua-btn {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 3px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.copy-dua-btn:hover {
  background: #ecfdf5;
  border-color: #a7f3d0;
  transform: scale(1.08);
}

.dua-text {
  font-family: 'Amiri', 'Traditional Arabic', serif;
  font-size: 1rem;
  line-height: 1.75;
  color: #1e293b;
  margin: 0;
}

.dua-note {
  display: block;
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 6px;
  line-height: 1.4;
  font-style: italic;
}

/* Spiritual Links (Desktop) */
.spiritual-links-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spiritual-tool-link {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.spiritual-tool-link:hover {
  background: #f0fdf4;
  border-color: #86efac;
  transform: translateY(-1px);
}

.tool-link-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.tool-link-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.tool-link-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.tool-link-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-link-action {
  font-size: 0.8rem;
  font-weight: 700;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.spiritual-tool-link:hover .tool-link-action {
  background: #047857;
  color: #ffffff;
  border-color: #047857;
}

.tool-link-desc {
  margin: 6px 0 0 0;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.45;
  width: 100%;
}

/* ==========================================================================
   تحسينات الجوال وتوسيع البطاقات بالكامل (Mobile Optimization & Expanded Cards)
   ========================================================================== */
@media (max-width: 991px) {
  .companion-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    width: 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 768px) {
  /* 1. الحاوية العامة: محاذاة بعرض 100% بدون أي تجاوز أو شريط تمرير أفقي */
  .quran-companion-bar {
    margin: 20px auto 145px auto !important;
    padding: 0 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* 2. إلغاء الإطار المزدوج لمنع انحصار البطاقات في قالب ضيق */
  .companion-bar-inner {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .companion-bar-inner::before {
    display: none !important;
  }

  /* 3. ترويسة أنيقة مستقلة في أعلى القسم */
  .companion-bar-header {
    background: #ffffff !important;
    border: 1px solid rgba(212, 175, 55, 0.3) !important;
    border-radius: 14px !important;
    padding: 14px 14px !important;
    margin-bottom: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .companion-title-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
  }

  .companion-badge-icon {
    font-size: 1.7rem !important;
    padding: 8px !important;
    border-radius: 12px !important;
    background: rgba(212, 175, 55, 0.12) !important;
    flex-shrink: 0 !important;
  }

  .companion-main-title {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    color: #1e293b !important;
    line-height: 1.35 !important;
    margin: 0 0 3px 0 !important;
    word-break: break-word !important;
  }

  .companion-subtitle {
    font-size: 0.78rem !important;
    line-height: 1.45 !important;
    color: #64748b !important;
    margin: 0 !important;
    word-break: break-word !important;
  }

  /* شبكة البطاقات الثلاث */
  .companion-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  /* 4. بطاقات القسم: عرض كامل 100% مع منع أي قص للنصوص */
  .companion-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    padding: 16px 14px !important;
    gap: 12px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .card-top-head {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding-bottom: 10px !important;
    border-bottom: 1px dashed rgba(212, 175, 55, 0.25) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .card-icon-badge {
    font-size: 1.3rem !important;
    padding: 6px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .card-titles {
    min-width: 0 !important;
    flex: 1 !important;
  }

  .card-titles h4 {
    font-size: 0.98rem !important;
    font-weight: 800 !important;
    color: #1e293b !important;
    margin: 0 !important;
    line-height: 1.35 !important;
    word-break: break-word !important;
  }

  .card-titles .card-sub {
    font-size: 0.75rem !important;
    color: #64748b !important;
    display: block !important;
    margin-top: 2px !important;
    line-height: 1.4 !important;
    word-break: break-word !important;
  }

  /* 5. بطاقة السور: شبكة عمودين متناسقة تماماً مع آية الكرسي كاملة */
  .quick-surahs-list {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .quick-surah-btn {
    padding: 8px 10px !important;
    min-height: 48px !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
  }

  .quick-surah-btn.quick-surah-kursi {
    grid-column: span 2 !important;
    padding: 10px 14px !important;
    min-height: 52px !important;
  }

  .surah-info-text {
    min-width: 0 !important;
    flex: 1 !important;
  }

  .surah-info-text strong {
    font-size: 0.84rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .surah-info-text small {
    font-size: 0.68rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .quick-surah-arrow {
    font-size: 0.85rem !important;
    flex-shrink: 0 !important;
  }

  /* 6. بطاقة الأدعية: إلغاء التمرير الداخلي وعرض كامل للنصوص دون أي اقتطاع */
  .duas-scroll-list {
    max-height: none !important;
    overflow-y: visible !important;
    padding-inline-end: 0 !important;
    gap: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .dua-item-box {
    padding: 12px 14px !important;
    border-radius: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .dua-item-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    margin-bottom: 6px !important;
  }

  .dua-tag {
    font-size: 0.74rem !important;
    padding: 2px 8px !important;
    line-height: 1.4 !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  .copy-dua-btn {
    font-size: 0.85rem !important;
    padding: 3px 8px !important;
    flex-shrink: 0 !important;
  }

  .dua-text {
    font-size: 0.96rem !important;
    line-height: 1.75 !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow: visible !important;
  }

  .dua-note {
    font-size: 0.74rem !important;
    line-height: 1.45 !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow: visible !important;
  }

  /* 7. بطاقة الأدوات: ظهور كامل للعناوين والأوصاف بدون white-space: nowrap */
  .spiritual-links-wrap {
    gap: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .spiritual-tool-link {
    padding: 12px 14px !important;
    border-radius: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .tool-link-top {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
  }

  .tool-link-title-group {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .tool-link-icon {
    font-size: 1.25rem !important;
    flex-shrink: 0 !important;
  }

  .tool-link-title {
    font-size: 0.92rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word !important;
    line-height: 1.35 !important;
  }

  .tool-link-action {
    font-size: 0.76rem !important;
    padding: 3px 9px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .tool-link-desc {
    font-size: 0.78rem !important;
    line-height: 1.45 !important;
    color: #64748b !important;
    margin: 6px 0 0 0 !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow: visible !important;
    width: 100% !important;
  }
}
/* Dark Theme Support */
body.theme-dark .companion-bar-inner {
  background: #111b24;
  border-color: rgba(212, 175, 55, 0.2);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.3);
}

body.theme-dark .companion-bar-header {
  background: #111b24 !important;
  border-color: rgba(212, 175, 55, 0.25) !important;
}

body.theme-dark .companion-main-title {
  color: #f1f5f9 !important;
}

body.theme-dark .companion-subtitle {
  color: #94a3b8 !important;
}

body.theme-dark .companion-card {
  background: #16222f !important;
  border-color: #243447 !important;
}

body.theme-dark .card-titles h4 {
  color: #f1f5f9;
}

body.theme-dark .card-titles .card-sub {
  color: #94a3b8;
}

body.theme-dark .quick-surah-btn {
  background: #0f172a !important;
  border-color: #334155 !important;
}

body.theme-dark .quick-surah-btn:hover {
  background: #1e293b !important;
  border-color: #facc15 !important;
}

body.theme-dark .quick-surah-btn.quick-surah-kursi {
  background: rgba(6, 78, 59, 0.35) !important;
  border-color: #059669 !important;
}

body.theme-dark .surah-info-text strong {
  color: #f1f5f9;
}

body.theme-dark .surah-info-text small {
  color: #94a3b8;
}

body.theme-dark .dua-item-box {
  background: #0f172a !important;
  border-color: #334155 !important;
}

body.theme-dark .dua-text {
  color: #f1f5f9;
}

body.theme-dark .dua-note {
  color: #94a3b8;
}

body.theme-dark .copy-dua-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #f1f5f9 !important;
}

body.theme-dark .spiritual-tool-link {
  background: #0f172a !important;
  border-color: #334155 !important;
}

body.theme-dark .spiritual-tool-link:hover {
  background: #1e293b !important;
  border-color: #059669 !important;
}

body.theme-dark .tool-link-top .tool-link-title {
  color: #f1f5f9;
}

body.theme-dark .tool-link-action {
  background: rgba(5, 150, 105, 0.2) !important;
  border-color: #059669 !important;
  color: #34d399 !important;
}

body.theme-dark .tool-link-desc {
  color: #94a3b8;
}

@keyframes searchPulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7); border-color: #d4af37; transform: scale(1.01); }
  60% { box-shadow: 0 0 0 10px rgba(212, 175, 55, 0); border-color: #d4af37; transform: scale(1); }
  100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); }
}
.search-highlight-pulse {
  animation: searchPulseGlow 1.4s ease-out !important;
  border-color: #d4af37 !important;
  outline: none !important;
}

/* ==========================================================================
   Comprehensive Dark Mode Overrides (Contrast & Legibility Fixes)
   ========================================================================== */
body.theme-dark .modal-card,
body.theme-dark .modal-body {
  color: var(--text-main);
  background-color: var(--bg-card);
}

/* Headings, strong, div, span, and labels using var(--primary) */
body.theme-dark strong[style*="color: var(--primary)"],
body.theme-dark div[style*="color: var(--primary)"],
body.theme-dark span[style*="color: var(--primary)"],
body.theme-dark p[style*="color: var(--primary)"],
body.theme-dark a[style*="color: var(--primary)"],
body.theme-dark h1[style*="color: var(--primary)"],
body.theme-dark h2[style*="color: var(--primary)"],
body.theme-dark h3[style*="color: var(--primary)"],
body.theme-dark h4[style*="color: var(--primary)"],
body.theme-dark h5[style*="color: var(--primary)"],
body.theme-dark h6[style*="color: var(--primary)"],
body.theme-dark .modal-body strong[style*="color: var(--primary)"],
body.theme-dark .modal-body div[style*="color: var(--primary)"],
body.theme-dark .modal-body span[style*="color: var(--primary)"],
body.theme-dark .modal-body h1[style*="color: var(--primary)"],
body.theme-dark .modal-body h2[style*="color: var(--primary)"],
body.theme-dark .modal-body h3[style*="color: var(--primary)"],
body.theme-dark .modal-body h4[style*="color: var(--primary)"],
body.theme-dark .modal-body h5[style*="color: var(--primary)"],
body.theme-dark .modal-body h6[style*="color: var(--primary)"] {
  color: #34d399 !important;
}

/* Gold callout boxes in Dark Mode */
body.theme-dark .modal-body div[style*="background: var(--accent-gold-light)"],
body.theme-dark .modal-body [style*="background: var(--accent-gold-light)"] {
  background: rgba(226, 186, 109, 0.1) !important;
  color: #f1f5f9 !important;
  border-color: rgba(226, 186, 109, 0.3) !important;
}

/* Hardcoded dark greens -> vibrant Quranic emerald */
body.theme-dark [style*="color: #047857"],
body.theme-dark [style*="color: #059669"],
body.theme-dark [style*="color: #065f46"],
body.theme-dark [style*="color: #15803d"],
body.theme-dark [style*="color: #16a34a"] {
  color: #34d399 !important;
}

/* Hardcoded dark ambers -> warm luminous amber */
body.theme-dark [style*="color: #92400e"],
body.theme-dark [style*="color: #b45309"],
body.theme-dark [style*="color: #854d0e"],
body.theme-dark [style*="color: #d97706"] {
  color: #fbbf24 !important;
}

/* Hardcoded dark blues -> readable sky blue */
body.theme-dark [style*="color: #0284c7"],
body.theme-dark [style*="color: #1e40af"],
body.theme-dark [style*="color: #1d4ed8"],
body.theme-dark [style*="color: #0369a1"],
body.theme-dark [style*="color: #3b82f6"] {
  color: #38bdf8 !important;
}

/* Hardcoded purples -> soft lavender */
body.theme-dark [style*="color: #7c3aed"],
body.theme-dark [style*="color: #6d28d9"] {
  color: #c084fc !important;
}

/* Hardcoded dark grays and blacks -> bright soft white */
body.theme-dark [style*="color: #1a1a1a"]:not(.keep-dark),
body.theme-dark [style*="color: #111111"],
body.theme-dark [style*="color: #000"],
body.theme-dark [style*="color: #000000"],
body.theme-dark [style*="color: #333333"],
body.theme-dark [style*="color: #4b5563"] {
  color: #e6edea !important;
}

/* Ensure modal buttons with var(--accent-gold) badges keep black text for high contrast */
body.theme-dark span[style*="background: var(--accent-gold)"],
body.theme-dark span[style*="background: #e2ba6d"],
body.theme-dark span[style*="background: #C5A059"],
body.theme-dark .modal-body span[style*="background: var(--accent-gold)"],
body.theme-dark .modal-body span[style*="background: #e2ba6d"],
body.theme-dark .modal-body span[style*="background: #C5A059"] {
  background: var(--accent-gold) !important;
  color: #121212 !important;
}

/* Hardcoded light backgrounds in modals -> translucent dark card backgrounds */
body.theme-dark .modal-body [style*="background: #fffbeb"],
body.theme-dark .modal-body [style*="background: #ecfdf5"],
body.theme-dark .modal-body [style*="background: #fef3c7"],
body.theme-dark .modal-body [style*="background: #eff6ff"],
body.theme-dark .modal-body [style*="background: #f8fafc"],
body.theme-dark .modal-body [style*="background: #fefce8"],
body.theme-dark .modal-body [style*="background: #fff"],
body.theme-dark .modal-body [style*="background: #ffffff"],
body.theme-dark .modal-body [style*="background: #fef2f2"],
body.theme-dark .modal-body [style*="background: #f1f5f9"],
body.theme-dark .modal-body [style*="background: #e0f2fe"],
body.theme-dark .modal-body [style*="background: #dbeafe"],
body.theme-dark .modal-body [style*="background: #f0fdf4"],
body.theme-dark .modal-body [style*="background: #dcfce7"],
body.theme-dark .modal-body [style*="background: #fffdfa"] {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #e6edea !important;
}

/* Responsive switch for Tafsir button text */
.btn-text-full {
  display: inline;
}
.btn-text-short {
  display: none;
}

/* Hide scroll-to-top when Mushaf Popover is open to prevent overlapping buttons */
body.mushaf-popover-open #scroll-to-top,
body.mushaf-popover-open .theme-scroll-to-top {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: scale(0.6) !important;
  transition: all 0.2s ease !important;
}


/* ==========================================================================
   Smart Return to Origin Floating Bar (زر وشريط العودة الذكي لنافذة الاستكشاف)
   ========================================================================== */
.quran-origin-return-bar {
  position: fixed;
  bottom: calc(var(--current-player-height, 85px) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100001; /* above audio player fixed (99999) */
  display: inline-flex;
  align-items: center;
  background: var(--bg-card, #ffffff);
  color: var(--text-main, #1e293b);
  border: 1.5px solid var(--accent-gold, #c5a059);
  border-radius: 9999px;
  padding: 4px 6px 4px 12px;
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(197, 160, 89, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  max-width: calc(100vw - 32px);
  animation: quranOriginSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  user-select: none;
}

[dir="rtl"] .quran-origin-return-bar {
  padding: 4px 12px 4px 6px;
}

body.quran-modal-open .quran-origin-return-bar {
  display: none !important;
}

body.mushaf-popover-open .quran-origin-return-bar {
  opacity: 0 !important;
  pointer-events: none !important;
}

@keyframes quranOriginSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 25px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.origin-return-main-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 9999px;
  text-decoration: none;
  min-width: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

.origin-return-main-btn:hover {
  background: var(--accent-gold-light, rgba(197, 160, 89, 0.15));
}

.origin-return-main-btn:active {
  transform: scale(0.98);
}

.origin-return-icon {
  font-size: 1.15rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.origin-return-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
  min-width: 0;
}

.origin-return-lead {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.origin-return-title {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.origin-return-dismiss-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-inline-start: 4px;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.origin-return-dismiss-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.origin-return-dismiss-btn:active {
  transform: scale(0.92);
}

/* Pulse animation on target card upon return */
@keyframes quranOriginPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(197, 160, 89, 0.85);
    border-color: var(--accent-gold);
  }
  40% {
    box-shadow: 0 0 0 10px rgba(197, 160, 89, 0.35);
    border-color: var(--accent-gold);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(197, 160, 89, 0);
  }
}

.quran-origin-highlight {
  animation: quranOriginPulse 1.8s ease-out !important;
  border-color: var(--accent-gold) !important;
}

/* Dark Mode Theme */
body.theme-dark .quran-origin-return-bar {
  background: rgba(21, 34, 29, 0.94);
  border-color: var(--accent-gold);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(226, 186, 109, 0.3);
}

body.theme-dark .origin-return-title {
  color: var(--primary);
}

/* Sepia Mode Theme */
body.theme-sepia .quran-origin-return-bar {
  background: rgba(245, 238, 224, 0.95);
  border-color: var(--accent-gold);
  box-shadow: 0 10px 25px rgba(61, 48, 35, 0.18), 0 0 0 1px rgba(179, 125, 54, 0.25);
}

/* Mobile responsive styling */
@media (max-width: 768px) {
  .quran-origin-return-bar {
    bottom: calc(var(--current-player-height, 105px) + 14px);
    padding: 3px 6px 3px 10px;
    max-width: calc(100vw - 24px);
  }

  [dir="rtl"] .quran-origin-return-bar {
    padding: 3px 10px 3px 6px;
  }

  .origin-return-main-btn {
    padding: 4px 6px;
    font-size: 0.85rem;
    gap: 6px;
  }

  .origin-return-text {
    max-width: 220px;
  }

  .origin-return-title {
    font-size: 0.85rem;
  }

  .origin-return-lead {
    font-size: 0.78rem;
  }

  .origin-return-dismiss-btn {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
  }
}

@media (max-width: 400px) {
  .origin-return-text {
    max-width: 170px;
  }
}
