/* MOB-01/02 phones (≤ 760 px): one column, parts stacked (no more squeezing side by side), and the GM's layout from
   Maker › UI theme › Mobile (body data-mlayout + CSS variables set by theme.js; only listed values reach the page).
   Layouts: stacked (one column, the page scrolls) · sheet (stage on top, chat + tabs in a sheet that slides up) ·
   full (the stage fills the screen; IC chat floats over it). */
@media (max-width: 760px) {
  :root { --m-stage: 46vh; --m-ic: 24vh; --m-tabs: 60vh; --m-text: 15px; --m-cards: 74px; }
  html, body { overflow-x: hidden; }
  #app { height: auto; min-height: 100vh; grid-template-rows: auto 1fr; }
  header { flex-wrap: wrap; gap: 6px 10px; padding: 4px 8px; min-height: 44px; }
  header #hd-users { display: none; }
  header button { padding: 4px 8px; }
  main, main.st-mini, main.st-open { display: flex !important; flex-direction: column; grid-template-columns: none !important; min-height: 0; }
  #center { display: contents; }
  #stage { order: var(--o-stage, 1); flex: 0 0 auto; height: var(--m-stage); min-height: 220px; }
  #ic { order: var(--o-ic, 2); flex: 0 0 auto; height: var(--m-ic); min-height: 120px; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
  #side { order: var(--o-tabs, 3); flex: 0 0 auto; height: var(--m-tabs); min-height: 260px; border-left: 0; border-top: 1px solid var(--line); }
  #status { order: var(--o-status, 4); width: auto; max-height: 40vh; overflow: auto; border-right: 0; border-top: 1px solid var(--line); }
  #status #st-body > * { display: revert !important; }
  #status .st-portrait { margin-top: 0 !important; }
  #st-toggle { display: none; }
  #ic .ic-input, #ic > div:last-child { flex-wrap: wrap; }
  #ic-text { min-width: 0; flex: 1 1 140px; }
  #tabs button { padding: 8px 0; font-size: 12px; }
  #dialogue, #dl-text { font-size: var(--m-text); }
  #dialogue { left: 6px !important; right: 6px !important; bottom: 6px !important; max-width: none !important; }
  .acard { width: var(--m-cards); height: calc(var(--m-cards) * .95); }
  .acard:has(.sub) { width: calc(var(--m-cards) + 14px); }
  #scene-tabs { flex-wrap: nowrap; overflow-x: auto; }
  #choice.centre .copt { padding: 11px 16px; font-size: 14px; }
  #now-playing { bottom: 8px; right: 8px; max-width: 70vw; }
  #yt-mini { right: 8px; }
  .emote-pop { width: min(290px, 94vw); }
  /* parts the GM collapsed: a thin bar that opens on tap */
  body.m-col-status #status:not(.m-open) { max-height: 34px; overflow: hidden; }
  body.m-col-tabs #side:not(.m-open) { height: 40px; min-height: 40px; overflow: hidden; }
  body.m-col-ic #ic:not(.m-open) { height: 40px; min-height: 40px; overflow: hidden; }
  body.m-hide-status #status, body.m-hide-tabs #side, body.m-hide-ic #ic { display: none !important; }
  body.m-hide-scenes #scene-tabs { display: none !important; }
  body.m-stick-stage-top #stage { position: sticky; top: 0; z-index: 30; }
  body.m-stick-ic-bottom #ic, body.m-stick-tabs-bottom #side { position: sticky; bottom: 0; z-index: 30; background: var(--panel); }

  /* sheet: chat + tabs slide up from the bottom */
  body[data-mlayout="sheet"] #app { height: 100vh; }
  body[data-mlayout="sheet"] main { height: calc(100vh - 44px); overflow: hidden; position: relative; }
  body[data-mlayout="sheet"] #stage { height: auto; flex: 1 1 auto; }
  body[data-mlayout="sheet"] #side { position: absolute; left: 0; right: 0; bottom: 0; height: 64vh; z-index: 40; transform: translateY(calc(100% - 40px));
    transition: transform .25s ease; border-radius: 12px 12px 0 0; box-shadow: 0 -6px 18px rgba(0,0,0,.5); }
  body[data-mlayout="sheet"] #side.m-open { transform: none; }
  body[data-mlayout="sheet"] #side::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: #456; margin: 6px auto 2px; }
  body[data-mlayout="sheet"] #ic { height: var(--m-ic); margin-bottom: 40px; }
  body[data-mlayout="sheet"] #status { display: none; }

  /* full: the stage fills the screen, IC chat floats over it */
  body[data-mlayout="full"] #app { height: 100vh; }
  body[data-mlayout="full"] main { height: calc(100vh - 44px); overflow: hidden; position: relative; }
  body[data-mlayout="full"] #stage { height: 100%; flex: 1 1 auto; }
  body[data-mlayout="full"] #ic { position: absolute; left: 0; right: 0; bottom: 40px; height: auto; min-height: 0; z-index: 41; background: transparent; border: 0; }
  body[data-mlayout="full"] #ic-list { display: none; }
  body[data-mlayout="full"] #side { position: absolute; left: 0; right: 0; bottom: 0; height: 64vh; z-index: 42; transform: translateY(calc(100% - 40px)); transition: transform .25s ease; }
  body[data-mlayout="full"] #side.m-open { transform: none; }
  body[data-mlayout="full"] #status { display: none; }
}
