/* Stop page-edge bounce without trapping swipes on clipped covers or controls.
   Descendants keep their default chaining so a gesture reaches the page. */
html:root {
  overscroll-behavior-y:none;
}
html:root :is(dialog, [role="dialog"], [role="listbox"], [role="menu"]) {
  overscroll-behavior-y:none;
}

#bookslop-safari-top-edge { display:none; }

/* WebKit samples a real fixed element at the top center of the viewport.
   Its primary background-color check requires a border box taller than 10px;
   a body pseudo-element does not provide the sampled element's renderer.
   Keep this element outside the React root and let pointer events through. */
@supports (-webkit-touch-callout:none) {
  #bookslop-safari-top-edge {
    display:block;
    position:fixed;
    inset:0 0 auto;
    height:11px;
    z-index:2147483647;
    background-color:var(--color-paper,#0a0a0a);
    pointer-events:none;
  }
  @media (max-width:540px) {
    /* The Library's final mobile padding is 8px, under the 11px edge.
       Keep the whole Import button below it, including its top corners. */
    .library-view .main-content { padding-top:21px; }
  }
}

/* Let iOS own the document scroll layer while its browser chrome animates.
   Panel isolation and the desktop overlay remain independent. */
html:root[data-native-page-scroll] {
  overflow-x:clip;
  overflow-y:auto;
  overscroll-behavior-y:auto;
  scrollbar-gutter:auto;
  scrollbar-width:auto;
  scrollbar-color:auto;
}
html:root[data-native-page-scroll] body {
  overflow-x:clip;
  overflow-y:visible;
  scrollbar-width:auto;
  scrollbar-color:auto;
}
html:root[data-native-page-scroll]::-webkit-scrollbar,
html:root[data-native-page-scroll] body::-webkit-scrollbar {
  display:revert;width:revert;height:revert;
}
