/* Global mobile app chrome + bottom navigation (site-wide) */
.tpp-app-nav,
.tpp-app-nav-backdrop,
.tpp-app-nav-sheet,
.tpp-app-chrome {
  display: none;
}

@media (max-width: 1024px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  /* Класичне верхнє меню на мобільному приховане — керування через app chrome + bottom nav */
  body .main-header,
  body header.main-header,
  body .site-header,
  body header.site-header {
    display: none !important;
  }

  body .main-footer {
    display: none !important;
  }

  body.tpp-leaderboard-page--mobile {
    padding-bottom: 0;
  }

  body.tpp-leaderboard-page--mobile .tpp-app-chrome {
    display: none !important;
  }

  .tpp-app-chrome {
    display: block;
    position: sticky;
    top: 0;
    z-index: 80;
    padding: max(14px, env(safe-area-inset-top, 0px)) 16px 12px;
    background:
      radial-gradient(120% 90% at 12% 0%, rgba(122, 47, 64, 0.28) 0%, transparent 52%),
      linear-gradient(180deg, rgba(9, 9, 11, 0.98) 0%, rgba(9, 9, 11, 0.92) 70%, rgba(9, 9, 11, 0.75) 100%);
    border-bottom: 1px solid rgba(122, 47, 64, 0.28);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f0deb3;
  }

  .tpp-app-chrome__inner {
    max-width: 720px;
    margin: 0 auto;
  }

  .tpp-app-chrome__brand {
    display: flex;
    gap: 14px;
    align-items: center;
  }

  .tpp-app-chrome__logo {
    flex-shrink: 0;
    width: 76px;
    height: 76px;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    overflow: hidden;
    border: 1px solid rgba(240, 215, 127, 0.38);
    background:
      radial-gradient(circle at 30% 25%, rgba(245, 227, 160, 0.22) 0%, transparent 55%),
      linear-gradient(160deg, rgba(90, 31, 43, 0.55), rgba(18, 16, 20, 0.95));
    box-shadow:
      0 10px 28px rgba(0, 0, 0, 0.35),
      0 0 0 1px rgba(212, 175, 55, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }

  .tpp-app-chrome__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 8px;
    box-sizing: border-box;
    filter: drop-shadow(0 2px 8px rgba(212, 175, 55, 0.18));
  }

  .tpp-app-chrome__mark {
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #f0d77f;
    text-shadow: 0 0 18px rgba(212, 175, 55, 0.35);
  }

  .tpp-app-chrome__titles {
    min-width: 0;
    flex: 1;
    padding-top: 2px;
  }

  .tpp-app-chrome__title {
    margin: 0;
    font-size: 1.32rem;
    font-weight: 900;
    line-height: 1.15;
    color: #fff;
    letter-spacing: -0.02em;
  }

  .tpp-app-chrome__desc {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: rgba(240, 222, 179, 0.7);
  }

  .tpp-app-chrome__tabs {
    margin: 14px -16px 0;
    padding: 0 16px;
    overflow: hidden;
  }

  .tpp-app-chrome__tabs-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .tpp-app-chrome__tabs-scroll::-webkit-scrollbar {
    display: none;
  }

  .tpp-app-chrome__tab {
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.8rem;
    color: rgba(240, 222, 179, 0.75);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .tpp-app-chrome__tab.is-active {
    color: #111318;
    background: linear-gradient(135deg, #f0d77f, #c9a227 55%, #7a2f40);
    border-color: rgba(240, 215, 127, 0.5);
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.25);
  }

  .tpp-app-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    align-items: flex-end;
    justify-content: space-around;
    gap: 2px;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom, 0px));
    background: rgba(12, 12, 14, 0.96);
    border-top: 1px solid rgba(122, 47, 64, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .tpp-app-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: rgba(240, 222, 179, 0.55);
    font-size: 0.62rem;
    font-weight: 700;
    min-height: 44px;
    justify-content: flex-end;
    padding-bottom: 2px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
  }

  .tpp-app-nav__item.is-active {
    color: #f0d77f;
  }

  .tpp-app-nav__item svg {
    opacity: 0.9;
  }

  .tpp-app-nav__item--center {
    margin-top: -14px;
    gap: 6px;
  }

  .tpp-app-nav__item--center > span:last-child {
    color: #f0d77f;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.01em;
  }

  .tpp-app-nav__fab {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111318;
    background: linear-gradient(180deg, #f5e3a0 0%, #d4af37 55%, #a8841f 100%);
    border: 1px solid rgba(255, 245, 210, 0.45);
    box-shadow: 0 8px 22px rgba(212, 175, 55, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  .tpp-app-nav__fab svg {
    opacity: 1;
  }

  .tpp-app-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 95;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .tpp-app-nav-backdrop[hidden] {
    display: none !important;
  }

  .tpp-app-nav-backdrop.is-open {
    display: block;
  }

  .tpp-app-nav-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 96;
    max-height: min(92vh, 720px);
    overflow: auto;
    border-radius: 24px 24px 0 0;
    padding: 12px 16px max(20px, env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, #1e1820, #111114);
    border-top: 1px solid rgba(212, 175, 55, 0.25);
    transform: translateY(110%);
    transition: transform 0.28s ease;
    color: rgba(240, 222, 179, 0.82);
  }

  .tpp-app-nav-sheet[hidden] {
    display: none !important;
  }

  .tpp-app-nav-sheet.is-open {
    display: block;
    transform: translateY(0);
  }

  .tpp-app-nav-sheet__handle {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 auto 14px;
  }

  .tpp-app-nav-sheet__title {
    margin: 0 0 12px;
    font-size: 1.1rem;
    font-weight: 900;
    color: #fff;
  }

  .tpp-app-nav-sheet__body {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .tpp-app-nav-sheet__close {
    width: 100%;
    margin-top: 14px;
    min-height: 48px;
    border-radius: 16px;
    border: 0;
    font-weight: 800;
    cursor: pointer;
    color: #111318;
    background: linear-gradient(180deg, #f0d77f, #d4af37);
  }

  .tpp-app-menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 4px;
  }

  .tpp-app-menu__group {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .tpp-app-menu__label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(240, 222, 179, 0.5);
    padding: 0 4px;
  }

  .tpp-app-menu__link {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 16px;
    text-decoration: none;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-weight: 700;
  }

  .tpp-app-menu__link.is-active {
    border-color: rgba(240, 215, 127, 0.45);
    background: rgba(122, 47, 64, 0.35);
    color: #f0d77f;
  }
}
