/* My Reading Room v6.9.1 — Keeper/Netlify badge collision fix.
   The Netlify preview overlay is outside the application and can be stacked
   above our controls. Keep click targets OUTSIDE its reserved bottom area.
   This is intentionally not a z-index battle. */
:root { --m691-overlay-safe-bottom: 148px; }
/* Anchor the entire Keeper launcher higher than preview badges. */
html body #m50Dock.m50-dock {
  bottom: calc(var(--m691-overlay-safe-bottom) + env(safe-area-inset-bottom, 0px)) !important;
  right: calc(18px + env(safe-area-inset-right, 0px)) !important;
  left: auto !important;
  box-sizing: border-box !important;
  width: min(340px, calc(100vw - 28px)) !important;
  max-height: calc(100dvh - var(--m691-overlay-safe-bottom) - 20px) !important;
  pointer-events: none;
}
html body #m50Dock.m50-dock > * { pointer-events: auto; }
html body #m50Launcher.m50-launcher {
  position:relative; z-index:1;
  min-height:54px; min-width:148px;
  touch-action:manipulation;
  pointer-events:auto!important;
}
html body #m50Dock.m50-dock[data-m691-side="left"]{
  right:auto!important;
  left:calc(18px + env(safe-area-inset-left, 0px))!important;
}
html body #m50Dock.m50-dock[data-m691-side="left"] #m50Launcher{margin-left:0;margin-right:auto}
/* Popover is positioned independently; keep its actions in a scrollable viewport. */
html body #m50Popover.m50-popover:not([hidden]) {
  bottom: calc(var(--m691-overlay-safe-bottom) + 67px + env(safe-area-inset-bottom, 0px)) !important;
  max-height: min(64dvh, calc(100dvh - var(--m691-overlay-safe-bottom) - 92px))!important;
  overscroll-behavior:contain;
}
html body #m50Dock.m50-dock[data-m691-side="left"] #m50Popover.m50-popover:not([hidden]){
  right:auto!important;
  left:16px!important;
}
/* Give other floating Keeper messages their own safe location. */
html body #m50Toast.m50-toast, html body .m64-keeper-bubble {
  bottom: calc(var(--m691-overlay-safe-bottom) + 65px + env(safe-area-inset-bottom, 0px))!important;
}
/* Keep the legal footer links clear of the preview badge while scrolling. */
html body .footer{padding-bottom:calc(114px + env(safe-area-inset-bottom, 0px))!important}
@media (max-width:700px){
  :root { --m691-overlay-safe-bottom: 164px; }
  html body #m50Dock.m50-dock { width:min(330px,calc(100vw - 24px))!important;right:12px!important; }
  html body #m50Dock.m50-dock[data-m691-side="left"] {left:12px!important;right:auto!important;}
  html body #m50Popover.m50-popover:not([hidden]) {
    left:12px!important;right:12px!important;width:calc(100vw - 24px)!important;
    max-height:calc(100dvh - var(--m691-overlay-safe-bottom) - 88px)!important;
  }
}
@media(max-height:620px){
  /* Compact layout leaves space for a short viewport and the bottom toolbar. */
  :root { --m691-overlay-safe-bottom: 112px; }
  html body #m50Popover.m50-popover:not([hidden]) {
    max-height:calc(100dvh - var(--m691-overlay-safe-bottom) - 78px)!important;
  }
}
@media(max-height:420px){
  :root { --m691-overlay-safe-bottom: 88px; }
  html body #m50Launcher.m50-launcher{min-height:45px}
  html body #m50Popover.m50-popover:not([hidden]){
    bottom:calc(var(--m691-overlay-safe-bottom) + 55px)!important;
    max-height:calc(100dvh - var(--m691-overlay-safe-bottom) - 65px)!important;
  }
}
