body[data-screen-tool=bach-microscope]{height:var(--studio-app-height);min-height:0;padding:0!important;display:flex;flex-direction:column}
body[data-screen-tool=bach-microscope] #root{flex:1;min-height:0}
body[data-screen-tool=bach-microscope] .app-container{height:100%;min-height:0;padding:6px 8px;gap:6px;display:flex;flex-direction:column;box-sizing:border-box}
body[data-screen-tool=bach-microscope] .app-header{padding:5px 8px;margin:0;flex:none;gap:8px;align-items:center}
body[data-screen-tool=bach-microscope] #root .app-header{display:flex;flex-direction:column;padding:5px 8px;gap:5px}
body[data-screen-tool=bach-microscope] #root .header-controls{display:grid;grid-template-columns:auto auto 1fr;gap:5px;width:100%;flex-direction:row}
body[data-screen-tool=bach-microscope] #root .playback-controls{grid-column:1/-1;justify-content:center}
body[data-screen-tool=bach-microscope] #root .mode-tabs{justify-self:end}
body[data-screen-tool=bach-microscope] #root .header-title h1{white-space:nowrap}
body[data-screen-tool=bach-microscope] .header-title h1{font-size:22px;line-height:1.2;margin:0}
body[data-screen-tool=bach-microscope] .header-title p{display:none}
body[data-screen-tool=bach-microscope] .header-controls{display:flex;flex-wrap:wrap;gap:5px;align-items:center}
body[data-screen-tool=bach-microscope] .piece-selector,body[data-screen-tool=bach-microscope] .midi-selector{margin:0;gap:5px;flex:none}
body[data-screen-tool=bach-microscope] .piece-dropdown{padding:5px;font-size:12px;max-width:260px;min-width:0;height:30px}
body[data-screen-tool=bach-microscope] .playback-controls{margin:0;gap:7px;flex-wrap:wrap;align-items:center;font-size:12px}
body[data-screen-tool=bach-microscope] .playback-controls>div{gap:4px!important}
body[data-screen-tool=bach-microscope] .playback-controls label{font-size:11px}
body[data-screen-tool=bach-microscope] .control-btn{padding:5px 9px;font-size:12px;height:30px;min-height:0}
body[data-screen-tool=bach-microscope] .mode-tabs{padding:2px;margin:0;gap:4px}
body[data-screen-tool=bach-microscope] .tab-btn{padding:4px 10px;font-size:12px}
body[data-screen-tool=bach-microscope] .main-content{flex:1;min-height:0;display:grid;grid-template-columns:230px minmax(0,1fr);gap:8px;margin:0;align-items:stretch}
body[data-screen-tool=bach-microscope] .sidebar{min-height:0;min-width:0;width:auto;padding:8px;overflow:visible;box-sizing:border-box}
body[data-screen-tool=bach-microscope] .sidebar [hidden]{display:none!important}
.bach-topic-choice{width:100%;padding:6px;border:1px solid var(--border,#637b99);border-radius:8px;background:var(--panel,#202b3b);color:var(--text,#eef4fc);font:14px 'Segoe UI';margin-bottom:7px}
body[data-screen-tool=bach-microscope] .sidebar-desc{margin:4px 0 8px;font-size:12px}
body[data-screen-tool=bach-microscope] .button-group{gap:5px;margin:0}
body[data-screen-tool=bach-microscope] .struct-button{padding:6px 8px;min-height:30px;font-size:12px;margin:0}
body[data-screen-tool=bach-microscope] .viewer-container{min-height:0;min-width:0;margin:0;padding:0!important;display:flex;flex-direction:column;overflow:hidden;box-sizing:border-box}
body[data-screen-tool=bach-microscope] .viewer-container>div{position:relative;flex:1;min-height:0;min-width:0;padding:0!important;margin:0!important;overflow:hidden!important}
body[data-screen-tool=bach-microscope] .bach-score-source{position:absolute!important;transform-origin:top left;margin:0!important;padding:0!important;max-width:none!important;overflow:visible!important}
body[data-screen-tool=bach-microscope] .bach-score-source>[id^=osmdCanvasPage]{max-width:none!important}
body[data-screen-tool=bach-microscope] .bach-score-source svg{max-width:none!important;flex:none}
.bach-measure-navigation{display:flex;align-items:center;justify-content:center;gap:7px;padding:5px;flex:none;background:var(--panel,#202b3b)}
.bach-measure-navigation button,.bach-measure-navigation select{padding:5px 8px;min-width:0;border:1px solid #637b99;border-radius:7px;background:var(--panel,#202b3b);color:var(--text,#eef4fc);font:12px 'Segoe UI';cursor:pointer}
body[data-screen-tool=bach-microscope]>footer{padding:2px!important;margin:0!important;font-size:10px!important;line-height:14px!important;flex:none}
@media(max-width:650px){
 body[data-screen-tool=bach-microscope] .app-header{display:flex;flex-direction:column;align-items:stretch;padding:5px;gap:4px}
 body[data-screen-tool=bach-microscope] .header-title h1{font-size:19px;text-align:center}
 body[data-screen-tool=bach-microscope] .header-controls{gap:4px;justify-content:center}
 body[data-screen-tool=bach-microscope] #root .header-controls{grid-template-columns:1fr 1fr}
 body[data-screen-tool=bach-microscope] #root .header-controls{grid-template-columns:minmax(0,1fr)}
 body[data-screen-tool=bach-microscope] .piece-selector,body[data-screen-tool=bach-microscope] .midi-selector{width:100%;min-width:0;display:flex;gap:4px}
 body[data-screen-tool=bach-microscope] .piece-selector select,body[data-screen-tool=bach-microscope] .midi-selector select{flex:1;min-width:0;width:0;max-width:none}
 body[data-screen-tool=bach-microscope] .bach-measure-navigation select{width:110px;max-width:35%;min-width:0}
 body[data-screen-tool=bach-microscope] .bach-measure-navigation button{white-space:nowrap;font-size:10px;padding:4px}
 body[data-screen-tool=bach-microscope] #root .mode-tabs{grid-column:1/-1;justify-self:center}
 body[data-screen-tool=bach-microscope] .piece-dropdown{max-width:190px;font-size:11px}
 body[data-screen-tool=bach-microscope] .midi-selector label{font-size:10px}
 body[data-screen-tool=bach-microscope] .playback-controls{justify-content:center;gap:5px}
 body[data-screen-tool=bach-microscope] .main-content{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr)}
 body[data-screen-tool=bach-microscope] .sidebar{padding:5px}
 body[data-screen-tool=bach-microscope] .sidebar .button-group{display:flex;flex-wrap:wrap;gap:4px}
 body[data-screen-tool=bach-microscope] .sidebar .struct-button{padding:4px 7px;font-size:11px;min-height:27px;flex:1}
 body[data-screen-tool=bach-microscope] .sidebar-desc{display:none}
 .bach-topic-choice{padding:4px;font-size:12px;margin-bottom:4px}
 .bach-measure-navigation{gap:4px}
 .bach-measure-navigation button,.bach-measure-navigation select{font-size:11px;padding:5px}
}
@media(max-height:450px){
 body[data-screen-tool=bach-microscope] .header-title{display:none}
 body[data-screen-tool=bach-microscope] .header-controls{gap:4px;flex-wrap:wrap}
 body[data-screen-tool=bach-microscope] .main-content{grid-template-columns:190px minmax(0,1fr)}
 body[data-screen-tool=bach-microscope] .playback-controls{gap:5px}
 body[data-screen-tool=bach-microscope] .sidebar .struct-button{padding:4px 6px;min-height:26px;font-size:11px}
 body[data-screen-tool=bach-microscope] .sidebar-desc{display:none}
}
/* Override the old mobile viewport minima, which reserve a second full screen. */
body[data-screen-tool=bach-microscope] #root .app-container{height:100%!important;min-height:0!important;padding:6px 8px!important}
body[data-screen-tool=bach-microscope] #root .viewer-container{height:auto!important;min-height:0!important}
@media(max-width:650px){body[data-screen-tool=bach-microscope] #root .app-header{padding:5px!important}body[data-screen-tool=bach-microscope] .sidebar .button-group{flex-direction:row!important}body[data-screen-tool=bach-microscope] .sidebar .struct-button{width:auto!important;flex:1 1 42%}}
