/* STERLING v1.0.84 | Authenticated student mobile usability layer.
   Does not alter student access, reading state, voice playback, payments or study logic.
   Leave reader font choice / A+ controls under the existing reader JS. */
@media screen and (max-width:760px){
  html{scroll-padding-top:76px}
  body.portal-body.is-authenticated{overflow-x:clip;--sc84-mobile-line:#d7e5f7}
  /* Mobile header: keep brand and account accessible without a tall desktop header. */
  body.portal-body.is-authenticated .top-shell{
    height:62px;min-height:62px;padding:6px 11px;gap:8px;
    z-index:110;box-sizing:border-box;
    box-shadow:0 3px 14px rgba(18,55,115,.09);
  }
  body.portal-body.is-authenticated .top-shell .brand-lockup{
    min-width:0;max-width:calc(100% - 56px);flex:1 1 auto;gap:8px;
  }
  body.portal-body.is-authenticated .top-shell .brand-lockup img{
    width:41px;height:41px;flex:0 0 41px;border-radius:10px;
  }
  body.portal-body.is-authenticated .top-shell .brand-lockup span{min-width:0;overflow:hidden}
  body.portal-body.is-authenticated .top-shell .brand-lockup strong{
    font-size:14px;line-height:1.05;letter-spacing:1px;white-space:nowrap;
  }
  body.portal-body.is-authenticated .top-shell .brand-lockup small{
    font-size:9px;letter-spacing:.9px;white-space:nowrap;color:#506989;
  }
  body.portal-body.is-authenticated .top-shell .student-chip{margin-left:auto;flex:0 0 auto}
  body.portal-body.is-authenticated .top-shell .student-account-trigger{
    min-width:44px;width:44px;height:44px;border-radius:13px;padding:2px;
    justify-content:center;box-sizing:border-box;
  }
  body.portal-body.is-authenticated .top-shell .student-avatar{width:37px;height:37px;border-radius:11px}
  body.portal-body.is-authenticated .top-shell .student-account-copy,
  body.portal-body.is-authenticated .top-shell .student-account-caret{display:none!important}
  body.portal-body.is-authenticated .student-account-dropdown{
    max-width:calc(100dvw - 20px);top:calc(100% + 8px);right:0;
  }
  body.portal-body.is-authenticated .student-account-dropdown a{min-height:48px;align-content:center}
  /* Keep content above the fixed mobile nav; single note reader retains its
     v1.0.72 end-of-page navigation and v1.0.83 floating voice dock. */
  body.portal-body.is-authenticated:not(.sc-screen-lesson){
    padding-bottom:calc(94px + env(safe-area-inset-bottom,0px));
  }
  body.portal-body.is-authenticated:not(.sc-screen-lesson) .page{
    box-sizing:border-box;max-width:100%;min-width:0;
    padding-bottom:calc(96px + env(safe-area-inset-bottom,0px));
  }
  body.portal-body.is-authenticated:not(.sc-screen-lesson) .sc-student-bottom-stack .mobile-nav{
    border-top:1px solid #cbdcf5;
    box-shadow:0 -8px 24px rgba(12,44,99,.12);
    padding:5px 5px max(8px,env(safe-area-inset-bottom,0px));
  }
  body.portal-body.is-authenticated .mobile-nav a{
    min-width:0;min-height:50px;border-radius:12px;line-height:1.1;
    padding:5px 1px;color:#4e6685;text-decoration:none;
    -webkit-tap-highlight-color:transparent;
  }
  body.portal-body.is-authenticated .mobile-nav a.active{
    color:#1659b5;background:linear-gradient(145deg,#e6f0ff,#f1ebff);
  }
  body.portal-body.is-authenticated .mobile-nav a span{font-size:21px;line-height:1}
  body.portal-body.is-authenticated .mobile-nav a small{font-size:10px;font-weight:800}
  /* Prevent the keyboard, header and large headings from creating narrow columns. */
  body.portal-body.is-authenticated :is(.page,.section,.hero-card,.card,.ait-wrap,.tm-page){min-width:0}
  body.portal-body.is-authenticated :is(.hero-card,.section,.lesson-card,.quick-card,.course-card,
    .subject-card,.tm-panel,.ait-card,.ait-history-item){overflow-wrap:break-word;word-break:normal}
  body.portal-body.is-authenticated :is(input:not([type=checkbox]):not([type=radio]),select,textarea){
    max-width:100%;min-width:0;box-sizing:border-box;font-size:16px;
  }
  body.portal-body.is-authenticated :is(.filter-bar,.section-head,.lesson-card-foot,
    .current-lesson-actions){max-width:100%;min-width:0}
  body.portal-body.is-authenticated .filter-bar input{min-width:0;flex-basis:100%}
  body.portal-body.is-authenticated .filter-bar select{max-width:100%}
  body.portal-body.is-authenticated .section-head{flex-wrap:wrap;gap:9px}
  body.portal-body.is-authenticated .section-head h2{line-height:1.25}
  body.portal-body.is-authenticated .page :is(.btn,button):not(.tm74-cell):not(.week76-day-button){touch-action:manipulation}
  body.portal-body.is-authenticated :is(.quick-card,.lesson-card,.course-card){max-width:100%;min-width:0}
  body.portal-body.is-authenticated .lesson-card-foot{flex-wrap:wrap}
  /* Dashboard: retain the v1.0.64 order and v1.0.76 count-only weekly cards. */
  body.sc-screen-dashboard .sc-dashboard :is(.multi-course-card,.tracker-lesson-card,.sc-dashboard-subject){
    min-width:0;max-width:100%;box-sizing:border-box;
  }
  body.sc-screen-dashboard .sc-dashboard :is(.multi-course-card h3,.tracker-lesson-card h3){
    overflow-wrap:break-word;word-break:normal;hyphens:auto;
  }
  body.sc-screen-dashboard #dashboard-weekly-study .week76-day-button{min-height:102px}
  body.sc-screen-dashboard .week76-overlay .week76-dialog{
    max-height:calc(100dvh - 18px);max-width:calc(100dvw - 16px)
  }
  /* AI Teacher: narrow request form and history must not push beyond the viewport.
     Don't expose the PIN outside the existing v1.0.80 secure popup. */
  body.sc-screen-ai-teacher .ait-wrap{width:100%;max-width:100%;padding:8px 10px 24px}
  body.sc-screen-ai-teacher .ait-hero{padding:17px;border-radius:18px}
  body.sc-screen-ai-teacher .ait-hero h1{font-size:clamp(23px,6.4vw,29px);line-height:1.16}
  body.sc-screen-ai-teacher .ait-ask-card{padding:14px}
  body.sc-screen-ai-teacher .ait-quick-picker{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  body.sc-screen-ai-teacher .ait-quick-picker button{min-width:0;min-height:94px}
  body.sc-screen-ai-teacher :is(.ait-hint-select,.ait-q,#ait-find){max-width:100%;min-width:0}
  body.sc-screen-ai-teacher :is(.ait-history-item,.ait-history-top,.ait-history-path){min-width:0;overflow-wrap:anywhere}
  body.sc-screen-ai-teacher .ait-points-dialog{max-width:calc(100dvw - 24px)}
  /* Full-page timetable: preserve seven-day/monthly data and controls. */
  body.sc-screen-my-timetable .tm-page{max-width:100%;min-width:0}
  body.sc-screen-my-timetable :is(.tm-panel,.tm74-calendar,.tm74-day-detail,.ex70-coach){
    min-width:0;box-sizing:border-box;
  }
  body.sc-screen-my-timetable .tm74-month-nav{gap:5px}
  body.sc-screen-my-timetable .tm74-cal-grid{width:100%;min-width:0;max-width:100%}
  body.sc-screen-my-timetable .tm74-cell{min-width:0}
  body.sc-screen-my-timetable :is(.tm74-note-row,.tm74-day-sessions .tm-session){min-width:0}
  body.sc-screen-my-timetable .tm74-day-detail{scroll-margin-top:76px}
  /* Single note reader: no changes to adjustable font size or speech state. */
  body.sc-screen-lesson .reader-page{max-width:calc(100% - 12px);min-width:0}
  body.sc-screen-lesson .lesson-quick-nav{max-width:100%;min-width:0}
  body.sc-screen-lesson .lesson-content{max-width:100%;overflow-wrap:break-word;word-break:normal}
  body.sc-screen-lesson .lesson-content :is(img,video,iframe){max-width:100%;height:auto}
  body.sc-screen-lesson .lesson-content pre{max-width:100%;overflow-x:auto}
  body.sc-screen-lesson .lesson-content table{display:block;max-width:100%;overflow-x:auto}
  body.sc-screen-lesson .sterling-mobile-voice-dock-v1083:not([hidden]){max-width:calc(100dvw - 16px)!important}
  body.sc-screen-lesson .sc-student-bottom-stack .mobile-nav{position:static!important}
  /* Accessible jumps to sections below the sticky header. */
  body.portal-body.is-authenticated :is([id^="dashboard-"],#lesson-content,
    #notes-plus,#tm-exams,#tm-smart-guide,#ait-history-filter){scroll-margin-top:76px}
}
@media screen and (max-width:360px){
  body.portal-body.is-authenticated .top-shell .brand-lockup strong{font-size:12px}
  body.portal-body.is-authenticated .top-shell .brand-lockup small{font-size:8px}
  body.portal-body.is-authenticated .mobile-nav a small{font-size:9px}
  body.sc-screen-ai-teacher .ait-quick-picker{grid-template-columns:1fr}
  body.sc-screen-ai-teacher .ait-quick-picker button{min-height:60px}
}
@media screen and (min-width:761px){
  /* Desktop deliberately unchanged. */
}
@media (prefers-reduced-motion:reduce){
  body.portal-body.is-authenticated .mobile-nav a{transition:none!important}
}
@media print{body.portal-body.is-authenticated .sc-student-bottom-stack{display:none!important}}
