/* Review correction: Surah chooser is a deliberately separated overlay, never a
   poorly anchored dropdown overlapping heading and unrelated controls. */
body.juz-learning-page #explore .mla-filter-panel:has(#reviewSurahPicker[open]){
  z-index:9998!important;isolation:auto!important;
}
body.juz-learning-page #explore #reviewSurahPicker[open]{
  z-index:9999!important;position:relative!important;
}
body.juz-learning-page #explore #reviewSurahPicker[open]:before{
  content:"";position:fixed;inset:0;background:rgba(3,24,50,.70);
  z-index:1;cursor:pointer;
}
body.juz-learning-page #explore #reviewSurahPicker .review-surah-options{
  display:none!important;
}
body.juz-learning-page #explore #reviewSurahPicker[open] .review-surah-options{
  position:fixed!important;inset:auto!important;top:50%!important;left:50%!important;right:auto!important;
  transform:translate(-50%,-50%)!important;
  z-index:3!important;width:min(620px,calc(100vw - 32px))!important;
  max-height:min(650px,calc(100dvh - 40px))!important;
  box-sizing:border-box!important;overflow-y:auto!important;overflow-x:hidden!important;
  background:#fff!important;border:1px solid #8fc7ea!important;border-radius:20px!important;
  padding:20px!important;box-shadow:0 25px 80px #00172d70!important;
  display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;
  align-content:start!important;align-items:stretch!important;gap:9px!important;
  direction:rtl!important;overscroll-behavior:contain;
}
body.juz-learning-page #explore #reviewSurahPicker .review-surah-options legend{display:none!important;}
body.juz-learning-page #explore #reviewSurahPicker .review-surah-options .mla-picker-title{
 grid-column:1/-1!important;font-size:19px!important;font-weight:900!important;color:#0a385e!important;
 margin:0 0 4px!important;line-height:1.5;text-align:right;padding:0 2px 12px;border-bottom:1px solid #d8e9f6;
}
body.juz-learning-page #explore #reviewSurahPicker .review-surah-options label{
  display:flex!important;align-items:center!important;justify-content:space-between!important;
  gap:8px!important;min-width:0!important;min-height:48px!important;box-sizing:border-box!important;
  margin:0!important;padding:8px 12px!important;border-radius:11px!important;
  border:1px solid var(--review-border,#b8d6e5)!important;
  background:var(--review-soft,#f0f8fb)!important;
  font-size:14px!important;line-height:1.5!important;
  color:var(--review-dark,#17435c)!important;cursor:pointer!important;
}
body.juz-learning-page #explore #reviewSurahPicker .review-surah-options label input{
  flex:0 0 auto!important;min-width:20px!important;width:20px!important;height:20px!important;
  accent-color:#147bf2;cursor:pointer;
}
body.juz-learning-page #explore #reviewSurahPicker .review-surah-options label span{
  min-width:0!important;overflow-wrap:anywhere!important;
}
body.juz-learning-page #explore #reviewSurahPicker .review-surah-options .mla-picker-actions{
  grid-column:1/-1!important;position:sticky;bottom:-20px;
  display:flex;flex-wrap:wrap;gap:9px;justify-content:stretch;
  padding:12px 0 1px;margin-top:5px;background:#fff;
  border-top:1px solid #d7e7f0;
}
body.juz-learning-page #explore #reviewSurahPicker .mla-picker-actions .review-filter-button{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  min-height:42px!important;padding:7px 12px!important;
  border-radius:10px!important;font-size:13px!important;
}
body.juz-learning-page #explore #reviewSurahPicker .mla-picker-actions .mla-close-surahs{
  margin-inline-start:auto;color:#fff;background:#087af5;border:1px solid #087af5;
  font-size:14px;font-weight:850;cursor:pointer;border-radius:10px;padding:8px 18px;
  min-height:42px;
}
body.juz-learning-page.mla-picker-open{overflow:hidden!important;}
/* Nav has its own stacking context above the learning section on phones;
   lower it only while the chooser is open so the chooser is never covered. */
body.juz-learning-page.mla-picker-open .pwa-nav,
body.juz-learning-page.mla-picker-open .topbar.site-header{z-index:0!important;}
@media(max-width:620px){
 body.juz-learning-page #explore #reviewSurahPicker[open] .review-surah-options{
  top:50%!important;left:50%!important;right:auto!important;
  width:calc(100vw - 24px)!important;max-height:calc(100dvh - 24px)!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  padding:14px!important;gap:7px!important;
 }
 body.juz-learning-page #explore #reviewSurahPicker .review-surah-options label{
  font-size:12px!important;min-height:44px!important;padding:7px 9px!important;
 }
 body.juz-learning-page #explore #reviewSurahPicker .review-surah-options .mla-picker-title{font-size:17px!important;}
 body.juz-learning-page #explore #reviewSurahPicker .review-surah-options .mla-picker-actions{bottom:-14px;}
 body.juz-learning-page #explore #reviewSurahPicker .mla-picker-actions .review-filter-button,
 body.juz-learning-page #explore #reviewSurahPicker .mla-picker-actions .mla-close-surahs{
  font-size:12px!important;flex:1!important;min-width:100px!important;
 }
}
/* Keep the existing 12-card batches and defer paint/layout for closed cards
   outside the viewport. The card stays in the DOM with a matching placeholder;
   open Qur'an reading and lesson views are always rendered normally. */
@supports (content-visibility:auto){
 body.juz-learning-page:not(.card-detail-active) #module-one-view #cards .modern-card:not(.open){
  content-visibility:auto;contain-intrinsic-size:auto 428px;
 }
}
body.juz-learning-page:not(.card-detail-active) #module-one-view #cards .modern-card:not(.open):not(.is-completed) .card-flip-rotor{
 transform:none!important;transform-style:flat!important;transition:none!important;
}
@media(max-width:650px){
 @supports (content-visibility:auto){
  body.juz-learning-page:not(.card-detail-active) #module-one-view #cards .modern-card:not(.open){
   contain-intrinsic-size:auto 418px;
  }
 }
}
/* The opaque navy header avoids expensive live backdrop blurring while scrolling. */
body.juz-learning-page .topbar.site-header{
 -webkit-backdrop-filter:none!important;backdrop-filter:none!important;
 background:#083763!important;
}
@media(prefers-reduced-motion:reduce){
 body.juz-learning-page #module-one-view #cards .modern-card .card-flip-rotor{transition:none!important;}
}
