/* Mobile navigation only: loaded for the explicit eligible storefront routes. */
.mobile-bottom-nav,
body .site-header .mobile-bottom-search { display: none; }

@media (max-width: 860px) {
  body.has-mobile-bottom-nav {
    --m2-bottom-nav-height: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  body.has-mobile-bottom-nav .site-shell { padding-bottom: var(--m2-bottom-nav-height); }
  body.has-mobile-bottom-nav .site-header .header-row { flex-wrap: nowrap; }
  body.has-mobile-bottom-nav .site-header .header-quick-actions {
    flex: 0 0 auto; width: auto; margin-left: 0;
  }
  body.has-mobile-bottom-nav .site-header .header-quick-actions > :is(.header-cart-link, .account-link) { display: none; }
  body.has-mobile-bottom-nav .site-header .mobile-bottom-search {
    box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 44px; width: 44px; height: 44px; border: 1px solid #3b506d;
    border-radius: 10px; background: #121e30; color: #d9e6f7;
  }
  body.has-mobile-bottom-nav .site-header .mobile-bottom-search svg { width: 20px; height: 20px; stroke-width: 1.85; }
  body.has-mobile-bottom-nav .site-header .mobile-bottom-search:is(:hover, :focus-visible) {
    background: #1d314b; border-color: #80addf; color: #fff;
  }
  .mobile-bottom-nav {
    box-sizing: border-box; position: fixed; z-index: 75; inset: auto 0 0;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    height: var(--m2-bottom-nav-height);
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    border-top: 1px solid #31445c; background: #101b2a; color: #a7bad1;
  }
  .mobile-bottom-nav-item {
    box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; align-items: center;
    min-width: 0; min-height: 44px; gap: 3px; padding: 3px 1px;
    color: #a7bad1; text-decoration: none; border: 1px solid transparent; border-radius: 8px;
  }
  .mobile-bottom-nav-icon {
    position: relative; display: grid; place-items: center; width: 44px; height: 32px; border-radius: 8px;
  }
  .mobile-bottom-nav-icon svg { width: 24px; height: 24px; stroke-width: 1.85; }
  .mobile-bottom-nav-label { font-size: 11px; font-weight: 500; line-height: 1.2; white-space: nowrap; }
  .mobile-bottom-nav-item[aria-current] { color: #a6d1ff; }
  .mobile-bottom-nav-item[aria-current] .mobile-bottom-nav-icon { background: #223a56; }
  .mobile-bottom-nav-item:focus-visible { border-color: #a6d1ff; color: #fff; }
  .mobile-bottom-nav-count {
    box-sizing: border-box; position: absolute; top: 0; right: 0; min-width: 16px; height: 16px;
    padding: 0 3px; display: grid; place-items: center; border-radius: 8px;
    background: #a83246; color: #fff; font-size: 10px; line-height: 1; font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .mobile-bottom-nav-count[hidden] { display: none; }

  /* Existing purchase/cart actions retain their form and semantics; only their
     positioning changes on eligible screens. The bottom nav owns the safe area. */
  body.has-mobile-bottom-nav .game-sticky-purchase:not([hidden]) {
    bottom: var(--m2-bottom-nav-height); padding-bottom: 8px;
  }
  body.has-mobile-bottom-nav .storefront-cart-sticky-checkout[data-cart-sticky-checkout] {
    bottom: var(--m2-bottom-nav-height); padding-bottom: 12px;
    max-height: calc(100vh - var(--m2-bottom-nav-height) - 96px);
    max-height: calc(100dvh - var(--m2-bottom-nav-height) - 96px);
    overflow-y: auto; overscroll-behavior: contain;
  }
  body.has-mobile-bottom-nav.has-game-sticky-purchase .site-main { padding-bottom: 74px; }
  body.has-mobile-bottom-nav .premium-floating-to-top { bottom: max(var(--m2-bottom-nav-height), var(--to-top-purchase-offset, 0px)); }
  body.has-mobile-bottom-nav:has(.storefront-cart-sticky-checkout.is-visible) .premium-floating-to-top {
    bottom: calc(var(--cart-sticky-cta-height, 116px) + var(--m2-bottom-nav-height));
  }

  /* Keep all background docks out of the modal/drawer and typing surface. */
  body.has-mobile-bottom-nav:is(.mobile-menu-open, .account-drawer-open, .m2-bottom-keyboard-open, :has(dialog[open]))
    :is(.mobile-bottom-nav, .game-sticky-purchase, .storefront-cart-sticky-checkout, .premium-floating-to-top) {
    visibility: hidden; pointer-events: none;
  }
}
@media (max-width: 860px) and (max-height: 420px) {
  body.has-mobile-bottom-nav .game-sticky-purchase:not([hidden]),
  body.has-mobile-bottom-nav .storefront-cart-sticky-checkout[data-cart-sticky-checkout] { display: none; }
  body.has-mobile-bottom-nav.has-game-sticky-purchase .site-main { padding-bottom: 0; }
}
@media (max-width: 860px) and (hover: hover) and (pointer: fine) {
  .mobile-bottom-nav-item:hover { color: #fff; background: #172b42; }
}
