/* Wondering Imp v0.8.18 — iOS form viewport guard + narrow-screen containment */

/* Keep the application inside the CSS viewport even after an iOS keyboard cycle. */
html,
body{
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}

.app-shell,
.main,
.page,
.topbar,
.top-actions,
.modal,
.modal-card,
.auth-pane,
.auth-pane form,
.form-grid,
.panel,
.match-card{
  min-width:0;
}

/* iOS Safari/PWA auto-zooms focused form controls when their rendered text is
   smaller than 16px. Keep editable controls at 16px+ while leaving checkboxes,
   radios and file inputs alone. */
@media (max-width:780px){
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea{
    font-size:16px!important;
  }

  .modal{
    width:100%;
    max-width:100%;
    padding-left:12px;
    padding-right:12px;
    overflow-x:hidden;
  }

  .modal-card,
  .modal-card.narrow,
  .modal-card.wide-modal,
  .modal-card.trade-modal{
    width:min(100%,720px);
    max-width:100%;
    min-width:0;
  }

  #authModal{
    align-items:flex-start;
    padding-top:max(18px,env(safe-area-inset-top));
    padding-bottom:max(18px,env(safe-area-inset-bottom));
  }

  #authModal .modal-card.narrow{
    width:min(100%,520px);
    max-width:100%;
    margin-left:auto;
    margin-right:auto;
    overflow-x:hidden;
  }

  #authModal .auth-tabs{
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    width:100%;
    max-width:100%;
    gap:8px;
  }

  #authModal .auth-tabs button{
    width:100%;
    min-width:0;
    max-width:100%;
    padding-left:8px;
    padding-right:8px;
    white-space:normal;
    overflow-wrap:anywhere;
  }

  #authModal .auth-pane,
  #authModal .auth-pane label,
  #authModal .auth-pane input{
    width:100%;
    max-width:100%;
    min-width:0;
  }

  .form-grid{
    width:100%;
    max-width:100%;
  }

  .form-grid>*{
    min-width:0;
  }
}

@media (max-width:390px){
  #authModal .modal-card.narrow{
    padding-left:18px;
    padding-right:18px;
  }

  #authModal .auth-tabs button{
    font-size:14px;
  }
}
