/**
 * Mobile UX + perf helpers (max-width: 768px).
 * Подключается через media — не влияет на desktop.
 */
@media (max-width: 768px) {
  :root {
    --mobile-touch-min: 44px;
    --mobile-dock-h: 4.25rem;
  }

  html.ec-mobile {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  html.ec-mobile body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  }

  html.ec-mobile .container {
    padding-left: max(0.85rem, env(safe-area-inset-left));
    padding-right: max(0.85rem, env(safe-area-inset-right));
  }

  html.ec-mobile .header {
    padding-top: env(safe-area-inset-top);
  }

  html.ec-mobile .header__inner {
    min-height: var(--mobile-touch-min);
    gap: 0.35rem;
  }

  html.ec-mobile .header .nav {
    display: none;
  }

  html.ec-mobile .header__social {
    display: none;
  }

  html.ec-mobile .main {
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }

  html.ec-mobile .btn,
  html.ec-mobile .nav__link,
  html.ec-mobile .mnav__btn,
  html.ec-mobile .mobile-burger {
    min-height: var(--mobile-touch-min);
  }

  html.ec-mobile .footer {
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  /* Каталог / карточки игр */
  html.ec-mobile .catalog-cheats-list,
  html.ec-mobile .catalog-games-list {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }

  html.ec-mobile .game-block,
  html.ec-mobile .cheat-card,
  html.ec-mobile .catalog-preview-card {
    min-height: 0;
  }

  html.ec-mobile .catalog-page__mosaic {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Главная */
  html.ec-mobile .hero__inner {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  html.ec-mobile .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }

  html.ec-mobile .hero__actions .btn {
    width: 100%;
    justify-content: center;
  }

  html.ec-mobile #main-games-grid {
    grid-template-columns: 1fr !important;
  }

  /* Product page v2 */
  html.ec-mobile.page-game .main,
  html.ec-mobile.page-game--rust .main {
    padding-bottom: calc(var(--mobile-dock-h) + 1.5rem + env(safe-area-inset-bottom));
  }

  html.ec-mobile .product-page--v2 .product-page__hero {
    min-height: 200px;
    border-radius: 14px;
  }

  html.ec-mobile .product-page--v2 .product-page__hero--has-video {
    aspect-ratio: 16 / 10;
    min-height: 0;
  }

  html.ec-mobile .product-page--v2 .product-page__hero-title {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
    line-height: 1.15;
  }

  html.ec-mobile .product-page--v2 .product-page__hero-overlay {
    padding: 0.85rem 1rem;
  }

  html.ec-mobile .product-page--v2 .product-page__hero-nav-btn {
    width: 2.75rem;
    height: 2.75rem;
  }

  html.ec-mobile .product-page--v2 .product-page__layout {
    gap: 1rem;
  }

  html.ec-mobile .product-page--v2 .product-page__card--purchase {
    border-radius: 14px;
  }

  html.ec-mobile .product-page--v2 .product-page__tariff {
    min-height: var(--mobile-touch-min);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  html.ec-mobile .product-page--v2 .product-page__buy-btn {
    min-height: 3rem;
    font-size: 1rem;
  }

  html.ec-mobile .product-page--v2 .product-page__tabs {
    position: sticky;
    top: calc(var(--header-inner-min-height, 56px) + env(safe-area-inset-top));
    z-index: 20;
    background: rgba(8, 12, 22, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.25rem;
  }

  html.ec-mobile .product-page--v2 .product-page__tab {
    min-height: var(--mobile-touch-min);
  }

  html.ec-mobile .product-page--v2 .product-page__thumbs {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.45rem;
  }

  html.ec-mobile .product-page--v2 .product-page__thumb {
    min-height: 3.5rem;
  }

  /* Sticky dock — цена + купить */
  html.ec-mobile .product-page__mobile-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem max(0.85rem, env(safe-area-inset-right)) calc(0.65rem + env(safe-area-inset-bottom))
      max(0.85rem, env(safe-area-inset-left));
    background: rgba(8, 12, 22, 0.94);
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  }

  html.ec-mobile .product-page__mobile-dock[hidden] {
    display: none !important;
  }

  html.ec-mobile .product-page__mobile-dock-price {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
  }

  html.ec-mobile .product-page__mobile-dock-label {
    font-size: 0.68rem;
    color: rgba(148, 163, 184, 0.95);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  html.ec-mobile .product-page__mobile-dock-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  html.ec-mobile .product-page__mobile-dock-buy {
    flex: 0 0 auto;
    min-width: 8.5rem;
    min-height: 3rem;
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  /* Legal / support */
  html.ec-mobile .legal-page__inner,
  html.ec-mobile .support-page__grid {
    grid-template-columns: 1fr !important;
  }

  html.ec-mobile .mnav-sheet__panel {
    padding-bottom: env(safe-area-inset-bottom);
  }

  html.ec-mobile .mnav-acc__content a {
    min-height: var(--mobile-touch-min);
    display: flex;
    align-items: center;
  }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  html.ec-mobile .product-page--v2 .product-page__tabs {
    position: static;
  }
}
