/* Gate 40 mobile app invariants: phone operation is portrait-first and zoom-independent. */
html,
body[data-app-shell] {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body[data-app-shell] :is(button, a, input, select, textarea, summary, [role="button"]) {
  touch-action: manipulation;
}

/* iOS zooms focused form controls below 16px. Keep app controls focus-stable on phones. */
@media (max-width: 600px) and (pointer: coarse) {
  body[data-app-shell] :is(input, select, textarea) {
    font-size: 16px !important;
  }
}

.mobile-orientation-guard {
  display: none;
}

/* Phone landscape fallback. Tablets are intentionally excluded. */
@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  body[data-app-shell] {
    overflow: hidden !important;
  }
  body[data-app-shell] > :not(.mobile-orientation-guard) {
    visibility: hidden !important;
  }
  body[data-app-shell] .mobile-orientation-guard {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: grid;
    place-items: center;
    visibility: visible !important;
    padding: max(18px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
    background: #f7f9fc;
    color: #132238;
  }
  .mobile-orientation-guard__card {
    width: min(420px, 88vw);
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 18px 20px;
    border: 1px solid #dfe6ee;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 16px 50px rgba(15, 23, 42, .12);
    text-align: center;
  }
  .mobile-orientation-guard__icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #edf7f5;
    color: #0f766e;
    font-size: 23px;
    font-weight: 800;
    transform: rotate(-90deg);
  }
  .mobile-orientation-guard__card strong {
    font-size: 16px;
    letter-spacing: -.02em;
  }
  .mobile-orientation-guard__card span {
    max-width: 320px;
    color: #68778b;
    font-size: 11px;
    line-height: 1.45;
  }
}
