/* Meloop mobile menu system — shared navigation language, never applied above 768px. */
@media (max-width: 768px) {
  body {
    --meloop-menu-radius: 16px;
    --meloop-menu-line: var(--studio-line, #e3e7e2);
    --meloop-menu-surface: var(--studio-card, #ffffff);
    --meloop-menu-ink: var(--studio-ink, #17221e);
    --meloop-menu-muted: var(--studio-muted, #66756d);
    --meloop-menu-accent: var(--studio-forest, #125b48);
  }

  /* Fixed dock: the only global mobile navigation, with the same spacing and states everywhere. */
  .mobile-bottom-nav {
    min-height: 68px !important;
    padding: 7px max(10px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important;
    gap: 2px !important;
    border-top: 1px solid var(--meloop-menu-line) !important;
    background: color-mix(in srgb, var(--meloop-menu-surface) 96%, transparent) !important;
    backdrop-filter: blur(14px);
  }

  .mob-tab-btn {
    min-width: 0 !important;
    min-height: 48px !important;
    border-radius: 12px !important;
    color: var(--meloop-menu-muted) !important;
    transition: transform 160ms ease, background-color 160ms ease, color 160ms ease !important;
  }

  .mob-tab-btn.active {
    background: color-mix(in srgb, var(--studio-mint, #b9e2cb) 56%, transparent) !important;
    color: var(--meloop-menu-accent) !important;
    box-shadow: none !important;
    transform: none !important;
    animation: none !important;
  }

  .mob-tab-btn:active { transform: scale(.96) !important; }
  .mob-tab-btn:focus-visible,
  .back-to-home-bar button:focus-visible,
  .mobile-game-shortcut:focus-visible,
  .mobile-games-catalog button:focus-visible {
    outline: 3px solid var(--meloop-menu-accent) !important;
    outline-offset: 3px !important;
  }

  .mob-tab-icon { margin-bottom: 3px !important; }
  .mob-tab-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Every secondary screen gets the same sleek, lightweight return bar on mobile. */
  .back-to-home-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    min-height: unset !important;
    margin: 18px 4px 14px !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    max-width: none !important;
  }

  .back-to-home-bar > div:first-child {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-width: 0;
    flex: 1 1 auto;
  }

  .back-to-home-bar .btn-secondary,
  .back-to-home-bar button {
    flex: 0 0 auto;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 14px !important;
    border: 1.5px solid var(--studio-line, #e3e7e2) !important;
    border-radius: 999px !important;
    background: var(--studio-card, #ffffff) !important;
    color: var(--studio-forest, #125b48) !important;
    font-size: 13px !important;
    font-weight: 750 !important;
    font-family: inherit !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
  }

  .back-to-home-bar .btn-secondary:active,
  .back-to-home-bar button:active {
    transform: scale(0.96) !important;
    background: var(--studio-mint, #e5f2e9) !important;
    border-color: var(--studio-forest, #125b48) !important;
  }

  .screen-breadcrumb {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--studio-muted, #66756d) !important;
    font-size: 12.5px !important;
    font-weight: 650 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    margin-left: 2px !important;
  }

  /* ⛔ BANNED: NO RIGHT-SIDE COLORED OVAL PILL BADGES ON RETURN BARS */
  .back-to-home-bar > span:last-child {
    display: none !important;
  }

  body.theme-dark .back-to-home-bar {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }
  body.theme-dark .back-to-home-bar .btn-secondary,
  body.theme-dark .back-to-home-bar button {
    background: #1e1e24 !important;
    border-color: #2e2e38 !important;
    color: #f4f4f5 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25) !important;
  }
  body.theme-dark .screen-breadcrumb {
    color: #a1a1aa !important;
  }
  body.theme-dark .back-to-home-bar > span:last-child {
    display: none !important;
  }

  @media (prefers-reduced-motion: reduce) {
    .mob-tab-btn,
    .back-to-home-bar button {
      transition: none !important;
      transform: none !important;
    }
  }
}
