/* Mobile layout contract. Loaded after feature styles; desktop remains independent. */
@media(max-width:767px), (max-width:1023px) and (max-height:500px) and (orientation:landscape){
 html{width:100%;-webkit-text-size-adjust:100%;text-size-adjust:100%;scroll-padding-bottom:100px}
 body{min-width:0;width:100%;margin:0;overflow-wrap:break-word}
 .main,main,#catalog,#catalog-content,.topic,.task-info,.computing-section,.py-reader,.lab-observation{min-width:0}
 button,input,select,textarea{touch-action:manipulation}
 input:not([type=range]):not([type=checkbox]):not([type=radio]),select,textarea{font-size:16px!important}
 .sidebar{min-height:68px;padding:12px max(16px,env(safe-area-inset-right)) 12px max(16px,env(safe-area-inset-left));gap:0;background:var(--ui-surface)}
 .sidebar{padding-top:calc(12px + env(safe-area-inset-top))}.sidebar .brand{font-size:25px;max-width:calc(100% - 112px);min-height:44px;letter-spacing:-1px}
 .sidebar .brandmark{font-size:30px}.sidebar .top-credit{display:none}
 header{position:relative;display:block;height:auto;min-height:0;padding:0 max(16px,env(safe-area-inset-right)) 14px max(16px,env(safe-area-inset-left));margin:0;background:var(--ui-surface);border-bottom:1px solid var(--line)}
 header .crumb,header .beta-badge,header .header-help,header .header-settings{display:none}
 header .account-button,header .header-support{position:absolute;top:-56px;min-width:44px;width:44px;height:44px;min-height:44px;max-width:44px;padding:8px;border-radius:13px;display:flex;align-items:center;justify-content:center}
 header .account-button{right:max(16px,env(safe-area-inset-right))}
 header .header-support{right:calc(max(16px,env(safe-area-inset-right)) + 52px)}
 header .account-button>span:last-child,header .header-support .support-label{display:none}
 header .search{display:flex;width:100%;height:46px;min-width:0;margin:0;border-radius:12px;background:var(--paper)!important;box-sizing:border-box}
 header .search[hidden]{display:none!important}
 header:has(.search[hidden]){padding-bottom:0;border-bottom:0}
 .search input{min-width:0;width:100%;font-size:16px}.search kbd{display:none}
 .sidebar nav{position:fixed;inset:auto 0 0;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));width:100%;margin:0;padding:6px max(8px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));gap:2px;z-index:30;background:var(--ui-surface);border-top:1px solid var(--line);box-shadow:0 -8px 24px #10251b0a}
 .sidebar .nav,.sidebar .settings-nav{width:100%;min-width:0;min-height:52px;padding:5px 1px;gap:4px;display:flex;flex-direction:column;justify-content:center;border-radius:11px}
 .sidebar .nav>span:first-child{display:block;width:auto;font-size:22px;line-height:1}
 .sidebar .nav .nav-label,.sidebar .nav .lab-mobile-label{font-size:10px;line-height:1.3;letter-spacing:-.2px;white-space:nowrap}
 .sidebar .nav .lab-desktop-label{display:none}.sidebar .nav .lab-mobile-label{display:block}.sidebar .nav b,.sidebar .nav i{display:none}
 main,[data-page=graphs] main{width:100%;max-width:100%;margin:0;padding:18px max(16px,env(safe-area-inset-right)) calc(100px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
 .domain-switch{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%;margin:0 0 18px;gap:3px;border-radius:14px;padding:4px}
 .domain-switch>button,.domain-switch #computingNav{min-width:0;min-height:52px;padding:9px 3px;gap:0;justify-content:center;text-align:center;border-radius:10px}
 .domain-switch>button>span,.domain-switch>button i,.domain-switch small{display:none!important}
 .domain-switch b{font-size:12px!important;line-height:1.4;letter-spacing:-.3px;white-space:nowrap}
 .hero{border-radius:20px}.hero-copy{padding:25px 23px}.hero h1{font-size:34px;line-height:1.12;letter-spacing:-1.4px;margin-top:18px}.hero p{font-size:14px;line-height:1.75;margin:17px 0 22px}.hero .eyebrow{font-size:8px;letter-spacing:1px;line-height:1.7}.hero-foot{font-size:11px;line-height:1.6;max-width:100%;margin-top:17px}
 .hero-actions{display:grid;grid-template-columns:1fr;gap:5px;width:100%}.hero-actions .primary{width:100%;justify-content:space-between;min-height:48px}.hero-graph{width:100%;min-height:44px;font-size:13px;text-align:left}
 .study-ribbon{display:none}.section-head{display:block;margin:27px 0 20px}.section-head h2{font-size:27px;line-height:1.2}.catalog-note{display:block;margin:9px 0 0;font-size:12px;line-height:1.7}
 .grade-row>div{grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}.grade-row button{min-width:0;min-height:44px;height:44px;font-size:16px}
 .subject-tabs{display:flex;width:100%}.subject-tabs button{min-width:0;flex:1;min-height:44px}
 .topics-head{align-items:flex-start;gap:8px;flex-wrap:wrap}.topics-head>span{font-size:11px;line-height:1.7}
 .topics{grid-template-columns:minmax(0,1fr);gap:12px}.topic{padding:20px;min-height:0;border-radius:17px}.topic-topline{margin-bottom:14px}.topic-symbol{position:static;width:36px;height:36px;font-size:21px}.topic h3{font-size:18px;line-height:1.4}.topic p{font-size:14px;line-height:1.75;margin:9px 0 15px}.topic-actions{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;margin-top:auto;padding-top:10px}.topic-actions button:first-child,.topic-actions button:last-child{font-size:12px;min-height:44px;white-space:normal}
 .challenge-banner{padding:21px;margin:25px 0}.challenge-banner h3{font-size:24px}.challenge-banner p{font-size:14px}.level-header{display:flex;align-items:flex-start;gap:10px;flex-wrap:wrap}.level-header h3{font-size:22px}.level-header>button{min-height:44px;font-size:12px}
 .filter-row{display:block}.level-tabs,#levelTabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:7px}.level-tabs button{min-width:0;min-height:44px;padding:10px 8px;font-size:12px;white-space:normal}.level-tabs button[data-level="3"]{grid-column:1/-1}.olympiad-notice{padding:15px;font-size:13px}
 .task-card{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:10px;padding:19px;border-radius:17px}.task-info{min-width:0}.task-info h3{font-size:18px;line-height:1.45}.task-info p{font-size:15px;line-height:1.75;overflow-wrap:anywhere}.task-caption{font-size:12px;line-height:1.7}.task-meta{font-size:12px}.bookmark{width:44px;min-height:44px}.solve{min-height:48px;font-size:14px}.task-num{display:none}
 .physics-filter{display:flex;flex-wrap:wrap;gap:10px}.physics-filter select{width:100%;max-width:100%;min-height:44px}.physics-filter>span{font-size:12px;line-height:1.7}.physics-filter button{min-height:44px}
 dialog{box-sizing:border-box;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;max-width:calc(100% - 20px)}
 .workspace-dialog{position:fixed;inset:0;width:100%;max-width:100%;height:100dvh;max-height:100dvh;margin:0;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom);border:0;border-radius:0;overflow-y:auto;background:var(--ui-surface)}
 .workspace-dialog>.close{position:fixed;top:calc(12px + env(safe-area-inset-top));right:12px;width:44px;height:44px;z-index:5}
 .workspace-top{padding:18px 68px 18px 20px}.workspace-top>div>span{font-size:12px;line-height:1.6}.workspace-grid{display:block}.problem-pane,.work-panel{padding:24px 20px;min-width:0}.workspace-dialog .modal-title{font-size:27px;line-height:1.2;overflow-wrap:anywhere}.workspace-dialog .question{font-size:16px;line-height:1.85}.problem-tags{flex-wrap:wrap;gap:7px}.problem-tags>span{max-width:100%;white-space:normal;line-height:1.6}.workspace-dialog .answer-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:9px}.workspace-dialog .answer-row input{width:100%;min-width:0;min-height:48px}.workspace-dialog .answer-row select{width:90px;min-height:48px}.workspace-dialog .answer-row .primary{grid-column:1/-1;width:100%;min-height:48px}.workspace-dialog .input-note{font-size:12px;line-height:1.8}.work-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;padding:0 12px}.work-tabs button{padding:12px 4px;min-width:0;min-height:48px;font-size:12px;white-space:normal}.draft-step textarea{width:100%;min-width:0;line-height:1.75}.draft-tools{flex-wrap:wrap;gap:10px}.guided-steps li{overflow-wrap:anywhere}.solution-plan,.solution-validation{padding:16px}.solution-controls{display:flex;flex-wrap:wrap;gap:8px}.solution-controls button{min-height:44px}.work-pane{padding-bottom:20px}.work-panel canvas{max-width:100%;touch-action:none}
 .lesson-dialog,.settings-dialog,.account-dialog,.support-dialog{width:calc(100% - 20px);max-width:calc(100% - 20px);max-height:calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));padding:25px 20px;border-radius:18px}.lesson-content>h2{font-size:28px;line-height:1.25}.lesson-dialog p,.lesson-dialog li{font-size:15px;line-height:1.85}.support-close{top:0;right:0}.settings-actions{flex-wrap:wrap;gap:12px}.setting-options{flex-wrap:wrap}.palette-options{grid-template-columns:1fr 1fr}
 .computing-hero{padding:25px 21px;gap:22px}.computing-intro h1{font-size:33px;line-height:1.13}.computing-terminal{display:none}.computing-heading h2{font-size:26px}.language-tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px}.language-tab{min-width:0;padding:15px 11px;gap:9px}.language-symbol{font-size:23px}.language-tab small{font-size:10px}.language-tab b{font-size:16px}.language-soon{display:none}
 .py-course-head h3{font-size:25px;line-height:1.25}.py-course-grid{display:block}.py-outline{position:static;padding:18px;margin-bottom:16px}.py-outline nav{grid-template-columns:1fr}.py-outline nav button{min-height:48px;font-size:13px}.py-theory,.py-workspace,#cppCourse .py-workspace{padding:21px 17px;border-radius:16px}.py-lesson-heading h3{font-size:26px;overflow-wrap:anywhere}.py-theory>p{font-size:15px;line-height:1.85}.py-code-editor{min-height:300px;max-width:100%;font-size:16px!important;line-height:1.65}.py-example>pre,.py-solution pre,#cppCourse pre{max-width:100%;overflow-x:auto;white-space:pre;word-break:normal}.py-run-bar{display:grid;grid-template-columns:1fr 1fr;gap:8px}.py-run-bar>span{grid-column:1/-1}.py-run-bar button{min-height:46px}.py-lesson-navigation button{font-size:13px;min-height:44px}
 .graph-heading h1,.lab-heading h1{font-size:33px;line-height:1.15}.graph-layout{display:block}.graph-controls{padding:20px;min-width:0}.graph-canvas-card{min-width:0}.plot-toolbar{flex-wrap:wrap;gap:10px}.plot-tools button{min-width:44px;min-height:44px}#plotArea{height:360px;max-width:100%}.formula-entry input{min-width:0}.lab-controls{gap:0 13px;padding:18px}.lab-work-head h2{font-size:27px}.lab-heading{margin:8px 0 23px}.lab-catalog{margin-top:20px}.lab-chart-card{padding:16px}.lab-play-row{gap:7px}.lab-play-row label{margin:8px 0 0;width:100%;justify-content:space-between}.lab-play-row select{min-height:44px}.lab-metrics strong{font-size:23px}.lab-theory p,.lab-theory li{font-size:14px;line-height:1.85}.lab-table-scroll{max-width:100%}.lab-btn{min-height:44px}.lab-challenge form>div{flex-wrap:wrap}.lab-challenge input{width:100%}.lab-challenge form>div button{width:100%}.lab-experiments{grid-template-columns:1fr}.lab-card{min-height:68px}.lab-card-info b{font-size:14px}.lab-card-info small{font-size:10px}
 .account-stats{grid-template-columns:1fr 1fr}.account-achievements{grid-template-columns:1fr}.account-achievements article b{font-size:14px}.account-achievements article p{font-size:12px}.account-action{min-height:44px;font-size:12px}.account-dialog-head h2{font-size:25px}.account-dialog input,.account-dialog select{min-height:48px}.account-user h3{font-size:23px}
 .discovery{padding:22px}.discovery h3{font-size:24px}.discovery p{font-size:14px;line-height:1.8}.footer-credit{font-size:11px}#toast{left:16px;right:16px;bottom:calc(82px + env(safe-area-inset-bottom));max-width:none;width:auto;font-size:13px;line-height:1.6}
}
@media(max-width:359px){.domain-switch b{font-size:10px!important}.hero h1{font-size:30px}.sidebar .nav .nav-label,.sidebar .nav .lab-mobile-label{font-size:9px}.hero-copy{padding:23px 20px}.lab-controls{grid-template-columns:1fr}}
@media(max-width:1023px) and (max-height:500px) and (orientation:landscape){.sidebar nav{padding-bottom:6px}.sidebar .nav,.sidebar .settings-nav{min-height:44px;flex-direction:row;gap:6px}.workspace-dialog{height:100dvh}.hero-actions{grid-template-columns:1fr 1fr}}
/* Keep account and support in the header flow, never above/behind the brand bar. */
@media(max-width:767px), (max-width:1023px) and (max-height:500px) and (orientation:landscape){
 .sidebar .brand{max-width:100%}
 header{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;padding-bottom:14px}
 header:has(.search[hidden]){padding-bottom:14px}
 header .account-button,header .header-support{position:static;inset:auto;top:auto;right:auto;bottom:auto;left:auto;width:100%;max-width:none;min-width:0;min-height:46px;height:auto;margin:0;padding:10px 8px;z-index:auto;gap:7px;box-sizing:border-box}
 header .account-button{grid-column:1;grid-row:1}
 header .header-support{grid-column:2;grid-row:1;white-space:normal}
 header .account-button>span:last-child{display:block;min-width:0;font-size:12px;line-height:1.5}
 header .header-support .support-label{display:block;font-size:11px;line-height:1.45;white-space:normal;text-align:left}
 header .header-support>span:first-child{font-size:22px;flex-shrink:0}
 header .search{grid-column:1/-1;grid-row:2;min-width:0}
}

