/* A stable work-page shell; only #dialog-scroll scrolls. Short scenes stay unchanged. */
@media screen and (max-width:760px), screen and (max-width:1100px) and (max-height:600px) {
  html.mobile-work-page { overflow:hidden; overscroll-behavior:none; }
  body.mobile-work-page { position:fixed; top:var(--panel-page-top,0px); left:0; right:0; width:100%; overflow:hidden; }
  #notebook-dialog[open]:not(.scene-dialog):not(.welcome) {
    display:grid;
    grid-template-rows:auto minmax(0,1fr);
    position:fixed;
    inset:0 0 auto;
    width:100%; max-width:100%; margin:0;
    height:100vh; max-height:100vh; min-height:0;
    height:100svh; max-height:100svh;
    overflow:hidden; touch-action:pan-y pinch-zoom;
    border:0; border-radius:0;
    transform:none; animation:none;
  }
  #notebook-dialog[open]:not(.scene-dialog):not(.welcome) > .dialog-top {
    position:relative; top:auto; min-height:52px; flex-shrink:0;
    background:var(--ui-paper,var(--paper));
    padding-top:max(8px,env(safe-area-inset-top));
  }
  #notebook-dialog[open]:not(.scene-dialog):not(.welcome) > #dialog-scroll {
    min-width:0; min-height:0;
    overflow-x:hidden; overflow-y:auto;
    overscroll-behavior-y:contain;
    touch-action:pan-y pinch-zoom;
    scroll-behavior:auto;
    scroll-padding-block:16px;
    -webkit-overflow-scrolling:touch;
  }
  #notebook-dialog[open]:not(.scene-dialog):not(.welcome).panel-keyboard {
    top:var(--panel-keyboard-top,0px);
    height:var(--panel-keyboard-height,100svh);
    max-height:var(--panel-keyboard-height,100svh);
  }
  #notebook-dialog[open]:not(.scene-dialog):not(.welcome) #dialog-save-warning { margin:12px 20px; }
  #notebook-dialog[open]:not(.scene-dialog):not(.welcome) .dialog-content {
    overflow:visible;
    padding-bottom:max(28px,calc(env(safe-area-inset-bottom) + 16px));
  }
  /* Keep the close action reachable and avoid zoom-on-focus in iOS. */
  #notebook-dialog .dialog-controls button { min-width:44px; min-height:44px; }
  #dialog-scroll input,#dialog-scroll textarea,#dialog-scroll select { font-size:16px; }
}
