/* MOBILE (owner, November 16, 2026, on his phone: "mobile is almost unplayable"; "menus and overlays on mobile have to be good"):
   phone fixes for the overlays, loaded after phone-hud.css. One overlay at a time, close always reachable, scroll inside the
   sheet only, no page bounce or double-tap zoom. Measured with tools-local/mobile/overlay-audit.mjs. */
@media (max-width: 640px), (pointer: coarse) {
  /* One overlay at a time: Lil Printer's card (games/guide-npc.js, z-index 62) sat over the Menu and over every sheet the Menu
     opened (Shop, Settings, Inventory...), covering their buttons. It steps aside while anything else is open and comes back
     as it was when that closes. */
  body:is(.sp-menu-open, .chat-open, .sp-emotes-open) .gd-box,
  body:has(#sheet:not([hidden])) .gd-box,
  body:has(dialog[open]) .gd-box,
  body:has(.people.open) .gd-box,
  body:has(.lb-sheet[open]) .gd-box { visibility: hidden !important; pointer-events: none !important; }
}
/* The phone toolbar's Menu button while the Menu is open: its frame stays cream (pixel-skin.css) but the open state turned its icon
   and word cream-white, so it read as an empty square. Ink on cream, as when it is closed. */
html body.map-docked #app#app .mobile-toolbar #open-menu[aria-expanded="true"] { color: var(--ink) !important; }
/* Touch targets at least 44 px on any touch screen (the guide's close and back were 40 px held sideways). */
@media (pointer: coarse) {
  .gp-x { min-width: 44px; min-height: 44px; }
}
/* The stick catches a thumb that lands just outside its ring (a near miss used to turn the camera instead); it still reads the
   push from its own centre (ui.js bindJoystick). Jump the same. */
@media (pointer: coarse) {
  .touch .joy::before, .touch .jump::before { content: ''; position: absolute; inset: -18px; border-radius: 50%; }
}
/* The keyboard is up (src/mobile-guard.js): a sheet stays within the part of the screen the keyboard leaves, so the field you
   type in and the sheet's buttons are never under it. */
body.pw-kb #app #sheet:not([hidden]) { top: calc(var(--safe-t) + 6px) !important; bottom: auto !important; max-height: calc(var(--pw-vvh, 100dvh) - var(--safe-t) - 12px) !important; height: auto !important; }
/* No page scroll, bounce or pull-to-refresh behind the game on a phone; a double tap never zooms. Sheets keep their own
   scroll (overscroll-behavior: contain on their bodies). */
html, body { overscroll-behavior: none; }
@media (pointer: coarse) {
  html, body { touch-action: manipulation; }
  #app button, #app [role=button], #app a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
}
