
.learning-tools{position:absolute;right:16px;top:70px;z-index:8;width:330px;max-height:calc(100% - 280px);overflow:auto;background:#fffefb;border:1px solid #c9d7df;border-radius:12px;padding:10px;box-shadow:0 8px 28px #102a3d18;font-size:13px}
.learning-tools summary{cursor:pointer;font-weight:700;padding:8px}
.learning-tools:not([open]){width:auto}
.learning-tools button,.learning-tools select,.file-button{min-height:44px;padding:8px;border:1px solid #cfdae1;border-radius:7px;background:#fff;color:#18374b;cursor:pointer}
.learning-tools input[type=range]{width:100%;min-height:36px}
.tool-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.tool-grid label{display:flex;flex-direction:column;gap:6px}
.teaching-warning{color:#8a5420;background:#fff3dc;padding:8px;line-height:1.6}
#lesson-content28{display:grid;gap:8px}#lesson-content28 fieldset{border:1px solid #d9e3e9;border-radius:6px}#lesson-content28 fieldset label{display:block;padding:8px;min-height:40px}
.file-button input{max-width:135px}
.part-labels{position:absolute;inset:0;pointer-events:none;z-index:5}.part-labels span{position:absolute;padding:4px 7px;background:#fffde9;border:1px solid #cbb575;border-radius:4px;font-size:12px;white-space:nowrap;max-width:250px;overflow:hidden;text-overflow:ellipsis}
#motion-select28{max-width:210px;min-height:44px}
@media(max-width:760px){
 .learning-tools{right:8px;top:60px;width:min(340px,calc(100% - 16px));max-height:50%;padding:8px}
 .bottom-controls{padding-bottom:max(10px,env(safe-area-inset-bottom));max-height:34vh;overflow:auto}
 .motion-row{flex-wrap:wrap}#motion-select28{max-width:100%;width:100%}
 button,select,.tree-select,.tree-expander{min-height:44px}
 .detail-card{top:auto!important;bottom:calc(34vh + 10px)!important;max-height:36vh!important;left:8px!important;right:8px!important;width:auto!important}
 .topbar{padding-top:max(8px,env(safe-area-inset-top))}
 .tool-grid{gap:6px}.part-labels span{max-width:150px}
}

/* Match actual virtual row stride to touch targets, including tablets. */
@media(max-width:760px),(pointer:coarse){
 button,select{min-width:44px;min-height:44px}
 input:not([type=checkbox]):not([type=radio]):not([type=hidden]),summary{min-height:44px}
 .tree-row{height:48px}
 .tree-row>.tree-expander{width:44px;min-width:44px;height:44px;line-height:44px}
 .tree-row>.tree-select{height:44px}
 .scope-only,#lesson-content28 fieldset label{min-height:44px;padding:8px}
 .learning-tools input[type=range]{min-height:44px}
 .bottom-controls{padding-bottom:max(10px,env(safe-area-inset-bottom))}
}

/* Keep the closed tool launcher clear of the detail close control. */
.learning-tools:not([open]){left:20px;right:auto;top:70px;max-width:calc(100% - 40px)}
@media(max-width:1050px){.learning-tools:not([open]){left:13px;top:128px;max-width:calc(100% - 26px)}}
