/* شاشة الدرس — مسرح التعلّم الخاص بتجويدي (يبني على tokens.css وcomponents.css) */

.lesson-meta-row{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px;}
.meta-chip{
  background:var(--sky-50); color:var(--sky-700); border:1px solid var(--sky-100);
  border-radius:999px; padding:5px 13px; font-size:12px; font-weight:700;
}
.meta-chip.draft{background:var(--danger-bg); color:var(--danger-700); border-color:var(--danger-100);}

/* ===== شريط المشهد الخفيف (بديل شريط السبع نقاط) ===== */
.scene-bar{display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; gap:12px; flex-wrap:wrap;}
.scene-bar-info{display:flex; align-items:baseline; gap:8px;}
.scene-bar-info .idx{font-size:12px; color:var(--muted); font-weight:700;}
.scene-bar-info .name{font-size:15.5px; color:var(--navy); font-weight:800;}
.scene-bar-right{display:flex; align-items:center; gap:10px;}
.mini-ring{
  width:28px; height:28px; border-radius:50%;
  background:conic-gradient(var(--pist-500) calc(var(--pct,0)*1%), var(--pist-100) 0);
  display:flex; align-items:center; justify-content:center;
}
.mini-ring i{width:20px; height:20px; border-radius:50%; background:var(--white); display:block;}
.map-btn{
  background:var(--white); border:1px solid var(--line); color:var(--sky-700);
  border-radius:999px; padding:6px 14px; font-size:12.5px; font-weight:700;
}
.map-btn:hover{border-color:var(--sky-300); background:var(--sky-50);}

