/* Every device: iPhone, iPad, Android, laptops (docs/devices.md). Loaded right after app.css on every page.
   Small, site-wide fixes only; a page's own CSS still wins where it sets something on purpose. */

/* iOS: don't enlarge text by itself when a phone turns sideways. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* No sideways wobble on phones when something is 1px too wide (position: sticky keeps working with clip). */
html { overflow-x: clip; }

/* Fast taps: no double-tap-to-zoom delay on buttons and links (pinch zoom still works everywhere). */
a, button, label, summary, select, input, [role="button"], [role="tab"], .btn, .chip { touch-action: manipulation; }

/* The real visible height on phones (the address bar comes and goes): 100dvh instead of 100vh. */
@supports (height: 100dvh) {
  .auth-wrap { min-height: calc(100dvh - 64px); }
  .page-back-row + .auth-wrap { min-height: calc(100dvh - 64px - 66px); }
  .ch-dialog { max-height: calc(100dvh - 40px); }
  dialog { max-height: calc(100dvh - 24px); }
}

/* Pop-ups and toasts stay clear of the iPhone home bar and the notch when SHID is on the home screen. */
.toast { bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px)); }
@media (display-mode: standalone) {
  .site-header { padding-top: env(safe-area-inset-top); }
  .site-footer { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
}

/* Fingers: small buttons are at least 44px tall on touch screens. */
@media (pointer: coarse) {
  .btn-sm, .nav-actions .btn, .lang-btn, .theme-btn { min-height: 44px; }
  .chip { min-height: 40px; }
}

/* Things that only showed on mouse hover also show on tap and keyboard focus. */
.an-col:focus-within .tip, .an-col:active .tip { display: block; }

/* Touch screens have no hover: a tapped card doesn't stay lifted. */
@media (hover: none) {
  .game-card:hover, .kg-tile:hover, .lesson-card:hover, .game-pick a:hover, .avatar-grid button:hover { transform: none; }
}

/* "You're offline" strip (device.js). */
.dev-offline { position: fixed; inset-inline: 0; top: 0; z-index: 9999; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; text-align: center; background: var(--ink, #0A1330); color: var(--bg, #fff); font-weight: 700; font-size: 15px; }
.dev-offline[hidden] { display: none; }

/* "Add SHID to your home screen" (profile → Appearance). */
.dev-install { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.dev-install h3 { margin: 0 0 6px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.dev-install p { margin: 0 0 10px; color: var(--muted); }
.dev-install ol { margin: 0 0 10px; padding-inline-start: 22px; line-height: 1.8; }
.dev-install .dev-share { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--primary-soft); color: var(--link); vertical-align: middle; }
.dev-install .dev-share svg { width: 16px; height: 16px; }
.dev-install .dev-done { color: var(--success, #137a3a); font-weight: 700; }

/* Phone held sideways (short screen): the header and the tabs scroll away instead of taking a third of the screen. */
@media (orientation: landscape) and (max-height: 500px) {
  .site-header, .app-nav { position: static; }
}
