/* mobile-keyboard.css — the on-screen keyboard on phones and touch tablets.
   See the header in mobile-keyboard.js. html.mkb-on is set only on touch
   devices, while a field has focus and the keyboard covers more than 80 px;
   --kb-h is then the px it covers at the bottom of the layout viewport.
   html.mkb-foot: the focused field is in the setup footer (Region). */

/* ── Phone layout (same list as mobile-*.css) ────────────────────── */
@media (max-width: 640px), (pointer: coarse) and (orientation: portrait) and (max-width: 1100px), (pointer: coarse) and (orientation: landscape) and (max-height: 500px), (max-width: 950px) and (orientation: landscape) and (max-height: 500px) {
  /* dashboard, portrait: the sheet sits on the keyboard (mobile-sheet.js
     caps its height to the room above it); the tab bar stays under it */
  html.mkb-on:not(.mland-on) .msheet { bottom: var(--kb-h, 0px); transition: none; }
  html.mkb-on:not(.mland-on) .msheet-tabs { visibility: hidden; }
  /* dashboard, landscape: same side panel, with room to scroll the field
     up above the keyboard */
  html.mkb-on.mland-on .msheet-body { padding-bottom: calc(var(--kb-h, 0px) + 16px); }

  /* setup: the footer stays at the page bottom (under the keyboard), the
     tiles / editor get room to scroll above it ... */
  html.mkb-on #setup { scroll-padding-bottom: var(--kb-h, 0px); }
  html.mkb-on:not(.mkb-foot) .setup-card > .setup-pane:not([hidden]) { padding-bottom: var(--kb-h, 0px); }
  /* ... unless the field is in the footer: then the footer goes on top of
     the keyboard */
  html.mkb-on.mkb-foot .setup-card > .setup-foot { bottom: var(--kb-h, 0px); }
}

/* ── Sign-in / register (every touch screen) ─────────────────────── */
@media (max-width: 640px), (pointer: coarse) {
  /* the card can scroll its field and button above the keyboard; at least
     the fixed reserve of mobile-auth.css, so a short card hardly moves */
  html.mkb-on #auth-overlay {
    padding-bottom: max(calc(max(16px, env(safe-area-inset-bottom)) + 35dvh), calc(var(--kb-h, 0px) + 16px));
    scroll-padding-bottom: calc(var(--kb-h, 0px) + 16px);
  }
}
