/* مصحف أم سليمان — التصميم
   لا خطوط ولا صور ولا مكتبات من الإنترنت: خطوط النظام والرسوم المضمَّنة وحدها.
   قاعدة أساسية: شاشة الأرقام تملأ الشاشة كاملة بلا أي تمرير. */

:root {
  --خلفية: #0f2419;
  --خلفية-٢: #14321f;
  --نص: #ffffff;
  --نص-باهت: #cfe3d6;
  --حد: #2f6b4a;
  --أصفر: #fbbf24;
  --أحمر: #dc2626;
  --خط-الآيات: 30px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--خلفية);
  color: var(--نص);
  font-family: 'Segoe UI', 'Noto Naskh Arabic', 'Geeza Pro', 'Traditional Arabic', Tahoma, sans-serif;
  font-size: 20px;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
}

.مخفي {
  display: none !important;
}

.شاشة {
  position: fixed;
  inset: 0;
  padding: calc(8px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right))
    calc(8px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== الشريط العلوي ===== */
.شريط-علوي {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.زر-قارئ {
  position: relative;
  flex: 0 0 auto;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 4px solid var(--حد);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  overflow: visible;
}

.زر-قارئ.صغير {
  width: 56px;
  height: 56px;
  border-width: 3px;
}

.زر-قارئ .وجه-القارئ {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.زر-قارئ .وجه-القارئ svg {
  width: 72%;
  height: 72%;
}

.زر-قارئ .وجه-القارئ img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.زر-قارئ .سهم-تبديل {
  position: absolute;
  bottom: -5px;
  left: -5px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--أصفر);
  color: #1a1206;
  display: grid;
  place-items: center;
  border: 2px solid var(--خلفية);
}

.زر-قارئ .سهم-تبديل svg {
  width: 18px;
  height: 18px;
}

/* ===== عنوان التطبيق في وسط الشريط ===== */
.عنوان-التطبيق {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
}

.اسم-المصحف {
  font-size: clamp(19px, 5.4vw, 26px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--أصفر);
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}

/* خيط ذهبي رفيع ينتهي طرفاه بتلاشٍ، كزخرفة المصاحف */
.زخرفة {
  display: block;
  width: 72%;
  max-width: 190px;
  height: 2px;
  background: linear-gradient(
    to left,
    transparent,
    var(--أصفر) 25%,
    var(--أصفر) 75%,
    transparent
  );
  opacity: 0.75;
}

.اسم-قارئ {
  min-width: 0;
  max-width: 100%;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--نص-باهت);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.عنوان-وجه {
  flex: 1;
  text-align: center;
  font-size: 30px;
  font-weight: 700;
}

.عنوان-وجه .صغير {
  display: block;
  font-size: 17px;
  font-weight: 400;
  color: var(--نص-باهت);
}

.زر-ترس {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--حد);
  background: var(--خلفية-٢);
  color: var(--نص-باهت);
  opacity: 0.32;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.زر-ترس svg {
  width: 24px;
  height: 24px;
}

.زر-استكمال-صغير {
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 4px solid var(--أصفر);
  background: var(--أصفر);
  color: #1a1206;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.زر-استكمال-صغير svg {
  width: 32px;
  height: 32px;
}

.زر-رجوع {
  flex: 0 0 auto;
  width: 66px;
  height: 66px;
  border-radius: 20px;
  border: 4px solid var(--حد);
  background: var(--خلفية-٢);
  color: var(--نص);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.زر-رجوع svg {
  width: 36px;
  height: 36px;
  transform: scaleX(-1);
}

/* ===== شريط الأجزاء الثلاثة ===== */
.شريط-أجزاء {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex: 0 0 auto;
}

.زر-جزء {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 62px;
  border-radius: 18px;
  border: 4px solid currentColor;
  background: var(--خلفية-٢);
  cursor: pointer;
  font-family: inherit;
  padding: 4px 6px;
}

.زر-جزء svg {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.زر-جزء .مدى {
  font-size: 19px;
  font-weight: 700;
  color: var(--نص);
  white-space: nowrap;
}

.زر-جزء[aria-pressed='true'] {
  background: #1d4530;
  box-shadow: 0 0 0 4px var(--أصفر);
}

/* ===== شبكة أرقام الأوجه: تملأ المتبقي بلا تمرير ===== */
.شبكة-أرقام {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.مربع-وجه {
  min-height: 0;
  min-width: 0;
  border: 4px solid currentColor;
  border-radius: 18px;
  background: var(--خلفية-٢);
  display: grid;
  place-items: center;
  position: relative;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  overflow: hidden;
}

.مربع-وجه .رقم {
  font-size: min(13vw, 10vh, 64px);
  font-weight: 700;
  color: var(--نص);
  line-height: 1;
}

.مربع-وجه .ركن {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.مربع-وجه[aria-pressed='true'] {
  background: #1d4530;
  box-shadow: inset 0 0 0 5px var(--أصفر);
}

.مربع-وجه .علامة-موضع {
  position: absolute;
  bottom: 5px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--أصفر);
}

/* ===== شاشة الاستماع ===== */
.دوائر {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex: 0 0 auto;
}

.دائرة {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid var(--حد);
  background: transparent;
}

.دائرة.تمّت {
  background: var(--أصفر);
  border-color: var(--أصفر);
}

.دائرة.جارية {
  background: var(--أصفر);
  border-color: #fff;
  box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.35);
}

/* ===== منطقتا التنقل: سهم كبير لأعلى وآخر لأسفل ===== */
.منطقة-تنقل {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 112px;
  padding: 6px 10px;
  border-radius: 22px;
  border: 4px solid var(--حد);
  background: var(--خلفية-٢);
  font-family: inherit;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
}

.منطقة-تنقل.أعلى {
  border-color: #b45309;
  color: #fdba74;
}

.منطقة-تنقل.أسفل {
  border-color: #15803d;
  color: #86efac;
}

.منطقة-تنقل:active {
  background: #1d4530;
}

.منطقة-تنقل:disabled {
  opacity: 0.35;
}

.منطقة-تنقل .سهم {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
}

.منطقة-تنقل .لمحة {
  font-size: 17px;
  line-height: 1.6;
  color: var(--نص-باهت);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  direction: rtl;
}

/* ===== الآية الجارية في الوسط ===== */
.منطقة-آية {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow-y: auto;
  padding: 6px 4px;
}

.آية-حالية {
  font-size: var(--خط-الآيات);
  line-height: 2.1;
  text-align: center;
  color: #ffffff;
  padding: 0 6px;
}

.آية-حالية .رقم-آية {
  display: inline-grid;
  place-items: center;
  min-width: 2.2em;
  height: 2.2em;
  margin-inline-start: 8px;
  border-radius: 50%;
  border: 2px solid var(--أصفر);
  color: var(--أصفر);
  font-size: 0.62em;
  vertical-align: middle;
}

.أزرار-الاستماع {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex: 0 0 auto;
  position: relative;
}

.زر-دائري {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 5px solid var(--حد);
  background: var(--خلفية-٢);
  color: var(--نص);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.زر-دائري.كبير {
  width: 104px;
  height: 104px;
  border-color: var(--أصفر);
  background: var(--أصفر);
  color: #1a1206;
}

.زر-دائري svg {
  width: 38px;
  height: 38px;
}

.زر-دائري.كبير svg {
  width: 54px;
  height: 54px;
}

.عداد-آية {
  position: absolute;
  inset-inline-end: 4px;
  font-size: 20px;
  color: var(--نص-باهت);
  font-weight: 700;
}

#زر-الميكروفون.يسمع {
  border-color: #ef4444;
  background: #7f1d1d;
  color: #fecaca;
  animation: نبض 1.4s ease-in-out infinite;
}

@keyframes نبض {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
  }
}

/* ===== قسم الأسرة ===== */
#شاشة-الأسرة {
  overflow-y: auto;
}

.عنوان-أسرة {
  margin: 0;
  font-size: 28px;
}

.أسرة-محتوى {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 19px;
  max-width: 760px;
  padding-bottom: 40px;
}

.أسرة-محتوى h3 {
  margin: 18px 0 2px;
  font-size: 23px;
  border-top: 2px solid var(--حد);
  padding-top: 14px;
}

.لوح-حالة {
  background: var(--خلفية-٢);
  border: 3px solid var(--حد);
  border-radius: 18px;
  padding: 14px 16px;
  line-height: 1.8;
}

.لوح-حالة.جاهز {
  border-color: #22c55e;
}

.لوح-حالة.ناقص {
  border-color: var(--أصفر);
}

.شرح {
  color: var(--نص-باهت);
  line-height: 1.9;
  margin: 4px 0;
}

.صف-قارئ {
  background: var(--خلفية-٢);
  border: 3px solid var(--حد);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.صف-قارئ .سطر-عنوان {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 21px;
  margin-bottom: 8px;
}

.شريط-تقدم {
  height: 20px;
  border-radius: 10px;
  background: #0a1b12;
  border: 2px solid var(--حد);
  overflow: hidden;
  margin: 10px 0 6px;
}

.شريط-تقدم > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--أصفر);
  transition: width 0.2s linear;
}

.أزرار-صف {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.زر-ثانوي {
  padding: 14px 20px;
  border-radius: 16px;
  border: 3px solid var(--حد);
  background: var(--خلفية-٢);
  color: var(--نص);
  font-family: inherit;
  font-size: 19px;
  cursor: pointer;
}

.زر-ثانوي.أساسي {
  background: var(--أصفر);
  border-color: var(--أصفر);
  color: #1a1206;
  font-weight: 700;
}

.زر-ثانوي.خطر {
  border-color: var(--أحمر);
  color: #fecaca;
}

.زر-ثانوي:disabled {
  opacity: 0.45;
}

.صف-إعداد {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--خلفية-٢);
  border: 3px solid var(--حد);
  border-radius: 18px;
  padding: 14px 16px;
}

.صف-إعداد input[type='range'] {
  flex: 1;
  height: 36px;
}

.قيمة {
  font-weight: 700;
  min-width: 7ch;
}

.مفتاح {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.مفتاح input {
  width: 30px;
  height: 30px;
}

/* ===== التنبيهات والرسائل ===== */
.تنبيه {
  flex: 0 0 auto;
  background: #3a2a06;
  border: 3px solid var(--أصفر);
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 18px;
  line-height: 1.6;
  color: #fff8e1;
  margin: 0;
}

/* دعوة التنزيل: لافتة ظاهرة تُفتح بضغطة واحدة */
.تنبيه.دعوة {
  cursor: pointer;
  text-align: center;
  padding: 14px;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25);
}

.تنبيه.دعوة:active {
  background: #4a3608;
}

.طبقة {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
}

.رسالة {
  background: var(--خلفية-٢);
  border: 5px solid var(--حد);
  border-radius: 26px;
  padding: 24px;
  max-width: 480px;
  text-align: center;
  font-size: 22px;
  line-height: 1.9;
}

.رسالة button {
  margin-top: 18px;
}

/* ===== شاشات عريضة: الأرقام تبقى مالئة ===== */
@media (min-width: 700px) {
  .شبكة-أرقام {
    grid-template-columns: repeat(5, 1fr);
  }
  .مربع-وجه .رقم {
    font-size: min(9vw, 12vh, 86px);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