/* Compact phone composition: keep the desktop illustrations and visual rhythm. */
@media(max-width:767px), (max-width:1023px) and (max-height:500px) and (orientation:landscape){
 .sidebar{min-height:48px;padding:6px max(12px,env(safe-area-inset-right)) 6px max(12px,env(safe-area-inset-left));padding-top:calc(6px + env(safe-area-inset-top))}
 .sidebar .brand{min-height:36px;font-size:22px}.sidebar .brandmark{font-size:27px}
 header{gap:6px;padding:0 max(12px,env(safe-area-inset-right)) 10px max(12px,env(safe-area-inset-left))}
 header .account-button,header .header-support{min-height:44px;padding:6px 9px;border-radius:11px}
 header .search{height:42px}.search input{padding-block:7px}
 main,[data-page=graphs] main{padding:12px max(12px,env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}
 .domain-switch{margin-bottom:12px;border-radius:13px}.domain-switch>button,.domain-switch #computingNav{min-height:44px;padding:6px 3px}
 .hero{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,.85fr);gap:12px 8px;min-height:0;padding:20px;border-radius:19px;align-items:center}
 .hero .hero-copy{display:contents}
 .hero .eyebrow,[data-domain=physics] .hero-copy>.eyebrow{grid-column:1/-1;grid-row:1;font-size:8px;line-height:1.5;letter-spacing:1px;margin:0}
 .hero h1{grid-column:1;grid-row:2;font-size:clamp(25px,6.8vw,36px);line-height:1.1;letter-spacing:-1px;margin:0;overflow-wrap:normal}
 .hero-art,[data-domain=physics] .hero-art{grid-column:2;grid-row:2;display:flex;position:relative;inset:auto;width:100%;min-width:0;padding:0;opacity:1;align-self:center;pointer-events:none;background:none}
 .hero-art svg{display:block;width:100%;min-width:0;height:auto;margin:0;max-width:100%}
 .hero-art .orbital,.hero-art .physics-visual{width:100%;min-width:0}
 .hero-art .orbit-caption,.hero-art .physics-caption{display:none}
 .hero p{grid-column:1/-1;grid-row:3;font-size:13px;line-height:1.65;margin:0;max-width:none}.hero p br{display:none}
 .hero-actions{grid-column:1/-1;grid-row:4;display:grid;grid-template-columns:auto minmax(0,1fr);gap:12px;width:100%;margin:2px 0 0;align-items:center}
 .hero .primary{min-height:44px;width:auto;padding:10px 15px;font-size:12px;gap:14px;border-radius:10px}
 .hero-graph,[data-domain=physics] .hero .hero-graph{width:auto;min-width:0;min-height:44px;font-size:11px;line-height:1.5;padding:4px 0;justify-content:center;gap:7px}
 .hero-foot{grid-column:1/-1;grid-row:5;font-size:10px;line-height:1.6;max-width:none;margin:0}
 .section-head{margin:22px 0 16px}.section-head h2{font-size:clamp(23px,5.8vw,29px);letter-spacing:-.7px;line-height:1.2}.section-head .eyebrow{font-size:8px;line-height:1.5}.catalog-note{font-size:11px;line-height:1.6;margin-top:7px}
 .grade-row>span{margin-bottom:8px}.grade-row>div{gap:6px}.grade-row button{height:44px;min-height:44px;font-size:14px}
 .subject-tabs{gap:7px}.subject-tabs button{padding:8px;font-size:13px;min-height:44px}
 .topics-head{margin:20px 0 12px}.topics-head h3{font-size:17px}.topics-head>span{font-size:10px}
 .topics{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 .topics .topic,[data-density=compact] .topics .topic{padding:14px;min-height:0;border-radius:14px;gap:0}
 .topic-topline{margin-bottom:10px}.topic-symbol{width:31px;height:31px;font-size:20px;border-radius:9px}.topic-index{font-size:10px}
 .topic h3{font-size:14px;line-height:1.4;letter-spacing:-.2px;overflow-wrap:normal;hyphens:auto}
 .topic p{font-size:12px;line-height:1.55;margin:7px 0 12px}
 .topic-actions{display:flex;flex-wrap:wrap;gap:0 8px;padding-top:5px;margin-top:auto;align-items:center}
 .topic-actions button:first-child,.topic-actions button:last-child{font-size:11px;line-height:1.4;min-height:44px;padding:6px 0;white-space:normal}
 .task-card{padding:14px;gap:8px;border-radius:14px}.task-info h3{font-size:16px;line-height:1.4}.task-info p{font-size:14px;line-height:1.65}.task-caption,.task-meta{font-size:11px}.solve{min-height:44px;font-size:13px}
 .level-header h3{font-size:19px}.level-tabs button{padding:8px;font-size:11px}.olympiad-notice{padding:12px;font-size:12px}
 .computing-hero{padding:20px;gap:16px;border-radius:19px}.computing-intro h1{font-size:clamp(27px,6.8vw,36px)}.computing-intro>p{font-size:13px;line-height:1.65}.computing-soon{font-size:11px}
 .computing-hero .computing-terminal{display:block;transform:none;min-width:0;max-width:100%;margin:0}.terminal-code{font-size:11px;padding:15px;gap:9px}.terminal-bar{padding:10px 13px}.terminal-bar small{font-size:8px}.terminal-ready{font-size:10px;white-space:normal;overflow-wrap:anywhere}
 .computing-heading h2{font-size:23px}.computing-heading>span{font-size:11px}.language-tab{padding:13px;gap:8px}.language-tab b{font-size:16px}.language-symbol{width:34px;height:34px;font-size:17px}
 .language-panel{padding:0}.py-course-head h3{font-size:22px}.py-outline{padding:14px}.py-theory,.py-workspace,#cppCourse .py-workspace{padding:17px 14px}.py-lesson-heading h3{font-size:23px}.py-theory>p{font-size:14px;line-height:1.75}
 .graph-heading h1,.lab-heading h1{font-size:28px}.lab-work-head h2{font-size:24px}.lab-experiments{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.lab-card{min-height:74px;padding:10px}.lab-card-info b{font-size:12px;line-height:1.4}.lab-card-info small{font-size:10px;line-height:1.5}.lab-card-icon{font-size:20px;width:23px}
 .problem-pane,.work-panel{padding:19px 16px}.workspace-top{padding:16px 65px 16px 16px}.workspace-dialog .modal-title{font-size:24px}.workspace-dialog .question{font-size:15px;line-height:1.75}
 .lesson-content>h2{font-size:25px}.lesson-dialog p,.lesson-dialog li{font-size:14px;line-height:1.8}
 .challenge-banner{padding:18px}.challenge-banner h3,.discovery h3{font-size:21px}.challenge-banner p,.discovery p{font-size:13px}
 #aiLaunch{right:max(12px,env(safe-area-inset-right));width:46px;height:46px}
}
@media(max-width:359px){
 .hero{padding:16px;gap:11px 5px;grid-template-columns:minmax(0,1.4fr) minmax(0,.8fr)}.hero h1{font-size:24px}.hero .eyebrow,[data-domain=physics] .hero-copy>.eyebrow{font-size:7px;letter-spacing:.7px}.hero-actions{gap:8px}.hero .primary{padding:9px 12px}.hero-graph,[data-domain=physics] .hero .hero-graph{font-size:10px}
 .topics{grid-template-columns:minmax(0,1fr)}.topics .topic{padding:16px}.topic-topline{margin-bottom:8px}.topic h3{font-size:16px}.topic p{font-size:13px}
 .lab-experiments{grid-template-columns:1fr}.section-head h2{font-size:23px}
}
@media(min-width:600px) and (max-width:767px), (min-width:768px) and (max-width:1023px) and (max-height:500px) and (orientation:landscape){
 .hero{grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);padding:26px;gap:12px 20px}.hero h1{font-size:36px}.hero-art,[data-domain=physics] .hero-art{grid-row:1/6;align-self:center}.hero .eyebrow,[data-domain=physics] .hero-copy>.eyebrow,.hero p,.hero-actions,.hero-foot{grid-column:1}.hero .primary{padding-inline:13px}.topics .topic{padding:18px}.topic h3{font-size:16px}
}

/* Phone task lists and solver: compact surfaces, full readable statements. */
@media(max-width:767px), (max-width:1023px) and (max-height:500px) and (orientation:landscape){
 .task-list,#tasks{gap:9px}
 .task-card,[data-density=compact] .task-card{padding:11px 12px;gap:3px 8px;border-radius:12px;align-items:start;grid-template-columns:minmax(0,1fr) 44px}
 .task-card .task-meta{font-size:10px;line-height:1.4;min-height:24px;gap:5px;align-self:center}
 .task-card .bookmark{width:44px;height:44px;min-height:44px;padding:5px;align-self:start;margin:-8px -5px -8px 0;font-size:19px}
 .task-card .task-info h3{font-size:calc(14px * var(--font-scale,1));line-height:1.35;margin:0 0 5px;letter-spacing:-.15px}
 .task-card .task-info p{font-size:calc(13px * var(--font-scale,1));line-height:1.5;margin:0;-webkit-line-clamp:2}
 .task-card .task-caption{font-size:10px;line-height:1.45;margin-top:6px}
 .task-card .solve{grid-column:1/-1;grid-row:3;min-height:44px;margin:5px 0 0;padding:7px 12px;font-size:12px;border-radius:9px}
 .workspace-dialog .workspace-top{padding:10px 62px 10px 12px;gap:7px;min-height:60px}
 .workspace-top .eyebrow{font-size:8px;letter-spacing:.6px}.workspace-top>div>span{font-size:10px;line-height:1.4}
 .workspace-dialog>.close{top:calc(8px + env(safe-area-inset-top));right:8px;width:44px;height:44px}
 .workspace-dialog .problem-pane,.workspace-dialog .work-panel{padding:13px 12px}
 .workspace-dialog .problem-tags{gap:5px;margin-bottom:10px}.workspace-dialog .problem-tags>span{font-size:10px;line-height:1.4;padding-block:3px}
 .workspace-dialog .modal-title{font-size:calc(20px * var(--font-scale,1));line-height:1.25;letter-spacing:-.4px;margin:9px 0 12px}
 .workspace-dialog .question{font-size:calc(14px * var(--font-scale,1));line-height:1.6;margin:0 0 14px}
 .workspace-dialog .answer-row{gap:6px;grid-template-columns:minmax(0,1fr) auto}
 .workspace-dialog .answer-row input,.workspace-dialog .answer-row select{min-height:44px;padding:8px 10px;border-radius:8px}
 .workspace-dialog .answer-row .primary{min-height:44px;padding:8px 12px;font-size:12px;grid-column:auto;width:auto;flex-basis:auto}
 .workspace-dialog .answer-row:has(select) .primary{grid-column:1/-1}
 .workspace-dialog .input-note{font-size:11px;line-height:1.5;margin:7px 0}
 .workspace-dialog .work-pane{min-height:0;height:auto}
 .workspace-dialog .work-tabs{gap:3px;padding:0 9px;grid-template-columns:repeat(3,minmax(0,1fr))}
 .workspace-dialog .work-tabs button{padding:8px 3px;min-height:44px;font-size:11px;line-height:1.35}
 .workspace-dialog .work-panel h3{font-size:16px;line-height:1.4;margin:8px 0 12px}
 .workspace-dialog .work-panel p,.workspace-dialog .guided-steps li{font-size:calc(13px * var(--font-scale,1));line-height:1.6}
 .workspace-dialog .solution-plan,.workspace-dialog .solution-validation{padding:11px;border-radius:10px}
 .workspace-dialog .solution-controls{gap:6px}.workspace-dialog .solution-controls button{font-size:11px;min-height:44px;padding:7px 9px}
 .workspace-dialog .draft-step{padding:10px;margin-bottom:9px}.workspace-dialog .draft-step textarea{min-height:76px;line-height:1.5;padding:9px}
 .workspace-dialog .draft-tools{gap:6px}.workspace-dialog .draft-tools button{min-height:44px;font-size:11px}
 .workspace-dialog .ege-task-figure{margin:12px 0}.workspace-dialog .ege-task-figure figcaption{font-size:11px;line-height:1.5;margin-top:7px}
 .workspace-dialog .ege-source-statement{font-size:15px;line-height:1.65;padding:10px;border-radius:10px}
}
@media(max-width:767px), (max-width:1023px) and (max-height:500px) and (orientation:landscape){
 .workspace-dialog .approach-guide{margin:10px 0 14px;padding:0 11px;border-radius:10px}
 .workspace-dialog .approach-guide summary{min-height:44px;padding:11px 0;font-size:12px;line-height:1.6}
 .workspace-dialog .approach-guide p{font-size:13px;line-height:1.6;margin:0 0 11px}
 .workspace-dialog .answer-label{font-size:11px;margin-bottom:7px}
 .workspace-dialog .feedback:empty{display:none}
 .workspace-dialog .task-status{font-size:11px;line-height:1.5;margin:8px 0}
 .workspace-dialog .hint-section{margin:10px 0;padding:4px 0}
 .workspace-dialog .hint-button{min-height:44px;padding:8px 0;font-size:12px}
 .workspace-dialog .hints p{font-size:13px;line-height:1.6;padding:10px;margin:6px 0}
 .workspace-dialog .solution-details{margin:10px 0;padding:0}
 .workspace-dialog .solution-details>summary{min-height:44px;padding:11px 0;font-size:13px;line-height:1.6}
 .workspace-dialog .solution-note,.workspace-dialog .solution-step-status{font-size:11px;line-height:1.5;margin:8px 0}
 .workspace-dialog .next-task{min-height:44px;margin-top:8px;padding:9px 0;font-size:12px}
}

/* Keep the project credit visible and the top actions compact on phones. */
@media(max-width:767px), (max-width:1023px) and (max-height:500px) and (orientation:landscape){
 .sidebar .brand{max-width:calc(100% - 115px);min-width:0}
 .sidebar button.top-credit{display:inline-flex;align-items:center;justify-content:flex-end;min-height:44px;padding:0 4px;font-size:10px;flex-shrink:0}
 header{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px}
 header .account-button,header .header-support{width:100%;min-height:44px;padding:5px 10px;font-size:11px;gap:5px}
 header .account-button>span:last-child,header .header-support .support-label{font-size:11px;line-height:1.2}
 header .header-support>span:first-child{font-size:19px}
 header .search{grid-column:1/-1}
}
