
html, body {
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
}

body.is-telegram-webapp {
  min-height: 100dvh;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body.is-telegram-webapp .app-shell {
  min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

.mobile-gallery-grid.gallery-showcase.gallery-showcase--grid,
.gallery-grid.gallery-showcase.mobile-gallery-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
}

.mobile-gallery-grid.gallery-showcase .gallery-item,
.mobile-gallery-grid.gallery-showcase .gallery-item-card,
.mobile-gallery-grid.gallery-showcase > .gallery-photo-tile,
.mobile-gallery-grid.gallery-showcase > .gallery-item {
  min-width: 0 !important;
  max-width: none !important;
  width: 100% !important;
  padding: 10px !important;
}

.mobile-gallery-grid.gallery-showcase .gallery-item img,
.mobile-gallery-grid.gallery-showcase .gallery-item-card img,
.mobile-gallery-grid.gallery-showcase > .gallery-photo-tile img,
.mobile-gallery-grid.gallery-showcase > .gallery-item img {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: 4 / 5 !important;
  object-fit: cover !important;
  object-position: center center !important;
}

.profile-main-photo.gallery-hero {
  aspect-ratio: 4 / 5;
  height: auto !important;
}

@media (max-width: 900px) {
  .app-shell {
    padding: max(12px, env(safe-area-inset-top)) 12px calc(88px + env(safe-area-inset-bottom)) 12px !important;
  }

  .topbar,
  .topbar-main,
  .brand-stack {
    gap: 12px !important;
  }

  .grid-2.align-start,
  .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .card {
    border-radius: 22px;
  }

  .profile-hero {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 14px !important;
  }

  .avatar-hero.gallery-hero {
    width: min(100%, 200px) !important;
    height: min(52vw, 200px) !important;
    border-radius: 24px !important;
  }

  .helper-row.wrap {
    gap: 8px !important;
  }

  .reaction-actions {
    width: 100%;
  }

  .action-wide-form,
  .icon-action-form {
    flex: 1 1 calc(50% - 6px);
  }

  .action-wide-btn,
  .icon-action-btn {
    width: 100% !important;
  }

  .gallery-showcase,
  .horizontal-gallery.gallery-showcase,
  .mobile-gallery-grid.gallery-showcase.gallery-showcase--grid,
  .gallery-grid.gallery-showcase.mobile-gallery-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  .gallery-showcase .gallery-item,
  .gallery-showcase .gallery-item-card,
  .gallery-showcase > .gallery-photo-tile,
  .gallery-showcase > .gallery-item,
  .gallery-card {
    flex: none !important;
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
    border-radius: 22px !important;
    padding: 8px !important;
  }

  .gallery-showcase .gallery-item::before,
  .gallery-showcase .gallery-item-card::before,
  .gallery-showcase > .gallery-photo-tile::before,
  .gallery-showcase > .gallery-item::before,
  .gallery-card::before {
    inset: 8px !important;
    border-radius: 18px !important;
  }

  .gallery-showcase .gallery-item img,
  .gallery-showcase .gallery-item-card img,
  .gallery-showcase > img,
  .gallery-showcase > .gallery-photo-tile img,
  .gallery-showcase > .gallery-item img,
  .gallery-card img,
  .admin-media-preview {
    width: 100% !important;
    aspect-ratio: 4 / 5 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
    border-radius: 18px !important;
  }

  .profile-main-photo.gallery-hero {
    width: 100% !important;
    aspect-ratio: 4 / 5 !important;
    max-height: none !important;
    border-radius: 22px !important;
  }

  .two-col-form {
    grid-template-columns: 1fr !important;
  }

  .top-actions-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100%;
  }

  .top-actions-grid .nav-pill {
    min-height: 46px !important;
    font-size: .95rem;
    padding-inline: 10px !important;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding-inline: 10px !important;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
  }

  .brand-name {
    font-size: 1.14rem;
  }

  .lang-segment {
    min-width: 104px;
  }

  .gallery-showcase,
  .horizontal-gallery.gallery-showcase,
  .mobile-gallery-grid.gallery-showcase.gallery-showcase--grid,
  .gallery-grid.gallery-showcase.mobile-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .gallery-showcase .gallery-item,
  .gallery-showcase .gallery-item-card,
  .gallery-showcase > .gallery-photo-tile,
  .gallery-showcase > .gallery-item,
  .gallery-card {
    border-radius: 18px !important;
    padding: 7px !important;
  }

  .gallery-showcase .gallery-item img,
  .gallery-showcase .gallery-item-card img,
  .gallery-showcase > img,
  .gallery-showcase > .gallery-photo-tile img,
  .gallery-showcase > .gallery-item img,
  .gallery-card img,
  .admin-media-preview {
    aspect-ratio: 1 / 1.22 !important;
    border-radius: 14px !important;
  }

  .action-wide-form,
  .icon-action-form {
    flex: 1 1 100%;
  }
}


