/* Hide Telegram-only elements by default on standard web browsers */
#tg-safe-area-logo,
.cart-link.tg-floating-cart {
  display: none !important;
}

html.tg-webapp-mobile {
  height: 100%;
  overflow: hidden;
  --tg-shell-header-height: max(calc(env(safe-area-inset-top, 0px) + 44px), 92px);
}

html.tg-webapp-mobile body {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
  background: var(--tg-shell-color, #f6f6f8);
}


html.tg-webapp-mobile body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--tg-shell-header-height);
  background: var(--tg-shell-color, #f6f6f8);
  z-index: 1001;
  pointer-events: none;
}

html.tg-webapp-mobile body::after {
  display: none;
}

html.tg-webapp-mobile .page-header {
  display: none !important;
}


html.tg-webapp-mobile #tg-safe-area-logo {
  display: flex !important;
  position: fixed;
  top: calc(var(--tg-shell-header-height) - 48px) !important;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1003;
  pointer-events: auto;
}

html.tg-webapp-mobile #tg-safe-area-logo .logo-wrapper {
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html.tg-webapp-mobile #tg-safe-area-logo .logo-wrapper img {
  width: auto;
  height: 38px;
}


html.tg-webapp-mobile .cart-link.tg-floating-cart {
  display: flex !important;
  position: fixed;
  top: calc(var(--tg-shell-header-height) + 8px);
  right: max(14px, env(safe-area-inset-right, 0px));
  z-index: 1006;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 20px rgba(12, 15, 20, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity var(--motion-base, 220ms) var(--motion-ease, ease),
    visibility var(--motion-base, 220ms) var(--motion-ease, ease),
    transform var(--motion-base, 220ms) var(--motion-ease, ease);
}

html.tg-webapp-mobile .cart-link.tg-floating-cart .cart-link__img {
  width: 24px;
  height: 24px;
}

html.tg-webapp-mobile .cart-link.tg-floating-cart .cart-count {
  display: inline-flex !important;
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border: 2px solid #fff;
}


html.tg-webapp-mobile .page {
  height: 100%;
  height: 100dvh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding-top: var(--tg-shell-header-height);
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
  position: relative;
  z-index: 1002;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

html.tg-webapp-mobile .page-main {
  flex: 1;
  overflow: visible;
  padding-top: 0;
  background: #ffffff;
}

html.tg-webapp-mobile .page-main-inner {
  padding-top: 20px;
}


html.tg-webapp-mobile .mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1004;
  background: var(--glass-bg, rgba(255, 255, 255, 0.86));
  backdrop-filter: blur(var(--glass-blur, 14px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 14px));
  border-top: 1px solid var(--glass-border, rgba(12, 15, 20, 0.08));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}


html.tg-webapp-mobile .page-footer {
  position: static !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  margin-top: auto;
  padding-top: 20px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  
  padding-bottom: calc(var(--nav-height, 60px) + 24px + env(safe-area-inset-bottom, 0px));
}

html.tg-webapp-mobile .page-footer-inner {
  align-items: flex-start;
  gap: 10px 16px;
}

html.tg-webapp-mobile .page-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  line-height: 1.35;
}


html.tg-webapp-mobile .cart-modal-overlay {
  position: fixed;
  inset: 0;
  height: 100dvh;
  z-index: 2000; 
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

html.tg-webapp-mobile .cart-modal {
  width: 100%;
  max-width: 520px;
  max-height: 85dvh;
  margin-bottom: 0;
  padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
}


html.tg-webapp-mobile .cart-modal::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  margin: 8px auto 4px;
  flex-shrink: 0;
}

html.tg-webapp-mobile .order-modal-overlay {
  position: fixed;
  inset: 0;
  height: 100dvh;
  z-index: 3001;
}

html.tg-webapp-mobile .add-to-cart-popup-overlay {
  position: fixed;
  inset: 0;
  height: 100dvh;
  z-index: 3002;
}

html.tg-webapp-mobile .cart-toast-container {
  bottom: calc(var(--nav-height, 60px) + 18px + env(safe-area-inset-bottom, 0px));
  z-index: 9999;
}


