
@media (max-width: 900px) {
  /* Stop page-level horizontal drift */
  html, body { overflow-x: hidden !important; }

  /* Outer wrappers must not exceed viewport */
  body.jr-memory-page #bp-memory-form-wrapper,
  body.jr-memory-page #memory-forms-container,
  body.jr-memory-page .memory-entry{
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Keep container centered with equal gaps */
  body.jr-memory-page #memory-forms-container{
    width: calc(100vw - 24px) !important;     /* 12px + 12px */
    max-width: calc(100vw - 24px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow-x: hidden !important;            /* contain children */
  }

  body.jr-memory-page #bp-memory-form-wrapper{
    overflow-x: hidden !important;
  }

  /* Table container is the ONLY horizontal scroller */
  body.jr-memory-page .memory-entry .table-container{
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
  }

  /* Support any injected scroll wrapper */
  body.jr-memory-page .memory-entry .table-container .jr-table-scroll,
  body.jr-memory-page .memory-entry .table-container .jr-mt-scroll,
  body.jr-memory-page .memory-entry .table-container .jr-scroll-wrap,
  body.jr-memory-page .memory-entry .table-container [data-jr-scroll-wrap="1"]{
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
  }

  /* Table should be allowed to be wider than container so scroll works */
  body.jr-memory-page .memory-entry .table-container table,
  body.jr-memory-page .memory-entry .table-container table[data-jr-memory-table="1"]{
    width: max-content !important;
    max-width: none !important;
  }

  /* Prevent cells from forcing container wider */
  body.jr-memory-page .memory-entry .table-container th,
  body.jr-memory-page .memory-entry .table-container td{
    white-space: nowrap;
  }
}