/* ===== لوحة الدرس: نسبة 16:9 ثابتة دائمًا ===== */
.lesson-stage-wrap{width:100%; max-width:900px; margin:0 auto;}
.lesson-panel{
  position:relative; width:100%; aspect-ratio:16/9;
  background:linear-gradient(180deg,#fff 0%, var(--sky-50) 130%);
  border-radius:var(--radius-lg); box-shadow:var(--shadow-md); border:1px solid var(--line);
  overflow:hidden; padding:26px 32px 18px; display:flex; flex-direction:column;
}
.deco{position:absolute; inset:0; pointer-events:none; overflow:hidden; z-index:0;}
.deco span{position:absolute; font-weight:800; line-height:1; user-select:none;}
.deco .h1{top:-18px; left:-14px; font-size:100px; color:var(--sky-100); opacity:.7;}
.deco .h2{bottom:-22px; right:-10px; font-size:90px; color:var(--pist-100); opacity:.7;}
.deco .h3{top:38%; right:3%; font-size:34px; color:var(--pist-100); opacity:.6;}
.deco .h4{bottom:34%; left:4%; font-size:26px; color:var(--sky-100); opacity:.6;}
.deco-wave{position:absolute; top:56px; right:6%; width:200px; height:16px; opacity:.4;}

.lesson-panel-head{flex:0 0 auto; position:relative; z-index:1; display:flex; align-items:center; justify-content:space-between; margin-bottom:2px;}
.stage-title{margin:0; font-size:clamp(15px,2.1vw,21px); font-weight:800; color:var(--navy);}
.stage-exit{
  width:28px; height:28px; border-radius:50%; background:var(--white); border:1px solid var(--line);
  color:var(--muted); display:flex; align-items:center; justify-content:center; font-size:13px; flex-shrink:0;
}
.stage-exit:hover{border-color:var(--sky-300); color:var(--sky-600);}

.lesson-body{
  flex:1 1 auto; min-height:0; overflow-y:auto; display:flex; flex-direction:column;
  position:relative; z-index:1; padding:8px 4px;
  scrollbar-width:thin; scrollbar-color:var(--sky-200) transparent;
}
.lesson-body::-webkit-scrollbar{width:5px;}
.lesson-body::-webkit-scrollbar-thumb{background:var(--sky-200); border-radius:6px;}
.lesson-body-inner{margin:auto 0; width:100%; display:flex; flex-direction:column; align-items:center; gap:12px; text-align:center;}
.lesson-body h2{margin:0; font-size:clamp(14.5px,2vw,19px); font-weight:700; color:var(--navy); max-width:640px;}
.lesson-body p{margin:0; font-size:clamp(12.5px,1.6vw,14.5px); color:var(--ink);}
.meta-line{margin:0; font-size:12.5px; color:var(--muted);}
.lead-line{margin:0; font-size:clamp(14px,1.9vw,17px); color:var(--muted);}

.intro-list{margin:0; padding-inline-start:20px; font-size:clamp(12px,1.6vw,14px); text-align:right; max-width:520px;}
.intro-list li{margin-bottom:6px;}

/* خانة عنوان الدرس مع رقمه — تظهر في مشهد التمهيد */
.lesson-title-box{
  width:100%; max-width:520px; background:var(--white); border:1px solid var(--line);
  border-radius:var(--radius-md); box-shadow:var(--shadow-sm); padding:12px 18px; text-align:center;
}
.lesson-title-box .lesson-number{display:block; font-size:11px; font-weight:800; color:var(--sky-600); margin-bottom:4px;}
.lesson-title-box h2{margin:0 !important;}

/* عبارات التمهيد — خانات متساوية، مزاحة لليمين، قابلة للضغط لعرض النص كاملاً */
.intro-cards{display:flex; flex-direction:column; gap:8px; width:100%; max-width:520px; align-self:flex-start;}
.intro-toggle{width:100%; justify-content:space-between; text-align:right;}
.intro-toggle span:first-child{flex:1; text-align:right;}
.intro-panel{width:100%; text-align:right;}

/* تمييز بصري داخل نص الدرس — من لوحة الألوان المعتمدة فقط */
.lesson-keyword{color:var(--sky-600); font-weight:800;}
.focus-underline{text-decoration:underline; text-decoration-color:var(--pist-500); text-decoration-thickness:2px; text-underline-offset:3px;}

.rule-box{width:100%; max-width:560px; display:flex; flex-direction:column; gap:8px;}
.rule-row{background:var(--white); border:1px solid var(--line); border-radius:12px; padding:10px 16px; text-align:right; box-shadow:var(--shadow-sm);}
.rule-row .k{display:block; font-size:11px; color:var(--sky-600); font-weight:800; margin-bottom:3px;}
.rule-row .v{font-size:clamp(12.5px,1.6vw,14px); color:var(--ink);}

.letters-row{display:flex; gap:8px; flex-wrap:wrap; justify-content:center;}
.letter-chip{
  width:48px; height:48px; border-radius:12px; background:var(--white); border:1px solid var(--sky-200);
  color:var(--navy); font-weight:800; font-size:24px; display:flex; align-items:center; justify-content:center;
  box-shadow:var(--shadow-sm);
}
.mnemonic{font-size:12.5px; color:var(--pist-700);}

.word-row{display:flex; gap:8px; flex-wrap:wrap; justify-content:center;}
.word-card{background:var(--white); border:1px solid var(--line); border-radius:var(--radius-md); padding:8px 14px; min-width:100px; box-shadow:var(--shadow-sm);}
.word-card .ar{font-size:clamp(16px,2.2vw,22px); font-weight:800; color:var(--navy); margin-bottom:3px;}
.word-card .rule{font-size:10.5px; color:var(--muted); margin-bottom:5px;}
.word-card .hl, .ar .hl{color:var(--pist-600);}
.listen-btn{display:inline-flex; align-items:center; gap:5px; background:var(--sky-500); color:#fff; border:none; border-radius:999px; padding:4px 10px; font-size:10.5px; font-weight:700;}
.listen-btn:hover{background:var(--sky-600);}
.listen-btn:disabled{opacity:.7;}
.audio-note{font-size:11px; color:var(--muted);}

.insight-box{background:var(--pist-50); color:var(--pist-700); border:1px solid var(--pist-200); border-radius:999px; padding:5px 16px; font-size:12px; font-weight:700;}

.mistake-grid{display:flex; gap:8px; flex-wrap:wrap; justify-content:center; width:100%;}
.mistake-card{
  background:var(--white); border:1px solid var(--danger-100); border-inline-start:4px solid var(--danger); border-radius:12px;
  padding:10px 14px; text-align:right; max-width:260px; box-shadow:var(--shadow-sm);
}
.mistake-card strong{display:block; font-size:12.5px; color:var(--danger-700); margin-bottom:3px;}
.mistake-card p{font-size:11.5px; margin-bottom:5px;}
.mistake-example{font-size:11px; color:var(--muted);}

.ayah-text{max-width:600px; font-size:clamp(13px,1.8vw,16px); line-height:2; color:var(--navy); font-weight:700;}
.highlight-list{display:flex; gap:8px; flex-wrap:wrap; justify-content:center;}
.hl-chip{background:var(--pist-50); border:1px solid var(--pist-200); border-radius:10px; padding:5px 10px; font-size:11.5px; color:var(--pist-700);}
.hl-chip small{display:block; color:var(--muted); font-size:9.5px;}

.drill-table{width:100%; max-width:620px; display:flex; flex-direction:column; gap:5px;}
.drill-row{display:flex; align-items:center; gap:8px; background:var(--white); border:1px solid var(--line); border-radius:10px; padding:6px 10px; box-shadow:var(--shadow-sm); flex-wrap:wrap; justify-content:center;}
.drill-letter{width:26px; height:26px; border-radius:8px; background:var(--sky-500); color:#fff; font-weight:800; display:flex; align-items:center; justify-content:center; font-size:13px; flex-shrink:0;}
.drill-item{
  font-size:clamp(11px,1.5vw,13px); color:var(--ink);
  padding:4px 10px; border-radius:8px; border:1px dashed var(--line);
  cursor:pointer; transition:background var(--dur-base), border-color var(--dur-base);
}
.drill-item:hover{border-color:var(--sky-300); background:var(--sky-50);}
.drill-item.revealed{
  background:var(--pist-50); border-style:solid; border-color:var(--pist-300); color:var(--pist-800);
}

/* ===== كشف عند الضغط (Term Toggle) — مكوّن موحّد يُستخدم في كل تعريف/توضيح عبر المنصة ===== */
.term-toggle{
  display:inline-flex; align-items:center; gap:6px; background:var(--sky-50);
  border:1.5px solid var(--sky-300); color:var(--sky-700); border-radius:999px;
  padding:7px 16px; font-size:clamp(12px,1.6vw,13.5px); font-weight:800; cursor:pointer;
  transition:background var(--dur-base), color var(--dur-base), border-color var(--dur-base);
}
.term-toggle:hover{background:var(--sky-100);}
.term-toggle:focus-visible{outline:3px solid var(--sky-300); outline-offset:2px;}
.term-toggle[aria-expanded="true"]{background:var(--sky-500); color:#fff; border-color:var(--sky-500);}
.term-toggle-icon{font-size:14px; line-height:1; transition:transform var(--dur-base);}
.term-toggle[aria-expanded="true"] .term-toggle-icon{transform:rotate(45deg);}

.term-panel{
  width:100%; max-width:560px; margin-top:-2px; background:var(--white); border:1px solid var(--line);
  border-radius:var(--radius-md); padding:12px 16px; box-shadow:var(--shadow-sm); text-align:center;
  animation:term-reveal var(--dur-scene) var(--ease-tajweedi);
}
.term-panel[hidden]{display:none;}
@keyframes term-reveal{from{opacity:0; transform:translateY(-4px);} to{opacity:1; transform:translateY(0);}}

/* ألوان الأقسام — نفس لوحة الألوان المعتمدة فقط (سماوي/فستقي/كحلي)، بلا أي إضافة لونية جديدة */
.term-toggle.sec-pist{background:var(--pist-50); border-color:var(--pist-300); color:var(--pist-700);}
.term-toggle.sec-pist:hover{background:var(--pist-100);}
.term-toggle.sec-pist[aria-expanded="true"]{background:var(--pist-500); border-color:var(--pist-500); color:#fff;}
.term-toggle.sec-navy{background:var(--ivory); border-color:var(--navy-2); color:var(--navy);}
.term-toggle.sec-navy:hover{background:#fff;}
.term-toggle.sec-navy[aria-expanded="true"]{background:var(--navy); border-color:var(--navy); color:#fff;}

.term-panel.sec-sky{border-inline-start:4px solid var(--sky-500);}
.term-panel.sec-pist{border-inline-start:4px solid var(--pist-500);}
.term-panel.sec-navy{border-inline-start:4px solid var(--navy);}

/* بطاقة مثال قابلة للنقر — الملاحظة تظهر فقط بعد الضغط */
.word-card.clickable{cursor:pointer; transition:box-shadow var(--dur-base), border-color var(--dur-base);}
.word-card.clickable:hover{border-color:var(--sky-300);}
.word-card.clickable:focus-visible{outline:3px solid var(--sky-300); outline-offset:2px;}
.word-card.clickable .rule{display:none;}
.word-card.clickable[aria-expanded="true"] .rule{display:block; animation:term-reveal var(--dur-base) var(--ease-tajweedi);}
.word-card.clickable .tap-hint{font-size:16px; line-height:1; color:var(--sky-500); font-weight:800;}
.word-card.clickable[aria-expanded="true"] .tap-hint{display:none;}
.word-card.sec-sky{border-inline-start:4px solid var(--sky-500);}
.word-card.sec-pist{border-inline-start:4px solid var(--pist-500);}
.word-card.sec-navy{border-inline-start:4px solid var(--navy);}

.quiz-choices{display:flex; gap:10px; flex-wrap:wrap; justify-content:center;}
.quiz-choice{background:var(--white); color:var(--navy); border-radius:var(--radius-md); padding:10px 16px; min-width:110px; border:2px solid var(--line); transition:var(--dur-base); box-shadow:var(--shadow-sm); cursor:pointer;}
.quiz-choice:hover{transform:translateY(-2px); border-color:var(--sky-300);}
.quiz-choice.correct{border-color:var(--pist-500); background:var(--pist-50);}
.quiz-choice.wrong{border-color:var(--danger); background:var(--danger-bg);}
.quiz-choice .ar{font-size:clamp(14px,2vw,18px); font-weight:800;}
.quiz-progress{font-size:11px; color:var(--muted);}
.quiz-explain{max-width:520px; font-size:11.5px; color:var(--pist-700); background:var(--pist-50); border-radius:10px; padding:8px 12px;}

.summary-card{width:100%; max-width:400px; background:var(--white); border:1px solid var(--line); border-radius:var(--radius-md); padding:12px 16px; box-shadow:var(--shadow-sm);}
.s-row{display:flex; justify-content:space-between; font-size:12.5px; padding:5px 0; border-bottom:1px dashed var(--line);}
.s-row:last-child{border-bottom:none;}
.s-row span{color:var(--muted);}
.s-row b{color:var(--navy);}

.result-box{display:flex; flex-direction:column; align-items:center; gap:6px;}
.result-badge{width:clamp(38px,6vw,52px); height:clamp(38px,6vw,52px); border-radius:50%; background:var(--pist-500); color:#fff; display:flex; align-items:center; justify-content:center; box-shadow:var(--shadow-md);}
.result-badge svg{width:55%; height:55%;}
.result-sub{margin:0; color:var(--muted); font-size:12.5px;}
.result-actions{display:flex; gap:10px; flex-wrap:wrap; justify-content:center; margin-top:4px;}
.next-card{margin-top:4px; background:var(--white); border:1px solid var(--sky-100); border-radius:var(--radius-md); padding:10px 18px; box-shadow:var(--shadow-sm); display:flex; flex-direction:column; align-items:center; gap:6px; min-width:240px;}
.next-card .next-label{font-size:11px; color:var(--muted); font-weight:700;}
.next-card strong{color:var(--navy); font-size:13.5px;}

.lesson-foot{flex:0 0 auto; display:flex; align-items:center; justify-content:space-between; gap:8px; position:relative; z-index:1; padding-top:8px;}
.nav-btn{background:transparent; border:1.5px solid var(--sky-300); color:var(--sky-700); border-radius:999px; padding:7px 18px; font-size:12.5px; font-weight:700; transition:var(--dur-base); flex-shrink:0;}
.nav-btn:hover{background:var(--sky-50);}
.nav-btn:disabled{opacity:.35; border-color:var(--line); color:var(--muted);}
.nav-btn.primary{background:var(--sky-500); color:#fff; border-color:var(--sky-500);}
.nav-btn.primary:hover{background:var(--sky-600);}
.slide-dots{display:flex; gap:6px; flex:1; min-width:0; overflow:hidden; justify-content:center;}
.slide-dots span{width:6px; height:6px; border-radius:50%; background:var(--line);}
.slide-dots span.active{background:var(--sky-500); width:18px; border-radius:5px;}

/* ===== خريطة الدرس (نافذة خفيفة عند الطلب) ===== */
.scene-map-overlay{
  position:fixed; inset:0; background:rgba(28,53,80,.4); z-index:80;
  display:flex; align-items:flex-end; justify-content:center;
}
.scene-map-overlay[hidden]{display:none;}
@media (min-width:640px){ .scene-map-overlay{align-items:center;} }
.scene-map-sheet{
  background:var(--white); width:100%; max-width:420px; max-height:70vh; overflow-y:auto;
  border-radius:var(--radius-lg) var(--radius-lg) 0 0; box-shadow:var(--shadow-lg);
}
@media (min-width:640px){ .scene-map-sheet{border-radius:var(--radius-lg);} }
.map-head{display:flex; align-items:center; justify-content:space-between; padding:16px 18px; border-bottom:1px solid var(--line);}
.map-head strong{color:var(--navy); font-size:15px;}
.map-head button{background:none; border:none; font-size:18px; color:var(--muted); cursor:pointer;}
.map-list{padding:8px;}
.map-item{
  width:100%; display:flex; align-items:center; gap:10px; text-align:right; padding:10px 12px;
  border-radius:10px; background:transparent; border:none; font-size:13px; color:var(--ink);
}
.map-item:hover{background:var(--sky-50);}
.map-item.current{background:var(--sky-50); color:var(--sky-700); font-weight:700;}
.map-item .m-n{width:22px; height:22px; border-radius:50%; background:var(--sky-100); color:var(--sky-700); font-size:11px; font-weight:800; display:flex; align-items:center; justify-content:center; flex-shrink:0;}
.map-item .m-done{margin-inline-start:auto; color:var(--pist-600);}

@media (max-width:640px){
  .lesson-panel{padding:14px 14px 10px; border-radius:18px;}
  .deco .h1{font-size:70px;} .deco .h2{font-size:60px;} .deco-wave{display:none;}
  .word-row{gap:6px;} .word-card{padding:6px 10px; min-width:80px;}
}

/* ===== رف الصوت الجانبي — خارج لوحة الدرس عمدًا، لا زر/أيقونة داخل الخانات ===== */
.audio-rail{
  position:fixed; top:50%; left:18px; transform:translateY(-50%); z-index:55;
  display:flex; flex-direction:column; align-items:center; gap:8px;
  background:var(--white); border:1px solid var(--line); border-radius:999px;
  padding:14px 10px; box-shadow:var(--shadow-md); width:76px;
}
.audio-rail-btn{
  width:44px; height:44px; border-radius:50%; background:var(--sky-500); color:#fff;
  border:none; flex-shrink:0; display:flex; align-items:center; justify-content:center;
  transition:background var(--dur-base), opacity var(--dur-base);
}
.audio-rail-btn svg{width:20px; height:20px;}
.audio-rail-btn:hover:not(:disabled){background:var(--sky-600);}
.audio-rail-btn:disabled{background:var(--line); color:var(--muted); cursor:default;}
.audio-rail-btn.playing{animation:audio-pulse 1s ease-in-out infinite;}
@keyframes audio-pulse{0%,100%{box-shadow:0 0 0 0 var(--sky-200);} 50%{box-shadow:0 0 0 6px transparent;}}
.audio-rail-status{font-size:9.5px; line-height:1.4; color:var(--muted); text-align:center;}

@media (max-width:900px){
  /* على الموبايل: جزء من تدفّق بطاقة الدرس نفسها (لا عنصر عائم مستقل) —
     يمنع تراكبه فوق التذييل/قائمة الدروس عند التمرير، لأنه يتحرّك مع الصفحة
     تمامًا كباقي محتوى اللوحة بدل الطفو في نقطة ثابتة من الشاشة. */
  .audio-rail{
    position:static; left:auto; top:auto; bottom:auto; transform:none; z-index:auto;
    flex-direction:row; width:auto; max-width:none; padding:8px 14px; margin-top:10px;
  }
  .audio-rail-status{max-width:none; text-align:right;}
}
@media (prefers-reduced-motion:reduce){.audio-rail-btn.playing{animation:none;}}
