/* E-205b — isolated Story moment editor scrolling.
   Keep the shared modal system untouched; only the live moment editor is affected. */
.moment-editor-overlay{
  align-items:center!important;
  justify-content:center!important;
  overflow:hidden!important;
  padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom))!important;
  touch-action:none!important;
}

.moment-editor-overlay .moment-editor-modal{
  width:min(100%,430px)!important;
  max-width:430px!important;
  height:auto!important;
  max-height:calc(100dvh - max(24px,env(safe-area-inset-top)) - max(24px,env(safe-area-inset-bottom)))!important;
  margin:0!important;
  padding:0!important;
  border-radius:32px!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain!important;
  -webkit-overflow-scrolling:touch!important;
  touch-action:pan-y!important;
  scroll-behavior:smooth;
}

/* Keep the close control visible while the form scrolls beneath it. */
.moment-editor-modal .moment-editor-head{
  position:sticky!important;
  top:0!important;
  z-index:4!important;
  margin:0!important;
  padding:24px 20px 14px!important;
  background:linear-gradient(180deg,#fff 0%,#fff 84%,rgba(255,255,255,.96) 100%)!important;
}

.moment-editor-modal .moment-form{
  padding:8px 20px calc(34px + env(safe-area-inset-bottom))!important;
}

/* Prevent the fixed app dock from swallowing the final form controls. */
.moment-editor-modal .moment-save-btn{
  margin-bottom:max(8px,env(safe-area-inset-bottom))!important;
}

@supports not (height:100dvh){
  .moment-editor-overlay .moment-editor-modal{
    max-height:calc(100vh - 32px)!important;
  }
}
