/* Responsive layout fixes (lessons by unit, cards, tabs) — v1 */
/* «الدروس»: #lessonGrid also carries .grid; make every unit a full-width row
   with its own responsive card grid. Flat fallback (app.js) still gets columns. */
#lessonGrid{grid-template-columns:repeat(auto-fill,minmax(min(100%,260px),1fr));align-items:start}
#lessonGrid>.unit-section,#lessonGrid>#backUnits,#lessonGrid>.content-loading,#lessonGrid>.empty-state{grid-column:1/-1}
#lessonGrid>#backUnits{justify-self:start;width:auto;min-height:0;height:auto}
.unit-section{margin:0 0 22px}
.unit-section-title{font-size:1.25rem;margin:6px 0 12px;padding-bottom:8px;border-bottom:2px solid var(--line,#e6dec9)}
.unit-lessons{display:grid;grid-template-columns:1fr;gap:14px;align-items:stretch}
@media(min-width:600px){.unit-lessons{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(min-width:1100px){.unit-lessons{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(min-width:1700px){.unit-lessons{grid-template-columns:repeat(4,minmax(0,1fr))}}
.lesson-card{min-width:0;display:flex;flex-direction:column}
.lesson-card h3{overflow-wrap:anywhere}
/* attempt-history chips must not overflow narrow cards */
.improvement-summary{grid-template-columns:repeat(auto-fit,minmax(70px,1fr))}
.improvement-summary span{min-width:0;overflow-wrap:anywhere}
/* wide screens / smartboard: use the space */
@media(min-width:1300px){.layout,.wrap{max-width:1280px}}
@media(min-width:1700px){.layout,.wrap{max-width:1560px}}
/* «تقدمي»: avoid one very long list with stretched bars on iPad landscape / smartboard */
@media(min-width:900px){
  #progressList{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:28px}
  #progressList>:not(.progress-item){grid-column:1/-1}
  #progressList>.progress-item:nth-last-child(2):nth-child(odd){border-bottom:0}
}
@media(min-width:1300px){#progressList{grid-template-columns:repeat(3,minmax(0,1fr))}}
/* phones: hint that the tab bar scrolls instead of clipping the last tab */
@media(max-width:700px){.nav{scroll-padding-inline:8px;-webkit-overflow-scrolling:touch}.nav .btn{flex:0 0 auto}}
