#mobile-menu,#mobile-backdrop{display:none}
@media(max-width:700px){
 body{width:100%;overflow:hidden}#editor-region,#document-pane{width:100%!important;min-width:0!important;margin:0!important}
 #sidebar,body.sidebar-collapsed #sidebar{position:fixed;inset:0 auto 0 0;width:min(300px,85vw)!important;height:100dvh;z-index:1002;transform:translateX(-100%);padding:20px 14px;visibility:hidden;transition:transform .2s ease,visibility .2s}
 body.mobile-ready:not(.sidebar-collapsed) #sidebar{transform:translateX(0);visibility:visible;box-shadow:8px 0 30px #17271c20}
 #mobile-menu{display:grid;place-items:center;position:fixed;top:10px;left:8px;width:44px;height:44px;padding:8px;z-index:220;font-size:24px;background:white}
 #mobile-backdrop{position:fixed;inset:0;background:#17271c66;border-radius:0;z-index:1001;width:100%;height:100%;padding:0}
 body.mobile-ready:not(.sidebar-collapsed) #mobile-backdrop{display:block}
 #controls{padding:8px 10px 8px 58px!important;min-height:64px!important;gap:8px!important;flex-wrap:nowrap!important}
 #controls button{min-height:44px;padding:8px 10px}#controls [data-save],#controls [data-entry-save]{display:none}
 #score-rail{position:static!important;margin:0!important;min-width:0!important}#score-rail .metric{padding:0!important}#score-rail strong{font-size:16px!important}
 #canvas{padding:16px!important;min-width:0!important}#document-edit{width:100%!important;min-width:0!important}#document-edit,#passage-highlights{font-size:16px!important;line-height:32px!important;letter-spacing:normal!important;word-spacing:normal!important}
 .entry-start{width:100%!important;max-width:100%!important;padding:24px 18px!important;margin:auto!important}.entry-start h1{font-size:38px!important;line-height:1.12!important}.entry-subtitle{font-size:16px!important}
 .entry-account-actions{width:100%;gap:8px}.entry-account-actions button{flex:1;min-height:44px;white-space:nowrap}#sidebar .context{font-size:14px!important}#sidebar .logo{font-size:30px!important}
 #sentence-panel{position:fixed!important;inset:64px 0 0!important;width:100%!important;max-width:none!important;height:auto!important;max-height:none!important;z-index:250;background:#f7f8f3;padding:0 20px 20px!important;overflow-y:auto!important;border-left:0!important;box-shadow:0 -4px 16px #22332215}
 #sentence-panel[hidden]{display:none!important}#sentence-panel .rhs-heading{position:sticky;top:0;background:#f7f8f3;z-index:2;padding:10px 0;margin:0;min-height:64px}#sentence-panel .rhs-heading button{min-height:44px;min-width:44px}
 #sentence-panel .rhs-original,#sentence-panel .rhs-current{max-height:none!important;overflow:visible!important}#sentence-panel textarea{min-height:110px!important;height:120px!important;font-size:16px}
 #sentence-panel .rhs-navigation button{min-width:44px;min-height:44px}#sentence-panel .rhs-apply{position:sticky;bottom:-20px;background:#f7f8f3;padding:12px 0 calc(12px + env(safe-area-inset-bottom));z-index:2}#sentence-panel .rhs-apply button{min-height:44px}
 body.tour-active #sentence-panel{bottom:230px!important}body.tour-active #canvas{padding-bottom:230px!important}
 dialog#dialog{max-height:calc(100dvh - 24px);overflow:auto}dialog#dialog:has(.normal-auth){padding:24px!important}
}
@media(prefers-reduced-motion:reduce){#sidebar{transition:none!important}}

@media(max-width:700px){
 #sentence-panel{top:calc(var(--mobile-visible-top,0px) + 64px)!important;bottom:auto!important;height:calc(var(--mobile-visible-height,100dvh) - 64px)!important;scroll-padding-top:68px;scroll-padding-bottom:80px;overscroll-behavior:contain}
 body.tour-active #sentence-panel{height:calc(var(--mobile-visible-height,100dvh) - 294px)!important;bottom:auto!important;min-height:100px}
 #sentence-edit{scroll-margin-block:70px;resize:none}
}

@media(max-width:700px){body.mobile-keyboard #editor-tour{visibility:hidden}body.mobile-keyboard #sentence-panel{height:calc(var(--mobile-visible-height,100dvh) - 64px)!important}}
body:not(.active-document) #controls #score-rail{display:none!important}
.entry-tour-link{display:block;margin:10px auto 0;text-decoration:underline;color:#53694c;font-size:13px;min-height:44px}
.sidebar-tour{display:block;text-align:left;margin:-12px 0 18px;width:100%;min-height:44px;color:#53694c;font-size:13px}
.sidebar-collapsed .sidebar-tour{display:none}
@media(max-width:700px){
 #context-popover{z-index:1010}#context-popover button{min-height:44px}
 [data-toolbar-detect]{min-height:44px;white-space:nowrap}
 body.active-document #controls{flex-wrap:wrap!important}
 body.active-document #score-rail{flex:1 1 100%;margin-left:0!important}
 body.active-document #controls [data-toolbar-detect],body.active-document #controls [data-rewrite]{flex:1}
 body:not(.active-document) #controls{justify-content:flex-end!important}
 body:not(.sidebar-collapsed) .sidebar-tour{display:block}
}

#controls .document-toolbar .actions{margin-left:auto!important;display:flex;justify-content:flex-end!important}
@media(max-width:700px){
 body:not(.active-document) #controls .document-toolbar{justify-content:flex-end!important;width:100%}
 #direct-sentence-hint{position:fixed!important;top:auto!important;bottom:calc(100% - var(--mobile-visible-top,0px) - var(--mobile-visible-height,100dvh) + 12px)!important;left:12px!important;right:12px!important;width:auto!important;max-width:none!important;z-index:260}
 body.mobile-keyboard #sentence-panel{padding:0 16px 12px!important;display:flex;flex-direction:column;gap:8px;overflow:auto!important}
 body.mobile-keyboard #sentence-panel .rhs-original,body.mobile-keyboard #sentence-panel .rhs-current,body.mobile-keyboard #sentence-panel .rhs-navigation,body.mobile-keyboard #sentence-panel>.muted{display:none!important}
 body.mobile-keyboard #sentence-panel .rhs-heading{flex-shrink:0;min-height:44px;padding:0}
 body.mobile-keyboard #sentence-edit{flex:1;min-height:72px!important;height:auto!important;margin:0}
 body.mobile-keyboard #sentence-panel .rhs-apply{flex-shrink:0;position:static;padding:6px 0;display:flex;justify-content:space-between}
}

@media(max-width:700px){
 body.mobile-sheet-open #canvas{overflow:hidden!important;pointer-events:none;overscroll-behavior:none}
 body.mobile-sheet-open{overflow:hidden!important}
 body #sentence-panel,body.tour-active #sentence-panel,body.mobile-keyboard #sentence-panel{box-sizing:border-box!important;display:grid!important;grid-template-rows:auto minmax(0,1fr) auto!important;gap:0!important;padding:0 16px!important;overflow:hidden!important;min-height:0!important;overscroll-behavior:none}
 body #sentence-panel[hidden]{display:none!important}
 #sentence-panel .rhs-heading{position:static!important;padding:6px 0!important;min-height:48px!important;margin:0!important}
 #sentence-panel .mobile-sentence-body{min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:8px 0}
 #sentence-panel .rhs-apply{position:static!important;bottom:auto!important;margin:0!important;padding:8px 0 calc(8px + env(safe-area-inset-bottom))!important;display:flex;justify-content:space-between;background:#f7f8f3}
 body.mobile-keyboard #sentence-panel{top:var(--mobile-visible-top,0px)!important;height:var(--mobile-visible-height,100dvh)!important;z-index:1050}
 body.mobile-keyboard #sentence-panel .mobile-sentence-body{display:flex;flex-direction:column;gap:6px;padding:4px 0;overflow:auto}
 body.mobile-keyboard #sentence-panel .mobile-sentence-body>.muted{display:none}
 body.mobile-keyboard #sentence-panel #sentence-edit{flex:1 1 auto!important;min-height:60px!important;height:0!important;margin:0!important;overflow:auto!important}
 body.mobile-keyboard #sentence-panel .rhs-apply{padding:8px 0!important}
}
body:not(.active-document) [data-entry-save],body:not(.active-document) [data-save]{display:none!important}

/* Keep Safari from zooming when focusing smaller form fields. Preserve pinch zoom. */
.mobile-brand{display:none}
@media(max-width:700px){
 body input,body textarea,body select,body #sentence-panel #sentence-edit{font-size:16px!important}
 html{-webkit-text-size-adjust:100%}
 #controls .document-toolbar{display:grid!important;grid-template-columns:minmax(0,1fr) auto;gap:4px 8px!important;width:100%;align-items:center}
 #controls .mobile-brand{display:block;grid-column:1;grid-row:1;font-size:24px;font-weight:750;letter-spacing:-1px;white-space:nowrap}
 .mobile-brand span{color:#8ca773}
 #controls .document-toolbar .actions{grid-column:2;grid-row:1;flex-wrap:nowrap!important;gap:6px}
 body.active-document #controls .mobile-brand{display:none}
 body.active-document #controls #score-rail{grid-column:1;grid-row:1;padding-top:0!important;min-width:0!important}
 body #sentence-panel{top:calc(var(--mobile-visible-top,0px) + var(--mobile-toolbar-height,64px))!important;height:calc(var(--mobile-visible-height,100dvh) - var(--mobile-toolbar-height,64px))!important}
 body.tour-active #sentence-panel{height:calc(var(--mobile-visible-height,100dvh) - var(--mobile-toolbar-height,64px) - 230px)!important}
 body.mobile-keyboard #sentence-panel{top:var(--mobile-visible-top,0px)!important;height:var(--mobile-visible-height,100dvh)!important}
}
