/* twittsocial.com V4.10.78 — Messenger HD wallpaper + keyboard viewport fix */

@media(max-width:760px){
  /* The JS calculates the actual visible chat height from visualViewport,
     current shell top, and the bottom nav. Older layers subtracted those values
     twice, leaving the white gap shown above the Android keyboard. */
  body.sp-messages-route{
    overflow:hidden!important;
    overscroll-behavior:none!important;
    touch-action:manipulation!important;
  }
  body.sp-messages-route .sp-shell{
    width:100%!important;
    height:var(--sp-mobile-chat-height,calc(100dvh - 58px - 62px))!important;
    min-height:0!important;
    max-height:var(--sp-mobile-chat-height,calc(100dvh - 58px - 62px))!important;
    padding:0!important;
    margin:0!important;
    overflow:hidden!important;
  }
  body.sp-messages-route .sp-messages-page,
  body.sp-messages-route .sp-messenger-shell,
  body.sp-messages-route .sp-messenger-sidebar,
  body.sp-messages-route .sp-messenger-thread,
  body.sp-messages-route .sp-chat-active{
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    max-height:100%!important;
  }
  body.sp-messages-route .sp-messages-page,
  body.sp-messages-route .sp-messenger-shell{
    display:block!important;
    padding:0!important;
    margin:0!important;
    overflow:hidden!important;
  }
  body.sp-messages-route .sp-chat-active{
    display:grid!important;
    grid-template-rows:58px minmax(0,1fr) auto!important;
    overflow:hidden!important;
  }
  body.sp-messages-route .sp-chat-active[hidden]{display:none!important}
  body.sp-messages-route .sp-chat-scroll{
    min-height:0!important;
    height:auto!important;
    max-height:none!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    touch-action:pan-y!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch!important;
  }
  body.sp-messages-route .sp-chat-composer{
    position:relative!important;
    inset:auto!important;
    flex:0 0 auto!important;
    margin:0!important;
    z-index:8!important;
    transform:none!important;
  }

  /* Once the visual viewport has actually shrunk, the keyboard occupies the
     bottom edge. Hide the site bottom nav and let Messenger use every remaining
     visible pixel. */
  body.sp-messages-route.sp-chat-keyboard-open .sp-mobile-nav{
    display:none!important;
    visibility:hidden!important;
    pointer-events:none!important;
  }
  body.sp-messages-route.sp-chat-keyboard-open .sp-chat-composer{
    padding-bottom:max(7px,env(safe-area-inset-bottom))!important;
  }

  /* Prevent the browser from panning the outer document when the textarea gains
     focus. Only the internal message list is allowed to scroll. */
  body.sp-messages-route .sp-messages-page,
  body.sp-messages-route .sp-messenger-shell,
  body.sp-messages-route .sp-messenger-thread{
    overscroll-behavior:none!important;
  }
}

/* Crisp wallpaper paint on both full Messenger and quick chat. */
[data-chat-theme].has-chat-image-theme .sp-chat-scroll{
  background-size:cover!important;
  background-position:center center!important;
  background-repeat:no-repeat!important;
  image-rendering:auto!important;
}
