/**
 * Mobile UX V2 — shared components (≤900px only)
 * Desktop untouched — all rules scoped to body.mob-cat-v2-active
 */

@media (max-width: 900px) {
  #mobCatV2 {
    display: none;
  }

  body.mob-cat-v2-active {
    --mob-cat-gold: #e8c45a;
    --mob-cat-gold-soft: rgba(232, 196, 90, 0.22);
    --mob-cat-gold-border: rgba(232, 196, 90, 0.45);
    --mob-cat-bg: #070707;
    --mob-cat-surface: #111318;
    --mob-cat-card: #161a22;
    --mob-cat-card-border: rgba(255, 255, 255, 0.08);
    --mob-cat-text: #f5f5f5;
    --mob-cat-muted: rgba(255, 255, 255, 0.55);
    --mob-cat-radius: 18px;
    --mob-cat-radius-sm: 12px;
    --mob-cat-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
    --mob-cat-touch: 52px;
  }

  body.mob-cat-v2-active #mobCatV2 {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    inset: 0;
    z-index: 1400;
    min-height: 100dvh;
    background: var(--mob-cat-bg);
    color: var(--mob-cat-text);
    padding-bottom: calc(var(--mob-v2-tab-h, 64px) + env(safe-area-inset-bottom, 0px));
  }

  /* Legacy home catalog section — hidden only while the V2 screen is open.
     NOTE: never hide #catalogDrawer/#catalogOverlay here — the drawer sits
     above the V2 overlay (z-index 2100 > 1400) and must stay reachable from
     the bottom-bar Catalog button. */
  body.mob-cat-v2-active #mobV2CatalogSection {
    display: none !important;
  }

  body.mob-cat-v2-active .mob-cat-v2-view {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }

  body.mob-cat-v2-active .mob-cat-v2-view[hidden] {
    display: none !important;
  }

  /* ── Header ── */
  body.mob-cat-v2-active .mob-cat-v2-header {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 14px;
    background: linear-gradient(180deg, rgba(7, 7, 7, 0.98) 0%, rgba(7, 7, 7, 0.88) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 20;
  }

  body.mob-cat-v2-active .mob-cat-v2-back {
    flex-shrink: 0;
    width: var(--mob-cat-touch);
    height: var(--mob-cat-touch);
    min-width: var(--mob-cat-touch);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 1px solid var(--mob-cat-card-border);
    border-radius: var(--mob-cat-radius-sm);
    background: var(--mob-cat-surface);
    color: var(--mob-cat-gold);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: var(--mob-cat-shadow);
  }

  body.mob-cat-v2-active .mob-cat-v2-back:active {
    transform: scale(0.96);
    background: rgba(232, 196, 90, 0.08);
  }

  body.mob-cat-v2-active .mob-cat-v2-back svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
  }

  html[dir="rtl"] body.mob-cat-v2-active .mob-cat-v2-back svg {
    transform: scaleX(-1);
  }

  body.mob-cat-v2-active .mob-cat-v2-header-text {
    flex: 1;
    min-width: 0;
    padding-top: 4px;
  }

  body.mob-cat-v2-active .mob-cat-v2-title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--mob-cat-text);
    line-height: 1.2;
  }

  html[dir="ltr"] body.mob-cat-v2-active .mob-cat-v2-title {
    font-family: var(--font-en, system-ui, sans-serif);
  }

  body.mob-cat-v2-active .mob-cat-v2-sub {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--mob-cat-muted);
    font-weight: 500;
  }

  /* ── Right arrow (shared) ── */
  body.mob-cat-v2-active .mob-cat-v2-arrow {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin-inline-start: auto;
    border-inline-end: 2px solid var(--mob-cat-gold);
    border-block-end: 2px solid var(--mob-cat-gold);
    transform: rotate(-45deg);
    opacity: 0.85;
  }

  html[dir="rtl"] body.mob-cat-v2-active .mob-cat-v2-arrow {
    transform: rotate(135deg);
  }

  /* ── Stat pills ── */
  body.mob-cat-v2-active .mob-cat-v2-stat {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--mob-cat-gold-soft);
    color: var(--mob-cat-gold);
    border: 1px solid var(--mob-cat-gold-border);
  }

  body.mob-cat-v2-active .mob-cat-v2-stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
  }

  /* ── Scrollable body ── */
  body.mob-cat-v2-active .mob-cat-v2-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 88px);
  }

  body.mob-cat-v2-active .mob-cat-v2-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--mob-cat-muted);
    font-size: 15px;
    line-height: 1.5;
  }
}
