/* German Coach on phones: iPhone safe areas, bottom bar, More menu, no zoom on focus, sync badge. */

/* Fill the real visible height on phones (100vh is taller than the screen in mobile Safari). */
.app { height: 100vh; height: 100dvh; padding-top: env(safe-area-inset-top, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
html, body { overscroll-behavior: none; }
body { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }

.show-sm { display: none !important; }
button.rail-item { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 0; }

/* Sync status in the top bar */
.sync-badge { color: var(--md-on-surface-variant); flex: none; }
.sync-badge.idle { color: var(--md-success, #2e7d32); }
.sync-badge.error { color: var(--md-error, #b3261e); }
.sync-badge.syncing svg { animation: sync-pulse 1s ease-in-out infinite alternate; }
@keyframes sync-pulse { from { opacity: 1; } to { opacity: .35; } }
.sync-key-out { margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sync-key-out code { font: 500 14px/20px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--md-surface-container); padding: 6px 10px; border-radius: 8px; word-break: break-all; user-select: all; -webkit-user-select: all; }

/* More menu (phones) */
.more-menu { display: grid; gap: 4px; }
.more-item { display: flex; align-items: center; gap: 16px; padding: 14px 12px; border-radius: 16px; color: var(--md-on-surface); text-decoration: none; }
.more-item:active, .more-item:hover { background: var(--md-surface-container-high); }
.more-item > span:last-child { display: flex; flex-direction: column; }
.more-item .ind { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--md-secondary-container); color: var(--md-on-secondary-container); flex: none; }

@media (max-width: 840px) {
  .show-sm { display: flex !important; }
  .hide-sm { display: none !important; }
  /* Bottom bar clears the iPhone home indicator */
  .app { grid-template-rows: 1fr calc(80px + env(safe-area-inset-bottom, 0px)); }
  .rail { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .snackbar { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 24px); min-width: 0; }
  .main { -webkit-overflow-scrolling: touch; }

  /* Full-screen exercises and panels respect the notch and home indicator */
  .runner { padding-top: env(safe-area-inset-top, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .runner-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .runner-foot .inner { flex-wrap: wrap; }
  .dialog { max-height: calc(100dvh - 48px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }

  /* Side panels become bottom sheets on phones */
  .sheet { top: auto; left: 0; right: 0; width: 100%; max-height: 85dvh; border-radius: 28px 28px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); animation: sheet-up .28s var(--ease-emph, ease-out); }
  .more-sheet { padding-top: 8px; }

  /* Settings rows stack so controls get the full width */
  .setting { flex-wrap: wrap; }
  .setting > .body { min-width: 0; flex: 1 1 220px; }
  .setting .field { max-width: 100%; }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

/* iPhone zooms into any text field under 16px: keep typing fields at 16px on touch screens */
@media (pointer: coarse) {
  input[type="text"], input[type="search"], input[type="password"], input[type="url"], input:not([type]), textarea, select { font-size: 16px !important; }
}
