/* Fixed phone shell: iOS can rubber-band the document even when body has
   overflow:hidden. Pin both root boxes so only the pane beneath the top bar
   can scroll. The keyboard's visual-viewport height and offset rules in
   keyboard-viewport.css still take precedence on body. */
@media (max-width: 820px) {
  html[data-fixed-shell-trial] {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--ui-bg);
  }

  html[data-fixed-shell-trial] body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
    background-color: var(--ui-bg);
  }

  /* This sheet loads after keyboard-viewport.css. The fixed-shell selector above
     has the same specificity as its keyboard rule, so repeat the measured
     height here with both state attributes rather than letting 100dvh win. */
  html[data-fixed-shell-trial][data-visual-keyboard-open] body {
    height: var(--cc-visual-viewport-height, 100dvh);
  }
}

/* These are the board's independently scrolling surfaces. Contain touch
   momentum at their edges so a sheet, list or transcript cannot hand a
   gesture to the document behind it. */
:is(.tab-panel, .fn-pane, .fn-preview-body, .pdf-pages,
    .agents-sheet-dialog, .agents-sheet-list, .agents-rail-list,
    .agents-rail-archive-list, .dock-transcript, #transcript,
    .settings-drawer, .settings-body, .settings-tabs,
    .detail-body, .mobile-navigation-drawer, .mobile-navigation-scroll,
    .overlay > [role="dialog"],
    .share-dialog-card) {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
