
@media (max-width: 768px) {
  body.balele-ui-v56 { padding-bottom: calc(var(--ba-tabbar-h-mobile) + env(safe-area-inset-bottom) + 14px); }
  .balele-site-header {
    min-height: var(--ba-header-h-mobile);
    padding: 0 16px; justify-content: center;
    background: rgba(255,255,255,0.94);
  }
  .balele-site-header > .balele-brand, .balele-desktop-nav { display: none !important; }
  .balele-mobile-header { display: grid; grid-template-columns: 48px 1fr 48px 48px; align-items: center; gap: 10px; width: 100%; }
  .balele-mobile-logo { display: grid; justify-items: center; line-height: 1; }
  .balele-mobile-logo strong { font-size: 22px; letter-spacing: .04em; }
  .balele-mobile-logo span { margin-top: 5px; font-size: 11px; color: #67707a; font-weight: 800; }
  .balele-mobile-icon-btn { width: 48px; height: 48px; border-radius: 18px; font-size: 28px; display: grid; place-items: center; color: #111; }
  .balele-mobile-header [data-balele-mobile-search] { background: rgba(35,20,15,.04); box-shadow: 0 10px 24px rgba(0,0,0,.06); }
  .balele-mobile-avatar { width: 48px; height: 48px; border-radius: 999px; overflow: hidden; display: grid; place-items: center; background: rgba(35,20,15,.05); font-size: 12px; font-weight: 900; }
  .balele-mobile-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .balele-mobile-tabbar {
    position: fixed; left: 16px; right: 16px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: var(--ba-z-tabbar);
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; min-height: var(--ba-tabbar-h-mobile);
    padding: 10px 8px; border-radius: 28px;
    background: rgba(255,255,255,.88); backdrop-filter: blur(20px); box-shadow: 0 18px 45px rgba(30,20,15,.16);
  }
  .balele-tabbar-item { display: grid; place-items: center; gap: 3px; color: #535b63; font-size: 12px; font-weight: 900; }
  .balele-tabbar-item span { font-size: 25px; line-height: 1; }
  .balele-tabbar-search { width: 62px; height: 62px; margin: -22px auto 0; border-radius: 999px; background: linear-gradient(135deg, var(--ba-color-primary), var(--ba-color-primary-2)); color: white; box-shadow: 0 14px 28px rgba(108,92,231,.35); }
  .balele-tabbar-search span { font-size: 30px; }
  .balele-tabbar-search strong { font-size: 10px; color: #4c3ccf; position: absolute; transform: translateY(36px); }
  .balele-mobile-menu-panel[hidden], .balele-mobile-search-sheet[hidden] { display: none !important; }
  .balele-mobile-menu-panel { position: fixed; top: var(--ba-header-h-mobile); left: 16px; right: 16px; z-index: calc(var(--ba-z-header) + 1); display: grid; gap: 10px; padding: 16px; border-radius: 22px; background: rgba(255,255,255,.96); box-shadow: var(--ba-shadow-card); }
  .balele-mobile-menu-panel a { padding: 14px 16px; border-radius: 14px; background: #f7f4ef; font-weight: 900; }
  .balele-mobile-search-sheet { position: fixed; inset: 0; z-index: var(--ba-z-modal); display: block; }
  .balele-mobile-search-backdrop { position: absolute; inset: 0; background: rgba(20,18,18,.35); }
  .balele-mobile-search-card { position: absolute; left: 14px; right: 14px; bottom: calc(16px + var(--ba-tabbar-h-mobile) + env(safe-area-inset-bottom)); padding: 18px; border-radius: 26px; background: rgba(255,255,255,.96); box-shadow: var(--ba-shadow-card); display: grid; gap: 12px; }
  .balele-mobile-search-card p { margin: 0; font-size: 18px; font-weight: 900; }
  .balele-mobile-search-card input { width: 100%; min-height: 52px; padding: 0 16px; border: 1px solid var(--ba-color-line); border-radius: 18px; }
  .balele-mobile-search-card button[data-balele-mobile-search-submit] { min-height: 50px; border-radius: 18px; background: var(--ba-color-primary); color: white; font-weight: 900; }
  .balele-mobile-sheet-close { position: absolute; top: 10px; right: 14px; font-size: 24px; }
}


/* Phase 5.6 Step 5: Mobile Navigation Polish
   Component-scope only: fixes readability and active state without touching Pin Wall logic. */
@media (max-width: 768px) {
  body.balele-ui-v56 .balele-mobile-tabbar {
    min-height: var(--ba-tabbar-h-mobile);
    padding: 9px 8px 10px;
    border: 1px solid var(--ba-mobile-nav-border);
    background: var(--ba-mobile-nav-bg) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    backdrop-filter: blur(18px) saturate(1.15);
    box-shadow: var(--ba-mobile-nav-shadow);
    color: var(--ba-mobile-nav-text);
  }

  body.balele-ui-v56 .balele-tabbar-item {
    position: relative;
    min-width: 0;
    min-height: 54px;
    padding: 5px 2px 4px;
    border-radius: 18px;
    color: var(--ba-mobile-nav-muted) !important;
    opacity: 1 !important;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    transition: color .18s ease, background-color .18s ease, transform .18s ease;
  }

  body.balele-ui-v56 .balele-tabbar-item span,
  body.balele-ui-v56 .balele-tabbar-item strong {
    display: block;
    color: inherit !important;
    opacity: 1 !important;
    text-shadow: none !important;
  }

  body.balele-ui-v56 .balele-tabbar-item span {
    font-size: 24px;
    line-height: 1;
    margin-bottom: 3px;
    font-weight: 500;
  }

  body.balele-ui-v56 .balele-tabbar-item strong {
    font-size: 11px;
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: .01em;
  }

  body.balele-ui-v56 .balele-tabbar-item.is-active,
  body.balele-ui-v56 .balele-tabbar-item[aria-current="page"] {
    color: var(--ba-mobile-nav-active) !important;
    background: var(--ba-mobile-nav-active-soft);
  }

  body.balele-ui-v56 .balele-tabbar-item:active {
    transform: scale(.96);
  }

  body.balele-ui-v56 .balele-tabbar-search {
    width: 66px;
    height: 66px;
    min-height: 66px;
    margin: -24px auto 0;
    padding: 0;
    display: grid;
    place-items: center;
    gap: 0;
    overflow: visible;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--ba-color-primary), var(--ba-color-primary-2)) !important;
    color: #fff !important;
    box-shadow: var(--ba-mobile-nav-search-shadow);
  }

  body.balele-ui-v56 .balele-tabbar-search span {
    margin: 0;
    font-size: 31px;
    line-height: 1;
    color: #fff !important;
  }

  body.balele-ui-v56 .balele-tabbar-search strong {
    position: absolute;
    left: 50%;
    top: calc(100% + 6px);
    transform: translateX(-50%);
    font-size: 12px;
    line-height: 1;
    font-weight: 900;
    color: var(--ba-mobile-nav-active) !important;
    white-space: nowrap;
  }

  body.balele-ui-v56 .balele-tabbar-search.is-open,
  body.balele-ui-v56 .balele-tabbar-search.is-active {
    background: linear-gradient(135deg, var(--ba-color-primary), var(--ba-color-primary-2)) !important;
    color: #fff !important;
  }

  body.balele-ui-v56.balele-mobile-search-open .balele-mobile-tabbar,
  body.balele-ui-v56.balele-modal-open .balele-mobile-tabbar {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity .18s ease, transform .18s ease;
  }

  body.balele-ui-v56 .balele-mobile-header {
    color: #111827;
  }

  body.balele-ui-v56 .balele-mobile-icon-btn {
    color: #111827 !important;
    opacity: 1 !important;
  }

  body.balele-ui-v56 .balele-mobile-logo strong {
    color: #111827 !important;
  }

  body.balele-ui-v56 .balele-mobile-logo span {
    color: #6b7280 !important;
  }

  body.balele-ui-v56 .balele-mobile-avatar {
    color: #111827 !important;
  }
}

/* =========================================================
   BALELE v3 Phase 5.6 Step 9B-2
   Mobile Bottom Navigation Refinement

   Scope: component visual density only. Makes the global mobile
   tabbar lighter and less dominant while preserving active states.
   ========================================================= */
@media (max-width: 768px) {
  body.balele-ui-v56 .balele-mobile-tabbar {
    left: 24px !important;
    right: 24px !important;
    bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    min-height: 62px !important;
    padding: 6px 8px 7px !important;
    border-radius: 24px !important;
    background: rgba(255,255,255,.94) !important;
    box-shadow: 0 14px 34px rgba(31,41,55,.14) !important;
  }

  body.balele-ui-v56 .balele-tabbar-item {
    min-height: 46px !important;
    padding: 3px 1px 2px !important;
    border-radius: 16px !important;
    font-size: 10px !important;
  }

  body.balele-ui-v56 .balele-tabbar-item span {
    font-size: 21px !important;
    margin-bottom: 2px !important;
  }

  body.balele-ui-v56 .balele-tabbar-item strong {
    font-size: 10px !important;
    letter-spacing: 0 !important;
  }

  body.balele-ui-v56 .balele-tabbar-search {
    width: 56px !important;
    height: 56px !important;
    min-height: 56px !important;
    margin: -16px auto 0 !important;
    box-shadow: 0 12px 24px rgba(108,92,231,.30) !important;
  }

  body.balele-ui-v56 .balele-tabbar-search span {
    font-size: 27px !important;
  }

  body.balele-ui-v56 .balele-tabbar-search strong {
    top: calc(100% + 3px) !important;
    font-size: 10px !important;
  }

  @media (max-width: 390px) {
    body.balele-ui-v56 .balele-mobile-tabbar {
      left: 18px !important;
      right: 18px !important;
      min-height: 60px !important;
    }

    body.balele-ui-v56 .balele-tabbar-search {
      width: 54px !important;
      height: 54px !important;
      min-height: 54px !important;
    }
  }
}


/* =========================================================
   BALELE v3 Phase 5.6 Step 9B-3
   Mobile Tabbar Search Label Removal

   Contract: the center action is identified by the magnifier icon; the
   text label is removed to keep the bottom navigation lighter.
   ========================================================= */
@media (max-width: 768px) {
  body.balele-ui-v56 .balele-tabbar-search strong {
    display: none !important;
  }

  body.balele-ui-v56 .balele-tabbar-search {
    margin-top: -14px !important;
  }
}


/* =========================================================
   BALELE v3 Phase 5.6 Step 9C-3
   Mobile Home Header + Menu Clarification

   Scope: mobile shell component only.
   - Restores the Home mobile header to the light UI token instead of the
     legacy dark Home Wall header.
   - Makes the left hamburger a clear quick menu drawer.
   ========================================================= */
@media (max-width: 768px) {
  body.balele-ui-v56.balele-page-home .balele-site-header {
    position: sticky !important;
    top: 0 !important;
    min-height: var(--ba-header-h-mobile) !important;
    padding: 0 16px !important;
    background: rgba(255,255,255,.96) !important;
    border-bottom: 1px solid rgba(31,41,55,.06) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.12) !important;
    backdrop-filter: blur(18px) saturate(1.12) !important;
    box-shadow: 0 8px 24px rgba(31,41,55,.045) !important;
  }

  body.balele-ui-v56.balele-page-home .balele-mobile-header {
    display: grid !important;
    grid-template-columns: 48px 1fr 48px 48px !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    color: #111827 !important;
  }

  body.balele-ui-v56.balele-page-home .balele-mobile-icon-btn,
  body.balele-ui-v56.balele-page-home .balele-mobile-logo strong,
  body.balele-ui-v56.balele-page-home .balele-mobile-avatar {
    color: #111827 !important;
    opacity: 1 !important;
  }

  body.balele-ui-v56.balele-page-home .balele-mobile-logo span {
    color: #6b7280 !important;
    opacity: 1 !important;
  }

  body.balele-ui-v56 .balele-mobile-menu-panel {
    top: calc(var(--ba-header-h-mobile) + 8px) !important;
    left: 18px !important;
    right: 18px !important;
    z-index: calc(var(--ba-z-modal) - 1) !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding: 14px !important;
    border-radius: 24px !important;
    background: rgba(255,255,255,.96) !important;
    border: 1px solid rgba(31,41,55,.08) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.12) !important;
    backdrop-filter: blur(18px) saturate(1.12) !important;
    box-shadow: 0 18px 46px rgba(31,41,55,.16) !important;
  }

  body.balele-ui-v56 .balele-mobile-menu-panel[hidden] {
    display: none !important;
  }

  body.balele-ui-v56 .balele-mobile-menu-title {
    padding: 4px 8px 8px !important;
    color: #9a6f3c !important;
    font-size: 11px !important;
    line-height: 1 !important;
    letter-spacing: .20em !important;
    text-transform: uppercase !important;
    font-weight: 950 !important;
  }

  body.balele-ui-v56 .balele-mobile-menu-panel a {
    min-height: 46px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 15px !important;
    border-radius: 16px !important;
    background: rgba(247,244,239,.88) !important;
    color: #241813 !important;
    text-decoration: none !important;
    font-size: 15px !important;
    font-weight: 900 !important;
  }

  body.balele-ui-v56 .balele-mobile-menu-panel a::after {
    content: '›';
    color: rgba(36,24,19,.38);
    font-size: 18px;
    font-weight: 900;
  }
}


/* BALELE v3 Phase 8 Step 10D3A: make the top search button the active mobile search entry. */
@media (max-width: 760px) {
  .balele-mobile-header [data-balele-mobile-search] {
    color: #1f2937;
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(31,41,55,.06);
  }
  .balele-mobile-header [data-balele-mobile-search].is-open {
    background: #fff7ed;
    color: #c2410c;
  }
  body.balele-page-market .balele-mobile-search-card p::after {
    content: ' in Market';
  }
}
