/* Client layout: touch controls, safe areas and small/landscape viewports. */
@media (max-width: 799px), (max-height: 500px) and (max-width: 1000px) {
  #athlete-view { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  #athlete-view *, #athlete-view *::before, #athlete-view *::after { box-sizing: border-box; }
  #athlete-view input, #athlete-view textarea, #athlete-view select { font-size: max(16px, 1rem); max-width: 100%; }
  #athlete-view button { touch-action: manipulation; }
  .athlete-ex-title-row, .athlete-ex-middle-left, .athlete-detail-item { min-width: 0; }
  .athlete-ex-name { overflow-wrap: anywhere; white-space: normal; }
  .athlete-ex-top { flex-wrap: wrap; }
  .athlete-ex-actions { flex-wrap: wrap; }
  .athlete-ex-actions button, .athlete-rest-pill, .athlete-day-btn { min-height: 44px; }
  .athlete-sets-grid, .athlete-completed-grid { flex-wrap: wrap; }
  #athlete-view .modal-overlay {
    top: var(--client-visual-top, 0px); bottom: auto;
    height: 100vh; height: var(--client-visual-height, 100dvh);
    overflow-y: auto; overscroll-behavior: contain;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  #athlete-view .modal-content {
    min-width: 0; max-width: 100%; max-height: calc(var(--client-visual-height, 100dvh) - 24px);
    overflow-y: auto; overscroll-behavior: contain; margin: auto;
    -webkit-overflow-scrolling: touch;
  }
  #athlete-view .athlete-weight-modal-card { width: 100%; padding: 16px; }
  .athlete-weight-inputs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .athlete-weight-col, .athlete-weight-input-row { min-width: 0; }
  #athlete-view .athlete-weight-input { min-width: 0; max-width: 100%; transform: none; }
  .athlete-weight-unit { flex-shrink: 0; }
  .athlete-weight-modal-title { overflow-wrap: anywhere; }
  #athlete-view .athlete-timer-hud {
    z-index: 1700;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    max-width: none; transition: none;
  }
  #athlete-view .athlete-timer-hud.timer-scrolled-down { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
  .athlete-timer-3d-trigger { min-height: 44px; }
  #athlete-view .athlete-timer-drawer {
    width: min(380px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    max-height: calc(100dvh - 180px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto; overscroll-behavior: contain;
  }
  .athlete-timer-actions > button, .atd-btn-collapse { min-height: 44px; }
  .athlete-timer-actions { gap: 8px; }
  #athlete-view.has-active-timer { padding-bottom: calc(170px + env(safe-area-inset-bottom)) !important; }
  .carousel-fullscreen .athlete-day-content { min-height: 0; }
  .carousel-fullscreen .athlete-exercise-list.is-carousel > .athlete-ex-card { min-height: 0; }
  #athlete-view.has-active-timer .carousel-fullscreen .athlete-exercise-list.is-carousel > .athlete-ex-card { padding-bottom: 80px; }
  .carousel-fullscreen .athlete-ex-thumb-wrap { min-height: 140px; height: clamp(140px, 30dvh, 300px); }
  #athlete-bottom-nav { touch-action: pan-y; }
}
@media (max-width: 360px) {
  .carousel-fullscreen .athlete-day-content { gap: 8px; padding-left: 8px; padding-right: 8px; }
  .carousel-fullscreen .athlete-exercise-list.is-carousel > .athlete-ex-card { padding: 12px; }
  .carousel-fullscreen .athlete-ex-details { gap: 6px; }
  .carousel-fullscreen .athlete-detail-item { padding: 8px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .carousel-fullscreen .athlete-ex-thumb-wrap { height: 140px; min-height: 140px; }
  #athlete-view .athlete-timer-drawer { max-height: calc(100dvh - 140px); }
}
@media (prefers-reduced-motion: reduce) {
  #athlete-view *, #athlete-view *::before, #athlete-view *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

#athlete-view .athlete-subpage { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
#athlete-view .athlete-subpage :is(img, video, canvas, iframe) { max-width: 100%; }
@media (max-width: 480px) {
  #athlete-bottom-nav .abn-item { min-width: 0; padding-inline: 2px; }
  #athlete-bottom-nav .abn-label { font-size: clamp(.56rem, 2.3vw, .7rem); }
}

.athlete-week-navigator {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  margin: 1rem auto .65rem; padding: .55rem; width: min(100%, 42rem);
  box-sizing: border-box; border: 1px solid var(--fz-orange, #ba1934); border-radius: 1rem;
  touch-action: pan-y;
}
.athlete-week-navigator > span { text-align: center; font-size: 1.05rem; font-weight: 750; }
.athlete-week-navigator small { font-weight: 400; }
.athlete-week-navigator button {
  width: 44px; min-width: 44px; min-height: 44px; border: 0; border-radius: .7rem;
  background: transparent; color: inherit; font-size: 1.5rem; cursor: pointer;
}
.athlete-week-navigator button:disabled { opacity: .3; cursor: default; }
.athlete-week-navigator button:focus-visible { outline: 2px solid var(--fz-orange, #ba1934); }
