/* Shared phone/tablet safeguards. Preserve natural scrolling and browser zoom. */
@media (max-width: 760px) {
  body :is(.sx-shell,.em-shell,.gl-page,.auth-panel) { min-width: 0; }
  body :is(.sx-shell,.em-content,.gl-page,.auth-panel) :is(input,select,textarea) {
    font-size: 16px; /* Avoid focus zoom on iOS. */
    max-width: 100%;
  }
  body :is(.sx-shell,.em-content,.gl-page,.auth-panel) :is(fieldset,form,label) { min-width: 0; }
  body :is(.sx-shell,.em-content,.gl-page) :is(h1,h2,h3,p,a,legend,small) { overflow-wrap: anywhere; }
  body .sx-shell :is(.sx-button,.sx-tabs a,.sx-prompts button,.sx-peer-link,.sx-subtle) {
    min-height: 44px;
    max-width: 100%;
    white-space: normal;
    touch-action: manipulation;
  }
  body .sx-shell :is(.sx-peer-link,.sx-subtle) { display: inline-flex; align-items: center; padding: 10px 6px; }
  body .sx-shell .sx-peer-link { margin-right: 8px; }
  body .sx-shell .sx-choice { display: flex; align-items: center; gap: 8px; min-height: 44px; }
  body .sx-shell .sx-choice input { flex: 0 0 18px; margin: 0; }
  body .sx-shell fieldset { max-width: 100%; }
  body .sx-shell legend { max-width: 100%; white-space: normal; }
  body .sx-shell .sx-inline { width: 100%; align-items: stretch; }
  body .sx-shell .sx-inline > :is(label,fieldset) { flex: 1 1 100%; width: 100%; }
  body .sx-shell .sx-row { align-items: stretch; }
  body .sx-shell .sx-row .sx-inline { flex: 1 1 110px; width: auto; }
  body .sx-shell .sx-row .sx-button { width: 100%; }
  body .sx-shell .sx-person > .sx-row { flex-basis: 100%; }
  body .sx-shell .sx-grow { min-width: 0; }
  body .sx-shell .sx-report summary { min-height: 44px; padding: 12px 8px; }
  body .sx-shell .sx-post-footer { gap: 8px; }
  body .sx-shell .sx-post-footer > .sx-inline { width: auto; }
  body .sx-shell .sx-photo { width: auto; height: auto; max-width: 100%; }
  body .sx-shell table { display: block; max-width: 100%; overflow-x: auto; }
  body .sx-shell :is(th,td) { padding: 10px 8px; }
  body .sx-shell textarea { resize: vertical; min-height: 100px; }
  body .sx-shell input[type=file] { font-size: 14px; overflow: hidden; }
  body .sx-shell .sx-search { align-items: stretch; }
  body .sx-shell .sx-search label { flex-basis: 100%; }
  body .sx-shell .sx-search > button { width: 100%; }
  body .sx-shell { padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
  body .sx-shell .sx-welcome > div { min-width: 0; }
  body .em-content :is(.em-option,.em-review summary) { overflow-wrap: anywhere; }
  body .em-content .em-option input { flex-shrink: 0; }
  body .em-content :is(img,video),body .gl-page img { max-width: 100%; height: auto; }
  body .em-content .em-question-nav a { min-width: 44px; }
  body .student-navigation { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  body .student-navigation :is(a,summary,button) { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 380px) {
  body .sx-shell { padding-inline: 12px; }
  body .sx-shell .sx-card { padding: 16px; }
  body .sx-shell .sx-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  body .sx-shell .sx-tabs a { display: flex; align-items: center; justify-content: center; text-align: center; }
  body .sx-shell .sx-prompts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  body .sx-shell .sx-prompts button { padding-inline: 10px; }
  body .em-content .em-stat-grid { grid-template-columns: 1fr; }
  body .em-sidebar nav { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body.signed-in .nav-shell { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .sx-shell *, .student-navigation * { scroll-behavior: auto; animation: none; transition: none; }
}
