/* V15.5.2 — mobile scroll and legibility repair. CSS-only; no tracking logic changes. */
@media screen {
  html {overflow-y:auto!important; overscroll-behavior-y:auto!important; scroll-behavior:auto}
  body:not(.mobile-eval-focus):not(.homework-review-open) {overflow-y:visible!important; min-height:100dvh!important; height:auto!important; max-height:none!important; touch-action:auto!important}
  main, main > .tab-content, #content-settings-page {min-height:0!important; height:auto!important; max-height:none!important}
  #content-settings-page.active {overflow-y:visible!important; overflow-x:visible!important}
  #ws52-scroll-top{position:fixed;right:11px;bottom:calc(16px + env(safe-area-inset-bottom,0px));z-index:90;display:none;align-items:center;gap:5px;padding:9px 12px;border-radius:13px;border:1px solid #c9e9de;background:#075c4d;color:#fff;box-shadow:0 4px 14px #002a2550;font:800 12px Cairo,Tajawal,Arial,sans-serif;min-height:44px;cursor:pointer}
  body.ws52-show-top:not(.ws-mobile-open) #ws52-scroll-top{display:flex}
}
@media screen and (max-width:1000px) {
  /* Exactly one vertical document scrollbar: the tracking grid scrolls on X only. */
  #tracking-table-scroll {height:auto!important; max-height:none!important; min-height:0!important; overflow-x:auto!important; overflow-y:auto!important; overscroll-behavior-y:auto!important; touch-action:auto!important; -webkit-overflow-scrolling:touch!important}
  #tracking-report-section,#content-tracking,#content-tracking>div{max-height:none!important; height:auto!important; overflow-y:visible!important}
  #main-table {max-height:none!important}
  .ws-mobile-button {z-index:101!important}
  body.ws-mobile-device #ws52-scroll-top{right:10px;bottom:calc(11px + env(safe-area-inset-bottom,0px))}
  /* Keep critical conflict tools actionable but stop blocking cells. */
  #tracker-sync-audit-button:not([hidden]) {left:7px!important;right:auto!important;bottom:calc(68px + env(safe-area-inset-bottom,0px))!important;max-width:82px!important;min-height:36px!important;padding:6px!important;font-size:10px!important;line-height:1.3!important;border-radius:10px!important}
  #tracker-recovery-export:not([hidden]){left:7px!important;bottom:calc(12px + env(safe-area-inset-bottom,0px))!important;max-width:44px!important;max-height:44px!important}
}
@media screen {
  body.ws-mobile-device #tracking-table-scroll {height:auto!important; max-height:none!important; min-height:0!important; overflow-x:auto!important; overflow-y:auto!important; overscroll-behavior-y:auto!important;touch-action:auto!important}
  body.ws-mobile-device #content-tracking>div,#content-tracking>div{height:auto!important;max-height:none!important}
}
/* Width-independent mobile design, including Chrome desktop-site viewport spoofing. */
@media screen {
 body.ws-mobile-device #content-dashboard{font-size:12px!important;line-height:1.5!important;gap:12px!important}
 body.ws-mobile-device #content-dashboard>div:first-child{padding:13px 14px!important;min-height:0!important;border-radius:19px!important}
 body.ws-mobile-device #content-dashboard>div:first-child h2{font-size:clamp(15px,4vw,18px)!important;line-height:1.45!important;letter-spacing:0!important;overflow-wrap:anywhere}
 body.ws-mobile-device #content-dashboard>div:first-child .text-xs{font-size:10px!important}
 body.ws-mobile-device #dashboard-kpis{gap:8px!important}
 body.ws-mobile-device #dashboard-kpis>div{min-width:0!important;min-height:67px!important;padding:10px!important;border-radius:15px!important}
 body.ws-mobile-device #dashboard-kpis>div .text-2xl{font-size:clamp(17px,4.8vw,23px)!important;line-height:1.3!important}
 body.ws-mobile-device #dashboard-kpis>div .text-xs{font-size:10px!important}
 body.ws-mobile-device #ws55-mobile-actions{padding:11px!important;margin:0!important}
 body.ws-mobile-device .ws55-actions-title{font-size:12px!important;margin-bottom:8px!important}
 body.ws-mobile-device .ws55-actions-grid{gap:7px!important}
 body.ws-mobile-device .ws55-actions-grid button{font-size:clamp(10px,3.3vw,13px)!important;line-height:1.45!important;min-height:49px!important;padding:7px 5px!important;min-width:0!important;white-space:normal!important;overflow-wrap:break-word!important}
 body.ws-mobile-device .ws55-actions-grid button span:first-child{font-size:18px!important;flex:0 0 auto}
 body.ws-mobile-device .ws55-actions-grid button .ws55-text{font-size:inherit!important;min-width:0!important}
 body.ws-mobile-device #content-settings-page {font-size:12px!important;line-height:1.7!important;padding-bottom:45px!important;overflow:visible!important}
 body.ws-mobile-device #content-settings-page :is(h1,h2,h3){font-size:clamp(15px,4vw,19px)!important;line-height:1.5!important;white-space:normal!important;overflow-wrap:anywhere}
 body.ws-mobile-device #content-settings-page :is(button,input,select){max-width:100%;font-size:clamp(11px,3.3vw,13px)!important}
 body.ws-mobile-device #content-settings-page :is(.text-2xl,.text-3xl,.text-4xl){font-size:17px!important}
 body.ws-mobile-device #content-settings-page :is(.p-8,.p-10){padding:14px!important}
 body.ws-mobile-device #content-settings-page :is(.rounded-\[2rem\],.rounded-\[2\.5rem\]){border-radius:19px!important}
 body.ws-mobile-device #content-settings-page > * {min-width:0!important;max-width:100%!important}
 body.ws-mobile-device #content-settings-page :is(.grid,.flex)>*{min-width:0}
 body.ws-mobile-device footer {font-size:10px!important;line-height:1.65!important;padding-bottom:calc(24px + env(safe-area-inset-bottom,0px))!important}
 body.ws-mobile-device #content-dashboard,body.ws-mobile-device #content-settings-page {padding-bottom:12px!important}
 /* Collapsed by default, but teachers can expand the original detailed dashboard. */
 body.ws-mobile-device.ws52-dashboard-details #content-dashboard>.grid:not(#dashboard-kpis){display:grid!important;gap:12px!important}
 body.ws-mobile-device.ws52-dashboard-details #content-dashboard>.grid:not(#dashboard-kpis)>div{min-width:0!important;padding:12px!important;border-radius:16px!important}
 body.ws-mobile-device.ws52-dashboard-details #content-dashboard>.grid:not(#dashboard-kpis) h3{font-size:14px!important}
 #ws52-dashboard-toggle{display:block;width:100%;margin-top:10px;min-height:42px;border:1px solid #cce2da;border-radius:12px;background:#f7fbfa;color:#075f51;font:800 12px Cairo,Tajawal,Arial,sans-serif}

}
@media print{#ws52-scroll-top{display:none!important}}
