/* 30PICK'EM — iOS/PWA viewport anchor v2
   Loaded near the end of the shell and fetched network-first by the service
   worker. This layer owns mobile geometry that must survive iOS standalone /
   Safari visual-viewport drift after inputs, sheets, keyboard dismissal, app
   resume and long scrolling screens. */
@media(max-width:899px){
  body>.footer{
    position:fixed!important;
    inset:auto 0 0 0!important;
    inset-block-start:auto!important;
    inset-block-end:0!important;
    left:0!important;
    right:0!important;
    top:auto!important;
    bottom:0!important;
    box-sizing:border-box!important;
    width:100%!important;
    max-width:none!important;
    height:calc(78px + env(safe-area-inset-bottom,0px))!important;
    min-height:calc(78px + env(safe-area-inset-bottom,0px))!important;
    max-height:calc(78px + env(safe-area-inset-bottom,0px))!important;
    margin:0!important;
    padding:8px max(8px,env(safe-area-inset-right,0px)) calc(8px + env(safe-area-inset-bottom,0px)) max(8px,env(safe-area-inset-left,0px))!important;
    display:grid!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    grid-template-rows:minmax(0,1fr)!important;
    grid-auto-flow:row!important;
    grid-auto-rows:minmax(0,1fr)!important;
    gap:0!important;
    align-items:stretch!important;
    overflow:hidden!important;
    transform:translate3d(0,0,0)!important;
    -webkit-transform:translate3d(0,0,0)!important;
    -webkit-backface-visibility:hidden!important;
    backface-visibility:hidden!important;
    will-change:transform;
    z-index:1000!important;
  }
  body>.footer .desktopOnlyNav{display:none!important}
  body>.footer .mobileMoreNav{display:flex!important}
  body>.footer .nav{
    min-width:0!important;
    width:100%!important;
    min-height:0!important;
    height:100%!important;
    margin:0!important;
    padding:6px 1px!important;
    align-self:stretch!important;
    overflow:hidden!important;
  }
  #app#app{
    padding-bottom:calc(94px + env(safe-area-inset-bottom,0px))!important;
  }
}

/* v0.9.48 — keep all five mobile nav items on one visual baseline */
@media(max-width:899px){
  body>.footer .desktopOnlyNav{display:none!important}
  body>.footer .nav:not(.desktopOnlyNav){
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    text-align:center!important;
    line-height:1.05!important;
  }
  body>.footer .mobileMoreNav{display:flex!important}
  body>.footer .nav b{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:100%!important;
    height:24px!important;
    margin:0 0 5px!important;
    line-height:1!important;
  }
  body>.footer .nav b svg{width:24px!important;height:24px!important;display:block!important}
}

/* Standings nav regression fix — keep the toolbar bottom-anchored on long
   mobile screens. Do not derive a fixed element's top from 100dvh: on iOS
   standalone/Safari, viewport-unit recomputation can lag after visual-viewport
   transitions and strand the toolbar inside scroll content. The root-level
   fixed footer plus bottom:0 is the stable viewport anchor; nav-anchor-v2.js
   reapplies it after viewport, focus and resume events without reparenting an
   attached footer. */

/* v0.9.49 iPhone stability sweep — the same stale dynamic-viewport failure
   that stranded the bottom nav and clipped Week Recap can affect any mobile
   sheet because the legacy base layer still assigns 100dvh. #modal is already
   fixed with inset:0, so percentage height follows the stable fixed containing
   block without inheriting a keyboard-sized viewport value. Keep the two
   intentional compact sheets content-height. */
@media(max-width:600px){
  #modalSheet.sheet:not(:has(.prv3SignOut)):not(:has(.cc2)){
    height:100%!important;
    max-height:100%!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch;
  }

  /* Profile Log Out stays a compact bottom sheet, but its cap is tied to the
     fixed modal rather than 100dvh. */
  html body #modal #modalSheet.sheet:has(.prv3SignOut){
    max-height:100%!important;
  }

  /* Card Saved also stays compact. This specificity intentionally beats the
     later polish-v0949 min(92vh,92dvh) rule. */
  html body #modal:not(.hidden):has(.cc2)>#modalSheet.sheet{
    max-height:92%!important;
  }
}

/* Hub's sticky section rail used the retired 76px masthead offset. Follow the
   same shared masthead/safe-area token as Picks so it cannot slide under or
   float away from the header on current iPhones. */
@media(max-width:700px){
  #app#app #hub .hubPageTabs{
    top:calc(var(--app-mast-h) + var(--app-safe-top))!important;
  }
}
