/* Short landscape phones only. Tablet/desktop geometry stays in its existing styles. */
@media (orientation:landscape) and (max-height:500px) and (max-width:1000px){
 #app .ui-page-header:not(.lab-header){display:flex;flex-wrap:nowrap;align-items:center;gap:6px;padding-block:4px;max-height:none;overflow-x:auto}
 #app .ui-page-header:not(.lab-header)>.ui-header-title{flex:1 1 0!important;order:0;min-width:110px;text-align:center}
 #app .ui-page-header h1{font-size:14px;line-height:1.35;margin:0}
 #app .ui-page-header small{display:none}
 #app .ui-page-header .application-header-actions{margin-inline-start:0;flex-shrink:0}
 #app .rc header:has(.calculator-navigation)>h1,
 #app .rc header:has(.calculator-navigation)>div:not(.calculator-navigation){order:0;flex-basis:0}
 #app .rc header>.fullscreen-icon{margin-inline-start:0}
 #app .rc .rc-form{min-width:0;width:100%;grid-template-columns:minmax(0,1fr)}
 #app .rc .rc-entry{min-width:0;width:100%;gap:5px}
 #app .rc .rc-entry input{flex:1 1 80px;width:80px;min-width:0}
 #app .rc .rc-entry select{flex:0 0 auto;max-width:90px;font-size:18px}
 #app .rc .rc-entry button{flex:0 0 auto;padding-inline:10px}
 #app .quick-editor{max-height:calc(100% - 16px);overflow-y:auto;overscroll-behavior:contain}
 #app .al-blocks,#app .al-blocks.ab-wide{position:fixed;inset:0;width:100%;height:auto;z-index:100}

 /* Keep the curriculum action inside the fixed, non-scrolling home. */
 #app .official-home .school-top{min-height:48px;padding:2px 16px}
 #app .official-home .school-main{padding:6px 18px;gap:5px;grid-template-rows:64px minmax(0,1fr)}
 #app .official-home .school-identity{margin:0;padding:0;gap:8px}
 #app .official-home .official-authority .ministry-logo{width:30px;height:32px;margin:0 auto 1px}
 #app .official-home .official-authority .official-state{font-size:10px;margin:0}
 #app .official-home .official-authority .official-ministry{font-size:12px;line-height:1.2;margin:0}
 #app .official-home .official-program strong{font-size:25px}
 #app .official-home .official-supervision .official-guidance{font-size:11px}
 #app .official-home .school-launch{gap:5px;padding-bottom:0}
 #app .official-home .school-heading{padding:2px 8px;margin:0}
 #app .official-home .school-heading h1{font-size:18px;line-height:1.3;margin:0}
 #app .official-home .school-primary-actions{gap:5px;grid-template-rows:repeat(2,minmax(44px,1fr));max-height:112px}
 #app .official-home .school-primary-actions button{min-height:44px;padding:4px 8px;font-size:14px}
 #app .official-home .school-secondary-actions>button{min-height:44px;padding:4px 12px}
 #app .official-subjects .school-launch{justify-content:center;gap:6px}
 #app .official-home .subject-buttons button{min-height:92px;padding:8px 12px}

 /* Tabs remain horizontally scrollable, including their full touch targets. */
 #app .g7-tabs{max-height:none;min-height:44px;overflow:auto;flex-shrink:0}
 #app .g7-experience .g7-parts{height:76px!important;min-height:76px}
 #app .g6-experiment .g6-stage-heading{padding:4px 8px 0}
 #app .g6-experiment .g6-stage-heading h2{font-size:12px;line-height:1.3}
 #app .g6-experiment .g6-stage-heading p{font-size:11px;line-height:1.3;margin:2px 0}

 /* A selected wooden piece must not hide its own settings above the stage. */
 #app .wood-selection{top:6px;bottom:auto;max-height:calc(100% - 12px);overflow-y:auto;overscroll-behavior:contain;box-sizing:border-box}
 #app .wood-selection label{gap:6px;min-width:0}
 #app .wood-selection select{min-width:0;max-width:100%;flex:1}
 #app .df-footer{overflow-x:auto;max-width:100%;flex-wrap:nowrap}
 #app .df-footer button,#app .df-footer>div{flex-shrink:0}
 #app .dc-room-lab .dc-head{max-height:none}
 #app .decor.dc-course-lab{height:var(--official-view,calc(100dvh - 48px));min-height:0;overflow:hidden}
 #app .decor.dc-course-lab .dc-work,#app .decor.dc-course-lab.dc-room-lab .dc-work{height:auto;min-height:0;flex:1;overflow:hidden}
 #app .decor.dc-course-lab .dc-stage,#app .decor.dc-course-lab .dc-canvas-wrap{min-height:0}
 #app .decor.dc-course-lab .dc-tools{min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:8px}
 #app .decor.dc-course-lab .dc-course-footer{flex-shrink:0;padding:3px 8px}
 #app .decor.dc-course-lab .dc-course-footer button{min-height:40px}
 #app .decor.dc-course-lab .dc-head h1{white-space:normal;text-overflow:clip;overflow:visible;line-height:1.3;font-size:13px}
 #app .decor.dc-course-lab .dc-tools>.dc-view,#app .decor.dc-course-lab .dc-tools>.ink-toolbar{position:static;max-width:100%;margin:6px 0;display:flex;flex-wrap:wrap;padding:4px;box-shadow:none}
 #app .decor.dc-course-lab .dc-tools>.dc-instruction{padding:6px;margin-bottom:8px;border-radius:8px}
 #app .decor.dc-course-lab .dc-tools .ink-options{flex-wrap:wrap;max-width:100%}

 /* Long answers scroll within the question screen instead of covering scoring. */
 #app .qa[data-stage="question"] .qa-question h2,
 #app .qa[data-stage="question"] .qa-answer{overflow-y:auto;overscroll-behavior:contain;max-height:100%;min-height:0}
 #app .qa[data-stage="question"] .qa-answer{justify-content:flex-start}
}
