/* =========================================================
   ATPROO NUTRIAI — MOBILE UX OVERRIDES
   Loaded last on purpose. Fixes nested scrolling, iOS safe
   areas, compact welcome layout and pull-to-refresh UI.
   ========================================================= */

.ws-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.ws-kicker-row .ws-badge { margin-bottom: 0 !important; }

.ws-enter-btn {
  min-height: 38px;
  padding: 8px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-shrink: 0;
  border: 1px solid rgba(113, 214, 255, .32);
  border-radius: 999px;
  background: rgba(13, 25, 58, .8);
  color: #eaf7ff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(39, 129, 255, .13);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.ws-enter-btn:active { transform: scale(.96); }

.pull-refresh {
  --ptr-y: -86px;
  position: fixed;
  top: max(8px, env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 12000;
  min-height: 42px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(100, 204, 255, .28);
  border-radius: 999px;
  background: rgba(8, 16, 39, .94);
  color: #dce9ff;
  box-shadow: 0 12px 38px rgba(0, 0, 0, .4), 0 0 24px rgba(80, 105, 255, .12);
  transform: translate3d(-50%, var(--ptr-y), 0);
  opacity: 0;
  pointer-events: none;
  transition: transform .18s ease, opacity .18s ease, border-color .18s ease;
  will-change: transform, opacity;
}

.pull-refresh.ptr-visible { opacity: 1; }
.pull-refresh.ptr-ready { border-color: rgba(72, 221, 255, .65); }
.pull-refresh.ptr-loading { --ptr-y: 0px; opacity: 1; }

.pull-refresh__icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #63dcff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  transition: transform .18s ease;
}

.pull-refresh.ptr-ready .pull-refresh__icon { transform: rotate(180deg); }
.pull-refresh.ptr-loading .pull-refresh__icon { animation: ptr-spin .72s linear infinite; }
.pull-refresh__text { white-space: nowrap; font-size: 12px; font-weight: 750; }

@keyframes ptr-spin { to { transform: rotate(360deg); } }

@media (max-width: 768px), (pointer: coarse) {
  html {
    width: 100%;
    height: 100%;
    overscroll-behavior-y: none;
  }

  body {
    width: 100% !important;
    height: 100dvh !important;
    min-height: 100svh;
  }

  #app {
    width: 100%;
    height: 100dvh;
    min-height: 0;
  }

  #main-wrap,
  .main-wrap {
    min-height: 0;
  }

  #content.content,
  #content {
    min-height: 0;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y pinch-zoom;
  }

  #auth-screen.auth-screen {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y pinch-zoom;
    align-items: flex-start !important;
    padding-top: max(16px, env(safe-area-inset-top, 0px)) !important;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #welcome-screen.ws-screen {
    width: 100%;
    height: 100dvh;
    min-height: 100svh;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y pinch-zoom;
    scroll-behavior: smooth;
  }

  #welcome-screen .ws-content {
    width: 100%;
    min-height: 100%;
    height: auto !important;
    gap: 14px !important;
    padding:
      max(16px, env(safe-area-inset-top, 0px))
      16px
      calc(30px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #welcome-screen .ws-main {
    width: 100%;
    flex: 0 0 auto;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 18px !important;
  }

  #welcome-screen .ws-left { width: 100%; }
  #welcome-screen .ws-kicker-row { margin-bottom: 12px; }
  #welcome-screen .ws-badge { padding: 6px 12px; font-size: 11.5px; }
  #welcome-screen .ws-heading {
    margin-bottom: 10px !important;
    font-size: clamp(29px, 8.3vw, 34px) !important;
    line-height: 1.12 !important;
  }
  #welcome-screen .ws-sub {
    margin-bottom: 18px !important;
    font-size: 13px !important;
    line-height: 1.55 !important;
  }

  #welcome-screen .ws-feat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 18px !important;
  }

  #welcome-screen .ws-feat {
    min-width: 0;
    min-height: 76px;
    gap: 8px !important;
    padding: 10px !important;
    align-items: center !important;
    border-radius: 13px !important;
  }

  #welcome-screen .ws-feat-ico {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }

  #welcome-screen .ws-feat-title {
    font-size: 11.5px;
    line-height: 1.25;
  }

  #welcome-screen .ws-feat-desc {
    display: -webkit-box;
    margin-top: 2px;
    overflow: hidden;
    font-size: 9.5px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  #welcome-screen .ws-buttons {
    gap: 9px !important;
    margin-bottom: 14px !important;
  }

  #welcome-screen .ws-btn-primary,
  #welcome-screen .ws-btn-secondary {
    min-height: 52px;
    padding: 13px 16px !important;
  }

  #welcome-screen .ws-trust { gap: 8px 12px; font-size: 10px; }
  #welcome-screen .ws-footer { padding: 4px 0 0; }
}

@media (max-width: 350px) {
  #welcome-screen .ws-feat-grid { grid-template-columns: 1fr !important; }
  #welcome-screen .ws-feat { min-height: 64px; }
  .ws-enter-btn { padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .pull-refresh,
  .pull-refresh__icon { transition: none; animation: none !important; }
}
