/* ═════════════════════════════════════════════════════════════════════════
   Phones (< 768px): Polymarket's mobile layout. Loaded after poly.css.
   - top bar: logo + Sign up (or Deposit + avatar); search moves to the bottom tab bar
   - compact swipe hero instead of the chart hero, no side lists
   - fixed bottom tab bar + "More" sheet
   ═════════════════════════════════════════════════════════════════════════ */
.pm-mhero, .pm-tabbar, .pm-msearch { display: none; }
.pm-grid-tools { display: flex; gap: 4px; }
.pm-tool-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--px-text); font-size: 17px; }
.pm-tool-btn:hover { background: var(--px-surface); color: var(--px-text); }

@media (max-width: 767.98px) {
    body { font-size: 14px; }
    .px-container { padding-left: 16px; padding-right: 16px; }
    main.px-container { padding-top: 16px !important; padding-bottom: 8px !important; }

    /* Top bar */
    .pm-topbar { flex-wrap: nowrap; height: 56px; padding-top: 0; padding-bottom: 0; gap: 8px; }
    .pm-header .pm-search { display: none; }
    .pm-logo { font-size: 19px; gap: 8px; }
    .pm-logo-mark { width: 28px; height: 28px; border-radius: 7px; }
    .pm-actions .px-btn-outline, .pm-how, .pm-stat { display: none !important; }
    .pm-actions .px-btn-brand { height: 34px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 10px; font-size: 14px; }
    .px-avatar { width: 32px; height: 32px; }

    /* Category tabs, scrolling */
    .pm-catnav { height: 44px; gap: 2px; }
    .pm-catnav a { font-size: 14px; font-weight: 500; padding: 0 10px; }
    .pm-catnav a.active { font-weight: 600; }
    .pm-catnav a i { display: none; }
    .pm-catnav a.active::after { left: 10px; right: 10px; }
    .pm-catnav a:first-child.active::after { left: 0; }

    /* Home: compact hero only */
    .pm-home-top { display: none; }
    .pm-mhero { display: block; margin: 0 -16px 28px; }
    .pm-mhero-track {
        display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
        padding: 0 24px; scroll-padding: 0 24px; -webkit-overflow-scrolling: touch;
    }
    .pm-mhero-track::-webkit-scrollbar { display: none; }
    .pm-mhero-card {
        flex: 0 0 calc(100% - 48px); scroll-snap-align: center; display: flex; flex-direction: column;
        min-height: 206px; padding: 16px; border-radius: 24px; background: var(--px-surface); border: 1px solid var(--px-border);
    }
    .pm-mhero-head { display: flex; align-items: center; gap: 12px; color: var(--px-text); margin-bottom: 14px; }
    .pm-mhero-head:hover { color: var(--px-text); }
    .pm-mhero-head .px-event-icon { border-radius: 8px; }
    .pm-mhero-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; font-weight: 600; line-height: 1.35; }
    .pm-mhero-date { display: block; font-size: 13px; color: var(--px-muted); margin-top: 2px; }
    .pm-mhero-rows { display: flex; flex-direction: column; gap: 12px; }
    .pm-mhero-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--px-text); }
    .pm-mhero-row:hover { color: var(--px-text); }
    .pm-mhero-name { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; font-size: 14px; font-weight: 500; }
    .pm-mhero-bar { display: block; height: 2px; border-radius: 2px; background: #2797FF; max-width: 100%; }
    .pm-mhero-pill {
        flex: none; display: grid; place-items: center; width: 60px; height: 34px; border-radius: 10px;
        background: #2797FF; color: #fff; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
        box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .14);
    }
    .pm-mhero-pill.lead { background: #87BFFF; }
    .pm-mhero-foot { margin-top: auto; padding-top: 14px; font-size: 13px; color: var(--px-muted); font-weight: 500; }
    .pm-mhero-dots { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }
    .pm-mhero-dots span { width: 6px; height: 6px; border-radius: 99px; background: var(--px-border-strong); transition: width .25s, background .25s; cursor: pointer; }
    .pm-mhero-dots span.active { width: 28px; background: var(--px-muted); }

    /* All markets */
    .pm-grid-head { margin-bottom: 10px; }
    .pm-h2 { font-size: 20px; font-weight: 600; }
    .pm-h1 { font-size: 22px; }
    .pm-grid-tools .pm-tool-btn:first-child { display: none; }
    .pm-chips { margin: 0 -16px 12px; padding: 0 16px 2px; gap: 4px; }
    .pm-chip { height: 32px; padding: 0 12px; font-weight: 500; }
    .pm-chip.active { font-weight: 600; }
    .pm-grid { grid-template-columns: 1fr; gap: 12px; }
    .pm-card { height: auto; min-height: 172px; padding: 14px 14px 10px; border-radius: 16px; border: 1px solid var(--px-border); }
    .pm-card:hover { box-shadow: none; }
    .pm-card-title { font-size: 15px; }
    .pm-card-list { height: auto; max-height: 80px; margin-bottom: 8px !important; scrollbar-width: none; }
    .pm-card-list::-webkit-scrollbar { display: none; }
    .pm-row { height: 40px; }
    .pm-row-name { font-size: 15px; color: var(--px-text); }
    .pm-row-pct { font-size: 16px; }
    .pm-mini { min-width: 42px; height: 30px; font-size: 14px; }
    .pm-buy { height: 46px; }
    .pm-card-foot { font-size: 13px; }

    /* Search page: its own search box (the header one is hidden) */
    .pm-msearch { display: flex; max-width: none; margin-bottom: 16px; }

    /* Bottom tab bar */
    .pm-tabbar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: grid; grid-template-columns: repeat(4, 1fr);
        height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
        background: rgba(16, 18, 23, .96); border-top: 1px solid var(--px-border); backdrop-filter: blur(12px);
    }
    .pm-tabbar a, .pm-tabbar button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0;
        background: none; border: 0; color: var(--px-muted); font-size: 11px; font-weight: 500;
    }
    .pm-tabbar i { font-size: 20px; line-height: 1; }
    .pm-tabbar span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
    .pm-tabbar .active { color: var(--px-text); font-weight: 600; }
    body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
    .toast-container { bottom: calc(64px + env(safe-area-inset-bottom)) !important; }
    /* Market pages have their own Yes / No bar instead */
    body:has(.px-mobile-bar) .pm-tabbar { display: none; }
    body:has(.px-mobile-bar) { padding-bottom: 0; }

    /* Market page: the stats already sit under the title, so the chart bar keeps only the range buttons */
    .px-chart-bar #eventVol, .px-chart-bar #eventVol24, .px-chart-bar #eventLiq { display: none; }
    .px-chart-bar { justify-content: flex-end; }
    .px-market .px-event-title { font-size: 20px; }

    /* Footer: compact */
    .px-footer { margin-top: 40px; }
    .px-footer-top { padding: 28px 0 20px; gap: 24px 16px; }
}

/* "More" sheet */
.pm-more.offcanvas-bottom { height: auto; max-height: 85vh; background: var(--px-surface); color: var(--px-text); border-top: 1px solid var(--px-border-strong); border-radius: 20px 20px 0 0; }
.pm-more-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--px-border-strong); margin: 10px auto 0; }
.pm-more .offcanvas-header { padding: 10px 16px 4px; }
.pm-more .offcanvas-title { font-size: 17px; font-weight: 700; }
.pm-more .offcanvas-body { padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); }
.pm-more-label { font-size: 12px; font-weight: 600; color: var(--px-muted); text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 8px; }
.pm-more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pm-more-grid a {
    display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border-radius: 12px;
    background: var(--px-surface-2); color: var(--px-text); font-size: 14px; font-weight: 600;
}
.pm-more-grid a i { color: var(--px-muted); }
.pm-more-list { display: flex; flex-direction: column; }
.pm-more-list a { display: flex; align-items: center; gap: 12px; height: 46px; color: var(--px-text); font-size: 15px; font-weight: 500; border-bottom: 1px solid var(--px-border); }
.pm-more-list a:last-child { border-bottom: 0; }
.pm-more-list a i { width: 20px; color: var(--px-muted); font-size: 17px; }
