/* Header and sources are viewport rows, never part of the content scroller. */
@media (min-width:761px){
 html.common-frame-active,html.common-frame-active body{height:100dvh!important;min-height:0!important;overflow:hidden!important;margin:0;max-width:none;width:100%;position:static}
 .site-frame{position:fixed;inset:0;max-width:1580px;margin:auto;padding:0 28px;display:grid;grid-template-rows:36px 92px minmax(0,1fr) 84px 38px;gap:0;color:var(--ink);background:var(--paper);font-size:16px;line-height:1.5;text-align:left}
 .common-top{min-height:0;border-bottom:1px solid var(--line)}
 .common-top>.teacher-navigation{width:100%;max-width:none;margin:0;padding:0 20px;height:36px;min-height:0;align-items:center;border:0}
 .common-top .teacher-partners>summary{font-size:12px;line-height:1.4;min-height:0;padding:7px 0}
 .site-frame>.common-header{height:92px;min-height:0;width:100%;max-width:none;margin:0;padding:12px 20px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:24px;flex-wrap:nowrap}
 .entrance-page .common-brand{text-decoration:none}
 .entrance-page .common-header .entrance-tagline{margin:2px 0 0;font-size:16px;line-height:1.2;white-space:nowrap}
 .common-brand{display:block;flex-shrink:0}.site-frame .common-brand img{display:block;width:90px;height:65px;object-fit:contain}
 .common-header-actions,.common-header-actions>nav{display:flex;align-items:center;justify-content:flex-end;gap:20px;font-size:13px;flex-wrap:wrap}
 .common-content{min-height:0;min-width:0;position:relative;overflow:auto;overscroll-behavior:contain;margin:20px 0;background:#fff;border:1px solid var(--line);border-radius:22px;padding:28px;scrollbar-gutter:stable}
 .common-content #board-canvas,.common-content #role-canvas{position:static;width:100%;height:100%;min-height:0;transform:none!important;padding:0}
 .common-content header.board-header,.common-content header.site-header,.common-content header.pupil-header,.common-content header.self-header,.common-content .entrance-brand,.common-content .teacher-mobile-notice,.common-content .board-footer,.common-content .pupil-footer,.common-content .site-footer{display:none!important}
 .common-content>main,.common-content .school-access,.common-content .account-entry-shell,.common-content .document,.common-content .self-layout{max-width:none;width:100%;margin:0;padding:0;min-height:0}
 .common-content h1,.common-content .teacher-start-content h2{font-size:40px;line-height:1.15;letter-spacing:-1px}
 .common-content .account-entry-shell>.eyebrow{margin-top:0}
 .common-content .board-layout{max-width:none;margin:0;padding:0;height:100%;min-height:0;grid-template-columns:minmax(0,1fr) 335px;gap:32px}
 .common-content:has(.board-layout){padding:0;border:0;background:transparent;overflow:hidden}
 .common-content .board-layout>.board,.common-content .board-layout>.student-monitor{height:100%;min-height:0}
 .common-content .board-layout>.board{padding-top:48px}
 .common-content .teacher-start-flow{height:100%;min-height:0}
 .common-content .teacher-start-content{justify-content:flex-start}
 .common-content .pupil-main{max-width:none;width:100%;margin:0;padding:0}
 .student-page.has-word-card .common-content .pupil-main{height:100%;max-width:480px;display:flex;flex-direction:column;margin:0 auto;overflow:hidden;min-height:0}
 .student-page.has-word-card .common-content .pupil-card{flex:1;min-height:0}
 .common-content:has(.entrance-shell){overflow:hidden;padding:0}
 .common-content .entrance-shell{position:absolute;top:0;left:50%;width:min(760px,calc(100% - 32px));margin:0;padding:20px 0;transform-origin:top center;transform:translateX(-50%) scale(var(--common-content-scale,1))}
 .common-content .entrance-shell .entrance-tagline{margin-top:0}
 .common-content .entrance-shell footer{display:none}
 .site-frame .common-sources{min-width:0;overflow:hidden;border-top:1px solid var(--line)}
 .site-frame .common-sources>.source-strip{box-sizing:border-box;width:100%;height:84px;min-height:0;max-width:none;margin:0;padding:10px 20px;border:0;display:flex;flex-direction:row;align-items:center;gap:24px}
 .site-frame .common-sources .source-strip-copy{flex:1;max-width:300px}.site-frame .common-sources h2{font-size:13px;font-weight:800;letter-spacing:0;line-height:1.2;margin:0 0 5px}
 .site-frame .common-sources p{font-size:10px;line-height:1.4;margin:0;color:var(--muted)}
 .site-frame .common-sources .source-links{flex:2;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:12px;min-width:0;align-items:center}
 .site-frame .common-sources .source-links a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-width:0;font-size:9px;line-height:1.2;text-decoration:none;color:var(--muted);text-align:center}
 .site-frame .common-sources .source-links img{display:block;height:30px;width:100%;max-width:90px;object-fit:contain}
 .site-frame .common-sources .lexin-wordmark{display:flex;align-items:center;justify-content:center;height:30px;font:bold 24px Arial;color:#205983;letter-spacing:1px}
 .common-footer{min-height:0;padding:0 20px;display:flex;align-items:center;justify-content:space-between;border-top:1px solid var(--line);gap:20px;font-size:10px;line-height:1.4;color:var(--muted)}
 .common-footer nav{display:flex;gap:20px}
 .common-content dialog{max-height:calc(100dvh - 32px)}
}
@media (min-width:761px) and (max-height:650px){.site-frame{grid-template-rows:32px 76px minmax(0,1fr) 76px 32px}.site-frame>.common-header{height:76px}.site-frame .common-brand img{height:55px}.site-frame .common-sources>.source-strip{height:76px}.common-content{margin-block:12px}}
/* The same links remain available in the existing mobile layouts. */
@media(max-width:760px){body>.teacher-navigation:not(.teacher-popup-layer){width:100%;max-width:480px;margin:0 auto;padding:4px 20px;flex-shrink:0}}
@media(max-width:760px){.teacher-mobile-notice>.teacher-navigation{width:100%;padding:0;margin:0 0 24px;justify-content:flex-end;gap:20px;border:0}.teacher-mobile-notice>.teacher-navigation summary{font-size:12px}}

/* Desktop navigation must not become another row above the phone app. */
@media (max-width:760px){
 [data-desktop-navigation]{display:none!important}
}
@media (max-width:760px){
 .source-strip-copy:has(.mobile-source-navigation){position:relative}
 .source-strip-copy:has(.mobile-source-navigation)>h2{padding-right:142px;min-height:13px}
 .source-strip-copy>.mobile-source-navigation.teacher-navigation{position:absolute;top:0;right:0;left:auto;display:flex!important;align-items:center;justify-content:flex-end;gap:12px;width:auto;max-width:none;height:13px;min-height:0;padding:0;margin:0;border:0}
 .mobile-source-navigation.teacher-navigation .teacher-partners{flex-basis:auto;width:auto}
 .mobile-source-navigation.teacher-navigation .teacher-partners>summary{font-size:9px;line-height:13px;min-height:0;padding:0;white-space:nowrap}
}

/* Square UKENS ORD artwork and proportional caption, desktop only. */
@media (min-width:761px){
 .desktop-logo{display:inline-flex;flex-direction:column;align-items:flex-start;gap:2px;vertical-align:middle;flex-shrink:0;line-height:1}
 .desktop-logo>img{display:block;width:72px!important;height:72px!important;aspect-ratio:1;object-fit:contain;border-radius:10px}
 .desktop-logo-tagline,.desktop-logo>.entrance-tagline{display:block;margin:0!important;padding:0;line-height:1.2;font-weight:700;color:var(--muted,#605e56);white-space:nowrap;letter-spacing:normal;text-decoration:none}
 a:has(>.desktop-logo){text-decoration:none}
 @media(max-height:650px){.desktop-logo>img{width:56px!important;height:56px!important;border-radius:8px}}
}

/* Desktop code entry. Account/history states retain their existing layout. */
@media (min-width:761px){
 .pupil-entry-desktop .common-content{overflow:hidden;scrollbar-gutter:auto;padding:24px}
 .pupil-entry-desktop .common-content>.pupil-main{height:100%;display:flex;flex-direction:column;gap:20px;min-height:0}
 .pupil-entry-desktop .pupil-main>.mobile-app-heading{grid-column:1/-1}
 .pupil-entry-desktop .mobile-app-heading>.eyebrow{margin:0 0 8px}
 .pupil-entry-desktop .mobile-app-heading>h1{margin:0;font-size:34px;line-height:1.15}
 .pupil-entry-desktop [data-mobile-pane=learn]{flex:1;min-height:0}
 .pupil-entry-desktop [data-mobile-pane=account],.pupil-portal #pupil-login{display:none}
 .pupil-entry-desktop [data-mobile-pane=library]{display:none}
 .pupil-entry-desktop .portal-join,.pupil-entry-desktop .portal-login{height:100%;min-height:0;margin:0;padding:22px;background:#fce8f1;display:flex;flex-direction:column;gap:10px}
 .pupil-entry-desktop .portal-join::before,.pupil-entry-desktop .portal-login::before{font-size:11px;font-weight:800;letter-spacing:1.5px;line-height:1.4}
 .pupil-entry-desktop .portal-join::before{content:'01'}.pupil-entry-desktop .portal-login::before{content:'02'}
 .pupil-entry-desktop .portal-join h2,.pupil-entry-desktop .portal-login h2{margin:0;font-size:24px;line-height:1.15}
 .pupil-entry-desktop .portal-join p,.pupil-entry-desktop .portal-login p{margin:0;font-size:14px;line-height:1.4}
 .pupil-entry-desktop .portal-login label,.pupil-entry-desktop .portal-join label{margin:0;font-size:13px}
 .pupil-entry-desktop .portal-login input:not([type=checkbox]){min-height:40px;padding:8px;font-size:16px;margin-top:4px}
 .pupil-entry-desktop .portal-code-row{grid-template-columns:1fr}
 .pupil-entry-desktop #enter-lesson-code{flex:1;display:flex;flex-direction:column;gap:4px}
 .pupil-entry-desktop .portal-code-row{flex:1;display:flex;flex-direction:column;align-items:stretch;justify-content:space-between}
 .pupil-entry-desktop .lesson-button{min-height:42px;padding:10px;font-size:13px;width:100%;margin:0}
 .pupil-entry-desktop .portal-login>.lesson-button{margin-top:auto;order:1}
 .pupil-entry-desktop .portal-login>.small{font-size:12px}
 @media(max-height:780px){
  .pupil-entry-desktop .common-content{padding:16px 20px}
  .pupil-entry-desktop .common-content>.pupil-main{gap:12px}
  .pupil-entry-desktop .mobile-app-heading>h1{font-size:28px}
  .pupil-entry-desktop .mobile-app-heading>.eyebrow{margin-bottom:4px}
  .pupil-entry-desktop .portal-join,.pupil-entry-desktop .portal-login{padding:14px;gap:4px}
  .pupil-entry-desktop .portal-login input:not([type=checkbox]){min-height:36px;padding:6px 8px;margin-top:2px}
  .pupil-entry-desktop .portal-join h2,.pupil-entry-desktop .portal-login h2{font-size:22px}
  .pupil-entry-desktop .lesson-button{min-height:36px;padding:8px;font-size:12px}
 }
}

@media (min-width:761px){
 .pupil-entry-desktop #school-status{margin:0;font-size:14px;line-height:1.3;flex-shrink:0}
 .pupil-entry-desktop #lesson-code{min-height:44px;font-size:22px;padding:8px;margin-top:2px}
 .pupil-entry-desktop #enter-lesson-code,.pupil-entry-desktop .portal-code-row{min-height:0}
 .pupil-entry-desktop .portal-join>h2,.pupil-entry-desktop .portal-join>p,.pupil-entry-desktop .portal-join::before,.pupil-entry-desktop .portal-join button{flex-shrink:0}
 .pupil-entry-desktop #join-without-account{min-height:36px;padding:8px;margin:0}
}
@media (min-width:761px){
 .pupil-entry-desktop #enter-lesson-code{flex:0 0 auto}
 .pupil-entry-desktop .portal-code-row{flex:0 0 auto;gap:6px}
 .pupil-entry-desktop #join-without-account{margin-top:auto}
 @media(max-height:780px){
  .pupil-entry-desktop .portal-join{padding:12px;gap:2px}
  .pupil-entry-desktop .portal-join h2{font-size:20px}
  .pupil-entry-desktop .portal-join p{font-size:13px;line-height:1.25}
  .pupil-entry-desktop .portal-join label{font-size:12px;line-height:1.25}
  .pupil-entry-desktop #lesson-code{min-height:40px;font-size:20px;padding:6px 8px}
  .pupil-entry-desktop #join-without-account{min-height:32px;padding:6px}
 }
}

@media (min-width:761px){.header-word-bank{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:11px 15px;border:1px solid #d8d2c5;border-radius:12px;background:#fff;color:#2457e6;font-weight:800;font-size:13px;text-decoration:none}.mode-switch>summary>.account-role-label{font-weight:400}.mode-switch>summary>.account-role-label strong{font-weight:800}}
@media (min-width:761px){.mode-switch>summary>.account-role-label{display:inline-flex;align-items:center;gap:4px;min-width:0}.account-role-label>strong{display:inline-block;max-width:min(24vw,260px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}
@media (min-width:761px){.pupil-entry-desktop .portal-join::before{content:none}}

@media (min-width:761px){[data-school-page=bank] #bank-lists{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start}[data-school-page=bank] .bank-list{padding:22px;background:#fce8f1;border:1px solid var(--line);border-radius:20px;min-width:0}[data-school-page=bank] .bank-list h2{margin:0 0 12px;font-size:24px}[data-school-page=bank] .bank-list p{font-size:14px;line-height:1.5}[data-school-page=bank] .bank-list a{overflow-wrap:anywhere}}
@media (min-width:761px){.common-header-actions a[href="/word-bank"]:not(.header-word-bank){display:none}}

/* An opened bank card is a focused exercise, outside the site chrome. */
@media (max-width:760px){
body.bank-card-focus .site-frame{padding:0;grid-template-rows:minmax(0,1fr);max-width:none}
body.bank-card-focus .site-frame>:not(.common-content),body.bank-card-focus>.pupil-header,body.bank-card-focus>.teacher-navigation,body.bank-card-focus>.teacher-popup-layer,body.bank-card-focus>.source-strip,body.bank-card-focus>.pupil-footer{display:none!important}
body.bank-card-focus .common-content{margin:0;padding:0;border:0;border-radius:0;background:transparent;overflow:hidden}
}
body.bank-card-focus .pupil-main,body.bank-card-focus .common-content .pupil-main{height:100%;width:100%;max-width:540px;padding:12px 18px 18px;margin:0 auto;display:flex;min-height:0;overflow:hidden}
body.bank-card-focus .pupil-main>:not(.pupil-card){display:none!important}
body.bank-card-focus .pupil-main>.pupil-card{width:100%;height:100%;max-width:none;min-height:0;margin:0;padding:0 7px 7px 0;flex:1}
body.bank-card-focus .pupil-card .phone-preview{height:100%;grid-template-rows:minmax(0,1fr)!important;gap:0;display:grid}
body.bank-card-focus .pupil-card .phone-heading,body.bank-card-focus .pupil-card .phone-footer{display:none!important}
body.bank-card-focus .pupil-card .phone-preview .word-card{height:100%;min-height:0;padding:24px;border-radius:28px;container-type:size}
body.bank-card-focus #card-front .pupil-face-content{height:100%;min-height:0;transform:none!important}
body.bank-card-focus .pupil-card #card-front .card-eyebrow{color:white;font-size:12px;flex-shrink:0;margin:0 0 12px}
body.bank-card-focus .pupil-card .phone-preview #card-front .word{height:clamp(64px,21cqh,145px);min-height:0;flex-shrink:0;margin:0 0 22px;font-size:clamp(22px,calc(145cqw / var(--word-letters,10)),66px)}
body.bank-card-focus .pupil-card #demo-form{display:flex;flex-direction:column;justify-content:space-between;flex:1;min-height:0;gap:14px}
body.bank-card-focus .pupil-card #demo-form fieldset,body.bank-card-focus .pupil-card #demo-form .field{flex-shrink:0;margin:0;font-size:12px}
body.bank-card-focus .pupil-card .phone-preview .choices span{font-size:12px;min-height:48px}
body.bank-card-focus .pupil-card .phone-preview .field textarea{height:clamp(44px,9cqh,76px);min-height:44px;font-size:16px;margin-top:8px;resize:none}
body.bank-card-focus .pupil-card #demo-form .flip-button{margin:0;min-height:48px}
body.bank-card-focus .pupil-card .form-error{margin:0;background:#fff;color:#a12626;padding:6px;border-radius:6px;font-size:12px;line-height:1.3}
body.bank-card-focus.pupil-keyboard .pupil-card .phone-preview .field.is-editing textarea{height:76px;min-height:76px}
@media(max-height:650px){body.bank-card-focus .pupil-main,body.bank-card-focus .common-content .pupil-main{padding:6px 12px 12px}body.bank-card-focus .pupil-card .phone-preview .word-card{padding:14px}body.bank-card-focus .pupil-card .phone-preview #card-front .word{height:64px;margin-bottom:12px}body.bank-card-focus .pupil-card #demo-form{gap:8px}body.bank-card-focus .pupil-card .phone-preview .choices span{min-height:38px;font-size:11px}body.bank-card-focus .pupil-card #demo-form .flip-button{min-height:40px}}

/* Fixed bank columns: only the list contents scroll, never the pink cards. */
@media (min-width:761px){
 [data-school-page=bank] .common-content{overflow:hidden}
 [data-school-page=bank] .common-content .pupil-main{height:100%;min-height:0;display:flex;flex-direction:column;overflow:hidden}
 [data-school-page=bank] .pupil-main>h1{flex-shrink:0;margin:0 0 18px}
 [data-school-page=bank] .pupil-main>.bank-reminder,[data-school-page=bank] .pupil-main>p.small,[data-school-page=bank] #school-status:empty{display:none}
 [data-school-page=bank] #school-status{flex-shrink:0;margin:0 0 12px}
 [data-school-page=bank] #bank-lists{flex:1;min-height:0;align-items:stretch;overflow:hidden}
 [data-school-page=bank] .bank-list{height:100%;min-height:0;display:flex;flex-direction:column;overflow:hidden}
 [data-school-page=bank] .bank-list h2{flex-shrink:0}
 [data-school-page=bank] .bank-list-scroll{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding-right:6px}
}

body.bank-card-focus .pupil-card .phone-preview:has(.bank-card-tools){grid-template-rows:58px minmax(0,1fr)!important;gap:8px}
.bank-card-tools{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:8px;min-width:0;color:#171713}
.bank-card-tools>div{display:flex;flex-direction:column;align-items:center;gap:4px;font-size:12px;white-space:nowrap}
.bank-card-tools a{color:#2457e6;font-weight:800;text-underline-offset:3px}
.bank-card-tools button{font:inherit;font-size:12px;font-weight:700;padding:9px 6px;min-height:40px;border:1px solid #d8d2c5;border-radius:10px;background:#fff;color:#2457e6;cursor:pointer}
.bank-card-tools button:disabled{opacity:.4;cursor:default}
body.bank-card-focus.pupil-keyboard .bank-card-tools{display:none}
body.bank-card-focus.pupil-keyboard .pupil-card .phone-preview:has(.bank-card-tools){grid-template-rows:minmax(0,1fr)!important}

/* Desktop bank cards share the fixed site frame; phone cards stay focused. */
@media (min-width:761px){
 body.student-page.bank-card-focus .common-content{display:grid;place-items:center;overflow:hidden;padding:12px}
 body.student-page.bank-card-focus .common-content .pupil-main{height:100%;max-height:760px;max-width:780px;padding:0;flex:none;container-type:size}
 body.student-page.bank-card-focus .pupil-main>.pupil-card{padding:0 10px 12px 0}
 body.student-page.bank-card-focus .pupil-card .phone-preview:has(.bank-card-tools){overflow:visible;grid-template-columns:minmax(76px,1fr) minmax(280px,min(414px,calc(65cqh - 44.2px))) minmax(76px,1fr);grid-template-rows:24px minmax(0,1fr) 28px!important;gap:8px 14px}
 body.student-page.bank-card-focus .bank-card-tools,body.student-page.bank-card-focus .bank-card-tools>div{display:contents}
 body.student-page.bank-card-focus .bank-week-prev{grid-column:1;grid-row:2;justify-self:end;align-self:center}
 body.student-page.bank-card-focus .bank-week-next{grid-column:3;grid-row:2;justify-self:start;align-self:center}
 body.student-page.bank-card-focus .bank-week-label{grid-column:2;grid-row:1;justify-self:center;align-self:center;font-size:12px}
 body.student-page.bank-card-focus .bank-return{grid-column:2;grid-row:3;justify-self:center;align-self:center;font-size:12px}
 body.student-page.bank-card-focus .pupil-card .phone-preview .word-card{grid-column:2;grid-row:2;border:1px solid #111;border-radius:32px;box-shadow:7px 9px 0 #111;padding:18px}
 body.student-page.bank-card-focus .pupil-card .phone-preview #card-front .word{height:clamp(64px,18cqh,108px);margin-bottom:12px}
 body.student-page.bank-card-focus .pupil-card #demo-form{gap:8px}
 body.student-page.bank-card-focus .pupil-card .phone-preview .choices span{min-height:40px}
 body.student-page.bank-card-focus .pupil-card .phone-preview .field textarea{height:44px;min-height:44px;margin-top:6px}
 body.student-page.bank-card-focus .pupil-card #demo-form .flip-button{min-height:40px}
 @media(max-height:700px){
  body.student-page.bank-card-focus .pupil-card .phone-preview .word-card{padding:8px}
  body.student-page.bank-card-focus .pupil-card #card-front .card-eyebrow{line-height:1.2;margin-bottom:6px}
  body.student-page.bank-card-focus .pupil-card .phone-preview #card-front .word{height:40px;margin-bottom:6px}
  body.student-page.bank-card-focus .pupil-card #demo-form{gap:4px}
  body.student-page.bank-card-focus .pupil-card #demo-form fieldset,body.student-page.bank-card-focus .pupil-card #demo-form .field{line-height:1.2}
  body.student-page.bank-card-focus .pupil-card .phone-preview .choices span{min-height:28px;padding:4px 2px}
  body.student-page.bank-card-focus .pupil-card .phone-preview .field textarea{height:28px;min-height:28px;padding:4px 8px;margin-top:4px;line-height:1.2}
  body.student-page.bank-card-focus .pupil-card #demo-form .flip-button{min-height:32px}
 }
}

/* Mobile shared chrome: compact sources and navigation above the page. */
@media (max-width:760px){
 .source-strip-copy>p{display:none}
 body:not(.bank-card-focus)>.mobile-source-navigation.teacher-navigation{position:absolute;top:max(8px,env(safe-area-inset-top));right:16px;left:auto;display:flex!important;align-items:center;justify-content:flex-end;gap:14px;width:auto;max-width:none;height:16px;min-height:0;padding:0;margin:0;border:0;z-index:40}
 .mobile-source-navigation.teacher-navigation .teacher-partners{flex-basis:auto;width:auto}
 .mobile-source-navigation.teacher-navigation .teacher-partners>summary{font-size:11px;line-height:16px;min-height:0;padding:0;white-space:nowrap}
 .entrance-page .entrance-shell{padding-top:max(36px,calc(env(safe-area-inset-top) + 28px))}
 .entrance-page footer,.entrance-page footer a,.pupil-footer,.pupil-footer a{font-size:10px}
 .entrance-page .entrance-lead.mobile-entrance-lead{font-size:clamp(10px,3.1vw,14px);line-height:1.4}
 .mobile-entrance-lead>span{display:block;white-space:nowrap}
}

/* A phone keeps the narrow mobile layout when held sideways. */
@media (orientation:landscape) and (max-width:760px){
 body{max-width:480px;margin-inline:auto}
 .entrance-page .entrance-shell{width:min(448px,calc(100vw - 32px))}
 body>.mobile-source-navigation.teacher-navigation{right:max(16px,calc((100vw - 480px)/2 + 16px))}
}

/* Mobile overflow stays reachable; desktop keeps its fixed frame. */
@media (max-width:760px){
 html:not(.common-frame-active){height:auto!important;min-height:100%;overflow-y:auto!important}
 body:not(.has-word-card){height:auto!important;min-height:100dvh;overflow-y:visible!important}
 .entrance-page .entrance-shell{position:relative;top:auto;left:auto;transform:none;margin-inline:auto;--entrance-scale:1}
 .mobile-app-shell:not(.has-word-card)>.pupil-main,.mobile-app-shell:not(.has-word-card)>.self-layout{flex:none;height:auto;max-height:none;overflow:visible;overscroll-behavior-y:auto}
 .teacher-mobile-allowed.weekly-page #board-canvas,.teacher-mobile-allowed.weekly-page .board-layout{flex:none;height:auto;overflow:visible}
 #board-canvas>#teacher-access{height:auto;overflow:visible}
 .student-page.has-word-card .pupil-card #card-front,.student-page.has-word-card .pupil-card #card-back{overflow-y:auto!important;overscroll-behavior-y:auto;-webkit-overflow-scrolling:touch}
 .student-page.has-word-card .pupil-card .pupil-face-content{height:auto!important;min-height:100%;transform:none!important}
}

/* Restore the existing source introduction only on the mobile front page. */
@media (max-width:760px){
 .entrance-page:has(.entrance-choices) .source-strip-copy>p{display:block}
 .entrance-page:has(.entrance-choices) .source-strip-copy>p br{display:initial}
}

.mobile-project-credit{display:none}
@media (max-width:760px){
 .entrance-page:has(.entrance-choices) footer{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}
 .entrance-page:has(.entrance-choices) footer>.mobile-project-credit{display:block;margin-right:auto}
 .entrance-page:has(.entrance-choices) footer>a[href="/appen"]{display:none}
}

/* Match the approved front page's 16px mobile gutters. */
@media (max-width:760px){
 body:not(.entrance-page)>main:not(.wrap),body:not(.entrance-page)>header,body:not(.entrance-page)>footer,body:not(.entrance-page)>.editor-pages{box-sizing:border-box;width:100%;max-width:480px;margin-inline:auto;padding-inline:16px}
 body:not(.entrance-page)>.wrap{width:calc(100% - 32px);max-width:448px;padding-inline:0}
 body:not(.entrance-page)>.source-strip{box-sizing:border-box;width:100%;max-width:480px;margin-inline:auto;padding-inline:16px}
 body.teacher-mobile-page>.teacher-mobile-notice{box-sizing:border-box;width:100%;max-width:480px;padding-inline:16px}
 .teacher-mobile-allowed.weekly-page #board-canvas>.board-header,.teacher-mobile-allowed.weekly-page #board-canvas>.board-layout,.teacher-mobile-allowed.weekly-page #board-canvas>.board-footer,.teacher-mobile-allowed.weekly-page #board-canvas>.source-strip{box-sizing:border-box;width:100%;max-width:480px;margin-inline:auto;padding-inline:16px}
 .teacher-mobile-allowed #board-canvas>#teacher-access{width:calc(100% - 32px);max-width:448px;margin-inline:auto}
 .mobile-app-shell.role-page>.pupil-footer,.mobile-app-shell>.pupil-footer,.mobile-app-shell>.pupil-header,.mobile-app-shell>.self-header{padding-inline:16px}
 body.student-page.has-word-card>.pupil-main{padding-inline:16px}
}

/* Phone navigation exposes the same bank and account actions as desktop. */
@media (max-width:760px){
 .header-word-bank{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:9px 12px;border:1px solid #d8d2c5;border-radius:12px;background:#fff;color:#2457e6;font-size:12px;font-weight:800;text-decoration:none}
 .mode-switch>summary>.account-role-label{display:inline-flex;align-items:center;gap:4px;min-width:0;font-weight:400}
 .account-role-label>strong{display:inline-block;max-width:min(30vw,140px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:800}
 .mobile-app-shell:not(.has-word-card)>.pupil-header,.mobile-app-shell>.self-header{padding-top:32px}
 .mobile-app-shell>.pupil-header>nav,.mobile-app-shell>.self-header>nav{min-width:0;flex:1}
 header nav>a[href="/word-bank"]:not(.header-word-bank){display:none}
 .teacher-mobile-allowed.weekly-page .board-layout>.student-monitor{display:block;width:100%;max-width:420px;margin:20px auto 0;flex-shrink:0}
}

/* Keep the mobile pupil focused on the teacher-led activity. */
@media (max-width:760px){
 body.student-page.pupil-activity>.mobile-source-navigation.teacher-navigation{display:none!important}
}

/* Mobile Ordbank cards retain the exercise content inside a physical card frame. */
@media (max-width:760px){
 body.student-page.bank-card-focus .pupil-main>.pupil-card{max-width:420px;margin-inline:auto;padding:0 10px 12px 0}
 body.student-page.bank-card-focus .pupil-card .phone-preview:has(.bank-card-tools){grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);grid-template-rows:48px minmax(0,1fr) 28px!important;gap:8px}
 body.student-page.bank-card-focus .bank-card-tools,body.student-page.bank-card-focus .bank-card-tools>div{display:contents}
 body.student-page.bank-card-focus .bank-week-prev{grid-column:1;grid-row:1;justify-self:start}
 body.student-page.bank-card-focus .bank-week-label{grid-column:2;grid-row:1;align-self:center;font-size:12px;white-space:nowrap}
 body.student-page.bank-card-focus .bank-week-next{grid-column:3;grid-row:1;justify-self:end}
 body.student-page.bank-card-focus .bank-return{grid-column:1 / -1;grid-row:3;justify-self:start;align-self:end;font-size:14px;text-decoration:none}
 body.student-page.bank-card-focus .pupil-card .phone-preview .word-card{grid-column:1 / -1;grid-row:2;border:1px solid #111;border-radius:32px;box-shadow:7px 9px 0 #111}
 body.student-page.bank-card-focus.pupil-keyboard .pupil-card .phone-preview:has(.bank-card-tools){grid-template-rows:minmax(0,1fr)!important}
 body.student-page.bank-card-focus.pupil-keyboard .bank-card-tools>*{display:none}
 body.student-page.bank-card-focus.pupil-keyboard .pupil-card .phone-preview .word-card{grid-row:1}
}

/* The live pupil card uses the same physical frame as mobile Ordbank cards. */
@media (max-width:760px){
 body.student-page.pupil-activity .pupil-main>.pupil-card{max-width:420px;margin-inline:auto;padding:0 10px 12px 0}
 body.student-page.pupil-activity .pupil-card .phone-preview{grid-template-rows:66px minmax(0,1fr) 24px;gap:10px}
 body.student-page.pupil-activity .pupil-card .phone-preview .word-card{border:1px solid #111;border-radius:32px;box-shadow:7px 9px 0 #111}
 body.student-page.pupil-activity .pupil-card .phone-footer{display:flex;justify-content:space-between;align-items:center;gap:12px;font-size:8px}
 body.student-page.pupil-activity .phone-footer :is(a,button){color:#2457e6;font-size:14px;font-weight:800;text-decoration:none;background:transparent;border:0;padding:0;min-height:0}
 @media(max-height:620px){body.student-page.pupil-activity .pupil-card .phone-preview{grid-template-rows:52px minmax(0,1fr) 24px;gap:6px}}
 body.student-page.pupil-activity.pupil-keyboard .pupil-card .phone-preview{grid-template-rows:minmax(0,1fr);gap:0}
 body.student-page.pupil-activity.pupil-keyboard .pupil-card .phone-footer{display:none}
}

/* The preview wrapper must not cut the card shadow off at its right edge. */
@media (max-width:760px){
 body.student-page:is(.pupil-activity,.bank-card-focus) .pupil-card .phone-preview{overflow:visible}
}

/* Fixed mobile card faces: fit text locally; keep the approved outer frame. */
@media (max-width:760px){
 body.student-page.has-word-card .pupil-card :is(#card-front,#card-back){overflow:hidden!important;overscroll-behavior:none}
 body.student-page.has-word-card .pupil-card .pupil-face-content{height:100%!important;min-height:0!important;transform:none!important}
 body.student-page.has-word-card .pupil-card #card-back .pupil-face-content>*{flex-shrink:0}
 body.student-page.has-word-card .pupil-card #card-back .flip-button{position:static}
}

/* Pupil camera entry is an additional mobile alternative to the existing code. */
.pupil-qr-trigger{display:none}
.pupil-qr-dialog{width:min(440px,calc(100% - 32px));max-height:calc(100dvh - 32px);overflow:auto;padding:20px;border:1px solid var(--line);border-radius:22px;background:var(--paper);color:var(--ink)}
.pupil-qr-dialog::backdrop{background:#0008}.pupil-qr-dialog h2{font-size:22px;margin:0 0 16px}.pupil-qr-dialog video{display:block;width:100%;max-height:50dvh;object-fit:contain;background:#111;border-radius:14px}.pupil-qr-dialog p{font-size:14px;line-height:1.5}.pupil-qr-dialog .quiet-button{min-height:44px}
@media (max-width:760px){.pupil-qr-trigger{display:flex;align-items:center;justify-content:center;width:100%;min-height:44px;margin:0 0 12px;font-size:13px}}

/* Personal answers are readable independently of the fitted word card. */
.student-page .pupil-card .pupil-answer-trigger{display:block;flex-shrink:0;width:100%;min-height:44px;margin:0 0 12px;padding:8px 0;border:0;border-block:1px solid #ded9d0;border-radius:0;background:transparent;color:#2457e6;text-align:left;font-size:16px;line-height:1.4;font-weight:800;letter-spacing:0;cursor:pointer}
.pupil-answer-dialog{box-sizing:border-box;width:min(440px,calc(100% - 32px));max-height:calc(100dvh - 32px);margin:auto;padding:24px;border:1px solid #111;border-radius:24px;background:#fffdf7;color:#111;box-shadow:5px 7px 0 #111;overflow:auto;overscroll-behavior:contain}
.pupil-answer-dialog::backdrop{background:#1118}
.pupil-answer-dialog h2{font-size:24px;line-height:1.2;margin:0 44px 24px 0}
.pupil-answer-dialog h3{font-size:14px;line-height:1.4;margin:20px 0 6px;color:#58544e}
.pupil-answer-dialog p{font-size:17px;line-height:1.5;margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.pupil-answer-close{position:absolute;right:12px;top:12px;width:44px;height:44px;border:0;border-radius:50%;background:#e7edda;color:#111;font-size:30px;line-height:1;cursor:pointer}

/* Class selection mirrors the existing green create-class panel. */
.teacher-class-picker{min-width:0;align-self:start;padding:20px;border-radius:16px;background:#e8eddb}
.teacher-class-picker h3,.teacher-class-picker h2{margin-top:0}
.teacher-class-picker .teacher-class-list{height:clamp(150px,25dvh,240px);min-height:0;overflow-y:auto;overscroll-behavior:contain;list-style:none;margin:0;padding:0 4px 0 0;scrollbar-gutter:stable}
.teacher-class-list li+li{margin-top:8px}
.teacher-class-list .teacher-class-choice{display:flex;flex-direction:column;align-items:flex-start;gap:4px;width:100%;min-height:52px;padding:12px;border:1px solid #d8d2c5;border-radius:12px;background:#fff;color:#111;text-align:left;cursor:pointer}
.teacher-class-choice strong{font-size:16px;line-height:1.3}.teacher-class-choice span{font-size:12px;line-height:1.4;color:#605e56}
.teacher-class-choice:hover{border-color:#111}.teacher-class-list-empty{padding:12px 0;font-size:14px}
.class-access-column.teacher-class-picker{overflow:hidden;padding:20px}

/* Always-visible class scrollbar, independent of OS overlay preferences. */
.teacher-class-scroll{position:relative;padding-right:20px;min-width:0}
.teacher-class-scroll .teacher-class-list{scrollbar-width:none}
.teacher-class-scroll .teacher-class-list::-webkit-scrollbar{display:none}
.teacher-class-scrollbar{position:absolute;top:0;bottom:0;right:0;width:14px;background:#e7e1d6;border-radius:10px;touch-action:none;cursor:pointer}
.teacher-class-thumb{position:absolute;left:3px;right:3px;min-height:32px;border-radius:8px;background:#6c675e;pointer-events:auto}
.teacher-class-scrollbar:hover .teacher-class-thumb,.teacher-class-scrollbar:focus-visible .teacher-class-thumb{background:#2457e6}
.teacher-class-scrollbar:focus-visible{outline:3px solid #2457e6;outline-offset:3px}

/* Let wheel/touch scrolling continue to the page at nested content boundaries.
   Dialogs and popup panels retain their own containment; the approved home
   page is excluded from every selector. */
body:not(.entrance-page) :is(.common-content,.pupil-main,.self-layout,.bank-list-scroll,.teacher-class-list,.teacher-start-content,.pupil-card #card-front,.pupil-card #card-back),
body:not(.entrance-page) .student-monitor #student-card[data-example-active=true]>div{overscroll-behavior-y:auto!important}


/* Overflow must stay reachable, including fixed mobile pupil-card frames.
   Preserve card geometry; scroll its contents rather than clipping or shrinking.
   The approved entrance and modal scroll boundaries are deliberately excluded. */
body:not(.entrance-page).student-page.has-word-card .pupil-card :is(#card-front,#card-back){overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior-y:auto!important;touch-action:pan-y pinch-zoom;-webkit-overflow-scrolling:touch}
body:not(.entrance-page).student-page.has-word-card .pupil-card .pupil-face-content{height:auto!important;min-height:100%!important;transform:none!important}
body:not(.entrance-page) :is(.board-layout>.board,.class-access-column){overflow-y:auto;overscroll-behavior-y:auto}
body:not(.entrance-page) :is(.teacher-start-content,.class-access-grid,.pupil-entry-grid,.pupil-library-entries){overscroll-behavior-y:auto}
@media(max-width:760px){body:not(.entrance-page) .teacher-start-content{justify-content:safe center}}

/* Fill the scanner's image window while keeping its title and controls. */
.pupil-qr-dialog[open]{display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;gap:12px;height:min(680px,90dvh);box-sizing:border-box}
.pupil-qr-dialog h2{grid-row:1;margin:0}
.pupil-qr-dialog video{grid-row:2;width:100%;height:100%;min-height:0;max-height:none;object-fit:cover;object-position:center}
.pupil-qr-dialog video[hidden]{display:none!important}
.pupil-qr-dialog p{grid-row:3;margin:0}
.pupil-qr-dialog>button{grid-row:4}
.pupil-qr-dialog:has(video[hidden]){height:auto;grid-template-rows:auto 0 auto auto}