/* SWIPE_MOBILE_READY_MAR2026 */
body.is-telegram-webapp .swipe-stack {
  min-height: calc(100dvh - 320px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
body.is-telegram-webapp .swipe-card {
  border-radius: 24px;
}
body.is-telegram-webapp .swipe-card__actions {
  padding-bottom: max(2px, env(safe-area-inset-bottom));
}
@media (max-width: 768px) {
  body.is-telegram-webapp .swipe-stage {
    width: 100%;
  }
}


/* === MARCH 2026 SEARCH + NAV REFRESH === */
.mobile-bottom-nav {
  display: none;
}

.nav-item {
  position: relative;
  text-decoration: none;
}

.nav-item__icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-item__icon svg {
  width: 22px;
  height: 22px;
}

.nav-badge--mobile {
  position: absolute;
  top: 6px;
  right: 12px;
  min-width: 20px;
  min-height: 20px;
  padding-inline: 6px;
  font-size: .7rem;
  box-shadow: 0 8px 20px rgba(255,95,154,.28);
}

.results-view-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.results-view-switch__item {
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 22px;
  border: 1px solid rgba(244, 208, 224, .95);
  background: rgba(255,255,255,.88);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(60, 29, 45, .06);
}

.results-view-switch__item.is-active {
  background: linear-gradient(135deg, rgba(255,95,154,.18), rgba(142,156,255,.16));
  border-color: rgba(255,95,154,.32);
  color: var(--primary);
}

.results-view-switch__item.is-disabled {
  pointer-events: none;
}

.results-view-switch__icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  font-size: 1rem;
}

.profile-card-bio {
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  line-height: 1.45;
}

.profile-interest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-interest-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(243,216,231,.96);
  color: #6d5964;
  font-size: .84rem;
  line-height: 1;
}

@media (max-width: 900px) {
  .top-actions-grid {
    display: none !important;
  }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    bottom: calc(env(safe-area-inset-bottom) + 8px);
  }

  .mobile-bottom-nav .nav-item {
    min-height: 62px;
    gap: 5px;
    padding: 10px 6px 8px;
  }

  .mobile-bottom-nav .nav-item small {
    font-size: .62rem;
    line-height: 1.1;
    text-align: center;
  }

  .footer-note {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 760px) {
  .results-view-switch {
    position: sticky;
    top: 10px;
    z-index: 8;
  }

  .profile-card-head h3 {
    font-size: 1.08rem;
    line-height: 1.15;
  }

  .profile-card-meta {
    gap: 6px;
  }

  .profile-card-meta .pill,
  .profile-card-meta .status-pill {
    padding: 7px 9px;
    font-size: .74rem;
  }
}

@media (max-width: 480px) {
  .mobile-bottom-nav {
    width: calc(100vw - 12px);
    gap: 4px;
    padding: 8px 6px;
    border-radius: 24px;
  }

  .mobile-bottom-nav .nav-item__icon {
    width: 22px;
    height: 22px;
  }

  .nav-badge--mobile {
    right: 6px;
  }

  .results-view-switch__item {
    min-height: 52px;
    border-radius: 18px;
    padding-inline: 12px;
    font-size: .94rem;
  }

  .profile-interest-list {
    gap: 6px;
  }

  .profile-interest-chip {
    font-size: .78rem;
    padding: 6px 9px;
  }
}

/* === CHAT HUB MOBILE REFINEMENTS MAR 2026 === */
@media (max-width: 900px) {
  .chat-hub__header {
    border-radius: 24px !important;
  }

  .chat-filter-menu__sheet {
    right: 0;
    left: auto;
  }

  .chat-thread-list {
    gap: 10px;
  }
}

@media (max-width: 520px) {
  .chat-hub__top {
    gap: 12px;
  }

  .chat-filter-menu__trigger {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

  .chat-thread-card__avatar {
    width: 58px;
    height: 58px;
    border-radius: 18px;
  }

  .chat-room-form {
    grid-template-columns: auto minmax(0, 1fr) auto auto !important;
  }

  .chat-room-send-btn {
    width: 52px;
    min-width: 52px;
    height: 52px;
  }
}


@media (max-width: 760px) {
  .profile-showcase__status-row {
    gap: 8px;
  }

  .profile-showcase__pill,
  .profile-showcase__badge {
    padding: 7px 10px;
    font-size: .76rem;
  }
}
