/* v1.0.4: Mobile Memory Table popouts only. Timeline/desktop remain unchanged. */
@media (max-width: 768px) {
  /* Use the same warm, rounded card treatment as the Media and Quick Guide.
     Higher specificity also overrides the legacy 220px right/bottom box rule. */
  body.jr-mt-fb-active.jr-mt-open-completion:not(.jr-mt-is-timeline) #bmca-floating-box {
    box-sizing: border-box !important;
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: min(67vw, 520px) !important;
    max-width: calc(100vw - 28px) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: min(84dvh, 650px) !important;
    overflow-y: auto !important;
    padding: 0 14px 17px !important;
    background: linear-gradient(180deg, #fffdfa 0%, #fbf7f0 100%) !important;
    border: 1px solid #e5d1b7 !important;
    border-radius: 22px !important;
    box-shadow: 0 22px 42px rgba(54, 38, 21, .17) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    z-index: 9999999 !important;
  }
  body.jr-mt-fb-active.jr-mt-open-completion:not(.jr-mt-is-timeline) #bmca-floating-box > .jr-mt-progress-head {
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    min-height: 65px !important;
    margin: 0 -14px 15px !important;
    padding: 11px 13px 10px 15px !important;
    background: linear-gradient(180deg, #fff 0%, #fbf6ef 100%) !important;
    border-bottom: 1px solid #e9d8c3 !important;
    text-align: left !important;
  }
  body.jr-mt-fb-active #bmca-floating-box .jr-mt-progress-labels {
    display: flex !important;
    min-width: 0 !important;
    flex-direction: column !important;
    gap: 4px !important;
  }
  body.jr-mt-fb-active #bmca-floating-box .jr-mt-progress-eyebrow {
    display: block !important;
    color: #b08043 !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    letter-spacing: .13em !important;
    line-height: 1.25 !important;
  }
  body.jr-mt-fb-active #bmca-floating-box .jr-mt-progress-title {
    display: block !important;
    color: #4a382b !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
  }
  body.jr-mt-fb-active #bmca-floating-box .jr-mt-progress-close {
    box-sizing: border-box !important;
    display: inline-flex !important;
    flex: 0 0 30px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 30px !important;
    padding: 0 !important;
    border: 1px solid #e5d1b7 !important;
    border-radius: 50% !important;
    background: #fbf6ee !important;
    color: #806043 !important;
    box-shadow: 0 4px 10px rgba(69,50,25,.06) !important;
    cursor: pointer !important;
    font-size: 21px !important;
    line-height: 1 !important;
    font-weight: 600 !important;
  }
  body.jr-mt-fb-active #bmca-floating-box .jr-mt-progress-close:focus-visible {
    outline: 2px solid #a87533 !important;
    outline-offset: 3px !important;
  }

  /* The legacy unified bundle contains several conflicting fixed heights for
     Quick Guide (335/370px). Its actual content should control the height.
     Scope strictly to the Memory Table panel, not Timeline's separate help. */
  body.jr-mt-fb-active.jr-mt-open-howto:not(.jr-mt-is-timeline) aside.jr-htu2-panel,
  body.jr-mt-fb-active.jr-mt-open-howto:not(.jr-mt-is-timeline) aside.jr-htu2-panel[style],
  body.jr-mt-fb-active.jr-mt-open-howto:not(.jr-mt-is-timeline) aside.jr-htu2-panel[aria-label="How to use"] {
    box-sizing: border-box !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: min(84dvh, 650px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    padding-bottom: 14px !important;
  }
}

/* v1.0.5 — On narrow phones the Quick Guide's final italic line was
   clipped against the rounded lower edge. Let its content set the height
   and reserve an extra ~24px of breathing room below the last line. */
@media (max-width: 768px) {
  body.jr-mt-fb-active.jr-mt-open-howto:not(.jr-mt-is-timeline) aside.jr-htu2-panel,
  body.jr-mt-fb-active.jr-mt-open-howto:not(.jr-mt-is-timeline) aside.jr-htu2-panel[style],
  body.jr-mt-fb-active.jr-mt-open-howto:not(.jr-mt-is-timeline) aside.jr-htu2-panel[aria-label="How to use"] {
    height: auto !important;
    min-height: 0 !important;
    max-height: min(90dvh, 720px) !important;
    padding-bottom: 38px !important;
    overflow-y: auto !important;
    scroll-padding-bottom: 28px !important;
  }
}

/* v1.0.6: the Guide gets enough *real height* to accommodate its last line.
   JS measures content; these rules override legacy fixed heights and allow
   vertical scrolling on unusually short viewports. */
@media (max-width:768px) {
 body.jr-mt-fb-active.jr-mt-open-howto:not(.jr-mt-is-timeline) aside.jr-htu2-panel {
    box-sizing:border-box !important;
    min-height:0 !important;
    height:auto !important;
    max-height:min(88dvh,760px) !important;
    overflow-y:auto !important;
    padding-bottom:30px !important;
    scroll-padding-bottom:24px !important;
 }
 body.jr-mt-fb-active.jr-mt-open-howto:not(.jr-mt-is-timeline) aside.jr-htu2-panel .jr-htu2-body,
 body.jr-mt-fb-active.jr-mt-open-howto:not(.jr-mt-is-timeline) aside.jr-htu2-panel .jr-htu2-content {
    height:auto !important;
    max-height:none !important;
    overflow:visible !important;
 }
}
