/* =========================================================
   قارئ المصحف بملء الشاشة — تخطيط مصحف المدينة الأصلي
   ========================================================= */
.mushaf-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: #fdfaf3; /* لون ورق المصحف — ثابت في الوضعين عشان الورق ورق */
  color: #1a1408;
}

html[data-theme='dark'] .mushaf-screen {
  background: #16130d;
  color: #e8dfc8;
}

.mushaf-loading {
  margin: auto;
  text-align: center;
  opacity: 0.7;
  font-size: 17px;
}

/* ------------------------------------------------------- الترويسة */
.mushaf-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px calc(10px);
  padding-top: calc(10px + var(--sa-top));
  border-bottom: 1px solid rgba(120, 95, 40, 0.22);
  flex: 0 0 auto;
}
.mushaf-title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mushaf-page-no {
  font-size: 13.5px;
  opacity: 0.7;
}
.mushaf-x {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  padding: 4px 8px;
  border-radius: var(--r-sm);
}
.mushaf-x:hover {
  background: rgba(120, 95, 40, 0.12);
}

/* --------------------------------------------------------- الصفحة */
.mushaf-sheet {
  flex: 1;
  min-height: 0;
  overflow: hidden; /* صفحة المصحف لازم تبان كاملة — الحجم بيتظبط بالقياس */
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 2px;
  padding: 8px clamp(8px, 3vw, 28px);
  margin-inline: auto; /* الصفحة بتتوسّط الشاشة زي المصحف في إيدك */
  /**
   * ده حجم مبدئي بس — `fitLines` بيحسب الحجم الحقيقي بالقياس عشان
   * الصفحة تدخل كاملة في الشاشة وتملى عرضها.
   */
  font-size: 24px;
  /**
   * أضيق من الطبيعي بقصد. حروف المصحف امتداداتها الرأسية كبيرة، ولو سِبنا
   * التباعد الافتراضي الصفحة بتطلع ضيقة وطويلة — مش زي نسبة صفحة المصحف
   * الحقيقية (عرضها ≈ ٦٠٪ من طولها). التداخل البسيط بين التشكيل والسطر
   * اللي تحته موجود في المطبوع نفسه.
   */
  line-height: 1.32;
  direction: rtl;
}

.mushaf-line {
  display: flex;
  justify-content: center;
  align-items: baseline;
  white-space: nowrap;
}

/**
 * السطر اللي بيملى العرض بيتمدّد زي المطبوع، والقصير (البسملة واسم
 * السورة) بيفضل في النص. التفرقة بتتحدد بالقياس في الجافاسكريبت.
 */
.mushaf-line.is-justified {
  justify-content: space-between;
}

.mushaf-run {
  cursor: pointer;
  border-radius: 5px;
  transition: background 0.15s ease;
  padding-block: 2px;
}
.mushaf-run:hover {
  background: rgba(120, 95, 40, 0.1);
}

/* حالات الحفظ — نفس ألوان العرض العادي */
.mushaf-run.memorized {
  background: color-mix(in srgb, var(--ok) 20%, transparent);
}
.mushaf-run.mastered {
  background: color-mix(in srgb, var(--gold) 28%, transparent);
}

/* --------------------------------------------------------- التنقّل */
.mushaf-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  padding-bottom: calc(10px + var(--sa-bottom));
  border-top: 1px solid rgba(120, 95, 40, 0.22);
  flex: 0 0 auto;
}
.mushaf-btn {
  background: transparent;
  border: 1px solid rgba(120, 95, 40, 0.35);
  color: inherit;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.mushaf-btn:hover:not(:disabled) {
  background: rgba(120, 95, 40, 0.12);
}
.mushaf-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.mushaf-jump {
  width: 76px;
  text-align: center;
  font-family: inherit;
  font-size: 15px;
  padding: 8px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(120, 95, 40, 0.35);
  background: transparent;
  color: inherit;
}

/* على الشاشات الواسعة نحصر الصفحة في عرض معقول زي المصحف الحقيقي */
/* العرض بيتحدد بالقياس في الجافاسكريبت — ده سقف عشان مايتمططش على شاشة كبيرة */
.mushaf-sheet {
  max-width: min(100%, 860px);
}
